Repository: K-3D/k3d Branch: master Commit: 17ef1bf060ea Files: 3509 Total size: 23.0 MB Directory structure: gitextract_y8b0ck_2/ ├── .ditz-plugins ├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── CTestConfig.cmake ├── CTestCustom.cmake.in ├── INSTALL ├── README ├── application/ │ ├── CMakeLists.txt │ ├── Info.plist.in │ ├── config.h.in │ ├── icon.rc │ ├── k3d_main.cpp │ ├── k3d_main.h │ ├── main.cpp │ └── winmain.cpp ├── bugs/ │ ├── CMakeLists.txt │ ├── issue-000e833956e3ebedbddc7a8f239368296cef05cf.yaml │ ├── issue-01d720a02d5558508a3b56a7ad0e603d0b8e57f7.yaml │ ├── issue-028d81eef227a051d03293c46b451db439f0c460.yaml │ ├── issue-02e36eaa0b39160335d6eb8d576d75c56577c5f7.yaml │ ├── issue-067c122609d0478c12319a8cfebda9c4f290bc78.yaml │ ├── issue-0ca786b59608c113bdb0a99f16c1e0e8e0076d8f.yaml │ ├── issue-0f0dc8929f4bd8dd646aedbab164defb8b01ba68.yaml │ ├── issue-0f2e779987beba2c16355000e49002e668efe3cd.yaml │ ├── issue-12ac6cbd6ff111c686796d107c8a9b8338158e8f.yaml │ ├── issue-13cd1ca286fd727add47164d6b9829a864732688.yaml │ ├── issue-1478f28b825b4003e89e19fd6627210de42670f1.yaml │ ├── issue-162c9fd22b62e2228b4963639d7cd652b4af2e5d.yaml │ ├── issue-164f2e0cd8b280e764bc49d2f1db806e4fef7fa3.yaml │ ├── issue-1787ece116f7300528f97ab0a9eb6c128a4ae826.yaml │ ├── issue-1850897e4259a756faf449a72ea07ac863d83cd0.yaml │ ├── issue-1ae2d51bee03627b3d7136008951efc67ab7766e.yaml │ ├── issue-1af4c139c1c4fe06ca2e3fbe31f1237cf963a20e.yaml │ ├── issue-1e7b3a952423fcf332c8f369ee0646873cafb877.yaml │ ├── issue-1f0827906ae4174800898596b0c8e4c623425ebd.yaml │ ├── issue-20324fd0e902a7a6bdb85dbf5f2ae4ce8180a61a.yaml │ ├── issue-20c18a2b4fe16b8e1a3982d83be136220b4cf863.yaml │ ├── issue-250f99eac16ec2eda3d6b7e324592efc46a1e250.yaml │ ├── issue-25c0b2699b08309f7452d4d7390d05a3fa78bf57.yaml │ ├── issue-26470a23cd083556484c98f6120b5f33661775c6.yaml │ ├── issue-28d83330170a35565ca1ada32317f34b2daf37a2.yaml │ ├── issue-28e8b98350d458dfe53427f2497401663b0dc97a.yaml │ ├── issue-2c158e15ef869a5b8ec01db38e4ed19a507b0bc2.yaml │ ├── issue-2c5ca49215d98ef29255e323180b3715cee1b1c1.yaml │ ├── issue-2e6128ca3bb63de99d369f1ae2f4f457cf7a1470.yaml │ ├── issue-3074be871fbce4de2da49a1abc0432d8e49e30c1.yaml │ ├── issue-361aa608201ea4f1ec2fd204a7c62df2ebfeb1b8.yaml │ ├── issue-363308f0b4815dcf1b3fb24103eb8b40f6645779.yaml │ ├── issue-38ed366c277ad6ad3cbf7113a50c73ab0dc6ecb9.yaml │ ├── issue-3c77f6ba4e20fe744f97629df5b855476eaefef0.yaml │ ├── issue-3cb4616e3fdf2b348db28c1ec4761759e7570b91.yaml │ ├── issue-4084f1c41c9a58ab4b0b49b7c8f988f45328edcc.yaml │ ├── issue-40ed654ea75987f34bbe51980b5622cc079d3c7e.yaml │ ├── issue-413564006de7bfe4283dc79f9165dedd9b49c271.yaml │ ├── issue-41f14db348415ee631409034dafa0d42d0deddea.yaml │ ├── issue-42a7588ab85a23f2a39a9fb36b63b6fa9d7af0f5.yaml │ ├── issue-432f8b1d7711eb5d22d6046d20bc006c18d5090b.yaml │ ├── issue-43ed5f6b35f29c0788a75461bf33f3120387f6c1.yaml │ ├── issue-44735744038c3434abe3f3a7e13f881e2e2cc48e.yaml │ ├── issue-4523543999b211ff2977debc785b31e70964ea2b.yaml │ ├── issue-45a8e81c24329d52763349b662988a9969e2a929.yaml │ ├── issue-478fd768c3286ce365c29af422175f8b9969ca11.yaml │ ├── issue-49b3bc440ae6da65fec9979da016681ccdd7df24.yaml │ ├── issue-4a400f4d42a40bb64cb5df9e83481ec74ea8974e.yaml │ ├── issue-4a7cea3d5863e1dec9aa8e78e239963e9c451926.yaml │ ├── issue-4ac006d705b9b7b5b3468932c4e7750d95564cce.yaml │ ├── issue-52654f9476391c6612de54e91d54e4dcda7bb847.yaml │ ├── issue-538f9fab4a345ba7c88ba39b4faa0ef55cfffaad.yaml │ ├── issue-555cc14dcbca30e03f0a333f0236c8f653e0a7f1.yaml │ ├── issue-5970a8d939cc358d1ab2bef5c0eeabf2baa2a9e8.yaml │ ├── issue-5d9c8400eb4dcb02edcf8dc56ce8bcd91955a53c.yaml │ ├── issue-5f88eac8fa3003c363a0364ee8827a438bcda2ca.yaml │ ├── issue-5fde01d7a4fcdff886003dbaeb9773d33e2b9f18.yaml │ ├── issue-607cbe27448028c9efc67e008d01f1e507bb1fbd.yaml │ ├── issue-624ea57c7b26a27eba7f3bfd65f0dee40eb814d3.yaml │ ├── issue-630255130a08cc316bba010d111dad725f7f9258.yaml │ ├── issue-637f683833589ed1b5cd3f5028206c80ec97d3e9.yaml │ ├── issue-63e3d51ee3915a539f21adf515ed7275f359295b.yaml │ ├── issue-66dbf9444de6bcf5ef19d5ad94b51e0e5b58c3cd.yaml │ ├── issue-6a66838dfc4773a21c04575103c92d8e8802f5ff.yaml │ ├── issue-6aedc6869efacb25e643f2bb3d447338cc7307e5.yaml │ ├── issue-6b7163b333419334ced5dd726d5b5a5c669cb9c8.yaml │ ├── issue-6d0f5f71bcca568aab7d418c23ea12de51a07b88.yaml │ ├── issue-6e358533fc719d3b3c1fe8b061f7091cd046453e.yaml │ ├── issue-703980e3eb7434bec1481e3f7b5558bf64926f9e.yaml │ ├── issue-7186061f7d139f1591333c49d6bc53b93cb6ecc3.yaml │ ├── issue-71a4669f4804254394b5e170afb5ca0fc537ad62.yaml │ ├── issue-71abd763037b718e574529c33c58a458f05af48c.yaml │ ├── issue-71e0e500fc3a528e690296d69e5f6c8d62cb0076.yaml │ ├── issue-720f97d969465f88647103a679fccfba9fdfe595.yaml │ ├── issue-726036fd940e69af892483f4fb81ced5076343c0.yaml │ ├── issue-72b9eb7ea6f2ee49a1aa6de0f9bdda95fd8226af.yaml │ ├── issue-734d997c30a2208e4cc49cfc83071a6e8c446203.yaml │ ├── issue-73b9d9eaea5e3100dfbd016ed74852541fea45b3.yaml │ ├── issue-748f4bfe0ef0aca0e383b81aa75f4ea91b90a9fb.yaml │ ├── issue-7642bc88b925585b8359bf58a5e818edf5575823.yaml │ ├── issue-79d92fefbdd858ed65e5dcc7605f304a4d29f4db.yaml │ ├── issue-7b49e59fee09d9c477c0bc0099d17bda335bafc1.yaml │ ├── issue-7bc390041917f4dad49790f8eaf5b365add00512.yaml │ ├── issue-7c1f591407ab1ed2d13f8d12ac20f23ba757029b.yaml │ ├── issue-7d151b992517ccf1a476e994da4ae95f811a0f28.yaml │ ├── issue-7d2708ff9bb5cd775481c46e2c34639a6baece89.yaml │ ├── issue-7f5736e37d226ef0df24d5ff0a103233993c1871.yaml │ ├── issue-809dbf8876e9da36c54d116410338e64ea634de7.yaml │ ├── issue-80b04a4ce93501dca03dff1f05711e2e22a6cdf7.yaml │ ├── issue-810cbd67c6f6737ee2900a8a85fd107e81a416bf.yaml │ ├── issue-83af56cb47d6d6414fdc911fd5ae4ea45b23691b.yaml │ ├── issue-85307f5c478fef938ea9202d85d4fb6ca351f82b.yaml │ ├── issue-87422f875fafba82217cb6ea9926431c664008e1.yaml │ ├── issue-880751463fbb518318275de1613945c253d371d4.yaml │ ├── issue-895d272b3cce6c0d083757a9b1d22066be7e8d48.yaml │ ├── issue-8b7048ef71c42a4ddfbd754d0eec458ced28cabb.yaml │ ├── issue-8e23f26186d044718dee4d0c597684d194ebb3ab.yaml │ ├── issue-91df55f58cd343ef052644a22be6ed6da975f4ff.yaml │ ├── issue-9340867dbd5c408b4505e0a5aac01dfd7cf13531.yaml │ ├── issue-93918136ae33aada69f7550025c0fc8b9844630f.yaml │ ├── issue-94d550d30436720fef32ba3311fd367a4b5317d2.yaml │ ├── issue-956ceb914b4a6b27defd0c78bb54adc3c4893b32.yaml │ ├── issue-9a2fb7311eae397db36e237be063404532b3b4a0.yaml │ ├── issue-9b2e091f7e3b9e36ff649b48155458080d7da913.yaml │ ├── issue-9c495b89016c7cceebed30b1c37286a935f9a2eb.yaml │ ├── issue-9cc79c6fd45d45ec92cdac3eef3ad3f050bae375.yaml │ ├── issue-9d6b0d8eaf8d80a966066c342bf1de0dd67869cf.yaml │ ├── issue-9e18e7eda2cde5ef31f3c5d75099f7e5aafbbb70.yaml │ ├── issue-9e5b6f8facf5da51725b10a558ac3560e03d651d.yaml │ ├── issue-a121afe2e22a6a972946c3f90472758987ca1d11.yaml │ ├── issue-a30d997fb6cf859f56794c2ba693d986d109a143.yaml │ ├── issue-a35971476137c99b326c5df30dc1c65c05d251fa.yaml │ ├── issue-a51f6fb9050dd6b4fc6b07052508b122ad181762.yaml │ ├── issue-a8c5a1d70781b39476748bd155c24a309d8ff50f.yaml │ ├── issue-ab67e65a87a4e7a37e5d858119e62a23fe218e09.yaml │ ├── issue-ab989d228e5a69168eb8a345a1dd5d59e0e264c0.yaml │ ├── issue-abb391e69f742b790e8da66ffaa784db0a5988bb.yaml │ ├── issue-ac1657b6dc20fb04947f9d412ada980948978fb5.yaml │ ├── issue-acffc0b1158b9235a406f1e988c574800e4cd368.yaml │ ├── issue-ad39f08267111c35c8e26b5264df5d06af65f718.yaml │ ├── issue-ad7ebb0ae83ac37ee352a9775b601e181d460e3d.yaml │ ├── issue-ae912d5a99e4737fe82a9576842bf25a9b7a83bf.yaml │ ├── issue-afe8a5c7a2db5849096010a7e4e37ffd246fc5de.yaml │ ├── issue-b143f0495234766027975401fdc8c071ceaccdc2.yaml │ ├── issue-b56196fba885cf00f611139e6b09a9135d465338.yaml │ ├── issue-baacef33fb990943146dd8064244e33486e5ea09.yaml │ ├── issue-c08027d5b63ee4951a747d366509431f86626ce3.yaml │ ├── issue-c15440cffbee3a681e073542040ad92aaa03e211.yaml │ ├── issue-c24cff95ec0290dc053789f3749c2d3a576427e6.yaml │ ├── issue-c3442cdcfa64300b26c4e16560338858110051e0.yaml │ ├── issue-c35b6212ab0df100143b32254a41325252ffec42.yaml │ ├── issue-c38bd09d7aa33d18d9df72894e7d7f4231a7afa4.yaml │ ├── issue-c3ec9bb8e635c2592d8ee6f80f29b56e939c7be4.yaml │ ├── issue-c4141d8b96026e37fc47c03ec3a610eb76d255e4.yaml │ ├── issue-c4fac5d4134a27c60a732f65c7aca6d081d888bd.yaml │ ├── issue-c566b10c51cf9be076002e098a80e627f7e57ad7.yaml │ ├── issue-c5bb24ef560d028232ce7243e179caf89232424a.yaml │ ├── issue-c60b33c866619f09ee3d9d98a588097c246dce9d.yaml │ ├── issue-c62d4189ed3035ce0a2c7896f97007ac715a1159.yaml │ ├── issue-c7068025feb6bc837b3c8238689cbd2808e602ec.yaml │ ├── issue-c88402eb19c30deba7254e8583c5554e169b4ee2.yaml │ ├── issue-c920698bb22ce982c3f377ceebe1c146ff08fa9e.yaml │ ├── issue-caa327a1b446cc943f4f8563d11862bb9a323006.yaml │ ├── issue-cbc65707315095a3c85694e09e179f711248ae01.yaml │ ├── issue-cf2cdc4985a66db59f55052f03c3c620237b451f.yaml │ ├── issue-cfefcca75810ec3b784ee014ff12c2b345d0e37d.yaml │ ├── issue-d171dd355a94e4b8c639dce81bab88f3b30ad4c1.yaml │ ├── issue-d33d9c38e1484b8ca1380cee2cc381a58073f2b8.yaml │ ├── issue-d641db2e9857dad68c2cb5cddad523f6a11a9f4c.yaml │ ├── issue-d7a44bff78ad31a7e7a6762e37c67cc721882f83.yaml │ ├── issue-d8ead7e3cb76c1f6312855dfb1007959bf2a81a3.yaml │ ├── issue-da7d93a9b31ed0769f5b56af3f388737dd957b7f.yaml │ ├── issue-da8965ea23097589e5b98a3b8c42580329dad12c.yaml │ ├── issue-daee8a01c7a1e37079658831fb65738559dc0493.yaml │ ├── issue-dbaae5eafd86c96dd10c4636fee6dbcf4a6223d2.yaml │ ├── issue-dbc9bdf294e3af3096d5b7b0777fbd501dbec183.yaml │ ├── issue-dbddd7fdc90195a94e62d0ae6440ac9d90308f40.yaml │ ├── issue-dc74ee9aa83bfe125ef4948bd8e8a46d3b895167.yaml │ ├── issue-dcaa8d49244983968dcc3d24b45671270e0238ba.yaml │ ├── issue-deed7f51f539b6c62b97c585ed7453b3242c9992.yaml │ ├── issue-e200400ec942d61b5d25ff523fbc59331e5cd00c.yaml │ ├── issue-e223abcb170a54b129321cb4020ec090b91aa06d.yaml │ ├── issue-e24dc27f9e5a9b6debdc7fbacdaef0390aa835b5.yaml │ ├── issue-e345f325aab4099f88dfc47616a86d4ddea54db3.yaml │ ├── issue-e4ab51a81942250ae3e8a0ecff44c1e0b329859e.yaml │ ├── issue-e4e3a8d3d7b0effd24b47227a38154c7f9ad1af1.yaml │ ├── issue-e695dc7181caa53d244666975fcb9416d23456d6.yaml │ ├── issue-e7da3769c8568a8dd24b895d954ce0f2afb278fb.yaml │ ├── issue-e7e2260686f43af5350ced8daf3fd52f748b7d4d.yaml │ ├── issue-e7f06c793e88c43060dc24a5e7b645e87f5c3372.yaml │ ├── issue-e83e4967aac6828eb4e02208edacd68d23252cde.yaml │ ├── issue-e86ef362f926037001e1c60a9fedea2822620595.yaml │ ├── issue-eab8f46b39c3ce8da3052e6c33ad2942556f3c8d.yaml │ ├── issue-ebaf6c348e0fa045023a7a486ea7c70969f96dde.yaml │ ├── issue-ec7e14fd48fc42fd5b2ca9a3d30caf4f1b027c1a.yaml │ ├── issue-ee2fe3f71ced0add4f940683db864c5cfe7422d9.yaml │ ├── issue-eefe2f1c031bdf2fbe9723b6baf8aaa7a6daac91.yaml │ ├── issue-efc598f7db94d366529406ccc835541ed77da749.yaml │ ├── issue-f0214576609193a60f014f6c1b55e5b01af8197d.yaml │ ├── issue-f20b5cc0c3904cfa8ec18ee3c7753e4bbff69d4e.yaml │ ├── issue-f70081ac577a3f841537885c3d1d3af7f23f5aef.yaml │ ├── issue-f7a6867233d707004a53404495ec68af38de7dc2.yaml │ ├── issue-f838455f2a342a4d7c1d2aa13e3bd4d459d9c289.yaml │ ├── issue-fd6e33c28fa0b3d7a02b1c4972bc5577b61d8838.yaml │ ├── issue-ff8b9cee50b4d5422d195a8a64467eaca0b11ded.yaml │ ├── issue-ff93d0f500a475dc818ff0f85fa530f5fbc58be0.yaml │ └── project.yaml ├── cmake/ │ ├── dashboards/ │ │ ├── continuous-debug.cmake │ │ ├── nightly-coverage.cmake │ │ ├── nightly-debug.cmake │ │ └── nightly-release.cmake │ └── modules/ │ ├── FindK3DAsciiDoc.cmake │ ├── K3DCompileResource.cmake │ ├── K3DCompiler.cmake │ ├── K3DDependencies.cmake │ ├── K3DFind3ds.cmake │ ├── K3DFindBoost.cmake │ ├── K3DFindCARVE.cmake │ ├── K3DFindCGAL.cmake │ ├── K3DFindCairomm.cmake │ ├── K3DFindCollada.cmake │ ├── K3DFindDBus.cmake │ ├── K3DFindFTGL.cmake │ ├── K3DFindFreetype2.cmake │ ├── K3DFindGMM.cmake │ ├── K3DFindGPerftools.cmake │ ├── K3DFindGTS.cmake │ ├── K3DFindGiomm.cmake │ ├── K3DFindGlibmm.cmake │ ├── K3DFindGthread.cmake │ ├── K3DFindGtkGLExt.cmake │ ├── K3DFindGtkSourceView.cmake │ ├── K3DFindGtkmm.cmake │ ├── K3DFindImageMagick.cmake │ ├── K3DFindInotify.cmake │ ├── K3DFindIntl.cmake │ ├── K3DFindJPEG.cmake │ ├── K3DFindODE.cmake │ ├── K3DFindOSMesa.cmake │ ├── K3DFindOpenEXR.cmake │ ├── K3DFindOpenGL.cmake │ ├── K3DFindPNG.cmake │ ├── K3DFindPkgConfig.cmake │ ├── K3DFindPython.cmake │ ├── K3DFindSigC.cmake │ ├── K3DFindSuperLU.cmake │ ├── K3DFindTBB.cmake │ ├── K3DFindTIFF.cmake │ ├── K3DFindXML.cmake │ ├── K3DFindZlib.cmake │ ├── K3DGenerateDEF.cmake │ ├── K3DOutOfSourceBuild.cmake │ ├── K3DParseArguments.cmake │ ├── K3DSystemConfiguration.cmake │ └── K3DWordSize.cmake ├── configuration/ │ └── size_type.cpp ├── desktop/ │ ├── CMakeLists.txt │ └── k3d.desktop.in ├── distribution/ │ ├── CMakeLists.txt │ ├── genslmeta.bat │ ├── osx/ │ │ ├── CMakeLists.txt │ │ ├── bundle/ │ │ │ ├── CMakeLists.txt │ │ │ ├── Info.plist.in │ │ │ ├── k3d-startup │ │ │ ├── package-binary-bundle.cpack.in │ │ │ ├── volume.icns │ │ │ └── volume_logo.xcf │ │ ├── dependencies.cmake.in │ │ └── packagemaker/ │ │ ├── CMakeLists.txt │ │ ├── package-binary-packagemaker.cpack.in │ │ ├── readme.txt │ │ └── welcome.txt │ ├── posix/ │ │ ├── CMakeLists.txt │ │ ├── package-binary-stgz.cpack.in │ │ ├── package-binary-tbz2.cpack.in │ │ └── package-binary-tgz.cpack.in │ ├── source/ │ │ ├── CMakeLists.txt │ │ ├── package-source-tbz2.cpack.in │ │ ├── package-source-tgz.cpack.in │ │ └── package-source-zip.cpack.in │ └── win32/ │ ├── CMakeLists.txt │ ├── aqsisrc │ ├── gtkrc │ └── nsis/ │ ├── CMakeLists.txt │ ├── headerimage.xcf │ └── package-binary-nsis.cpack.in ├── docs/ │ ├── CMakeLists.txt │ ├── coding_style/ │ │ ├── CMakeLists.txt │ │ ├── astylerc │ │ └── k3d-style.in │ ├── doxygen/ │ │ ├── CMakeLists.txt │ │ ├── Doxyfile.in │ │ ├── footer.html │ │ ├── header.html │ │ └── k3d.css │ ├── epydoc/ │ │ ├── CMakeLists.txt │ │ ├── epydoc.css │ │ └── make-epydoc-docs.py │ ├── mesh_arrays.ods │ ├── sample_module/ │ │ ├── CMakeLists.txt │ │ └── module.cpp │ ├── uml/ │ │ ├── data.xmi │ │ ├── network_rendering.xmi │ │ └── subdivision_surface/ │ │ ├── classes.dia │ │ ├── sds_design.tex │ │ ├── set_input_initial.dia │ │ ├── set_input_invalid.dia │ │ ├── update_detail.dia │ │ ├── update_invalid.dia │ │ └── update_valid.dia │ ├── wiki/ │ │ ├── CMakeLists.txt │ │ ├── make-wiki-docs-plugins.py │ │ └── make-wiki-docs-primitives.py │ └── xml/ │ ├── document_schema.xsd │ └── slmeta_schema.xsd ├── gendef/ │ ├── CMakeLists.txt │ └── gendef.cc ├── k3dsdk/ │ ├── CMakeLists.txt │ ├── Half/ │ │ ├── AUTHORS │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── LICENSE │ │ ├── README │ │ ├── eLut.cpp │ │ ├── half.cpp │ │ ├── half.h │ │ ├── halfFunction.h │ │ ├── halfLimits.h │ │ └── toFloat.cpp │ ├── algebra.h │ ├── application.cpp │ ├── application.h │ ├── application_detail.cpp │ ├── application_detail.h │ ├── application_plugin_factory.h │ ├── array.cpp │ ├── array.h │ ├── aspect_ratios.cpp │ ├── aspect_ratios.h │ ├── axis.cpp │ ├── axis.h │ ├── base64.cpp │ ├── base64.h │ ├── basic_math.h │ ├── batch_mode.cpp │ ├── batch_mode.h │ ├── batch_mode_init.h │ ├── bezier.cpp │ ├── bezier.h │ ├── bezier_private.h │ ├── bezier_triangle_patch.cpp │ ├── bezier_triangle_patch.h │ ├── bicubic_patch.cpp │ ├── bicubic_patch.h │ ├── bilinear_patch.cpp │ ├── bilinear_patch.h │ ├── bitmap.h │ ├── bitmap_modifier.h │ ├── bitmap_sink.h │ ├── bitmap_source.h │ ├── blobby.cpp │ ├── blobby.h │ ├── boost_throw_exception.cpp │ ├── bounding_box3.cpp │ ├── bounding_box3.h │ ├── classes.h │ ├── color.h │ ├── color_source.h │ ├── component.cpp │ ├── component.h │ ├── cone.cpp │ ├── cone.h │ ├── contributors.cpp │ ├── contributors.h │ ├── convert.h │ ├── cubic_curve.cpp │ ├── cubic_curve.h │ ├── cylinder.cpp │ ├── cylinder.h │ ├── data.cpp │ ├── data.h │ ├── dependencies.cpp │ ├── dependencies.h │ ├── difference.h │ ├── disk.cpp │ ├── disk.h │ ├── document.cpp │ ├── document.h │ ├── document_plugin_factory.h │ ├── double_source.h │ ├── euler_operations.cpp │ ├── euler_operations.h │ ├── exceptions.h │ ├── explicit_instantiation.cpp │ ├── explicit_snap_source.cpp │ ├── explicit_snap_source.h │ ├── explicit_snap_target.cpp │ ├── explicit_snap_target.h │ ├── expression/ │ │ ├── CMakeLists.txt │ │ ├── basic_parser.cpp │ │ ├── basic_parser.h │ │ ├── fparser.cpp │ │ ├── fparser.h │ │ ├── fparser_license.txt │ │ ├── fpconfig.h │ │ ├── fpoptimizer.cpp │ │ ├── fptypes.h │ │ ├── parser.cpp │ │ └── parser.h │ ├── expression_grammar.h │ ├── file_helpers.cpp │ ├── file_helpers.h │ ├── file_range.cpp │ ├── file_range.h │ ├── frames.cpp │ ├── frames.h │ ├── fstream.h │ ├── geometric_operations.cpp │ ├── geometric_operations.h │ ├── geometry.cpp │ ├── geometry.h │ ├── gil/ │ │ └── boost/ │ │ ├── gil/ │ │ │ └── extension/ │ │ │ └── numeric/ │ │ │ ├── affine.hpp │ │ │ ├── algorithm.hpp │ │ │ ├── channel_numeric_operations.hpp │ │ │ ├── convolve.hpp │ │ │ ├── kernel.hpp │ │ │ ├── pixel_numeric_operations.hpp │ │ │ ├── resample.hpp │ │ │ └── sampler.hpp │ │ └── uuid/ │ │ ├── nil_generator.hpp │ │ ├── random_generator.hpp │ │ ├── seed_rng.hpp │ │ └── sha1.hpp │ ├── gl/ │ │ ├── CMakeLists.txt │ │ ├── context.cpp │ │ ├── context.h │ │ ├── context_factory.h │ │ ├── enum.spec │ │ ├── enumext.spec │ │ ├── extension.cpp │ │ ├── extension.h │ │ ├── gl.spec │ │ ├── gl.tm │ │ ├── offscreen_context.h │ │ └── offscreen_context_factory.h │ ├── gl.h │ ├── graph.cpp │ ├── graph.h │ ├── gzstream.cpp │ ├── gzstream.h │ ├── high_res_timer.h │ ├── hints.cpp │ ├── hints.h │ ├── hyperboloid.cpp │ ├── hyperboloid.h │ ├── i3d_2d_mapping.h │ ├── iapplication.h │ ├── iapplication_plugin_factory.h │ ├── iattribute_property_ri.h │ ├── ibitmap_exporter.h │ ├── ibitmap_importer.h │ ├── ibitmap_sink.h │ ├── ibitmap_source.h │ ├── ibounded.h │ ├── icamera.h │ ├── icolor_source.h │ ├── icrop_window.h │ ├── idependencies.h │ ├── idisplacement_shader_ri.h │ ├── idocument.h │ ├── idocument_exporter.h │ ├── idocument_importer.h │ ├── idocument_plugin_factory.h │ ├── idocument_sink.h │ ├── idouble_source.h │ ├── ienumeration_property.h │ ├── ievent_loop.h │ ├── ifile_change_notifier.h │ ├── ihint.h │ ├── iimager_shader_ri.h │ ├── iint32_source.h │ ├── ikeyframer.h │ ├── ilight_gl.h │ ├── ilight_ri.h │ ├── ilight_shader_ri.h │ ├── ilight_yafray.h │ ├── ilist_property.h │ ├── imaterial.h │ ├── imaterial_ri.h │ ├── imaterial_sink.h │ ├── imaterial_yafray.h │ ├── imatrix_sink.h │ ├── imatrix_source.h │ ├── imeasurement_property.h │ ├── imesh_painter_gl.h │ ├── imesh_painter_ri.h │ ├── imesh_selection_algorithm.h │ ├── imesh_selection_sink.h │ ├── imesh_sink.h │ ├── imesh_source.h │ ├── imesh_storage.h │ ├── imeta_object.cpp │ ├── imeta_object.h │ ├── imetadata.h │ ├── imime_type_handler.h │ ├── imulti_mesh_sink.h │ ├── inetwork_render_farm.h │ ├── inetwork_render_frame.h │ ├── inetwork_render_job.h │ ├── inode.h │ ├── inode_change_signal.h │ ├── inode_collection.h │ ├── inode_collection_property.h │ ├── inode_collection_sink.h │ ├── inode_name_map.h │ ├── inode_property.h │ ├── inode_selection.h │ ├── int32_source.h │ ├── interface_list.h │ ├── iomanip.cpp │ ├── iomanip.h │ ├── ioption_property_ri.h │ ├── iparentable.h │ ├── ipath_property.h │ ├── ipersistent.h │ ├── ipersistent_collection.h │ ├── ipersistent_lookup.h │ ├── ipipeline.h │ ├── ipipeline_profiler.h │ ├── iplugin_factory.h │ ├── iplugin_factory_collection.h │ ├── iplugin_registry.h │ ├── iprojection.h │ ├── iproperty.h │ ├── iproperty_collection.h │ ├── iproperty_group_collection.h │ ├── iproperty_sink.h │ ├── irender_animation.h │ ├── irender_camera_animation.h │ ├── irender_camera_frame.h │ ├── irender_camera_preview.h │ ├── irender_engine_ri.h │ ├── irender_frame.h │ ├── irender_preview.h │ ├── irender_viewport_gl.h │ ├── irenderable_gl.h │ ├── irenderable_ri.h │ ├── ireset_properties.h │ ├── iscript_engine.h │ ├── iscript_property.h │ ├── iscripted_action.h │ ├── iselectable.h │ ├── ishader_collection_ri.h │ ├── isnap_source.h │ ├── isnap_target.h │ ├── isnappable.h │ ├── istate_container.h │ ├── istate_recorder.h │ ├── istate_recorder_sink.h │ ├── istream_ri.h │ ├── istreaming_bitmap_source.h │ ├── istring_source.h │ ├── isurface_shader_ri.h │ ├── itexture.h │ ├── itexture_ri.h │ ├── itime_sink.h │ ├── itransform_array_1d.h │ ├── itransform_array_2d.h │ ├── itransform_array_3d.h │ ├── iunknown.h │ ├── iuri_handler.h │ ├── iuser_interface.h │ ├── iuser_property.h │ ├── ivector3_source.h │ ├── ivolume_shader_ri.h │ ├── iwatched_path_property.h │ ├── iwritable_property.h │ ├── k3d-i18n-config.h.in │ ├── k3d-ngui-config.h.in │ ├── k3d-parallel-config.h.in │ ├── k3d-platform-config.h.in │ ├── k3d-version-config.h.in │ ├── keyboard.cpp │ ├── keyboard.h │ ├── line2.cpp │ ├── line2.h │ ├── line3.cpp │ ├── line3.h │ ├── linear_curve.cpp │ ├── linear_curve.h │ ├── log.cpp │ ├── log.h │ ├── log_control.h │ ├── material.h │ ├── material_sink.h │ ├── matrix_source.h │ ├── measurement.cpp │ ├── measurement.h │ ├── mesh.cpp │ ├── mesh.h │ ├── mesh_deformation_modifier.cpp │ ├── mesh_deformation_modifier.h │ ├── mesh_modifier.h │ ├── mesh_painter_gl.h │ ├── mesh_reader.h │ ├── mesh_selection_modifier.h │ ├── mesh_selection_sink.h │ ├── mesh_simple_deformation_modifier.cpp │ ├── mesh_simple_deformation_modifier.h │ ├── mesh_sink.h │ ├── mesh_source.h │ ├── mesh_triangulate_detail.h │ ├── mesh_writer.h │ ├── metadata.cpp │ ├── metadata.h │ ├── metadata_keys.cpp │ ├── metadata_keys.h │ ├── mime_types.cpp │ ├── mime_types.h │ ├── module.h │ ├── named_array_types.h │ ├── named_arrays.cpp │ ├── named_arrays.h │ ├── named_tables.cpp │ ├── named_tables.h │ ├── namespace_documentation.h │ ├── network_render_farm.cpp │ ├── network_render_farm.h │ ├── network_render_farm_detail.h │ ├── ngui/ │ │ ├── CMakeLists.txt │ │ ├── angle_axis.cpp │ │ ├── angle_axis.h │ │ ├── application_state.cpp │ │ ├── application_state.h │ │ ├── application_window.cpp │ │ ├── application_window.h │ │ ├── asynchronous_update.cpp │ │ ├── asynchronous_update.h │ │ ├── auto_property_page.cpp │ │ ├── auto_property_page.h │ │ ├── auto_property_toolbar.cpp │ │ ├── auto_property_toolbar.h │ │ ├── basic_input_model.cpp │ │ ├── basic_input_model.h │ │ ├── basic_viewport_input_model.cpp │ │ ├── basic_viewport_input_model.h │ │ ├── bitmap_preview.cpp │ │ ├── bitmap_preview.h │ │ ├── bounding_box.cpp │ │ ├── bounding_box.h │ │ ├── button.cpp │ │ ├── button.h │ │ ├── check_button.cpp │ │ ├── check_button.h │ │ ├── check_menu_item.cpp │ │ ├── check_menu_item.h │ │ ├── collapsible_frame.cpp │ │ ├── collapsible_frame.h │ │ ├── color_chooser.cpp │ │ ├── color_chooser.h │ │ ├── combo_box.cpp │ │ ├── combo_box.h │ │ ├── console.cpp │ │ ├── console.h │ │ ├── context_menu.cpp │ │ ├── context_menu.h │ │ ├── custom_property_control.h │ │ ├── custom_property_page.h │ │ ├── document.cpp │ │ ├── document.h │ │ ├── document_state.cpp │ │ ├── document_state.h │ │ ├── document_window.cpp │ │ ├── document_window.h │ │ ├── entry.cpp │ │ ├── entry.h │ │ ├── enumeration_chooser.cpp │ │ ├── enumeration_chooser.h │ │ ├── event_button.h │ │ ├── file_chooser_dialog.cpp │ │ ├── file_chooser_dialog.h │ │ ├── hotkey_cell_renderer_text.cpp │ │ ├── hotkey_cell_renderer_text.h │ │ ├── hotkey_entry.cpp │ │ ├── hotkey_entry.h │ │ ├── icons.cpp │ │ ├── icons.h │ │ ├── image_toggle_button.cpp │ │ ├── image_toggle_button.h │ │ ├── input_model.h │ │ ├── interactive.cpp │ │ ├── interactive.h │ │ ├── keyboard.cpp │ │ ├── keyboard.h │ │ ├── main_document_window.cpp │ │ ├── main_document_window.h │ │ ├── menus.cpp │ │ ├── menus.h │ │ ├── merge_nodes.cpp │ │ ├── merge_nodes.h │ │ ├── messages.cpp │ │ ├── messages.h │ │ ├── modifiers.cpp │ │ ├── modifiers.h │ │ ├── move_tool.cpp │ │ ├── move_tool.h │ │ ├── navigation_input_model.cpp │ │ ├── navigation_input_model.h │ │ ├── node.cpp │ │ ├── node.h │ │ ├── node_chooser.cpp │ │ ├── node_chooser.h │ │ ├── node_collection_chooser.cpp │ │ ├── node_collection_chooser.h │ │ ├── node_window.cpp │ │ ├── node_window.h │ │ ├── null_viewport_input_model.cpp │ │ ├── null_viewport_input_model.h │ │ ├── options.cpp │ │ ├── options.h │ │ ├── panel.h │ │ ├── panel_frame.cpp │ │ ├── panel_frame.h │ │ ├── panel_mediator.cpp │ │ ├── panel_mediator.h │ │ ├── path_chooser.cpp │ │ ├── path_chooser.h │ │ ├── pipeline.cpp │ │ ├── pipeline.h │ │ ├── point3.cpp │ │ ├── point3.h │ │ ├── property.cpp │ │ ├── property.h │ │ ├── property_button.cpp │ │ ├── property_button.h │ │ ├── property_label.cpp │ │ ├── property_label.h │ │ ├── property_widget.cpp │ │ ├── property_widget.h │ │ ├── render.cpp │ │ ├── render.h │ │ ├── rotate_tool.cpp │ │ ├── rotate_tool.h │ │ ├── safe_close_dialog.cpp │ │ ├── safe_close_dialog.h │ │ ├── savable_application_window.cpp │ │ ├── savable_application_window.h │ │ ├── savable_document_window.cpp │ │ ├── savable_document_window.h │ │ ├── scale_tool.cpp │ │ ├── scale_tool.h │ │ ├── screen_overlay.cpp │ │ ├── screen_overlay.h │ │ ├── script_button.cpp │ │ ├── script_button.h │ │ ├── scripting.cpp │ │ ├── scripting.h │ │ ├── selection.cpp │ │ ├── selection.h │ │ ├── selection_input_model.cpp │ │ ├── selection_input_model.h │ │ ├── selection_tool.cpp │ │ ├── selection_tool.h │ │ ├── spin_button.cpp │ │ ├── spin_button.h │ │ ├── target.cpp │ │ ├── target.h │ │ ├── text.cpp │ │ ├── text.h │ │ ├── toggle_button.cpp │ │ ├── toggle_button.h │ │ ├── tool.cpp │ │ ├── tool.h │ │ ├── tool_selection.h │ │ ├── toolbar.cpp │ │ ├── toolbar.h │ │ ├── transform.cpp │ │ ├── transform.h │ │ ├── transform_tool.cpp │ │ ├── transform_tool.h │ │ ├── undo_utility.cpp │ │ ├── undo_utility.h │ │ ├── unknown.xpm │ │ ├── unsaved_document.h │ │ ├── uri.cpp │ │ ├── uri.h │ │ ├── utility.cpp │ │ ├── utility.h │ │ ├── viewport.cpp │ │ ├── viewport.h │ │ ├── viewport_input_model.h │ │ ├── widget_manip.cpp │ │ └── widget_manip.h │ ├── node.cpp │ ├── node.h │ ├── node_change_signal.h │ ├── node_name_map.cpp │ ├── node_name_map.h │ ├── nodes.cpp │ ├── nodes.h │ ├── noise.cpp │ ├── noise.h │ ├── normal3.h │ ├── nurbs_curve.cpp │ ├── nurbs_curve.h │ ├── nurbs_patch.cpp │ ├── nurbs_patch.h │ ├── options.cpp │ ├── options.h │ ├── options_policy.h │ ├── os_load_module.cpp │ ├── os_load_module.h │ ├── painter_render_state_gl.h │ ├── painter_selection_state_gl.h │ ├── paraboloid.cpp │ ├── paraboloid.h │ ├── parallel/ │ │ ├── CMakeLists.txt │ │ ├── blocked_range.h │ │ ├── parallel_for.h │ │ ├── threads.cpp │ │ └── threads.h │ ├── parentable.h │ ├── particle.cpp │ ├── particle.h │ ├── path.cpp │ ├── path.h │ ├── persistent_lookup.cpp │ ├── persistent_lookup.h │ ├── persistent_property_collection.cpp │ ├── persistent_property_collection.h │ ├── pipeline.cpp │ ├── pipeline.h │ ├── pipeline_data.h │ ├── pipeline_profiler.cpp │ ├── pipeline_profiler.h │ ├── plane.cpp │ ├── plane.h │ ├── plugin.cpp │ ├── plugin.h │ ├── plugin_factory.cpp │ ├── plugin_factory.h │ ├── plugin_factory_collection.cpp │ ├── plugin_factory_collection.h │ ├── plugins_detail.h │ ├── point2.h │ ├── point3.h │ ├── point4.h │ ├── pointer_demand_storage.h │ ├── polyhedron.cpp │ ├── polyhedron.h │ ├── primitive_validation.cpp │ ├── primitive_validation.h │ ├── property.cpp │ ├── property.h │ ├── property_collection.cpp │ ├── property_collection.h │ ├── property_group_collection.cpp │ ├── property_group_collection.h │ ├── property_types.h │ ├── property_types_ri.h │ ├── python/ │ │ ├── CMakeLists.txt │ │ ├── angle_axis_python.cpp │ │ ├── angle_axis_python.h │ │ ├── any_python.cpp │ │ ├── any_python.h │ │ ├── atk_python.cpp │ │ ├── atk_python.h │ │ ├── bezier_triangle_patch_python.cpp │ │ ├── bezier_triangle_patch_python.h │ │ ├── bicubic_patch_python.cpp │ │ ├── bicubic_patch_python.h │ │ ├── bilinear_patch_python.cpp │ │ ├── bilinear_patch_python.h │ │ ├── bitmap_python.cpp │ │ ├── bitmap_python.h │ │ ├── blobby_python.cpp │ │ ├── blobby_python.h │ │ ├── bounding_box3_python.cpp │ │ ├── bounding_box3_python.h │ │ ├── color_python.cpp │ │ ├── color_python.h │ │ ├── cone_python.cpp │ │ ├── cone_python.h │ │ ├── const_bitmap_python.cpp │ │ ├── const_bitmap_python.h │ │ ├── const_named_arrays_python.cpp │ │ ├── const_named_arrays_python.h │ │ ├── const_named_tables_python.cpp │ │ ├── const_named_tables_python.h │ │ ├── const_table_python.cpp │ │ ├── const_table_python.h │ │ ├── const_typed_array_python.cpp │ │ ├── const_typed_array_python.h │ │ ├── cubic_curve_python.cpp │ │ ├── cubic_curve_python.h │ │ ├── cylinder_python.cpp │ │ ├── cylinder_python.h │ │ ├── difference_python.cpp │ │ ├── difference_python.h │ │ ├── disk_python.cpp │ │ ├── disk_python.h │ │ ├── euler_angles_python.cpp │ │ ├── euler_angles_python.h │ │ ├── euler_python.cpp │ │ ├── euler_python.h │ │ ├── file_signal_python.cpp │ │ ├── file_signal_python.h │ │ ├── filesystem_python.cpp │ │ ├── filesystem_python.h │ │ ├── geometry_python.cpp │ │ ├── geometry_python.h │ │ ├── hyperboloid_python.cpp │ │ ├── hyperboloid_python.h │ │ ├── idocument_exporter_python.cpp │ │ ├── idocument_exporter_python.h │ │ ├── idocument_importer_python.cpp │ │ ├── idocument_importer_python.h │ │ ├── idocument_python.cpp │ │ ├── idocument_python.h │ │ ├── ifile_change_notifier_python.cpp │ │ ├── ifile_change_notifier_python.h │ │ ├── ikeyframer_python.cpp │ │ ├── ikeyframer_python.h │ │ ├── imesh_storage_python.cpp │ │ ├── imesh_storage_python.h │ │ ├── imeta_object_python.cpp │ │ ├── imeta_object_python.h │ │ ├── imetadata_python.cpp │ │ ├── imetadata_python.h │ │ ├── inode_python.cpp │ │ ├── inode_python.h │ │ ├── inode_selection_python.cpp │ │ ├── inode_selection_python.h │ │ ├── instance_wrapper_python.h │ │ ├── iplugin_factory_python.cpp │ │ ├── iplugin_factory_python.h │ │ ├── iproperty_collection_python.cpp │ │ ├── iproperty_collection_python.h │ │ ├── iproperty_python.cpp │ │ ├── iproperty_python.h │ │ ├── irender_camera_frame_python.cpp │ │ ├── irender_camera_frame_python.h │ │ ├── irender_camera_preview_python.cpp │ │ ├── irender_camera_preview_python.h │ │ ├── isnappable_python.cpp │ │ ├── isnappable_python.h │ │ ├── iunknown_python.cpp │ │ ├── iunknown_python.h │ │ ├── iuser_interface_python.cpp │ │ ├── iuser_interface_python.h │ │ ├── linear_curve_python.cpp │ │ ├── linear_curve_python.h │ │ ├── log_python.cpp │ │ ├── log_python.h │ │ ├── matrix4_python.cpp │ │ ├── matrix4_python.h │ │ ├── mesh_python.cpp │ │ ├── mesh_python.h │ │ ├── mime_python.cpp │ │ ├── mime_python.h │ │ ├── named_arrays_python.cpp │ │ ├── named_arrays_python.h │ │ ├── named_tables_python.cpp │ │ ├── named_tables_python.h │ │ ├── node_python.cpp │ │ ├── node_python.h │ │ ├── normal3_python.cpp │ │ ├── normal3_python.h │ │ ├── nurbs_curve_python.cpp │ │ ├── nurbs_curve_python.h │ │ ├── nurbs_patch_python.cpp │ │ ├── nurbs_patch_python.h │ │ ├── object_model_python.cpp │ │ ├── object_model_python.h │ │ ├── offscreen_context_factory_gl_python.cpp │ │ ├── offscreen_context_factory_gl_python.h │ │ ├── owned_instance_wrapper_python.h │ │ ├── paraboloid_python.cpp │ │ ├── paraboloid_python.h │ │ ├── parallel_python.cpp │ │ ├── parallel_python.h │ │ ├── particle_python.cpp │ │ ├── particle_python.h │ │ ├── plugin_python.cpp │ │ ├── plugin_python.h │ │ ├── point2_python.cpp │ │ ├── point2_python.h │ │ ├── point3_python.cpp │ │ ├── point3_python.h │ │ ├── point4_python.cpp │ │ ├── point4_python.h │ │ ├── polyhedron_python.cpp │ │ ├── polyhedron_python.h │ │ ├── property_python.cpp │ │ ├── property_python.h │ │ ├── resource_python.cpp │ │ ├── resource_python.h │ │ ├── ri_python.cpp │ │ ├── ri_python.h │ │ ├── script_python.cpp │ │ ├── script_python.h │ │ ├── selection_python.cpp │ │ ├── selection_python.h │ │ ├── sphere_python.cpp │ │ ├── sphere_python.h │ │ ├── table_python.cpp │ │ ├── table_python.h │ │ ├── teapot_python.cpp │ │ ├── teapot_python.h │ │ ├── texture3_python.cpp │ │ ├── texture3_python.h │ │ ├── torus_python.cpp │ │ ├── torus_python.h │ │ ├── typed_array_python.cpp │ │ ├── typed_array_python.h │ │ ├── utility_python.h │ │ ├── uuid_python.cpp │ │ ├── uuid_python.h │ │ ├── vector2_python.cpp │ │ ├── vector2_python.h │ │ ├── vector3_python.cpp │ │ ├── vector3_python.h │ │ ├── vector4_python.cpp │ │ └── vector4_python.h │ ├── qtui/ │ │ ├── CMakeLists.txt │ │ ├── action.cpp │ │ ├── action.h │ │ ├── application.cpp │ │ ├── application.h │ │ ├── application_widget.cpp │ │ ├── application_widget.h │ │ ├── console.cpp │ │ ├── console.h │ │ ├── convert.h │ │ ├── document.cpp │ │ ├── document.h │ │ ├── document_widget.cpp │ │ ├── document_widget.h │ │ ├── file_dialog.cpp │ │ ├── file_dialog.h │ │ ├── focus.cpp │ │ ├── focus.h │ │ ├── icon_factory.cpp │ │ ├── icon_factory.h │ │ ├── message.cpp │ │ ├── message.h │ │ ├── modal_text_editor.cpp │ │ ├── modal_text_editor.h │ │ ├── mode.cpp │ │ ├── mode.h │ │ ├── nag_message_dialog.cpp │ │ ├── nag_message_dialog.h │ │ ├── nag_message_dialog.ui │ │ ├── node_list_model.cpp │ │ ├── node_list_model.h │ │ ├── options.cpp │ │ ├── options.h │ │ ├── panel.h │ │ ├── property_widget.h │ │ ├── property_widget_factory.cpp │ │ ├── property_widget_factory.h │ │ ├── script/ │ │ │ ├── CMakeLists.txt │ │ │ ├── color.cpp │ │ │ ├── color.h │ │ │ ├── console.cpp │ │ │ ├── console.h │ │ │ ├── engine.cpp │ │ │ ├── engine.h │ │ │ ├── iunknown.cpp │ │ │ ├── iunknown.h │ │ │ ├── log.cpp │ │ │ ├── log.h │ │ │ ├── matrix4.cpp │ │ │ ├── matrix4.h │ │ │ ├── model.cpp │ │ │ ├── model.h │ │ │ ├── plugin.cpp │ │ │ └── plugin.h │ │ ├── script.cpp │ │ ├── script.h │ │ ├── selection.cpp │ │ ├── selection.h │ │ ├── uri.cpp │ │ └── uri.h │ ├── rectangle.cpp │ ├── rectangle.h │ ├── register_application.h │ ├── register_plugin_factories.h │ ├── render_state_gl.h │ ├── render_state_ri.h │ ├── renderable_gl.h │ ├── renderable_ri.cpp │ ├── renderable_ri.h │ ├── resolutions.cpp │ ├── resolutions.h │ ├── resource/ │ │ ├── CMakeLists.txt │ │ ├── resource.cpp │ │ └── resource.h │ ├── result.h │ ├── scalar_source.cpp │ ├── scalar_source.h │ ├── scripted_node.h │ ├── scripted_plugin.h │ ├── scripting.cpp │ ├── scripting.h │ ├── selectable.h │ ├── selection.cpp │ ├── selection.h │ ├── selection_state_gl.h │ ├── selection_validation.h │ ├── serialization_xml.cpp │ ├── serialization_xml.h │ ├── sgi_tesselator/ │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── alg-outline │ │ ├── dict-list.h │ │ ├── dict.c │ │ ├── dict.h │ │ ├── geom.c │ │ ├── geom.h │ │ ├── gluos.h │ │ ├── memalloc.c │ │ ├── memalloc.h │ │ ├── mesh.c │ │ ├── mesh.h │ │ ├── normal.c │ │ ├── normal.h │ │ ├── priorityq-heap.c │ │ ├── priorityq-heap.h │ │ ├── priorityq-sort.h │ │ ├── priorityq.c │ │ ├── render.c │ │ ├── render.h │ │ ├── sweep.c │ │ ├── sweep.h │ │ ├── tess.c │ │ ├── tess.h │ │ ├── tessmono.c │ │ └── tessmono.h │ ├── sgi_tesselator.h │ ├── shader_cache.cpp │ ├── shader_cache.h │ ├── shader_cache_detail.h │ ├── shader_collection_ri.cpp │ ├── shader_collection_ri.h │ ├── shader_ri.cpp │ ├── shader_ri.h │ ├── share.cpp │ ├── share.h │ ├── share_detail.h │ ├── signal_accumulators.h │ ├── signal_slots.h │ ├── signal_system.h │ ├── sl.cpp │ ├── sl.h │ ├── snap_source.cpp │ ├── snap_source.h │ ├── snap_target.cpp │ ├── snap_target.h │ ├── snappable.h │ ├── snappable_detail.cpp │ ├── snappable_detail.h │ ├── socket.cpp │ ├── socket.h │ ├── sphere.cpp │ ├── sphere.h │ ├── state_change_set.cpp │ ├── state_change_set.h │ ├── stream_io_ri.cpp │ ├── stream_io_ri.h │ ├── stream_ri.cpp │ ├── stream_ri.h │ ├── string_cast.h │ ├── string_modifiers.cpp │ ├── string_modifiers.h │ ├── string_source.h │ ├── subdivision_surface/ │ │ ├── CMakeLists.txt │ │ ├── catmull_clark.cpp │ │ └── catmull_clark.h │ ├── system.cpp │ ├── system.h │ ├── table.cpp │ ├── table.h │ ├── table_copier.cpp │ ├── table_copier.h │ ├── teapot.cpp │ ├── teapot.h │ ├── texture3.h │ ├── time_sink.h │ ├── time_source.cpp │ ├── time_source.h │ ├── tokens.cpp │ ├── tokens.h │ ├── torus.cpp │ ├── torus.h │ ├── transform.cpp │ ├── transform.h │ ├── transformable.h │ ├── triangulator.cpp │ ├── triangulator.h │ ├── type_registry.cpp │ ├── type_registry.h │ ├── typed_array.h │ ├── types.h │ ├── types_ri.cpp │ ├── types_ri.h │ ├── uint_t_array.h │ ├── user_interface.cpp │ ├── user_interface.h │ ├── user_interface_init.h │ ├── user_property.cpp │ ├── user_property.h │ ├── user_property_changed_signal.cpp │ ├── user_property_changed_signal.h │ ├── ustring.cpp │ ├── ustring.h │ ├── utility.h │ ├── utility_gl.cpp │ ├── utility_gl.h │ ├── uuid.cpp │ ├── uuid.h │ ├── value_demand_storage.h │ ├── vector2.h │ ├── vector3.h │ ├── vector3_source.h │ ├── vector4.h │ ├── vectors.h │ ├── virtual_document_plugin_factory.h │ ├── watched_path_property.h │ ├── win32.h │ ├── xml.cpp │ ├── xml.h │ ├── xpath.cpp │ └── xpath.h ├── make-module-proxy/ │ ├── CMakeLists.txt │ └── main.cpp ├── man/ │ └── k3d.1.in ├── modules/ │ ├── 3ds_io/ │ │ ├── 3dschunknames.h │ │ ├── CMakeLists.txt │ │ ├── integration.cpp │ │ ├── integration.h │ │ ├── mesh_reader.cpp │ │ └── module.cpp │ ├── CMakeLists.txt │ ├── advanced_opengl_painters/ │ │ ├── CMakeLists.txt │ │ ├── attic/ │ │ │ ├── cached_triangulation.cpp │ │ │ ├── cached_triangulation.h │ │ │ ├── face_varying_painter.cpp │ │ │ ├── hidden_line_painter.cpp │ │ │ ├── normal_cache.cpp │ │ │ ├── normal_cache.h │ │ │ ├── point_normal_painter.cpp │ │ │ ├── sds_cache.h │ │ │ ├── sds_painter.cpp │ │ │ ├── selection_cache.h │ │ │ ├── textured_face_painter.cpp │ │ │ ├── vbo.cpp │ │ │ ├── vbo.h │ │ │ ├── vbo_edge_painter.cpp │ │ │ ├── vbo_face_painter.cpp │ │ │ ├── vbo_point_painter.cpp │ │ │ └── vbo_sds_painter.cpp │ │ ├── module.cpp │ │ ├── painter_cache.h │ │ ├── sds_cache.cpp │ │ ├── sds_cache.h │ │ ├── sds_edge_painter.cpp │ │ ├── sds_face_painter.cpp │ │ ├── sds_point_painter.cpp │ │ ├── texture_colored_selection_painter_gl.h │ │ ├── vbo.cpp │ │ └── vbo.h │ ├── animation/ │ │ ├── CMakeLists.txt │ │ ├── animation_track.cpp │ │ ├── interpolator.cpp │ │ ├── interpolator.h │ │ └── module.cpp │ ├── annotation/ │ │ ├── CMakeLists.txt │ │ ├── annotate_normal.cpp │ │ ├── annotation.cpp │ │ ├── annotation_2d.cpp │ │ ├── annotation_3d.cpp │ │ ├── common.cpp │ │ ├── common.h │ │ └── module.cpp │ ├── aqsis/ │ │ ├── CMakeLists.txt │ │ └── engine.cpp │ ├── array/ │ │ ├── CMakeLists.txt │ │ ├── alternate_array_1d.cpp │ │ ├── alternate_array_2d.cpp │ │ ├── alternate_array_3d.cpp │ │ ├── detail.h │ │ ├── module.cpp │ │ ├── rotate_array_1d.cpp │ │ ├── rotate_array_2d.cpp │ │ ├── rotate_array_3d.cpp │ │ ├── translate_array_1d.cpp │ │ ├── translate_array_2d.cpp │ │ └── translate_array_3d.cpp │ ├── bicubic_patch/ │ │ ├── CMakeLists.txt │ │ ├── bicubic_to_poly.cpp │ │ ├── module.cpp │ │ └── newell_primitives.cpp │ ├── bilinear_patch/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ └── poly_to_bilinear.cpp │ ├── bitmap/ │ │ ├── CMakeLists.txt │ │ ├── add.cpp │ │ ├── checker.cpp │ │ ├── color_monochrome.cpp │ │ ├── gamma.cpp │ │ ├── invert.cpp │ │ ├── matte_colordiff.cpp │ │ ├── matte_invert.cpp │ │ ├── module.cpp │ │ ├── multiply.cpp │ │ ├── reader.cpp │ │ ├── reference_image_2d.cpp │ │ ├── reference_image_3d.cpp │ │ ├── simple_modifier.h │ │ ├── solid.cpp │ │ ├── subtract.cpp │ │ └── threshold.cpp │ ├── blobby/ │ │ ├── CMakeLists.txt │ │ ├── add.cpp │ │ ├── detail.cpp │ │ ├── detail.h │ │ ├── divide.cpp │ │ ├── edges_to_blobby.cpp │ │ ├── ellipsoid.cpp │ │ ├── maximum.cpp │ │ ├── minimum.cpp │ │ ├── module.cpp │ │ ├── multiply.cpp │ │ ├── negate.cpp │ │ ├── points_to_blobby.cpp │ │ ├── segment.cpp │ │ └── subtract.cpp │ ├── bundled_renderman_engines/ │ │ ├── CMakeLists.txt │ │ ├── aqsis.cpp │ │ └── module.cpp │ ├── carve/ │ │ ├── CMakeLists.txt │ │ ├── boolean.cpp │ │ └── module.cpp │ ├── cgal/ │ │ ├── CMakeLists.txt │ │ ├── big_integer.h │ │ ├── boolean.cpp │ │ ├── cgal_simplifying_constructors.h │ │ ├── conversion.h │ │ ├── k3d_to_nef.h │ │ └── module.cpp │ ├── cloth/ │ │ ├── CMakeLists.txt │ │ ├── cloth_solver.h │ │ ├── d_Vec3f.h │ │ ├── d_Vecf.h │ │ ├── particle.h │ │ └── simulation.cpp │ ├── collada_io/ │ │ ├── CMakeLists.txt │ │ ├── collada.cpp │ │ ├── collada.h │ │ ├── document_exporter.cpp │ │ ├── document_importer.cpp │ │ ├── int_elements.cpp │ │ ├── int_elements.h │ │ ├── integration.cpp │ │ ├── integration.h │ │ ├── mesh_reader.cpp │ │ ├── mesh_writer.cpp │ │ └── module.cpp │ ├── compiz/ │ │ ├── CMakeLists.txt │ │ ├── compiz_check.cpp │ │ └── module.cpp │ ├── core/ │ │ ├── CMakeLists.txt │ │ ├── axes.cpp │ │ ├── camera.cpp │ │ ├── module.cpp │ │ ├── multi_material.cpp │ │ └── null.cpp │ ├── cuda/ │ │ ├── CMakeLists.txt │ │ ├── FindCUDA.cmake │ │ ├── cuda_bitmap_add.cpp │ │ ├── cuda_bitmap_color_monochrome.cpp │ │ ├── cuda_bitmap_gamma.cpp │ │ ├── cuda_bitmap_invert.cpp │ │ ├── cuda_bitmap_matte_colordiff.cpp │ │ ├── cuda_bitmap_matte_invert.cpp │ │ ├── cuda_bitmap_multiply.cpp │ │ ├── cuda_bitmap_simple_modifier.h │ │ ├── cuda_bitmap_subtract.cpp │ │ ├── cuda_bitmap_threshold.cpp │ │ ├── cuda_deformation_transform_points.cpp │ │ ├── cuda_device_mesh.cpp │ │ ├── cuda_device_mesh.h │ │ ├── cuda_device_polyhedra.cpp │ │ ├── cuda_device_polyhedra.h │ │ ├── cuda_entry_points.cu │ │ ├── cuda_entry_points.h │ │ ├── cuda_kernels.cu │ │ ├── cuda_mesh_cuda_to_k3d_converter.cpp │ │ ├── cuda_mesh_k3d_to_cuda_converter.cpp │ │ ├── cuda_mesh_poly_grid.cpp │ │ ├── cuda_mesh_poly_grid_with_transform_points.cpp │ │ ├── cuda_mesh_simple_deformation_modifier.cpp │ │ ├── cuda_mesh_simple_deformation_modifier.h │ │ ├── cuda_mesh_subdivide_edges.cpp │ │ ├── cuda_mesh_topology_data.cpp │ │ ├── cuda_mesh_topology_data.h │ │ └── module.cpp │ ├── deformation/ │ │ ├── CMakeLists.txt │ │ ├── bend_points.cpp │ │ ├── bulge_points.cpp │ │ ├── center_points.cpp │ │ ├── cylindrical_wave_points.cpp │ │ ├── deformation_expression.cpp │ │ ├── linear_point_noise.cpp │ │ ├── linear_transformation_worker.h │ │ ├── linear_wave_points.cpp │ │ ├── mesh_modifier.h │ │ ├── module.cpp │ │ ├── morph_points.cpp │ │ ├── rotate_points.cpp │ │ ├── scale_points.cpp │ │ ├── set_position.cpp │ │ ├── shear_points.cpp │ │ ├── smooth_points.cpp │ │ ├── sphereize_points.cpp │ │ ├── taper_points.cpp │ │ ├── transform_points.cpp │ │ ├── translate_points.cpp │ │ ├── tweak_points.cpp │ │ └── twist_points.cpp │ ├── development/ │ │ ├── CMakeLists.txt │ │ ├── glsl_painter.cpp │ │ └── module.cpp │ ├── double/ │ │ ├── CMakeLists.txt │ │ ├── add.cpp │ │ ├── divide.cpp │ │ ├── double_to_string.cpp │ │ ├── expression.cpp │ │ ├── module.cpp │ │ ├── modulo.cpp │ │ ├── multiply.cpp │ │ ├── sine.cpp │ │ └── subtract.cpp │ ├── euler_operations/ │ │ ├── CMakeLists.txt │ │ ├── kill_edge_and_vertex.cpp │ │ ├── kill_edge_make_loop.cpp │ │ └── module.cpp │ ├── external/ │ │ └── CMakeLists.txt │ ├── file_magic/ │ │ ├── CMakeLists.txt │ │ ├── mime_type_handler.cpp │ │ └── module.cpp │ ├── freetype2/ │ │ ├── CMakeLists.txt │ │ ├── freetype.h │ │ └── poly_text.cpp │ ├── gio/ │ │ ├── CMakeLists.txt │ │ ├── mime_type_handler.cpp │ │ ├── module.cpp │ │ └── uri_handler.cpp │ ├── glx/ │ │ ├── CMakeLists.txt │ │ ├── context_factory.cpp │ │ └── module.cpp │ ├── gmsh_io/ │ │ ├── CMakeLists.txt │ │ ├── mesh_writer.cpp │ │ └── module.cpp │ ├── gperftools/ │ │ ├── CMakeLists.txt │ │ ├── gperftools.cpp │ │ └── module.cpp │ ├── graphviz/ │ │ ├── CMakeLists.txt │ │ ├── mesh_writer.cpp │ │ ├── module.cpp │ │ └── render_engine.cpp │ ├── gts/ │ │ ├── CMakeLists.txt │ │ ├── helpers.cpp │ │ ├── helpers.h │ │ ├── mesh_area.cpp │ │ ├── mesh_volume.cpp │ │ └── module.cpp │ ├── gts_io/ │ │ ├── CMakeLists.txt │ │ ├── mesh_reader.cpp │ │ └── module.cpp │ ├── highlighting/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ └── rubber_band.cpp │ ├── iges_io/ │ │ ├── CMakeLists.txt │ │ ├── mesh_writer.cpp │ │ └── module.cpp │ ├── imagemagick_io/ │ │ ├── CMakeLists.txt │ │ ├── bitmap_importer.cpp │ │ └── module.cpp │ ├── indigo/ │ │ ├── CMakeLists.txt │ │ ├── background.cpp │ │ ├── diffuse_material.cpp │ │ ├── light.h │ │ ├── material.h │ │ ├── module.cpp │ │ ├── rectangle_light.cpp │ │ ├── render_engine.cpp │ │ ├── skylight.cpp │ │ ├── spectrum.cpp │ │ └── spectrum.h │ ├── inotify/ │ │ ├── CMakeLists.txt │ │ ├── file_change_notifier.cpp │ │ ├── inotify-cxx.cpp │ │ ├── inotify-cxx.h │ │ └── module.cpp │ ├── jpeg_io/ │ │ ├── CMakeLists.txt │ │ ├── bitmap_importer.cpp │ │ ├── bitmap_reader.cpp │ │ ├── bitmap_writer.cpp │ │ └── module.cpp │ ├── k3d_io/ │ │ ├── CMakeLists.txt │ │ ├── document_exporter.cpp │ │ ├── document_importer.cpp │ │ ├── mesh_reader.cpp │ │ ├── mesh_writer.cpp │ │ └── module.cpp │ ├── linear_curve/ │ │ ├── CMakeLists.txt │ │ ├── knot_curve.cpp │ │ ├── lissajous_curve.cpp │ │ └── module.cpp │ ├── lipsync/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ └── papagayo_lipsync_reader.cpp │ ├── lsystem/ │ │ ├── CMakeLists.txt │ │ └── l_parser.cpp │ ├── luxrender/ │ │ ├── CMakeLists.txt │ │ ├── bilinear_interpolation_texture.cpp │ │ ├── carpaint_material.cpp │ │ ├── color_texture.h │ │ ├── color_texture_reference.cpp │ │ ├── color_texture_reference.h │ │ ├── distant_light.cpp │ │ ├── environment_light.cpp │ │ ├── glass_material.cpp │ │ ├── glossy_material.cpp │ │ ├── goniometric_light.cpp │ │ ├── image_texture.cpp │ │ ├── light.cpp │ │ ├── light.h │ │ ├── material.cpp │ │ ├── material.h │ │ ├── matte_material.cpp │ │ ├── matte_translucent_material.cpp │ │ ├── metal_material.cpp │ │ ├── mirror_material.cpp │ │ ├── mix_material.cpp │ │ ├── module.cpp │ │ ├── null_material.cpp │ │ ├── point_light.cpp │ │ ├── render_engine.cpp │ │ ├── rough_glass_material.cpp │ │ ├── scalar_image_texture.cpp │ │ ├── scalar_texture.h │ │ ├── scalar_texture_reference.cpp │ │ ├── scalar_texture_reference.h │ │ ├── shiny_metal_material.cpp │ │ ├── sky_light.cpp │ │ ├── sun_light.cpp │ │ ├── texture.cpp │ │ ├── texture.h │ │ ├── texture2.cpp │ │ ├── texture2.h │ │ ├── utility.cpp │ │ └── utility.h │ ├── matrix/ │ │ ├── CMakeLists.txt │ │ ├── frozen_matrix.cpp │ │ ├── inverse.cpp │ │ ├── look.cpp │ │ ├── module.cpp │ │ ├── orientation.cpp │ │ ├── position.cpp │ │ ├── scale.cpp │ │ ├── snap.cpp │ │ ├── snap_test.py │ │ └── view.cpp │ ├── md2_io/ │ │ ├── CMakeLists.txt │ │ ├── md2.cpp │ │ ├── md2.h │ │ ├── mesh_reader.cpp │ │ └── module.cpp │ ├── mesh/ │ │ ├── CMakeLists.txt │ │ ├── array_1d.cpp │ │ ├── array_2d.cpp │ │ ├── array_3d.cpp │ │ ├── merge_mesh.cpp │ │ ├── module.cpp │ │ ├── points_centroid.cpp │ │ └── weld_points.cpp │ ├── mesh_attributes/ │ │ ├── CMakeLists.txt │ │ ├── calculate_normals.cpp │ │ ├── module.cpp │ │ ├── named_text_array.cpp │ │ ├── set_color.cpp │ │ └── set_material.cpp │ ├── mesh_instance/ │ │ ├── CMakeLists.txt │ │ ├── frozen_mesh.cpp │ │ ├── mesh_instance.cpp │ │ └── module.cpp │ ├── ngui/ │ │ ├── CMakeLists.txt │ │ ├── file_notification.cpp │ │ ├── file_notification.h │ │ ├── splash_box.cpp │ │ ├── splash_box.h │ │ └── user_interface.cpp │ ├── ngui_about/ │ │ ├── CMakeLists.txt │ │ └── dialog.cpp │ ├── ngui_animation_timeline_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── ngui_assign_hotkeys/ │ │ ├── CMakeLists.txt │ │ └── dialog.cpp │ ├── ngui_atk_event_recorder/ │ │ ├── CMakeLists.txt │ │ └── dialog.cpp │ ├── ngui_knot_vector_control/ │ │ ├── CMakeLists.txt │ │ └── control.cpp │ ├── ngui_learning/ │ │ ├── CMakeLists.txt │ │ └── dialog.cpp │ ├── ngui_log/ │ │ ├── CMakeLists.txt │ │ └── dialog.cpp │ ├── ngui_material_manager_panel/ │ │ ├── CMakeLists.txt │ │ ├── ContentPanel.cpp │ │ ├── ContentPanel.h │ │ ├── DocumentUtilities.cpp │ │ ├── DocumentUtilities.h │ │ ├── GroupContentPanel.cpp │ │ ├── GroupContentPanel.h │ │ ├── MaterialContentPanel.cpp │ │ ├── MaterialContentPanel.h │ │ ├── MaterialGroup.cpp │ │ ├── MaterialGroup.h │ │ ├── MaterialObj.cpp │ │ ├── MaterialObj.h │ │ ├── PreviewCube.cpp │ │ ├── PreviewCube.h │ │ ├── PreviewObj.cpp │ │ ├── PreviewObj.h │ │ ├── PreviewSphere.cpp │ │ ├── PreviewSphere.h │ │ ├── PreviewTorus.cpp │ │ ├── PreviewTorus.h │ │ ├── RenderedImage.cpp │ │ ├── RenderedImage.h │ │ └── panel.cpp │ ├── ngui_mesh_control/ │ │ ├── CMakeLists.txt │ │ └── control.cpp │ ├── ngui_morph_points_page/ │ │ ├── CMakeLists.txt │ │ └── page.cpp │ ├── ngui_node_list_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── ngui_node_properties_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── ngui_opengl_dialog/ │ │ ├── CMakeLists.txt │ │ └── dialog.cpp │ ├── ngui_parent_tool/ │ │ ├── CMakeLists.txt │ │ └── tool.cpp │ ├── ngui_pipeline_panel/ │ │ ├── CMakeLists.txt │ │ ├── document_to_graph.cpp │ │ ├── document_to_graph.h │ │ ├── edge_indices.cpp │ │ ├── edge_indices.h │ │ ├── extract_tree.cpp │ │ ├── extract_tree.h │ │ ├── graph_modifier.h │ │ ├── graph_source.h │ │ ├── panel.cpp │ │ ├── tree_layout.cpp │ │ └── tree_layout.h │ ├── ngui_pipeline_profiler_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── ngui_python_shell/ │ │ ├── CMakeLists.txt │ │ ├── completion.py │ │ └── dialog.cpp │ ├── ngui_rectangle_control/ │ │ ├── CMakeLists.txt │ │ └── control.cpp │ ├── ngui_render_region_tool/ │ │ ├── CMakeLists.txt │ │ └── tool.cpp │ ├── ngui_selection_control/ │ │ ├── CMakeLists.txt │ │ └── control.cpp │ ├── ngui_snap_tool/ │ │ ├── CMakeLists.txt │ │ ├── snap_tool_detail.cpp │ │ ├── snap_tool_detail.h │ │ └── tool.cpp │ ├── ngui_space_navigator/ │ │ ├── CMakeLists.txt │ │ └── dialog.cpp │ ├── ngui_text_editor/ │ │ ├── CMakeLists.txt │ │ ├── config.h.in │ │ └── dialog.cpp │ ├── ngui_timeline_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── ngui_tool_properties_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── ngui_toolbar_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── ngui_undo_tree_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── ngui_uv_editor_panel/ │ │ ├── CMakeLists.txt │ │ └── panel.cpp │ ├── nui/ │ │ ├── CMakeLists.txt │ │ └── user_interface.cpp │ ├── nurbs/ │ │ ├── CMakeLists.txt │ │ ├── add_trim_curve.cpp │ │ ├── close_curve.cpp │ │ ├── connect_curves.cpp │ │ ├── create_cap.cpp │ │ ├── curve_degree_elevation.cpp │ │ ├── curve_traversal.cpp │ │ ├── edit_knot_vector.cpp │ │ ├── extract_curve_point.cpp │ │ ├── extract_patch_curve.cpp │ │ ├── extract_trim_curves.cpp │ │ ├── extrude_curve.cpp │ │ ├── extrude_patch.cpp │ │ ├── flip_curve.cpp │ │ ├── insert_knot.cpp │ │ ├── merge_connected_curves.cpp │ │ ├── merge_curve_knot_vectors.cpp │ │ ├── module.cpp │ │ ├── nurbs_curves.cpp │ │ ├── nurbs_curves.h │ │ ├── nurbs_patches.cpp │ │ ├── nurbs_patches.h │ │ ├── patch_degree_elevation.cpp │ │ ├── patch_insert_knot.cpp │ │ ├── polygonize_curve.cpp │ │ ├── polygonize_patch.cpp │ │ ├── revolve_curve.cpp │ │ ├── ruled_surface.cpp │ │ ├── set_weight.cpp │ │ ├── skinned_surface.cpp │ │ ├── split_curve.cpp │ │ ├── split_patch.cpp │ │ ├── sweep_surface.cpp │ │ ├── utility.cpp │ │ └── utility.h │ ├── nurbs_sources/ │ │ ├── CMakeLists.txt │ │ ├── circle.cpp │ │ ├── cone.cpp │ │ ├── curve.cpp │ │ ├── cylinder.cpp │ │ ├── disk.cpp │ │ ├── grid.cpp │ │ ├── hyperboloid.cpp │ │ ├── module.cpp │ │ ├── paraboloid.cpp │ │ ├── polygon.cpp │ │ ├── sphere.cpp │ │ └── torus.cpp │ ├── obj_io/ │ │ ├── CMakeLists.txt │ │ ├── mesh_reader.cpp │ │ ├── mesh_writer.cpp │ │ ├── module.cpp │ │ ├── obj_parser.cpp │ │ ├── obj_parser.h │ │ └── obj_specification.txt │ ├── ode/ │ │ ├── CMakeLists.txt │ │ ├── isimulation.h │ │ ├── module.cpp │ │ ├── node.cpp │ │ └── simulation.cpp │ ├── ogre_io/ │ │ ├── CMakeLists.txt │ │ ├── mesh_writer.cpp │ │ └── module.cpp │ ├── openexr_io/ │ │ ├── CMakeLists.txt │ │ ├── bitmap_importer.cpp │ │ └── module.cpp │ ├── opengl/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ ├── render_engine.cpp │ │ └── version_check.cpp │ ├── osmesa/ │ │ ├── CMakeLists.txt │ │ ├── context_factory.cpp │ │ └── module.cpp │ ├── osx/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ └── uri_handler.cpp │ ├── particle/ │ │ ├── CMakeLists.txt │ │ ├── make_particles.cpp │ │ └── module.cpp │ ├── pdiff/ │ │ ├── CMakeLists.txt │ │ ├── CompareArgs.cpp │ │ ├── CompareArgs.h │ │ ├── LPyramid.cpp │ │ ├── LPyramid.h │ │ ├── Metric.cpp │ │ ├── Metric.h │ │ ├── README.txt │ │ ├── RGBAImage.cpp │ │ ├── RGBAImage.h │ │ ├── gpl.txt │ │ ├── module.cpp │ │ └── perceptual_difference.cpp │ ├── pixie/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ └── raytrace_map.cpp │ ├── plot/ │ │ ├── CMakeLists.txt │ │ ├── least_squares_plot.cpp │ │ ├── module.cpp │ │ └── surface_plot.cpp │ ├── ply_io/ │ │ ├── CMakeLists.txt │ │ ├── mesh_reader.cpp │ │ ├── mesh_writer.cpp │ │ └── module.cpp │ ├── png_io/ │ │ ├── CMakeLists.txt │ │ ├── bitmap_importer.cpp │ │ ├── bitmap_reader.cpp │ │ ├── bitmap_writer.cpp │ │ └── module.cpp │ ├── polyhedron/ │ │ ├── CMakeLists.txt │ │ ├── bevel_faces.cpp │ │ ├── bevel_points.cpp │ │ ├── bridge_edges.cpp │ │ ├── bridge_faces.cpp │ │ ├── cap_holes.cpp │ │ ├── collapse_edges.cpp │ │ ├── collapse_faces.cpp │ │ ├── collapse_points.cpp │ │ ├── connect_vertices.cpp │ │ ├── delete_components.cpp │ │ ├── dissolve_faces.cpp │ │ ├── extrude_faces.cpp │ │ ├── fillet_edges.cpp │ │ ├── flip_orientation.cpp │ │ ├── make_hole.cpp │ │ ├── make_sds.cpp │ │ ├── merge_collinear_edges.cpp │ │ ├── merge_coplanar_faces.cpp │ │ ├── merge_polyhedra.cpp │ │ ├── module.cpp │ │ ├── move_first_edge.cpp │ │ ├── reshape_face_to_circle.cpp │ │ ├── sds_corner.cpp │ │ ├── sds_crease.cpp │ │ ├── sds_hole.cpp │ │ ├── selected_faces_to_polyhedron.cpp │ │ ├── subdivide_edges.cpp │ │ ├── subdivide_faces.cpp │ │ └── triangulate_faces.cpp │ ├── polyhedron_sources/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ ├── poly_cone.cpp │ │ ├── poly_cube.cpp │ │ ├── poly_cushion.cpp │ │ ├── poly_cylinder.cpp │ │ ├── poly_disk.cpp │ │ ├── poly_grid.cpp │ │ ├── poly_icosahedron.cpp │ │ ├── poly_sphere.cpp │ │ └── poly_torus.cpp │ ├── python/ │ │ ├── CMakeLists.txt │ │ └── engine.cpp │ ├── pyui/ │ │ ├── CMakeLists.txt │ │ └── user_interface.cpp │ ├── qslim/ │ │ ├── CMakeLists.txt │ │ ├── MxBlockModel.cpp │ │ ├── MxBlockModel.h │ │ ├── MxHeap.cpp │ │ ├── MxHeap.h │ │ ├── MxMath.cpp │ │ ├── MxMath.h │ │ ├── MxMesh.h │ │ ├── MxQMetric3.cpp │ │ ├── MxQMetric3.h │ │ ├── MxQSlim.cpp │ │ ├── MxQSlim.h │ │ ├── MxStdModel.cpp │ │ ├── MxStdModel.h │ │ ├── MxStdSlim.cpp │ │ ├── MxStdSlim.h │ │ ├── MxTriangle.cpp │ │ ├── MxTriangle.h │ │ └── qslim.cpp │ ├── qtui/ │ │ ├── CMakeLists.txt │ │ ├── config.h.in │ │ ├── extrude_faces.ui │ │ ├── main_window.cpp │ │ ├── main_window.h │ │ ├── main_window.ui │ │ ├── scene.cpp │ │ ├── scene.h │ │ ├── stylesheet.css │ │ ├── user_interface.cpp │ │ ├── user_interface.h │ │ ├── user_interface.qrc │ │ ├── viewport.cpp │ │ └── viewport.h │ ├── qtui_about_dialog/ │ │ ├── CMakeLists.txt │ │ ├── dialog.cpp │ │ ├── dialog.qrc │ │ └── dialog.ui │ ├── qtui_aqsis/ │ │ ├── CMakeLists.txt │ │ ├── dialog.cpp │ │ ├── dialog.h │ │ ├── dialog.ui │ │ ├── thread.cpp │ │ └── thread.h │ ├── qtui_aqsis_mode/ │ │ ├── CMakeLists.txt │ │ ├── mode.cpp │ │ ├── mode.h │ │ ├── thread.cpp │ │ └── thread.h │ ├── qtui_boolean/ │ │ ├── CMakeLists.txt │ │ ├── widget.cpp │ │ └── widget.h │ ├── qtui_color/ │ │ ├── CMakeLists.txt │ │ ├── widget.cpp │ │ └── widget.h │ ├── qtui_default_mode/ │ │ ├── CMakeLists.txt │ │ └── mode.cpp │ ├── qtui_javascript_shell/ │ │ ├── CMakeLists.txt │ │ ├── shell.cpp │ │ ├── shell.h │ │ └── shell.ui │ ├── qtui_log/ │ │ ├── CMakeLists.txt │ │ ├── window.cpp │ │ ├── window.h │ │ └── window.ui │ ├── qtui_matrix/ │ │ ├── CMakeLists.txt │ │ ├── dialog.cpp │ │ ├── dialog.h │ │ ├── dialog.ui │ │ ├── widget.cpp │ │ ├── widget.h │ │ └── widget.ui │ ├── qtui_move_mode/ │ │ ├── CMakeLists.txt │ │ ├── mode.cpp │ │ ├── mode.h │ │ ├── module.cpp │ │ ├── move_manipulators.cpp │ │ └── move_manipulators.h │ ├── qtui_node_list/ │ │ ├── CMakeLists.txt │ │ ├── panel.cpp │ │ ├── panel.h │ │ └── panel.ui │ ├── qtui_node_properties/ │ │ ├── CMakeLists.txt │ │ ├── panel.cpp │ │ ├── panel.h │ │ └── panel.ui │ ├── qtui_opengl/ │ │ ├── CMakeLists.txt │ │ ├── window.cpp │ │ ├── window.h │ │ └── window.ui │ ├── qtui_path/ │ │ ├── CMakeLists.txt │ │ ├── widget.cpp │ │ ├── widget.h │ │ └── widget.ui │ ├── qtui_programmable_mode/ │ │ ├── CMakeLists.txt │ │ ├── default_script.js │ │ ├── mode.cpp │ │ └── mode.h │ ├── qtui_string/ │ │ ├── CMakeLists.txt │ │ ├── widget.cpp │ │ └── widget.h │ ├── qtui_text_editor/ │ │ ├── CMakeLists.txt │ │ ├── window.cpp │ │ ├── window.h │ │ └── window.ui │ ├── quadrics/ │ │ ├── CMakeLists.txt │ │ ├── cone.cpp │ │ ├── cylinder.cpp │ │ ├── detail.h │ │ ├── disk.cpp │ │ ├── hyperboloid.cpp │ │ ├── logo.cpp │ │ ├── module.cpp │ │ ├── paraboloid.cpp │ │ ├── sphere.cpp │ │ ├── teapot.cpp │ │ └── torus.cpp │ ├── reference_opengl_painters/ │ │ ├── CMakeLists.txt │ │ ├── bezier_triangle_patch_painter.cpp │ │ ├── bicubic_patch_painter.cpp │ │ ├── bilinear_patch_painter.cpp │ │ ├── blobby_point_painter.cpp │ │ ├── color_face_painter.cpp │ │ ├── colored_selection_painter_gl.h │ │ ├── cone_painter.cpp │ │ ├── cubic_curve_painter.cpp │ │ ├── cylinder_painter.cpp │ │ ├── disk_painter.cpp │ │ ├── edge_numbering_painter.cpp │ │ ├── edge_painter.cpp │ │ ├── face_normal_painter.cpp │ │ ├── face_numbering_painter.cpp │ │ ├── face_orientation_painter.cpp │ │ ├── face_painter.cpp │ │ ├── half_edge_painter.cpp │ │ ├── hyperboloid_painter.cpp │ │ ├── linear_curve_painter.cpp │ │ ├── module.cpp │ │ ├── multi_painter.cpp │ │ ├── normal_array_painter.cpp │ │ ├── nurbs_curve_numbering_painter.cpp │ │ ├── nurbs_curve_painter.cpp │ │ ├── nurbs_patch_numbering_painter.cpp │ │ ├── nurbs_patch_painter.cpp │ │ ├── paraboloid_painter.cpp │ │ ├── point_numbering_painter.cpp │ │ ├── point_painter.cpp │ │ ├── sphere_painter.cpp │ │ ├── teapot_painter.cpp │ │ ├── torus_painter.cpp │ │ ├── utility.cpp │ │ ├── utility.h │ │ ├── varying_data_painter.cpp │ │ └── vertex_data_painter.cpp │ ├── release/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ └── welcome.cpp │ ├── renderman/ │ │ ├── CMakeLists.txt │ │ ├── area_light.cpp │ │ ├── array_1d.cpp │ │ ├── array_2d.cpp │ │ ├── array_3d.cpp │ │ ├── background_plane.cpp │ │ ├── csg_operator.cpp │ │ ├── csg_solid.cpp │ │ ├── delayed_read_archive.cpp │ │ ├── direct_texture_map.cpp │ │ ├── lat_long_environment_map.cpp │ │ ├── light.cpp │ │ ├── material.cpp │ │ ├── module.cpp │ │ ├── read_archive.cpp │ │ ├── render_engine.cpp │ │ ├── renderman_script.cpp │ │ ├── shaders.cpp │ │ ├── shadow_map.cpp │ │ └── texture_map.cpp │ ├── renderman_engines/ │ │ ├── CMakeLists.txt │ │ ├── air.cpp │ │ ├── aqsis.cpp │ │ ├── bmrt.cpp │ │ ├── delight.cpp │ │ ├── module.cpp │ │ ├── netprman.cpp │ │ ├── pixie.cpp │ │ ├── povman.cpp │ │ ├── prman.cpp │ │ └── rdc.cpp │ ├── renderman_painters/ │ │ ├── CMakeLists.txt │ │ ├── array_helpers.cpp │ │ ├── array_helpers.h │ │ ├── bicubic_patch_painter.cpp │ │ ├── bilinear_patch_painter.cpp │ │ ├── blobby_painter.cpp │ │ ├── cone_painter.cpp │ │ ├── cubic_curve_painter.cpp │ │ ├── cylinder_painter.cpp │ │ ├── disk_painter.cpp │ │ ├── hyperboloid_painter.cpp │ │ ├── linear_curve_painter.cpp │ │ ├── module.cpp │ │ ├── multi_painter.cpp │ │ ├── nurbs_patch_painter.cpp │ │ ├── paraboloid_painter.cpp │ │ ├── particle_painter.cpp │ │ ├── polyhedron_painter.cpp │ │ ├── scripted_painter.cpp │ │ ├── sphere_painter.cpp │ │ ├── subdivision_surface_painter.cpp │ │ ├── teapot_painter.cpp │ │ └── torus_painter.cpp │ ├── scripted_plugins/ │ │ ├── CMakeLists.txt │ │ └── module.cpp │ ├── scripting/ │ │ ├── CMakeLists.txt │ │ ├── action_script.cpp │ │ ├── action_script.py │ │ ├── bitmap_modifier_script.cpp │ │ ├── bitmap_modifier_script.py │ │ ├── bitmap_source_script.cpp │ │ ├── bitmap_source_script.py │ │ ├── color_source_script.cpp │ │ ├── color_source_script.py │ │ ├── double_source_script.cpp │ │ ├── double_source_script.py │ │ ├── int32_source_script.cpp │ │ ├── int32_source_script.py │ │ ├── matrix_modifier_script.cpp │ │ ├── matrix_modifier_script.py │ │ ├── matrix_source_script.cpp │ │ ├── matrix_source_script.py │ │ ├── mesh_modifier_script.cpp │ │ ├── mesh_modifier_script.py │ │ ├── mesh_source_script.cpp │ │ ├── mesh_source_script.py │ │ ├── meta_object_script.cpp │ │ ├── meta_object_script.py │ │ ├── module.cpp │ │ ├── null_output_script.cpp │ │ ├── null_output_script.py │ │ ├── opengl_painter_script.cpp │ │ ├── opengl_painter_script.py │ │ ├── opengl_renderable_script.cpp │ │ ├── opengl_renderable_script.py │ │ ├── render_engine_script.cpp │ │ ├── render_engine_script.py │ │ ├── string_source_script.cpp │ │ ├── string_source_script.py │ │ ├── vector3_source_script.cpp │ │ └── vector3_source_script.py │ ├── selection/ │ │ ├── CMakeLists.txt │ │ ├── face_to_point_selections.cpp │ │ ├── grow_selection.cpp │ │ ├── make_curve_selection.cpp │ │ ├── make_edge_selection.cpp │ │ ├── make_face_selection.cpp │ │ ├── make_patch_selection.cpp │ │ ├── make_point_selection.cpp │ │ ├── mesh_selection.cpp │ │ ├── module.cpp │ │ ├── node_selection.cpp │ │ ├── select_bicubic_patch_by_number.cpp │ │ ├── select_bilinear_patch_by_number.cpp │ │ ├── select_boundary_edges.cpp │ │ ├── select_clockwise.cpp │ │ ├── select_companion.cpp │ │ ├── select_connected_components.cpp │ │ ├── select_cube.cpp │ │ ├── select_cubic_curve_by_number.cpp │ │ ├── select_degenerate_faces.cpp │ │ ├── select_edge_by_number.cpp │ │ ├── select_edgeloops.cpp │ │ ├── select_edgerings.cpp │ │ ├── select_face_by_number.cpp │ │ ├── select_linear_curve_by_number.cpp │ │ ├── select_n_sided.cpp │ │ ├── select_nurbs_curve_by_number.cpp │ │ ├── select_nurbs_patch_by_number.cpp │ │ ├── select_point_by_number.cpp │ │ └── select_points_above_number.cpp │ ├── solar/ │ │ ├── CMakeLists.txt │ │ ├── module.cpp │ │ ├── position.cpp │ │ └── solpos/ │ │ ├── CMakeLists.txt │ │ ├── aboutsolpos.html │ │ ├── solpos.cpp │ │ └── solpos.h │ ├── stl_io/ │ │ ├── CMakeLists.txt │ │ ├── binary_stl.h │ │ ├── mesh_reader.cpp │ │ ├── mesh_writer.cpp │ │ └── module.cpp │ ├── subdivision_surface/ │ │ ├── CMakeLists.txt │ │ ├── catmull_clark_subdivider.cpp │ │ └── module.cpp │ ├── svg_io/ │ │ ├── CMakeLists.txt │ │ ├── mesh_reader.cpp │ │ └── module.cpp │ ├── test/ │ │ ├── CMakeLists.txt │ │ ├── add_color_attribute.cpp │ │ ├── add_color_attributes.cpp │ │ ├── add_index_attributes.cpp │ │ ├── add_point_attributes.cpp │ │ ├── mesh_to_stdout.cpp │ │ ├── module.cpp │ │ ├── pipeline_profiler.cpp │ │ ├── selection_to_stdout.cpp │ │ ├── string_to_stdout.cpp │ │ └── valid_meshes.cpp │ ├── tiff_io/ │ │ ├── CMakeLists.txt │ │ ├── bitmap_exporter.cpp │ │ ├── bitmap_importer.cpp │ │ ├── bitmap_reader.cpp │ │ ├── bitmap_writer.cpp │ │ └── module.cpp │ ├── time/ │ │ ├── CMakeLists.txt │ │ ├── manual_time_source.cpp │ │ ├── module.cpp │ │ ├── real_time_source.cpp │ │ ├── time_source.cpp │ │ └── time_to_string.cpp │ ├── uniform_polyhedron/ │ │ ├── CMakeLists.txt │ │ ├── data/ │ │ │ ├── augmented_dodecahedron.xml │ │ │ ├── augmented_hexagonal_prism.xml │ │ │ ├── augmented_pentagonal_prism.xml │ │ │ ├── augmented_sphenocorona.xml │ │ │ ├── augmented_triangular_prism.xml │ │ │ ├── augmented_tridiminished_icosahedron.xml │ │ │ ├── augmented_truncated_cube.xml │ │ │ ├── augmented_truncated_dodecahedron.xml │ │ │ ├── augmented_truncated_tetrahedron.xml │ │ │ ├── biaugmented_pentagonal_prism.xml │ │ │ ├── biaugmented_triangular_prism.xml │ │ │ ├── biaugmented_truncated_cube.xml │ │ │ ├── bigyrate_diminished_rhombicosidodecahedron.xml │ │ │ ├── bilunabirotunda.xml │ │ │ ├── cube.xml │ │ │ ├── decagonal_antiprism.xml │ │ │ ├── decagonal_prism.xml │ │ │ ├── diminished_rhombicosidodecahedron.xml │ │ │ ├── disphenocingulum.xml │ │ │ ├── dodecadodecahedron.xml │ │ │ ├── dodecahedron.xml │ │ │ ├── echidnahedron.xml │ │ │ ├── elongated_pentagonal_cupola.xml │ │ │ ├── elongated_pentagonal_dipyramid.xml │ │ │ ├── elongated_pentagonal_gyrobicupola.xml │ │ │ ├── elongated_pentagonal_gyrobirotunda.xml │ │ │ ├── elongated_pentagonal_gyrocupolarotunda.xml │ │ │ ├── elongated_pentagonal_orthobicupola.xml │ │ │ ├── elongated_pentagonal_orthobirotunda.xml │ │ │ ├── elongated_pentagonal_orthocupolarotunda.xml │ │ │ ├── elongated_pentagonal_pyramid.xml │ │ │ ├── elongated_pentagonal_rotunds.xml │ │ │ ├── elongated_square_cupola.xml │ │ │ ├── elongated_square_dipyramid.xml │ │ │ ├── elongated_square_gyrobicupola.xml │ │ │ ├── elongated_square_pyramid.xml │ │ │ ├── elongated_triangular_cupola.xml │ │ │ ├── elongated_triangular_dipyramid.xml │ │ │ ├── elongated_triangular_gyrobicupola.xml │ │ │ ├── elongated_triangular_orthobicupola.xml │ │ │ ├── elongated_triangular_pyramid.xml │ │ │ ├── great_dodecahedron.xml │ │ │ ├── great_icosahedron.xml │ │ │ ├── great_stellated_dodecahedron.xml │ │ │ ├── gyrate_bidiminished_rhombicosidodecahedron.xml │ │ │ ├── gyrate_rhombicosidodecahedron.xml │ │ │ ├── gyrobifastigium.xml │ │ │ ├── gyroelongated_pentagonal_bicupola.xml │ │ │ ├── gyroelongated_pentagonal_birotunda.xml │ │ │ ├── gyroelongated_pentagonal_cupola.xml │ │ │ ├── gyroelongated_pentagonal_cupolarotunda.xml │ │ │ ├── gyroelongated_pentagonal_pyramid.xml │ │ │ ├── gyroelongated_pentagonal_rotunda.xml │ │ │ ├── gyroelongated_square_bicupola.xml │ │ │ ├── gyroelongated_square_cupola.xml │ │ │ ├── gyroelongated_square_dipyramid.xml │ │ │ ├── gyroelongated_square_pyramid.xml │ │ │ ├── gyroelongated_triangular_bicupola.xml │ │ │ ├── gyroelongated_triangular_cupola.xml │ │ │ ├── hebesphenomegacorona.xml │ │ │ ├── hexagonal_antiprism.xml │ │ │ ├── hexagonal_prism.xml │ │ │ ├── hexakis_icosahedron.xml │ │ │ ├── hexakis_octahedron.xml │ │ │ ├── icosahedron.xml │ │ │ ├── metabiaugmented_dodecahedron.xml │ │ │ ├── metabiaugmented_hexagonal_prism.xml │ │ │ ├── metabiaugmented_truncated_dodecahedron.xml │ │ │ ├── metabidiminished_icosahedron.xml │ │ │ ├── metabidiminished_rhombicosidodecahedron.xml │ │ │ ├── metabigyrate_rhombicosidodecahedron.xml │ │ │ ├── metagyrate_diminished_rhombicosidodecahedron.xml │ │ │ ├── octagonal_antiprism.xml │ │ │ ├── octagonal_prism.xml │ │ │ ├── octahedron.xml │ │ │ ├── octahemioctahedron.xml │ │ │ ├── parabiaugmented_dodecahedron.xml │ │ │ ├── parabiaugmented_hexagonal_prism.xml │ │ │ ├── parabiaugmented_truncated_dodecahedron.xml │ │ │ ├── parabidiminished_rhombicosidodecahedron.xml │ │ │ ├── parabigyrate_rhombicosidodecahedron.xml │ │ │ ├── paragyrate_diminished_rhombicosidodecahedron.xml │ │ │ ├── pentagonal_antiprism.xml │ │ │ ├── pentagonal_cupola.xml │ │ │ ├── pentagonal_dipyramid.xml │ │ │ ├── pentagonal_gyrobicupola.xml │ │ │ ├── pentagonal_gyrocupolarotunda.xml │ │ │ ├── pentagonal_hexecontahedron.xml │ │ │ ├── pentagonal_icositetrahedron.xml │ │ │ ├── pentagonal_orthobicupola.xml │ │ │ ├── pentagonal_orthobirotunda.xml │ │ │ ├── pentagonal_orthocupolarontunda.xml │ │ │ ├── pentagonal_prism.xml │ │ │ ├── pentagonal_pyramid.xml │ │ │ ├── pentagonal_rotunda.xml │ │ │ ├── pentakis_dodecahedron.xml │ │ │ ├── polyhedra.txt │ │ │ ├── rhombic_dodecahedron.xml │ │ │ ├── rhombic_triacontahedron.xml │ │ │ ├── small_ditrigonal_icosidodecahedron.xml │ │ │ ├── small_stellated_dodecahedron.xml │ │ │ ├── snub_disphenoid.xml │ │ │ ├── snub_square_antiprism.xml │ │ │ ├── sphenocorona.xml │ │ │ ├── sphenomegacorona.xml │ │ │ ├── square_antiprism.xml │ │ │ ├── square_cupola.xml │ │ │ ├── square_gyrobicupola.xml │ │ │ ├── square_orthobicupola.xml │ │ │ ├── square_pyramid.xml │ │ │ ├── tetrahedron.xml │ │ │ ├── tetrahemihexahedron.xml │ │ │ ├── tetrakis_hexahedron.xml │ │ │ ├── trapezoidal_hexecontahedron.xml │ │ │ ├── trapezoidal_icositetrahedron.xml │ │ │ ├── triakis_icosahedron.xml │ │ │ ├── triakis_octahedron.xml │ │ │ ├── triangular_cupola.xml │ │ │ ├── triangular_dipyramid.xml │ │ │ ├── triangular_hebesphenorotunda.xml │ │ │ ├── triangular_orthobicupola.xml │ │ │ ├── triangular_prism.xml │ │ │ ├── triaugmented_dodecahedron.xml │ │ │ ├── triaugmented_hexagonal_prism.xml │ │ │ ├── triaugmented_triangular_prism.xml │ │ │ ├── triaugmented_truncated_dodecahedron.xml │ │ │ ├── tridiminished_icosahedron.xml │ │ │ ├── tridiminished_rhombicosidodecahedron.xml │ │ │ ├── trigyrate_rhombicosidodecahedron.xml │ │ │ └── vacuum.py │ │ ├── module.cpp │ │ └── uniform_polyhedron.cpp │ ├── virtual_offscreen/ │ │ ├── CMakeLists.txt │ │ ├── camera_to_bitmap.cpp │ │ └── module.cpp │ ├── virtual_opengl_painters/ │ │ ├── CMakeLists.txt │ │ ├── edge_painter.cpp │ │ ├── face_painter.cpp │ │ ├── module.cpp │ │ ├── point_painter.cpp │ │ ├── sds_edge_painter.cpp │ │ ├── sds_face_painter.cpp │ │ └── sds_point_painter.cpp │ ├── wgl/ │ │ ├── CMakeLists.txt │ │ ├── camera_to_bitmap.cpp │ │ └── module.cpp │ ├── windows/ │ │ ├── CMakeLists.txt │ │ ├── disable_desktop_composition.cpp │ │ ├── module.cpp │ │ └── uri_handler.cpp │ ├── xtrackcad/ │ │ ├── CMakeLists.txt │ │ ├── document_importer.cpp │ │ └── module.cpp │ └── yafray/ │ ├── CMakeLists.txt │ ├── area_light.cpp │ ├── global_photon_light.cpp │ ├── hemi_light.cpp │ ├── lights.h │ ├── material.cpp │ ├── module.cpp │ ├── photon_light.cpp │ ├── point_light.cpp │ ├── render_engine.cpp │ ├── soft_light.cpp │ ├── spot_light.cpp │ └── sun_light.cpp ├── po/ │ ├── CMakeLists.txt │ └── chef.po ├── renderframe/ │ ├── CMakeLists.txt │ └── main.cpp ├── renderjob/ │ ├── CMakeLists.txt │ └── main.cpp ├── resource-compiler/ │ ├── CMakeLists.txt │ └── main.cpp ├── share/ │ ├── CMakeLists.txt │ ├── k3d/ │ │ ├── CMakeLists.txt │ │ ├── aspect_ratios.k3d │ │ ├── documents/ │ │ │ ├── CMakeLists.txt │ │ │ ├── animation/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── arc_length.k3d │ │ │ │ ├── digital_clock.k3d │ │ │ │ └── euler_angles.k3d │ │ │ ├── index.k3d │ │ │ └── logo.k3d │ │ ├── fonts/ │ │ │ └── CMakeLists.txt │ │ ├── geometry/ │ │ │ ├── CMakeLists.txt │ │ │ └── knot.obj │ │ ├── guide/ │ │ │ ├── CMakeLists.txt │ │ │ ├── content/ │ │ │ │ ├── building_plugins.txt │ │ │ │ ├── debugging.txt │ │ │ │ ├── guide-docinfo.xml.in │ │ │ │ ├── guide.txt.in │ │ │ │ ├── importing_exporting.txt │ │ │ │ ├── logging.txt │ │ │ │ ├── luxrender.txt │ │ │ │ ├── on_demand_modules.txt │ │ │ │ ├── pipeline.txt │ │ │ │ ├── pipeline_hints.txt │ │ │ │ ├── plugin_design.txt │ │ │ │ ├── plugins.py.in │ │ │ │ ├── render_models.txt │ │ │ │ ├── resources.txt │ │ │ │ ├── scripting.txt │ │ │ │ ├── time.txt │ │ │ │ └── wiki2asciidoc.py │ │ │ └── qt/ │ │ │ ├── about.txt.in │ │ │ ├── guide.qhcp.in │ │ │ └── guide.qhp.in │ │ ├── icons/ │ │ │ ├── CMakeLists.txt │ │ │ └── k3d.icns │ │ ├── logo/ │ │ │ └── CMakeLists.txt │ │ ├── lsystem/ │ │ │ ├── CMakeLists.txt │ │ │ ├── abop-2d-form.ls │ │ │ ├── abop-block-form.ls │ │ │ ├── abop-bush.ls │ │ │ ├── abop-compound-leave-3d.ls │ │ │ ├── abop-compound-leave.ls │ │ │ ├── abop-cordate-leave.ls │ │ │ ├── abop-dragon-curves.ls │ │ │ ├── abop-fractal.ls │ │ │ ├── abop-lychnis-structure.ls │ │ │ ├── abop-maple-like-leave.ls │ │ │ ├── abop-monopodial-tree.ls │ │ │ ├── abop-monopodial-tree2.ls │ │ │ ├── abop-nested-polygon-leaves.ls │ │ │ ├── abop-plant.ls │ │ │ ├── abop-ternary-tree.ls │ │ │ ├── airhorse.ls │ │ │ ├── axis.ls │ │ │ ├── best-tree.ls │ │ │ ├── cees-3dartist.ls │ │ │ ├── cees-crystal-with-leaves.ls │ │ │ ├── cees-crystal-with-leaves2.ls │ │ │ ├── cees-crystal.ls │ │ │ ├── cees-crystals.ls │ │ │ ├── cees-koch.ls │ │ │ ├── cees-koch2.ls │ │ │ ├── cees-pascal-cube.ls │ │ │ ├── cees-pascal-cube2.ls │ │ │ ├── cees-passion-flower.ls │ │ │ ├── cees-plant-kwal.ls │ │ │ ├── cees-plant.ls │ │ │ ├── cees-plant2.ls │ │ │ ├── cees-sierpinski-gasket.ls │ │ │ ├── cees-sierpinski-gasket2.ls │ │ │ ├── cello-plant.ls │ │ │ ├── circle-form.ls │ │ │ ├── conifer-type-tree.ls │ │ │ ├── conifer-type-tree2.ls │ │ │ ├── cordate-leave-arrangement.ls │ │ │ ├── cordate-leaves.ls │ │ │ ├── dasysiphonia-rigidula.ls │ │ │ ├── daysa-rigidula.ls │ │ │ ├── fern-plant.ls │ │ │ ├── flower.ls │ │ │ ├── fractint.ls │ │ │ ├── fractint2.ls │ │ │ ├── fractint3.ls │ │ │ ├── fractint4.ls │ │ │ ├── half-cycle.ls │ │ │ ├── half-cycle2.ls │ │ │ ├── higgs-butterfly.ls │ │ │ ├── higgs-copepoda-crustacean-mutated.ls │ │ │ ├── higgs-copepoda-crustacean.ls │ │ │ ├── higgs-lobster.ls │ │ │ ├── higgs-sierpinski-variants.ls │ │ │ ├── large-spiral-plant.ls │ │ │ ├── large-spiral-plant2.ls │ │ │ ├── leavy-ternary-tree-type.ls │ │ │ ├── lobster-form.ls │ │ │ ├── lobster-form2.ls │ │ │ ├── lobster-form3.ls │ │ │ ├── lobster-form4.ls │ │ │ ├── lobster-form5.ls │ │ │ ├── menger-cube.ls │ │ │ ├── octo-spider.ls │ │ │ ├── palm-tree.ls │ │ │ ├── shell.ls │ │ │ ├── shell2.ls │ │ │ ├── shell3.ls │ │ │ ├── shell4.ls │ │ │ ├── spiral-bush.ls │ │ │ ├── spiral-design.ls │ │ │ ├── spiral-form.ls │ │ │ ├── spiral-tree.ls │ │ │ ├── spiral-types.ls │ │ │ ├── tree-base.ls │ │ │ ├── tree.ls │ │ │ ├── tree2.ls │ │ │ ├── tree3.ls │ │ │ ├── trees.ls │ │ │ ├── trees2.ls │ │ │ ├── trees3.ls │ │ │ ├── tropism-experimental-tree.ls │ │ │ ├── tropism.ls │ │ │ └── willow-tree.ls │ │ ├── ngui/ │ │ │ ├── CMakeLists.txt │ │ │ ├── pixmap/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── about.xpm │ │ │ │ ├── automagic-off.xpm │ │ │ │ ├── automagic-on.xpm │ │ │ │ ├── fast_forward.xpm │ │ │ │ ├── mat_edit_shader_icon.xpm │ │ │ │ ├── mat_preview_bg_icon.xpm │ │ │ │ ├── mat_preview_date_icon.xpm │ │ │ │ ├── pinned.xpm │ │ │ │ ├── play.xpm │ │ │ │ ├── play_from_cursor.xpm │ │ │ │ ├── play_loop.xpm │ │ │ │ ├── record.xpm │ │ │ │ ├── render_animation.xpm │ │ │ │ ├── render_frame.xpm │ │ │ │ ├── render_preview.xpm │ │ │ │ ├── reverse_play.xpm │ │ │ │ ├── reverse_play_loop.xpm │ │ │ │ ├── rewind.xpm │ │ │ │ ├── splash.xpm │ │ │ │ ├── stop.xpm │ │ │ │ └── unpinned.xpm │ │ │ ├── rasterized/ │ │ │ │ └── CMakeLists.txt │ │ │ ├── scalable/ │ │ │ │ └── CMakeLists.txt │ │ │ ├── tool_layout.k3d │ │ │ └── toolbar_layout.k3d │ │ ├── qtui/ │ │ │ ├── CMakeLists.txt │ │ │ ├── icons/ │ │ │ │ └── CMakeLists.txt │ │ │ ├── scripted_modes/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── browser.js │ │ │ │ ├── console.js │ │ │ │ ├── create_node.js │ │ │ │ ├── hello_world.js │ │ │ │ ├── null.js │ │ │ │ ├── sound_effects.js │ │ │ │ └── state_machine.js │ │ │ └── sounds/ │ │ │ └── CMakeLists.txt │ │ ├── resolutions.k3d │ │ ├── scripts/ │ │ │ ├── CMakeLists.txt │ │ │ ├── MeshModifierScript/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── random_face_varying_colors.py │ │ │ │ ├── random_per_face_colors.py │ │ │ │ ├── random_per_vertex_colors.py │ │ │ │ └── snow_animation.py │ │ │ ├── MeshSourceScript/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── bezier_triangle_patches.py │ │ │ │ ├── bicubic_patches.py │ │ │ │ ├── bilinear_patches.py │ │ │ │ ├── blobby.py │ │ │ │ ├── cones.py │ │ │ │ ├── cubes.py │ │ │ │ ├── cubic_curves.py │ │ │ │ ├── cylinders.py │ │ │ │ ├── disks.py │ │ │ │ ├── hyperboloids.py │ │ │ │ ├── linear_curves.py │ │ │ │ ├── nurbs_curves.py │ │ │ │ ├── nurbs_patches.py │ │ │ │ ├── paraboloids.py │ │ │ │ ├── particles.py │ │ │ │ ├── polyhedra.py │ │ │ │ ├── simple_polyhedron.py │ │ │ │ ├── snow_source.py │ │ │ │ ├── spheres.py │ │ │ │ ├── teapots.py │ │ │ │ └── tori.py │ │ │ ├── OpenGLPainterScript/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── blue_particles.py │ │ │ ├── OpenGLRenderableScript/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── gradient_background.py │ │ │ ├── RenderManScript/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── tribble.py │ │ │ ├── animation/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── keyframes.py │ │ │ ├── count_plugins.py │ │ │ ├── create_bicubic_patch.py │ │ │ ├── create_bilinear_patch.py │ │ │ ├── create_blobby.py │ │ │ ├── create_cubic_curve.py │ │ │ ├── create_linear_curve.py │ │ │ ├── create_particles.py │ │ │ ├── create_polyhedron.py │ │ │ ├── create_polyhedron_simple.py │ │ │ ├── describe_plugins.py │ │ │ ├── hello_world.py │ │ │ ├── innovation.py │ │ │ ├── log_messages.py │ │ │ ├── print_selected_objects.py │ │ │ ├── pygtk_hello_world.py │ │ │ ├── pygtk_plot_function.py │ │ │ ├── script_context.py │ │ │ ├── script_recursion.py │ │ │ ├── script_recursion_context.py │ │ │ ├── scripted_plugins/ │ │ │ │ └── CMakeLists.txt │ │ │ ├── shell/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── batch_render.k3d │ │ │ │ ├── batch_render.py │ │ │ │ └── simple_rpc.py │ │ │ ├── undo_redo_errors.py │ │ │ ├── user_interface.py │ │ │ └── user_properties.py │ │ ├── shaders/ │ │ │ ├── CMakeLists.txt │ │ │ ├── displacement/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── k3d_brickbump.sl │ │ │ │ ├── k3d_brickbump.sl.slmeta │ │ │ │ ├── k3d_bubbles.sl │ │ │ │ ├── k3d_bubbles.sl.slmeta │ │ │ │ ├── k3d_bubbly.sl │ │ │ │ ├── k3d_bubbly.sl.slmeta │ │ │ │ ├── k3d_castucco.sl │ │ │ │ ├── k3d_castucco.sl.slmeta │ │ │ │ ├── k3d_dented.sl │ │ │ │ ├── k3d_dented.sl.slmeta │ │ │ │ ├── k3d_displacementmap.sl │ │ │ │ ├── k3d_displacementmap.sl.slmeta │ │ │ │ ├── k3d_droop.sl │ │ │ │ ├── k3d_droop.sl.slmeta │ │ │ │ ├── k3d_dturb.sl │ │ │ │ ├── k3d_fractal.sl │ │ │ │ ├── k3d_fractal.sl.slmeta │ │ │ │ ├── k3d_gloop.sl │ │ │ │ ├── k3d_gloop.sl.slmeta │ │ │ │ ├── k3d_ridged_multifractal.sl │ │ │ │ ├── k3d_ridged_multifractal.sl.slmeta │ │ │ │ ├── k3d_round.sl │ │ │ │ ├── k3d_round.sl.slmeta │ │ │ │ ├── k3d_slateroofd.sl │ │ │ │ ├── k3d_slateroofd.sl.slmeta │ │ │ │ ├── k3d_square_ridges.sl │ │ │ │ ├── k3d_square_ridges.sl.slmeta │ │ │ │ ├── k3d_stucco.sl │ │ │ │ ├── k3d_stucco.sl.slmeta │ │ │ │ ├── k3d_terranbump.sl │ │ │ │ ├── k3d_terranbump.sl.slmeta │ │ │ │ ├── k3d_threads.sl │ │ │ │ ├── k3d_threads.sl.slmeta │ │ │ │ ├── k3d_windywave.sl │ │ │ │ └── k3d_windywave.sl.slmeta │ │ │ ├── glsl/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── gooch_fragment.glsl │ │ │ │ ├── gooch_vertex.glsl │ │ │ │ ├── show_normals_fragment.glsl │ │ │ │ └── show_normals_vertex.glsl │ │ │ ├── imager/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── k3d_background.sl │ │ │ │ ├── k3d_background.sl.slmeta │ │ │ │ ├── k3d_bluescreen.sl │ │ │ │ ├── k3d_bluescreen.sl.slmeta │ │ │ │ ├── k3d_clamptoalpha.sl │ │ │ │ └── k3d_clamptoalpha.sl.slmeta │ │ │ ├── k3d_colors.h │ │ │ ├── k3d_constants.h │ │ │ ├── k3d_displace.h │ │ │ ├── k3d_filterwidth.h │ │ │ ├── k3d_functions.h │ │ │ ├── k3d_isshad.h │ │ │ ├── k3d_km.h │ │ │ ├── k3d_locillum.h │ │ │ ├── k3d_material.h │ │ │ ├── k3d_noises.h │ │ │ ├── k3d_oak.h │ │ │ ├── k3d_patterns.h │ │ │ ├── k3d_proctext.h │ │ │ ├── k3d_project.h │ │ │ ├── k3d_pshad.h │ │ │ ├── k3d_rayserver.h │ │ │ ├── k3d_raysphere.h │ │ │ ├── k3d_reflections.h │ │ │ ├── k3d_rmannotes.h │ │ │ ├── k3d_tile.h │ │ │ ├── light/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── k3d_ambientlight.sl │ │ │ │ ├── k3d_ambientlight.sl.slmeta │ │ │ │ ├── k3d_distant_shadow.sl │ │ │ │ ├── k3d_distant_shadow.sl.slmeta │ │ │ │ ├── k3d_distantlight.sl │ │ │ │ ├── k3d_distantlight.sl.slmeta │ │ │ │ ├── k3d_pointlight.sl │ │ │ │ ├── k3d_pointlight.sl.slmeta │ │ │ │ ├── k3d_spotlight.sl │ │ │ │ ├── k3d_spotlight.sl.slmeta │ │ │ │ ├── k3d_waterlight.sl │ │ │ │ └── k3d_waterlight.sl.slmeta │ │ │ ├── surface/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── k3d_bluemarble.sl │ │ │ │ ├── k3d_bluemarble.sl.slmeta │ │ │ │ ├── k3d_brick.sl │ │ │ │ ├── k3d_brick.sl.slmeta │ │ │ │ ├── k3d_brushedmetal.sl │ │ │ │ ├── k3d_brushedmetal.sl.slmeta │ │ │ │ ├── k3d_ceramic.sl │ │ │ │ ├── k3d_ceramic.sl.slmeta │ │ │ │ ├── k3d_checks.sl │ │ │ │ ├── k3d_checks.sl.slmeta │ │ │ │ ├── k3d_constant.sl │ │ │ │ ├── k3d_constant.sl.slmeta │ │ │ │ ├── k3d_corktile.sl │ │ │ │ ├── k3d_corktile.sl.slmeta │ │ │ │ ├── k3d_craters.sl │ │ │ │ ├── k3d_craters.sl.slmeta │ │ │ │ ├── k3d_crayon.sl │ │ │ │ ├── k3d_crayon.sl.slmeta │ │ │ │ ├── k3d_crayontoon.sl │ │ │ │ ├── k3d_crayontoon.sl.slmeta │ │ │ │ ├── k3d_dots.sl │ │ │ │ ├── k3d_dots.sl.slmeta │ │ │ │ ├── k3d_easysurface.sl │ │ │ │ ├── k3d_easysurface.sl.slmeta │ │ │ │ ├── k3d_environment_plastic.sl │ │ │ │ ├── k3d_environment_plastic.sl.slmeta │ │ │ │ ├── k3d_envsurf.sl │ │ │ │ ├── k3d_envsurf.sl.slmeta │ │ │ │ ├── k3d_eyeball.sl │ │ │ │ ├── k3d_eyeball.sl.slmeta │ │ │ │ ├── k3d_filament.sl │ │ │ │ ├── k3d_filament.sl.slmeta │ │ │ │ ├── k3d_fire.sl │ │ │ │ ├── k3d_fire.sl.slmeta │ │ │ │ ├── k3d_fresnelplastic.sl │ │ │ │ ├── k3d_fresnelplastic.sl.slmeta │ │ │ │ ├── k3d_funkyglass.sl │ │ │ │ ├── k3d_funkyglass.sl.slmeta │ │ │ │ ├── k3d_fur2.sl │ │ │ │ ├── k3d_fur2.sl.slmeta │ │ │ │ ├── k3d_glow.sl │ │ │ │ ├── k3d_glow.sl.slmeta │ │ │ │ ├── k3d_gooch.sl │ │ │ │ ├── k3d_gooch.sl.slmeta │ │ │ │ ├── k3d_gradient_t.sl │ │ │ │ ├── k3d_gradient_t.sl.slmeta │ │ │ │ ├── k3d_granite.sl │ │ │ │ ├── k3d_granite.sl.slmeta │ │ │ │ ├── k3d_greenmarble.sl │ │ │ │ ├── k3d_greenmarble.sl.slmeta │ │ │ │ ├── k3d_hair.sl │ │ │ │ ├── k3d_hair.sl.slmeta │ │ │ │ ├── k3d_hextile.sl │ │ │ │ ├── k3d_hextile.sl.slmeta │ │ │ │ ├── k3d_incandplastic.sl │ │ │ │ ├── k3d_incandplastic.sl.slmeta │ │ │ │ ├── k3d_luna.sl │ │ │ │ ├── k3d_luna.sl.slmeta │ │ │ │ ├── k3d_lunette.sl │ │ │ │ ├── k3d_lunette.sl.slmeta │ │ │ │ ├── k3d_matte.sl │ │ │ │ ├── k3d_matte.sl.slmeta │ │ │ │ ├── k3d_metal.sl │ │ │ │ ├── k3d_metal.sl.slmeta │ │ │ │ ├── k3d_mondometal.sl │ │ │ │ ├── k3d_mondometal.sl.slmeta │ │ │ │ ├── k3d_mottled_clay.sl │ │ │ │ ├── k3d_mottled_clay.sl.slmeta │ │ │ │ ├── k3d_oak.sl │ │ │ │ ├── k3d_oak.sl.slmeta │ │ │ │ ├── k3d_oakplank.sl │ │ │ │ ├── k3d_oakplank.sl.slmeta │ │ │ │ ├── k3d_orennayar.sl │ │ │ │ ├── k3d_orennayar.sl.slmeta │ │ │ │ ├── k3d_paintedplastic.sl │ │ │ │ ├── k3d_paintedplastic.sl.slmeta │ │ │ │ ├── k3d_parquet_plank.sl │ │ │ │ ├── k3d_parquet_plank.sl.slmeta │ │ │ │ ├── k3d_particle.sl │ │ │ │ ├── k3d_particle.sl.slmeta │ │ │ │ ├── k3d_planetclouds.sl │ │ │ │ ├── k3d_planetclouds.sl.slmeta │ │ │ │ ├── k3d_plastic.sl │ │ │ │ ├── k3d_plastic.sl.slmeta │ │ │ │ ├── k3d_puffyclouds.sl │ │ │ │ ├── k3d_puffyclouds.sl.slmeta │ │ │ │ ├── k3d_redapple.sl │ │ │ │ ├── k3d_redapple.sl.slmeta │ │ │ │ ├── k3d_roughmetal.sl │ │ │ │ ├── k3d_roughmetal.sl.slmeta │ │ │ │ ├── k3d_rubber.sl │ │ │ │ ├── k3d_rubber.sl.slmeta │ │ │ │ ├── k3d_saturn.sl │ │ │ │ ├── k3d_saturn.sl.slmeta │ │ │ │ ├── k3d_screen.sl │ │ │ │ ├── k3d_screen.sl.slmeta │ │ │ │ ├── k3d_shiny.sl │ │ │ │ ├── k3d_shiny.sl.slmeta │ │ │ │ ├── k3d_shinymetal.sl │ │ │ │ ├── k3d_shinymetal.sl.slmeta │ │ │ │ ├── k3d_show_st.sl │ │ │ │ ├── k3d_show_st.sl.slmeta │ │ │ │ ├── k3d_slateroof.sl │ │ │ │ ├── k3d_slateroof.sl.slmeta │ │ │ │ ├── k3d_star.sl │ │ │ │ ├── k3d_star.sl.slmeta │ │ │ │ ├── k3d_strata.sl │ │ │ │ ├── k3d_strata.sl.slmeta │ │ │ │ ├── k3d_superplank.sl │ │ │ │ ├── k3d_superplank.sl.slmeta │ │ │ │ ├── k3d_supertoon.sl │ │ │ │ ├── k3d_supertoon.sl.slmeta │ │ │ │ ├── k3d_terran.sl │ │ │ │ ├── k3d_terran.sl.slmeta │ │ │ │ ├── k3d_tooledsteel.sl │ │ │ │ ├── k3d_tooledsteel.sl.slmeta │ │ │ │ ├── k3d_urbermap.sl │ │ │ │ ├── k3d_urbermap.sl.slmeta │ │ │ │ ├── k3d_veinedmarble.sl │ │ │ │ ├── k3d_veinedmarble.sl.slmeta │ │ │ │ ├── k3d_velvet.sl │ │ │ │ ├── k3d_velvet.sl.slmeta │ │ │ │ ├── k3d_venus.sl │ │ │ │ ├── k3d_venus.sl.slmeta │ │ │ │ ├── k3d_warningstripes.sl │ │ │ │ ├── k3d_warningstripes.sl.slmeta │ │ │ │ ├── k3d_wood2.sl │ │ │ │ ├── k3d_wood2.sl.slmeta │ │ │ │ ├── k3d_woodcut.sl │ │ │ │ └── k3d_woodcut.sl.slmeta │ │ │ └── volume/ │ │ │ ├── CMakeLists.txt │ │ │ ├── k3d_altitude_fog.sl │ │ │ ├── k3d_altitude_fog.sl.slmeta │ │ │ ├── k3d_depthcue.sl │ │ │ ├── k3d_depthcue.sl.slmeta │ │ │ ├── k3d_fog.sl │ │ │ └── k3d_fog.sl.slmeta │ │ └── textures/ │ │ └── CMakeLists.txt │ └── man/ │ ├── CMakeLists.txt │ ├── k3d-renderframe.1.txt.in │ ├── k3d-renderjob.1.txt.in │ ├── k3d-sl2xml.1.txt.in │ ├── k3d-uuidgen.1.txt.in │ └── k3d.1.txt.in ├── sl2xml/ │ ├── CMakeLists.txt │ └── main.cpp ├── tests/ │ ├── CMakeLists.txt │ ├── animation/ │ │ ├── AnimationTrack.py │ │ └── CMakeLists.txt │ ├── benchmarking.py │ ├── bitmap/ │ │ ├── CMakeLists.txt │ │ ├── bitmap.modifier.BenchmarkComparison.py │ │ ├── bitmap.modifier.BitmapAdd.py │ │ ├── bitmap.modifier.BitmapColorMonochrome.py │ │ ├── bitmap.modifier.BitmapGamma.py │ │ ├── bitmap.modifier.BitmapInvert.py │ │ ├── bitmap.modifier.BitmapMatteColorDiff.py │ │ ├── bitmap.modifier.BitmapMatteInvert.py │ │ ├── bitmap.modifier.BitmapMultiply.py │ │ ├── bitmap.modifier.BitmapSubtract.py │ │ ├── bitmap.modifier.BitmapThreshold.py │ │ ├── bitmap.modifier.CUDABitmapAdd.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapAdd.py │ │ ├── bitmap.modifier.CUDABitmapColorMonochrome.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapColorMonochrome.py │ │ ├── bitmap.modifier.CUDABitmapGamma.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapGamma.py │ │ ├── bitmap.modifier.CUDABitmapInvert.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapInvert.py │ │ ├── bitmap.modifier.CUDABitmapMatteColorDiff.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapMatteColorDiff.py │ │ ├── bitmap.modifier.CUDABitmapMatteInvert.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapMatteInvert.py │ │ ├── bitmap.modifier.CUDABitmapMultiply.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapMultiply.py │ │ ├── bitmap.modifier.CUDABitmapSubtract.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapSubtract.py │ │ ├── bitmap.modifier.CUDABitmapThreshold.benchmark.py │ │ ├── bitmap.modifier.CUDABitmapThreshold.py │ │ ├── bitmap.source.BitmapChecker.py │ │ ├── bitmap.source.BitmapReader.bmp.py │ │ ├── bitmap.source.BitmapReader.jpeg.py │ │ ├── bitmap.source.BitmapReader.png.py │ │ ├── bitmap.source.BitmapReader.sun.py │ │ ├── bitmap.source.BitmapReader.tiff.py │ │ ├── bitmap.source.BitmapSolid.py │ │ ├── bitmap.source.BitmapSourceScript.py │ │ ├── bitmap.source.JPEGBitmapReader.py │ │ ├── bitmap.source.PNGBitmapReader.py │ │ └── bitmap.source.TIFFBitmapReader.py │ ├── bitmaps/ │ │ ├── test_rgb_8.sun │ │ └── test_rgb_8.tif │ ├── code/ │ │ ├── CMakeLists.txt │ │ ├── const_cast.cmake │ │ ├── debug_logging.cmake │ │ ├── exit.cmake │ │ ├── filename_case.cmake │ │ ├── filename_length.cmake │ │ ├── header_guard.cmake │ │ ├── legacy.cmake │ │ ├── line_endings.cmake │ │ ├── pretty_function.cmake │ │ ├── printf.cmake │ │ ├── quoted_includes.cmake │ │ └── typed_array_uint_t.cmake │ ├── color/ │ │ ├── CMakeLists.txt │ │ └── source.ColorSourceScript.py │ ├── double/ │ │ ├── CMakeLists.txt │ │ ├── source.DoubleExpression.py │ │ ├── source.DoubleSourceScript.py │ │ └── source.PapagayoLipsyncReader.py │ ├── int32/ │ │ ├── CMakeLists.txt │ │ └── source.Int32SourceScript.py │ ├── matrix/ │ │ ├── CMakeLists.txt │ │ ├── modifier.FrozenMatrix.py │ │ └── modifier.MatrixInverse.py │ ├── mesh/ │ │ ├── CMakeLists.txt │ │ ├── mesh.diff.py │ │ ├── mesh.metrics.GTSMeshArea.PolyCube.py │ │ ├── mesh.metrics.GTSMeshArea.self_intersection.py │ │ ├── mesh.metrics.GTSMeshVolume.PolyCube.py │ │ ├── mesh.modifier.BenchmarkComparison.py │ │ ├── mesh.modifier.BendPoints.py │ │ ├── mesh.modifier.BevelFaces.py │ │ ├── mesh.modifier.BevelPoints.boundary.py │ │ ├── mesh.modifier.BevelPoints.py │ │ ├── mesh.modifier.BlobbyAdd.py │ │ ├── mesh.modifier.BlobbyDivide.py │ │ ├── mesh.modifier.BlobbyMaximum.py │ │ ├── mesh.modifier.BlobbyMinimum.py │ │ ├── mesh.modifier.BlobbyMultiply.py │ │ ├── mesh.modifier.BlobbyNegate.py │ │ ├── mesh.modifier.BlobbySubtract.py │ │ ├── mesh.modifier.BridgeEdges.py │ │ ├── mesh.modifier.BridgeFaces.py │ │ ├── mesh.modifier.BulgePoints.py │ │ ├── mesh.modifier.CARVEBoolean.benchmark.py │ │ ├── mesh.modifier.CARVEBoolean.cubes.py │ │ ├── mesh.modifier.CARVEBoolean.cylinders.py │ │ ├── mesh.modifier.CARVEBoolean.ply.py │ │ ├── mesh.modifier.CGALBoolean.benchmark.py │ │ ├── mesh.modifier.CGALBoolean.cubes.py │ │ ├── mesh.modifier.CGALBoolean.cylinders.py │ │ ├── mesh.modifier.CUDA.Breakdown.py │ │ ├── mesh.modifier.CUDAConversion.py │ │ ├── mesh.modifier.CUDASubdivideEdges.benchmark.py │ │ ├── mesh.modifier.CUDASubdivideEdges.py │ │ ├── mesh.modifier.CUDASubdivideEdgesSimple.py │ │ ├── mesh.modifier.CUDATransformPoints.benchmark.py │ │ ├── mesh.modifier.CUDATransformPoints.py │ │ ├── mesh.modifier.CUDATransformPointsAsynchronous.benchmark.py │ │ ├── mesh.modifier.CUDATransformPointsAsynchronous.py │ │ ├── mesh.modifier.CalculateNormals.2.py │ │ ├── mesh.modifier.CalculateNormals.py │ │ ├── mesh.modifier.CapHoles.py │ │ ├── mesh.modifier.CatmullClark.benchmark.py │ │ ├── mesh.modifier.CatmullClark.complex.py │ │ ├── mesh.modifier.CatmullClark.cube.py │ │ ├── mesh.modifier.CatmullClark.py │ │ ├── mesh.modifier.CenterPoints.py │ │ ├── mesh.modifier.CollapseEdges.py │ │ ├── mesh.modifier.CollapseFaces.py │ │ ├── mesh.modifier.CollapsePoints.py │ │ ├── mesh.modifier.ConnectVertices.py │ │ ├── mesh.modifier.CylindricalWavePoints.py │ │ ├── mesh.modifier.DeformationExpression.py │ │ ├── mesh.modifier.EdgesToBlobby.py │ │ ├── mesh.modifier.EulerKillEdgeAndVertex.py │ │ ├── mesh.modifier.EulerKillEdgeMakeLoop.py │ │ ├── mesh.modifier.ExtrudeFaces.py │ │ ├── mesh.modifier.LeastSquaresPlot.py │ │ ├── mesh.modifier.LinearPointNoise.py │ │ ├── mesh.modifier.LinearWavePoints.py │ │ ├── mesh.modifier.MakeHole.py │ │ ├── mesh.modifier.MergeCollinearEdges.py │ │ ├── mesh.modifier.MergeCoplanarFaces.py │ │ ├── mesh.modifier.MergeMesh.generic.py │ │ ├── mesh.modifier.MergeMesh.py │ │ ├── mesh.modifier.MergePolyhedra.py │ │ ├── mesh.modifier.MeshArray1D.py │ │ ├── mesh.modifier.MeshArray2D.py │ │ ├── mesh.modifier.MeshArray3D.py │ │ ├── mesh.modifier.MorphPoints.py │ │ ├── mesh.modifier.MoveFirstEdge.py │ │ ├── mesh.modifier.NurbsAddTrimCurve.py │ │ ├── mesh.modifier.NurbsCloseCurve1.py │ │ ├── mesh.modifier.NurbsCloseCurve2.py │ │ ├── mesh.modifier.NurbsConnectCurves.py │ │ ├── mesh.modifier.NurbsCreateCap.py │ │ ├── mesh.modifier.NurbsCurveInsertKnot.py │ │ ├── mesh.modifier.NurbsCurveTraversal.py │ │ ├── mesh.modifier.NurbsDegreeElevateCurve.py │ │ ├── mesh.modifier.NurbsEditKnotVector1.py │ │ ├── mesh.modifier.NurbsExtractCurvePoint.py │ │ ├── mesh.modifier.NurbsExtractPatchCurve.py │ │ ├── mesh.modifier.NurbsExtractTrimCurves.py │ │ ├── mesh.modifier.NurbsExtrudeCurve.py │ │ ├── mesh.modifier.NurbsExtrudePatch.py │ │ ├── mesh.modifier.NurbsFlipCurve.py │ │ ├── mesh.modifier.NurbsMergeConnectedCurves.py │ │ ├── mesh.modifier.NurbsMergeCurveKnotVectors.py │ │ ├── mesh.modifier.NurbsPatchDegreeElevation.py │ │ ├── mesh.modifier.NurbsPatchInsertKnot.py │ │ ├── mesh.modifier.NurbsPolygonizeCurve.py │ │ ├── mesh.modifier.NurbsPolygonizePatch.py │ │ ├── mesh.modifier.NurbsRevolveCurve.py │ │ ├── mesh.modifier.NurbsRuledSurface.py │ │ ├── mesh.modifier.NurbsSetWeight1.py │ │ ├── mesh.modifier.NurbsSetWeight2.py │ │ ├── mesh.modifier.NurbsSkinnedSurface.py │ │ ├── mesh.modifier.NurbsSplitCurve.py │ │ ├── mesh.modifier.NurbsSplitPatch.py │ │ ├── mesh.modifier.NurbsSplitPatch2.py │ │ ├── mesh.modifier.NurbsSweepSurface.py │ │ ├── mesh.modifier.PGPRemesh.bun_zipper_res4.py │ │ ├── mesh.modifier.PGPRemesh.high.py │ │ ├── mesh.modifier.PGPRemesh.ply.bunny.py │ │ ├── mesh.modifier.PGPRemesh.ply.torus.py │ │ ├── mesh.modifier.PGPRemesh.py │ │ ├── mesh.modifier.PGPRemesh.triang.py │ │ ├── mesh.modifier.PointsToBlobby.py │ │ ├── mesh.modifier.QSlim.py │ │ ├── mesh.modifier.RotatePoints.py │ │ ├── mesh.modifier.SDSCorner.py │ │ ├── mesh.modifier.SDSCrease.py │ │ ├── mesh.modifier.SDSHole.py │ │ ├── mesh.modifier.ScalePoints.py │ │ ├── mesh.modifier.SelectConnectedComponents.py │ │ ├── mesh.modifier.SelectCube.py │ │ ├── mesh.modifier.SelectNSided.py │ │ ├── mesh.modifier.SelectedFacesToPolyhedron.py │ │ ├── mesh.modifier.SetColor.py │ │ ├── mesh.modifier.SetPosition.py │ │ ├── mesh.modifier.ShearPoints.py │ │ ├── mesh.modifier.SmoothPoints.py │ │ ├── mesh.modifier.SphereizePoints.py │ │ ├── mesh.modifier.SubdivideEdges.benchmark.py │ │ ├── mesh.modifier.SubdivideEdges.py │ │ ├── mesh.modifier.SubdivideFaces.Center.py │ │ ├── mesh.modifier.SubdivideFaces.CenterMidpoints.py │ │ ├── mesh.modifier.SubdivideFaces.Midpoints.py │ │ ├── mesh.modifier.TaperPoints.py │ │ ├── mesh.modifier.TransformPoints.benchmark.py │ │ ├── mesh.modifier.TransformPoints.py │ │ ├── mesh.modifier.TranslatePoints.py │ │ ├── mesh.modifier.TriangulateFaces.PolyCube.py │ │ ├── mesh.modifier.TriangulateFaces.PolyGrid.py │ │ ├── mesh.modifier.TriangulateFaces.PolyGrid.selection.py │ │ ├── mesh.modifier.TriangulateFaces.self_intersection.py │ │ ├── mesh.modifier.TriangulateFaces.vertex.py │ │ ├── mesh.modifier.TwistPoints.py │ │ ├── mesh.selection.GrowSelection.py │ │ ├── mesh.selection.SelectBoundaryEdges.py │ │ ├── mesh.selection.SelectDegenerateFaces.py │ │ ├── mesh.selection.all.py │ │ ├── mesh.selection.none.py │ │ ├── mesh.selection.null.py │ │ ├── mesh.selection.points.py │ │ ├── mesh.serialization.py │ │ ├── mesh.sink.GmshGeoMeshWriter.py │ │ ├── mesh.sink.IGESMeshWriter.py │ │ ├── mesh.sink.K3DMeshWriter.py │ │ ├── mesh.sink.OBJMeshWriter.py │ │ ├── mesh.sink.PLYMeshWriter.py │ │ ├── mesh.sink.PointsCentroid.py │ │ ├── mesh.sink.STLMeshWriter.magics.py │ │ ├── mesh.sink.STLMeshWriter.py │ │ ├── mesh.sink.STLMeshWriter.viscam.py │ │ ├── mesh.solid.failure.py │ │ ├── mesh.solid.py │ │ ├── mesh.source.3DSMeshReader.py │ │ ├── mesh.source.BenchmarkComparison.py │ │ ├── mesh.source.BlobbyEllipsoid.py │ │ ├── mesh.source.BlobbySegment.py │ │ ├── mesh.source.COLLADAMeshReader.py │ │ ├── mesh.source.CUDA.Breakdown.py │ │ ├── mesh.source.CUDAPolyGrid.benchmark.py │ │ ├── mesh.source.CUDAPolyGrid.py │ │ ├── mesh.source.CUDAPolyGridAndTransformPoints.benchmark.py │ │ ├── mesh.source.CUDAPolyGridAndTransformPoints.py │ │ ├── mesh.source.GTSMeshReader.cube.py │ │ ├── mesh.source.GTSMeshReader.gz.cube.py │ │ ├── mesh.source.LSystemParser.py │ │ ├── mesh.source.MD2MeshReader.py │ │ ├── mesh.source.MeshSourceScript.bezier_triangle_patches.py │ │ ├── mesh.source.MeshSourceScript.bicubic.patches.py │ │ ├── mesh.source.MeshSourceScript.bilinear.patches.py │ │ ├── mesh.source.MeshSourceScript.blobby.py │ │ ├── mesh.source.MeshSourceScript.cones.py │ │ ├── mesh.source.MeshSourceScript.cubic.curves.py │ │ ├── mesh.source.MeshSourceScript.cylinders.py │ │ ├── mesh.source.MeshSourceScript.disks.py │ │ ├── mesh.source.MeshSourceScript.hyperboloids.py │ │ ├── mesh.source.MeshSourceScript.linear.curves.py │ │ ├── mesh.source.MeshSourceScript.nurbs.curves.py │ │ ├── mesh.source.MeshSourceScript.nurbs.patches.py │ │ ├── mesh.source.MeshSourceScript.paraboloids.py │ │ ├── mesh.source.MeshSourceScript.particles.py │ │ ├── mesh.source.MeshSourceScript.polyhedra.py │ │ ├── mesh.source.MeshSourceScript.simple_polyhedron.py │ │ ├── mesh.source.MeshSourceScript.spheres.py │ │ ├── mesh.source.MeshSourceScript.teapots.py │ │ ├── mesh.source.MeshSourceScript.tori.py │ │ ├── mesh.source.Newell.teacup.py │ │ ├── mesh.source.Newell.teapot.py │ │ ├── mesh.source.Newell.teaspoon.py │ │ ├── mesh.source.NurbsCircle.py │ │ ├── mesh.source.NurbsCone.py │ │ ├── mesh.source.NurbsCurve.py │ │ ├── mesh.source.NurbsCylinder.py │ │ ├── mesh.source.NurbsDisk.py │ │ ├── mesh.source.NurbsGrid.py │ │ ├── mesh.source.NurbsHyperboloid.py │ │ ├── mesh.source.NurbsParaboloid.py │ │ ├── mesh.source.NurbsPolygon.py │ │ ├── mesh.source.NurbsSphere.py │ │ ├── mesh.source.NurbsTorus.py │ │ ├── mesh.source.OBJMeshReader.nurbs.py │ │ ├── mesh.source.OBJMeshReader.polyhedron.py │ │ ├── mesh.source.PLYMeshReader.py │ │ ├── mesh.source.PolyCone.py │ │ ├── mesh.source.PolyCube.py │ │ ├── mesh.source.PolyCushion.py │ │ ├── mesh.source.PolyCylinder.caps.py │ │ ├── mesh.source.PolyCylinder.py │ │ ├── mesh.source.PolyDisk.py │ │ ├── mesh.source.PolyGrid.benchmark.py │ │ ├── mesh.source.PolyGrid.py │ │ ├── mesh.source.PolyIcosahedron.py │ │ ├── mesh.source.PolySphere.1.py │ │ ├── mesh.source.PolySphere.2.py │ │ ├── mesh.source.PolySphere.3.py │ │ ├── mesh.source.PolyText.py │ │ ├── mesh.source.PolyTorus.py │ │ ├── mesh.source.QuadricCone.py │ │ ├── mesh.source.QuadricCylinder.py │ │ ├── mesh.source.QuadricDisk.py │ │ ├── mesh.source.QuadricHyperboloid.py │ │ ├── mesh.source.QuadricLogo.py │ │ ├── mesh.source.QuadricParaboloid.py │ │ ├── mesh.source.QuadricSphere.py │ │ ├── mesh.source.QuadricTorus.py │ │ ├── mesh.source.STLMeshReader.magics.py │ │ ├── mesh.source.STLMeshReader.py │ │ ├── mesh.source.STLMeshReader.viscam.py │ │ ├── mesh.source.SVGMeshReader.py │ │ ├── mesh.source.SurfacePlot.py │ │ ├── mesh.source.Teapot.py │ │ ├── mesh.source.reader.bogus_input.py │ │ ├── mesh.validation.py │ │ ├── modifier.BicubicToPoly.py │ │ ├── modifier.DeleteComponents.complex.py │ │ ├── modifier.DeleteComponents.edge.py │ │ ├── modifier.DeleteComponents.face.py │ │ ├── modifier.DeleteComponents.point.py │ │ ├── modifier.DissolveFaces.py │ │ ├── modifier.PointsToParticles.py │ │ ├── modifier.PolyToBilinear.py │ │ ├── modifier.WeldPoints.py │ │ ├── source.LinearKnot.py │ │ ├── source.LinearLissajousCurve.py │ │ └── source.UniformPolyhedron.py │ ├── meshes/ │ │ ├── mesh.modifier.BendPoints.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.BendPoints.reference.k3d │ │ ├── mesh.modifier.BevelFaces.reference.k3d │ │ ├── mesh.modifier.BevelPoints.boundary.reference.k3d │ │ ├── mesh.modifier.BevelPoints.reference.k3d │ │ ├── mesh.modifier.BicubicToPoly.reference.k3d │ │ ├── mesh.modifier.BlobbyAdd.reference.k3d │ │ ├── mesh.modifier.BlobbyDivide.reference.k3d │ │ ├── mesh.modifier.BlobbyMaximum.reference.k3d │ │ ├── mesh.modifier.BlobbyMinimum.reference.k3d │ │ ├── mesh.modifier.BlobbyMultiply.reference.k3d │ │ ├── mesh.modifier.BlobbyNegate.reference.k3d │ │ ├── mesh.modifier.BlobbySubtract.reference.k3d │ │ ├── mesh.modifier.BridgeEdges.reference.k3d │ │ ├── mesh.modifier.BridgeEdges.source.k3d │ │ ├── mesh.modifier.BridgeFaces.reference.k3d │ │ ├── mesh.modifier.BridgeFaces.source.k3d │ │ ├── mesh.modifier.BulgePoints.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.BulgePoints.reference.k3d │ │ ├── mesh.modifier.CARVEBoolean.benchmark.reference.k3d │ │ ├── mesh.modifier.CARVEBoolean.cubes.reference.k3d │ │ ├── mesh.modifier.CARVEBoolean.cylinders.reference.k3d │ │ ├── mesh.modifier.CARVEBoolean.input.a.ply │ │ ├── mesh.modifier.CARVEBoolean.input.b.ply │ │ ├── mesh.modifier.CARVEBoolean.ply.reference.k3d │ │ ├── mesh.modifier.CGALBoolean.benchmark.reference.k3d │ │ ├── mesh.modifier.CGALBoolean.cubes.reference.k3d │ │ ├── mesh.modifier.CGALBoolean.cylinders.reference.k3d │ │ ├── mesh.modifier.CalculateNormals.2.reference.k3d │ │ ├── mesh.modifier.CalculateNormals.reference.k3d │ │ ├── mesh.modifier.CapHoles.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.CapHoles.reference.k3d │ │ ├── mesh.modifier.CatmullClark.complex.reference.k3d │ │ ├── mesh.modifier.CatmullClark.cube.reference.k3d │ │ ├── mesh.modifier.CatmullClark.reference.k3d │ │ ├── mesh.modifier.CenterPoints.reference.k3d │ │ ├── mesh.modifier.CollapseEdges.reference.k3d │ │ ├── mesh.modifier.CollapseFaces.reference.k3d │ │ ├── mesh.modifier.CollapsePoints.reference.k3d │ │ ├── mesh.modifier.ConnectVertices.reference.k3d │ │ ├── mesh.modifier.CreateTrimCurve.reference.k3d │ │ ├── mesh.modifier.CylindricalWavePoints.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.CylindricalWavePoints.reference.k3d │ │ ├── mesh.modifier.DeformationExpression.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.DeformationExpression.reference.k3d │ │ ├── mesh.modifier.DeleteComponents.complex.reference.k3d │ │ ├── mesh.modifier.DeleteComponents.edge.reference.k3d │ │ ├── mesh.modifier.DeleteComponents.face.reference.k3d │ │ ├── mesh.modifier.DeleteComponents.point.reference.k3d │ │ ├── mesh.modifier.EdgesToBlobby.reference.k3d │ │ ├── mesh.modifier.EulerKillEdgeAndVertex.reference.k3d │ │ ├── mesh.modifier.EulerKillEdgeMakeLoop.reference.k3d │ │ ├── mesh.modifier.ExtrudeFaces.reference.k3d │ │ ├── mesh.modifier.LinearPointNoise.reference.k3d │ │ ├── mesh.modifier.LinearWavePoints.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.LinearWavePoints.reference.k3d │ │ ├── mesh.modifier.MakeHole.reference.k3d │ │ ├── mesh.modifier.MergeCollinearEdges.reference.k3d │ │ ├── mesh.modifier.MergeCoplanarFaces.reference.k3d │ │ ├── mesh.modifier.MergeMesh.generic.reference.k3d │ │ ├── mesh.modifier.MergeMesh.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.MergeMesh.reference.k3d │ │ ├── mesh.modifier.MergePolyhedra.reference.k3d │ │ ├── mesh.modifier.MeshArray1D.reference.k3d │ │ ├── mesh.modifier.MeshArray2D.reference.k3d │ │ ├── mesh.modifier.MeshArray3D.reference.k3d │ │ ├── mesh.modifier.MorphPoints.reference.k3d │ │ ├── mesh.modifier.MoveFirstEdge.reference.k3d │ │ ├── mesh.modifier.NurbsAddTrimCurve.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsAddTrimCurve.reference.k3d │ │ ├── mesh.modifier.NurbsCloseCurve1.reference.k3d │ │ ├── mesh.modifier.NurbsCloseCurve2.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsCloseCurve2.reference.k3d │ │ ├── mesh.modifier.NurbsConnectCurves.reference.k3d │ │ ├── mesh.modifier.NurbsCreateCap.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsCreateCap.reference.k3d │ │ ├── mesh.modifier.NurbsCurveInsertKnot.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsCurveInsertKnot.reference.k3d │ │ ├── mesh.modifier.NurbsCurveTraversal.reference.k3d │ │ ├── mesh.modifier.NurbsDegreeElevateCurve.reference.k3d │ │ ├── mesh.modifier.NurbsEditKnotVector.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsEditKnotVector.reference.k3d │ │ ├── mesh.modifier.NurbsExtractCurvePoint.reference.k3d │ │ ├── mesh.modifier.NurbsExtractPatchCurve.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsExtractPatchCurve.reference.k3d │ │ ├── mesh.modifier.NurbsExtractTrimCurves.reference.k3d │ │ ├── mesh.modifier.NurbsExtrudeCurve.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsExtrudeCurve.reference.k3d │ │ ├── mesh.modifier.NurbsExtrudePatch.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsExtrudePatch.reference.k3d │ │ ├── mesh.modifier.NurbsFlipCurve.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsFlipCurve.reference.k3d │ │ ├── mesh.modifier.NurbsMergeConnectedCurves.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsMergeConnectedCurves.reference.k3d │ │ ├── mesh.modifier.NurbsMergeCurveKnotVectors.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsMergeCurveKnotVectors.reference.k3d │ │ ├── mesh.modifier.NurbsPatchDegreeElevation.reference.k3d │ │ ├── mesh.modifier.NurbsPatchInsertKnot.reference.k3d │ │ ├── mesh.modifier.NurbsPolygonizeCurve.reference.3.k3d │ │ ├── mesh.modifier.NurbsPolygonizeCurve.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsPolygonizeCurve.reference.k3d │ │ ├── mesh.modifier.NurbsPolygonizePatch.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsPolygonizePatch.reference.k3d │ │ ├── mesh.modifier.NurbsRevolveCurve.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsRevolveCurve.reference.k3d │ │ ├── mesh.modifier.NurbsRuledSurface.reference.k3d │ │ ├── mesh.modifier.NurbsSetWeight1.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsSetWeight1.reference.k3d │ │ ├── mesh.modifier.NurbsSetWeight2.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.NurbsSetWeight2.reference.k3d │ │ ├── mesh.modifier.NurbsSkinnedSurface.reference.k3d │ │ ├── mesh.modifier.NurbsSplitCurve.reference.k3d │ │ ├── mesh.modifier.NurbsSplitPatch1.reference.k3d │ │ ├── mesh.modifier.NurbsSplitPatch2.reference.k3d │ │ ├── mesh.modifier.NurbsSweepSurface.reference.k3d │ │ ├── mesh.modifier.PGPRemesh.bun_zipper_res4.reference.k3d │ │ ├── mesh.modifier.PGPRemesh.bunny.ply │ │ ├── mesh.modifier.PGPRemesh.bunny.reference.k3d │ │ ├── mesh.modifier.PGPRemesh.high.reference.k3d │ │ ├── mesh.modifier.PGPRemesh.reference.k3d │ │ ├── mesh.modifier.PGPRemesh.torus.ply │ │ ├── mesh.modifier.PGPRemesh.torus.reference.k3d │ │ ├── mesh.modifier.PGPRemesh.triang.reference.k3d │ │ ├── mesh.modifier.PointsToBlobby.reference.k3d │ │ ├── mesh.modifier.PointsToParticles.reference.k3d │ │ ├── mesh.modifier.PolyToBilinear.reference.k3d │ │ ├── mesh.modifier.QSlim.reference.k3d │ │ ├── mesh.modifier.QuadrilateralRemeshing.reference.k3d │ │ ├── mesh.modifier.RotatePoints.reference.k3d │ │ ├── mesh.modifier.SDSCorner.reference.k3d │ │ ├── mesh.modifier.SDSCrease.reference.k3d │ │ ├── mesh.modifier.SDSHole.reference.k3d │ │ ├── mesh.modifier.ScalePoints.reference.k3d │ │ ├── mesh.modifier.SelectConnectedComponents.reference.k3d │ │ ├── mesh.modifier.SelectCube.reference.k3d │ │ ├── mesh.modifier.SelectNSided.reference.k3d │ │ ├── mesh.modifier.SelectedFacesToPolyhedron.reference.k3d │ │ ├── mesh.modifier.SetColor.reference.k3d │ │ ├── mesh.modifier.SetPosition.reference.k3d │ │ ├── mesh.modifier.ShearPoints.reference.k3d │ │ ├── mesh.modifier.SimplifyPolyhedra.reference.k3d │ │ ├── mesh.modifier.SmoothPoints.reference.k3d │ │ ├── mesh.modifier.SphereizePoints.reference.k3d │ │ ├── mesh.modifier.SubdivideEdges.reference.k3d │ │ ├── mesh.modifier.SubdivideFaces.Center.reference.k3d │ │ ├── mesh.modifier.SubdivideFaces.CenterMidpoints.reference.k3d │ │ ├── mesh.modifier.SubdivideFaces.Midpoints.reference.k3d │ │ ├── mesh.modifier.TaperPoints.reference.Darwin-i386.k3d │ │ ├── mesh.modifier.TaperPoints.reference.k3d │ │ ├── mesh.modifier.TransformPoints.reference.k3d │ │ ├── mesh.modifier.TranslatePoints.reference.k3d │ │ ├── mesh.modifier.TriangulateFaces.PolyCube.reference.k3d │ │ ├── mesh.modifier.TriangulateFaces.PolyGrid.reference.k3d │ │ ├── mesh.modifier.TriangulateFaces.PolyGrid.selection.reference.k3d │ │ ├── mesh.modifier.TriangulateFaces.self_intersection.reference.k3d │ │ ├── mesh.modifier.TriangulateFaces.vertex.reference.k3d │ │ ├── mesh.modifier.TwistPoints.reference.k3d │ │ ├── mesh.modifier.WeldPoints.reference.k3d │ │ ├── mesh.selection.GrowSelection.reference.k3d │ │ ├── mesh.selection.SelectBoundaryEdges.reference.k3d │ │ ├── mesh.selection.SelectDegenerateFaces.reference.k3d │ │ ├── mesh.selection.all.reference.k3d │ │ ├── mesh.selection.none.reference.k3d │ │ ├── mesh.selection.null.reference.k3d │ │ ├── mesh.selection.points.reference.k3d │ │ ├── mesh.sink.K3DMeshWriter.reference.k3d │ │ ├── mesh.sink.OBJMeshWriter.reference.k3d │ │ ├── mesh.sink.PLYMeshWriter.reference.k3d │ │ ├── mesh.sink.STLMeshWriter.magics.reference.k3d │ │ ├── mesh.sink.STLMeshWriter.magics.stl │ │ ├── mesh.sink.STLMeshWriter.reference.k3d │ │ ├── mesh.sink.STLMeshWriter.viscam.reference.k3d │ │ ├── mesh.source.3DSMeshReader.test.3ds │ │ ├── mesh.source.3DSMeshReader.test.reference.k3d │ │ ├── mesh.source.BlobbyEllipsoid.reference.k3d │ │ ├── mesh.source.BlobbySegment.reference.k3d │ │ ├── mesh.source.COLLADAMeshReader.duck.dae │ │ ├── mesh.source.COLLADAMeshReader.duck.reference.k3d │ │ ├── mesh.source.GTSMeshReader.cube.gts │ │ ├── mesh.source.GTSMeshReader.cube.reference.k3d │ │ ├── mesh.source.GTSMeshReader.gz.cube.reference.k3d │ │ ├── mesh.source.GTSPolySphere.reference.k3d │ │ ├── mesh.source.LSystemParser.reference.k3d │ │ ├── mesh.source.LeastSquaresPlot.reference.k3d │ │ ├── mesh.source.LinearKnot.reference.Darwin-i386.k3d │ │ ├── mesh.source.LinearKnot.reference.k3d │ │ ├── mesh.source.LinearLissajousCurve.reference.Darwin-i386.k3d │ │ ├── mesh.source.LinearLissajousCurve.reference.k3d │ │ ├── mesh.source.MD2MeshReader.md2 │ │ ├── mesh.source.MD2MeshReader.reference.k3d │ │ ├── mesh.source.MeshSourceScript.bezier_triangle_patches.reference.k3d │ │ ├── mesh.source.MeshSourceScript.bicubic.patches.reference.k3d │ │ ├── mesh.source.MeshSourceScript.bilinear.patches.reference.k3d │ │ ├── mesh.source.MeshSourceScript.blobby.reference.k3d │ │ ├── mesh.source.MeshSourceScript.cones.reference.k3d │ │ ├── mesh.source.MeshSourceScript.cubic.curves.reference.k3d │ │ ├── mesh.source.MeshSourceScript.cylinders.reference.k3d │ │ ├── mesh.source.MeshSourceScript.disks.reference.k3d │ │ ├── mesh.source.MeshSourceScript.hyperboloids.reference.k3d │ │ ├── mesh.source.MeshSourceScript.linear.curves.reference.k3d │ │ ├── mesh.source.MeshSourceScript.nurbs.curves.reference.k3d │ │ ├── mesh.source.MeshSourceScript.nurbs.patches.reference.k3d │ │ ├── mesh.source.MeshSourceScript.paraboloids.reference.k3d │ │ ├── mesh.source.MeshSourceScript.particles.reference.k3d │ │ ├── mesh.source.MeshSourceScript.polyhedra.reference.k3d │ │ ├── mesh.source.MeshSourceScript.simple_polyhedron.reference.k3d │ │ ├── mesh.source.MeshSourceScript.spheres.reference.k3d │ │ ├── mesh.source.MeshSourceScript.teapots.reference.k3d │ │ ├── mesh.source.MeshSourceScript.tori.reference.k3d │ │ ├── mesh.source.Newell.teacup.reference.k3d │ │ ├── mesh.source.Newell.teapot.reference.k3d │ │ ├── mesh.source.Newell.teaspoon.reference.k3d │ │ ├── mesh.source.NurbsCircle.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsCircle.reference.k3d │ │ ├── mesh.source.NurbsCone.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsCone.reference.k3d │ │ ├── mesh.source.NurbsCurve.reference.k3d │ │ ├── mesh.source.NurbsCylinder.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsCylinder.reference.k3d │ │ ├── mesh.source.NurbsDisk.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsDisk.reference.k3d │ │ ├── mesh.source.NurbsGrid.reference.k3d │ │ ├── mesh.source.NurbsHyperboloid.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsHyperboloid.reference.k3d │ │ ├── mesh.source.NurbsParaboloid.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsParaboloid.reference.k3d │ │ ├── mesh.source.NurbsPolygon.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsPolygon.reference.k3d │ │ ├── mesh.source.NurbsSphere.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsSphere.reference.k3d │ │ ├── mesh.source.NurbsTorus.reference.Darwin-i386.k3d │ │ ├── mesh.source.NurbsTorus.reference.k3d │ │ ├── mesh.source.OBJMeshReader.nurbs.obj │ │ ├── mesh.source.OBJMeshReader.nurbs.reference.k3d │ │ ├── mesh.source.OBJMeshReader.polyhedron.obj │ │ ├── mesh.source.OBJMeshReader.polyhedron.reference.k3d │ │ ├── mesh.source.PLYMeshReader.ply │ │ ├── mesh.source.PLYMeshReader.reference.k3d │ │ ├── mesh.source.PolyCone.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolyCone.reference.k3d │ │ ├── mesh.source.PolyCube.reference.k3d │ │ ├── mesh.source.PolyCushion.reference.k3d │ │ ├── mesh.source.PolyCylinder.caps.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolyCylinder.caps.reference.k3d │ │ ├── mesh.source.PolyCylinder.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolyCylinder.reference.k3d │ │ ├── mesh.source.PolyDisk.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolyDisk.reference.k3d │ │ ├── mesh.source.PolyGrid.reference.k3d │ │ ├── mesh.source.PolyGridAndTransformPoints.reference.k3d │ │ ├── mesh.source.PolyIcosahedron.reference.k3d │ │ ├── mesh.source.PolySphere.1.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolySphere.1.reference.k3d │ │ ├── mesh.source.PolySphere.2.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolySphere.2.reference.k3d │ │ ├── mesh.source.PolySphere.3.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolySphere.3.reference.k3d │ │ ├── mesh.source.PolyText.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolyText.reference.k3d │ │ ├── mesh.source.PolyTorus.reference.Darwin-i386.k3d │ │ ├── mesh.source.PolyTorus.reference.k3d │ │ ├── mesh.source.QuadricCone.reference.k3d │ │ ├── mesh.source.QuadricCylinder.reference.k3d │ │ ├── mesh.source.QuadricDisk.reference.k3d │ │ ├── mesh.source.QuadricHyperboloid.reference.k3d │ │ ├── mesh.source.QuadricLogo.reference.Darwin-i386.k3d │ │ ├── mesh.source.QuadricLogo.reference.k3d │ │ ├── mesh.source.QuadricParaboloid.reference.k3d │ │ ├── mesh.source.QuadricSphere.reference.k3d │ │ ├── mesh.source.QuadricTorus.reference.k3d │ │ ├── mesh.source.STLMeshReader.magics.reference.k3d │ │ ├── mesh.source.STLMeshReader.reference.k3d │ │ ├── mesh.source.STLMeshReader.stl │ │ ├── mesh.source.STLMeshReader.viscam.reference.k3d │ │ ├── mesh.source.STLMeshReader.viscam.stl │ │ ├── mesh.source.SVGMeshReader.reference.k3d │ │ ├── mesh.source.SphereEversion.reference.k3d │ │ ├── mesh.source.SurfacePlot.reference.k3d │ │ ├── mesh.source.Teapot.reference.k3d │ │ ├── modifier.DissolveFaces.reference.k3d │ │ ├── ngui.tools.move.reference.k3d │ │ ├── ngui.tools.rotate.reference.k3d │ │ ├── polyhedron.hole.k3d │ │ ├── random_bytes │ │ ├── source.UniformPolyhedron.reference.k3d │ │ └── zero_bytes │ ├── ngui/ │ │ ├── CMakeLists.txt │ │ ├── MoveTool.py │ │ ├── RotateTool.py │ │ ├── icons.missing.py │ │ ├── icons.unexpected.py │ │ └── icons.unrasterized.py │ ├── offscreen/ │ │ ├── CMakeLists.txt │ │ ├── offscreen.GLXCameraToBitmap.py │ │ ├── offscreen.OpenGLFramebufferCameraToBitmap.py │ │ ├── offscreen.VirtualCameraToBitmap.py │ │ └── offscreen.WGLCameraToBitmap.py │ ├── other/ │ │ ├── CMakeLists.txt │ │ ├── document.create.py │ │ ├── document.importer.bogus_input.py │ │ ├── document.serialization.properties.py │ │ └── notifier.InotifyFileChangeNotifier.py │ ├── parallel/ │ │ ├── CMakeLists.txt │ │ ├── grain_size.ScalePoints.py │ │ └── thread_count.ScalePoints.py │ ├── platform/ │ │ ├── CMakeLists.txt │ │ ├── platform_configuration.py │ │ ├── platform_floating_point.cpp │ │ ├── platform_normalized.cpp │ │ ├── platform_statistics.cpp │ │ └── platform_types.cpp │ ├── python/ │ │ ├── CMakeLists.txt │ │ ├── angle_axis.py │ │ ├── document_environment.py │ │ ├── get_dependency.py │ │ ├── module.py │ │ ├── named_arrays.py │ │ ├── node_selection.py │ │ ├── property_linking.py │ │ ├── property_value.py │ │ ├── renderman_attributes.py │ │ ├── renderman_options.py │ │ └── user_properties.py │ ├── sdk/ │ │ ├── CMakeLists.txt │ │ ├── array_metadata.cpp │ │ ├── bitmap_conversion.cpp │ │ ├── circular_signals.cpp │ │ ├── data_sizes.cpp │ │ ├── difference.cpp │ │ ├── document_upgrade.cpp │ │ ├── float_to_string.cpp │ │ ├── hint_mapping.cpp │ │ ├── non_blocking_server.cpp │ │ ├── nurbs_deserialize.cpp │ │ ├── nurbs_evaluate.cpp │ │ ├── nurbs_serialize.cpp │ │ ├── path_decomposition.cpp │ │ ├── pipeline_data.cpp │ │ ├── program_options.cpp │ │ ├── relative_path.cpp │ │ ├── selection_equality.cpp │ │ ├── selection_serialization.cpp │ │ ├── shared_dynamic_cast.cpp │ │ ├── shared_dynamic_cast_config.h.in │ │ ├── shared_dynamic_cast_library.cpp │ │ ├── shared_dynamic_cast_library.h │ │ ├── uuid.cpp │ │ ├── xml_input.cpp │ │ ├── xml_output.cpp │ │ ├── xml_sanity_checks.cpp │ │ └── xml_xpath.cpp │ ├── shaders/ │ │ ├── CMakeLists.txt │ │ ├── displacement_shader_test.k3d │ │ ├── light_shader_test.k3d │ │ ├── surface_shader_test.k3d │ │ └── volume_shader_test.k3d │ ├── string/ │ │ ├── CMakeLists.txt │ │ └── source.StringSourceScript.py │ ├── testing/ │ │ ├── CMakeLists.txt │ │ ├── PipelineProfiler.py │ │ ├── detect_language_failure │ │ ├── detect_python.py │ │ ├── detect_python_exception.py │ │ ├── detect_python_failure.py │ │ └── measurements.py │ ├── testing.py │ └── vector3/ │ ├── CMakeLists.txt │ └── source.Vector3SourceScript.py ├── uuidgen/ │ ├── CMakeLists.txt │ └── main.cpp └── web/ ├── CMakeLists.txt ├── developer/ │ ├── dashboard-index.html │ ├── dashboard.html │ ├── developer.css │ ├── documentation.html │ ├── index.html │ ├── logo.xcf │ ├── navigation.html │ └── tracker/ │ ├── issue.html │ ├── navigation.html │ ├── project.html │ ├── release.html │ ├── tracker │ └── tracker.css ├── k3d.css ├── planet/ │ ├── index.html │ ├── logo.xcf │ ├── planet │ └── planet.css └── www/ ├── donations.html ├── downloads.html ├── index.html ├── maintenance.html ├── navigation.html ├── resources/ │ └── banner └── video.html ================================================ FILE CONTENTS ================================================ ================================================ FILE: .ditz-plugins ================================================ - issue-claiming ================================================ FILE: .gitignore ================================================ .kdev4 *.kdev4 *.pyc share/k3d/guide/content/._pipeline.txt ================================================ FILE: AUTHORS ================================================ This is K-3D, the free-as-in-freedom 3D modeling, animation, and rendering system. For a list of K-3D contributors, use the "Help > About" menu item. To see the list of contributors without running K-3D, see the k3dsdk/contributors.cpp file. For further information, visit the K-3D web site: http://www.k-3d.org Thank You, The K-3D Team ================================================ FILE: CMakeLists.txt ================================================ PROJECT(k3d) # Configure CMake ... CMAKE_MINIMUM_REQUIRED(VERSION 3.1 FATAL_ERROR) CMAKE_POLICY(SET CMP0003 OLD) IF(${CMAKE_MAJOR_VERSION} GREATER 3 OR ${CMAKE_MAJOR_VERSION} EQUAL 3) CMAKE_POLICY(SET CMP0026 OLD) ENDIF() set(CMAKE_CXX_STANDARD 11) SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") SET(CMAKE_INSTALL_NAME_DIR "@exectuable_path/../lib/") INCLUDE(K3DOutOfSourceBuild) # Disallow in-source builds INCLUDE(K3DCompileResource) INCLUDE(K3DGenerateDEF) # Convenience macro for linking Win32 DLLs using MSVC INCLUDE(K3DDependencies) INCLUDE(K3DWordSize) # Detect 32/64 bit platform INCLUDE(K3DCompiler) # Detect problematic compilers # Set the K-3D version SET(K3D_MAJOR_VERSION 0) SET(K3D_MINOR_VERSION 8) SET(K3D_RELEASE_VERSION 0) SET(K3D_BUILD_VERSION 7) SET(K3D_SO_VERSION 1) SET(K3D_PACKAGE k3d) SET(K3D_VERSION ${K3D_MAJOR_VERSION}.${K3D_MINOR_VERSION}.${K3D_RELEASE_VERSION}.${K3D_BUILD_VERSION}) SET(K3D_HOST ${CMAKE_SYSTEM} ${CMAKE_SYSTEM_PROCESSOR}) SET(K3D_COPYRIGHT "Copyright (c) 1995-2010, Timothy M. Shead. All Rights Reserved.") # Run tests to find external packages ... INCLUDE(K3DFind3ds) INCLUDE(K3DFindCairomm) INCLUDE(K3DFindCARVE) INCLUDE(K3DFindCGAL) INCLUDE(K3DFindCollada) INCLUDE(K3DFindDBus) INCLUDE(K3DFindFreetype2) INCLUDE(K3DFindFTGL) INCLUDE(K3DFindGiomm) INCLUDE(K3DFindGlibmm) INCLUDE(K3DFindGMM) INCLUDE(K3DFindGPerftools) INCLUDE(K3DFindGtkGLExt) INCLUDE(K3DFindGtkmm) INCLUDE(K3DFindGtkSourceView) INCLUDE(K3DFindGTS) INCLUDE(K3DFindImageMagick) INCLUDE(K3DFindInotify) INCLUDE(K3DFindIntl) INCLUDE(K3DFindJPEG) INCLUDE(K3DFindODE) INCLUDE(K3DFindOpenEXR) INCLUDE(K3DFindOpenGL) INCLUDE(K3DFindOSMesa) INCLUDE(K3DFindPNG) INCLUDE(K3DFindPython) INCLUDE(K3DFindSigC) INCLUDE(K3DFindSuperLU) INCLUDE(K3DFindTBB) INCLUDE(K3DFindTIFF) INCLUDE(K3DFindXML) INCLUDE(K3DFindZlib) FIND_PACKAGE(Aqsis NO_MODULE QUIET) FIND_PACKAGE(Qt4 4.6.2 COMPONENTS QtCore QtGui QtScript) FIND_PACKAGE(K3DAsciiDoc) # Setup platform-specific defaults ... IF(WIN32 AND MSVC) SET(K3D_ENABLE_SYMBOL_VISIBILITY_DEFAULT ON) ELSE() SET(K3D_ENABLE_SYMBOL_VISIBILITY_DEFAULT OFF) ENDIF() IF(Aqsis_FOUND AND QT4_FOUND) SET(K3D_QT_AQSIS_FOUND TRUE) ELSE() SET(K3D_QT_AQSIS_FOUND FALSE) ENDIF() IF(K3D_OSMESA_FOUND AND QT4_FOUND) SET(K3D_QT_OSMESA_FOUND TRUE) ELSE() SET(K3D_QT_OSMESA_FOUND FALSE) ENDIF() OPTION(K3D_BUILD_3DS_IO_MODULE "Build the 3ds_io module" ${K3D_3DS_FOUND}) OPTION(K3D_BUILD_ADVANCED_OPENGL_PAINTERS_MODULE "Build the advanced OpenGL mesh painters module" ON) OPTION(K3D_BUILD_ANIMATION_MODULE "Build the animation module" ON) OPTION(K3D_BUILD_ANNOTATION_MODULE "Build the annotation module" ${K3D_FREETYPE2_FOUND}) OPTION(K3D_BUILD_AQSIS_MODULE "Build the embedded Aqsis render engine module" ${Aqsis_FOUND}) OPTION(K3D_BUILD_ARRAY_MODULE "Build the array module" ON) OPTION(K3D_BUILD_BICUBIC_PATCH_MODULE "Build the bicubic patch module" ON) OPTION(K3D_BUILD_BILINEAR_PATCH_MODULE "Build the bilinear patch module" ON) OPTION(K3D_BUILD_BITMAP_MODULE "Build the bitmap module" ON) OPTION(K3D_BUILD_BLOBBY_MODULE "Build the blobby module" ON) OPTION(K3D_BUILD_BUNDLED_RENDERMAN_ENGINES_MODULE "Provides integration with RenderMan-compatible render engines that are bundled with K-3D." OFF) OPTION(K3D_BUILD_CARVE_MODULE "Build the CARVE module" ${K3D_CARVE_FOUND}) OPTION(K3D_BUILD_CGAL_MODULE "Build the CGAL module" ${K3D_CGAL_FOUND}) OPTION(K3D_BUILD_CLOTH_MODULE "Build the cloth module" ON) OPTION(K3D_BUILD_COLLADA_IO_MODULE "Build the COLLADA module" ${K3D_COLLADA_FOUND}) OPTION(K3D_BUILD_COMPIZ_MODULE "Build the Compiz module" ${K3D_DBUS_FOUND}) OPTION(K3D_BUILD_CORE_MODULE "Build the core module" ON) OPTION(K3D_BUILD_CUDA_MODULE "Build the cuda module" OFF) OPTION(K3D_BUILD_DEFORMATION_MODULE "Build the mesh deformation module" ON) OPTION(K3D_BUILD_DEVELOPMENT_MODULE "Build the development module" ON) OPTION(K3D_BUILD_DOUBLE_MODULE "Build the double module" ON) OPTION(K3D_BUILD_EULER_OPERATIONS_MODULE "Build the module that exposes the Euler mesh operations as mesh modifiers" OFF) OPTION(K3D_BUILD_FILE_MAGIC_MODULE "Build the file-identification-magic module" ON) OPTION(K3D_BUILD_FREETYPE2_MODULE "Build the freetype2 module" ON) OPTION(K3D_BUILD_GIO_MODULE "Build the GIO module for mime type support" ${K3D_GIOMM_FOUND}) OPTION(K3D_BUILD_GLX_MODULE "Build the GLX offscreen rendering module" OFF) OPTION(K3D_BUILD_GMSH_IO_MODULE "Build the Gmsh file format module" ON) OPTION(K3D_BUILD_GPERFTOOLS_MODULE "Build the GPerftools profiling module" ${K3D_GPERFTOOLS_FOUND}) OPTION(K3D_BUILD_GRAPHVIZ_MODULE "Build the GraphViz integration module" ON) OPTION(K3D_BUILD_GTS_IO_MODULE "Build the GNU Triangulated Surfaces file format module" ON) OPTION(K3D_BUILD_GTS_MODULE "Build the GNU Triangulated Surfaces module" ${K3D_GTS_FOUND}) OPTION(K3D_BUILD_HIGHLIGHTING_MODULE "Build the user interface 'highlighting' module" ON) OPTION(K3D_BUILD_IGES_IO_MODULE "Build the IGES file format module" ON) OPTION(K3D_BUILD_IMAGEMAGICK_IO_MODULE "Build the ImageMagick file format module" ${K3D_IMAGEMAGICK_FOUND}) OPTION(K3D_BUILD_INDIGO_MODULE "Build the Indigo render engine integration module" ON) OPTION(K3D_BUILD_INOTIFY_MODULE "Build the inotify file change notification module" ${K3D_INOTIFY_FOUND}) OPTION(K3D_BUILD_JPEG_IO_MODULE "Build the jpeg file format module" ${K3D_JPEG_FOUND}) OPTION(K3D_BUILD_K3D_IO_MODULE "Build the K-3D file format module" ON) OPTION(K3D_BUILD_LINEAR_CURVE_MODULE "Build the linear curve module" ON) OPTION(K3D_BUILD_LIPSYNC_MODULE "Build the lip synchronization tools module" ON) OPTION(K3D_BUILD_LSYSTEM_MODULE "Build the l-system parser module" ON) OPTION(K3D_BUILD_LUXRENDER_MODULE "Build the Luxrender render enegine integration module" ON) OPTION(K3D_BUILD_MATRIX_MODULE "Build the matrix operations module" ON) OPTION(K3D_BUILD_MD2_IO_MODULE "Build the md2 io module" ON) OPTION(K3D_BUILD_MESH_ATTRIBUTES_MODULE "Build the mesh attributes module" ON) OPTION(K3D_BUILD_MESH_INSTANCE_MODULE "Build the mesh-instance module" ON) OPTION(K3D_BUILD_MESH_MODULE "Build the mesh module" ON) OPTION(K3D_BUILD_NGUI_ABOUT_MODULE "Build the user interface 'about' dialog module" ON) OPTION(K3D_BUILD_NGUI_ANIMATION_TIMELINE_PANEL_MODULE "Build the experimental animation timeline panel module" ON) OPTION(K3D_BUILD_NGUI_ASSIGN_HOTKEYS_MODULE "Build the user interface 'assign hotkeys' module" ON) OPTION(K3D_BUILD_NGUI_ATK_EVENT_RECORDER_MODULE "Build the user interface ATK 'event recorder' module" OFF) OPTION(K3D_BUILD_NGUI_KNOT_VECTOR_CONTROL_MODULE "Build the custom knot-vector property control module" ON) OPTION(K3D_BUILD_NGUI_LEARNING_MODULE "Build the user interface learning (tutorial) dialog module" ON) OPTION(K3D_BUILD_NGUI_LOG_MODULE "Build the user interface log window module" ON) OPTION(K3D_BUILD_NGUI_MATERIAL_MANAGER_PANEL_MODULE "Build the user interface manager manager panel module" OFF) OPTION(K3D_BUILD_NGUI_MESH_CONTROL_MODULE "Build the mesh property control module" ON) OPTION(K3D_BUILD_NGUI_MODULE "Build the standard graphical user interface module" ON) OPTION(K3D_BUILD_NGUI_MORPH_POINTS_PAGE_MODULE "Build the MorphPoints custom property page module" ON) OPTION(K3D_BUILD_NGUI_NODE_LIST_PANEL_MODULE "Build the user interface node list panel module" ON) OPTION(K3D_BUILD_NGUI_NODE_PROPERTIES_PANEL_MODULE "Build the user interface node properties panel module" ON) OPTION(K3D_BUILD_NGUI_OPENGL_DIALOG_MODULE "Build the user interface OpenGL information dialog module" ON) OPTION(K3D_BUILD_NGUI_PARENT_TOOL_MODULE "Build the user interface 'parent tool' module" ON) OPTION(K3D_BUILD_NGUI_PIPELINE_PANEL_MODULE "Build the user interface pipeline display panel module" ON) OPTION(K3D_BUILD_NGUI_PIPELINE_PROFILER_PANEL_MODULE "Build the user interface pipeline profiler panel module" ON) OPTION(K3D_BUILD_NGUI_PYTHON_SHELL_MODULE "Build the interactive Python shell module" ON) OPTION(K3D_BUILD_NGUI_RECTANGLE_CONTROL_MODULE "Build the custom rectangle property control module" ON) OPTION(K3D_BUILD_NGUI_RENDER_REGION_TOOL_MODULE "Build the user interface 'render region tool' module" ON) OPTION(K3D_BUILD_NGUI_SELECTION_CONTROL_MODULE "Build the selection property control module" ON) OPTION(K3D_BUILD_NGUI_SNAP_TOOL_MODULE "Build the user interface 'snap tool' module" ON) OPTION(K3D_BUILD_NGUI_SPACE_NAVIGATOR_MODULE "Build the SpaceNavigator 3D mouse integration module" OFF) OPTION(K3D_BUILD_NGUI_TEXT_EDITOR_MODULE "Build the user interface text editor module" ON) OPTION(K3D_BUILD_NGUI_TIMELINE_PANEL_MODULE "Build the user interface timeline panel module" ON) OPTION(K3D_BUILD_NGUI_TOOLBAR_PANEL_MODULE "Build the user interface toolbar panel module" ON) OPTION(K3D_BUILD_NGUI_TOOL_PROPERTIES_PANEL_MODULE "Build the user interface tool properties panel module" ON) OPTION(K3D_BUILD_NGUI_UNDO_TREE_PANEL_MODULE "Build the user interface undo panel module" ON) OPTION(K3D_BUILD_NGUI_UV_EDITOR_PANEL_MODULE "Build the user interface UV editor panel module" OFF) OPTION(K3D_BUILD_NUI_MODULE "Build the Null User Interface module" ON) OPTION(K3D_BUILD_NURBS_MODULE "Build the NURBS module" ON) OPTION(K3D_BUILD_NURBS_SOURCES_MODULE "Build the NURBS sources module" ON) OPTION(K3D_BUILD_OBJ_IO_MODULE "Build the Wavefront .obj file format module" ON) OPTION(K3D_BUILD_ODE_MODULE "Build the Open Dynamics Engine (ODE) integration module" ${K3D_ODE_FOUND}) OPTION(K3D_BUILD_OGRE_IO_MODULE "Build the Object-oriented Graphics Engine (OGRE) file I/O module" ON) OPTION(K3D_BUILD_OPENEXR_IO_MODULE "Build the OpenEXR file format module" ${K3D_OPENEXR_FOUND}) OPTION(K3D_BUILD_OPENGL_MODULE "Build the OpenGL integration module" ON) OPTION(K3D_BUILD_OSMESA_MODULE "Build the Offscreen Mesa integration module" ${K3D_OSMESA_FOUND}) OPTION(K3D_BUILD_OSX_MODULE "Build the Mac OSX integration module" ${APPLE}) OPTION(K3D_BUILD_PARTICLE_MODULE "Build the point group module" ON) OPTION(K3D_BUILD_PDIFF_MODULE "Build the perceptual-diff module" ON) OPTION(K3D_BUILD_PIXIE_MODULE "Build the Pixie render engine integration module" ON) OPTION(K3D_BUILD_PLOT_MODULE "Build the function-plot module" ON) OPTION(K3D_BUILD_PLY_IO_MODULE "Build the Stanford .ply file format module" ON) OPTION(K3D_BUILD_PNG_IO_MODULE "Build the PNG file format module" ON) OPTION(K3D_BUILD_POLYHEDRON_MODULE "Build the polyhedron module" ON) OPTION(K3D_BUILD_POLYHEDRON_SOURCES_MODULE "Build the polyhedron sources module" ON) OPTION(K3D_BUILD_PYTHON_MODULE "Build the Python scripting language module" ON) OPTION(K3D_BUILD_PYUI_MODULE "Build the Python user interface plugin" ON) OPTION(K3D_BUILD_QSLIM_MODULE "Build the qslim module" ON) OPTION(K3D_BUILD_QTUI_ABOUT_DIALOG_MODULE "Build the Qt user interface 'about' dialog module" OFF) OPTION(K3D_BUILD_QTUI_AQSIS_MODE_MODULE "Build the Qt-Aqsis integration mode module" OFF) OPTION(K3D_BUILD_QTUI_AQSIS_MODULE "Build the Qt-Aqsis integration module" OFF) OPTION(K3D_BUILD_QTUI_BOOLEAN_MODULE "Build the Qt graphical user interface boolean property widget module" OFF) OPTION(K3D_BUILD_QTUI_COLOR_MODULE "Build the Qt graphical user interface color property widget module" OFF) OPTION(K3D_BUILD_QTUI_DEFAULT_MODE_MODULE "Build the Qt graphical user interface default mode module" OFF) OPTION(K3D_BUILD_QTUI_JAVASCRIPT_SHELL_MODULE "Build the Qt graphical user interface interactive JavaScript shell module" OFF) OPTION(K3D_BUILD_QTUI_LOG_MODULE "Build the Qt user interface log window module" OFF) OPTION(K3D_BUILD_QTUI_MATRIX_MODULE "Build the Qt graphical user interface matrix property widget module" OFF) OPTION(K3D_BUILD_QTUI_MODULE "Build the Qt graphical user interface module" OFF) OPTION(K3D_BUILD_QTUI_MOVE_MODE_MODULE "Build the user interface mode to move components" OFF) OPTION(K3D_BUILD_QTUI_NODE_LIST_MODULE "Build the Qt graphical user interface node list module" OFF) OPTION(K3D_BUILD_QTUI_NODE_PROPERTIES_MODULE "Build the Qt graphical user interface node properties module" OFF) OPTION(K3D_BUILD_QTUI_OPENGL_MODULE "Build the Qt graphical user interface OpenGL-test module" OFF) OPTION(K3D_BUILD_QTUI_PATH_MODULE "Build the Qt graphical user interface filesystem path property widget module" OFF) OPTION(K3D_BUILD_QTUI_PROGRAMMABLE_MODE_MODULE "Build the Qt graphical user interface programmable mode module" OFF) OPTION(K3D_BUILD_QTUI_STRING_MODULE "Build the Qt graphical user interface string property widget module" OFF) OPTION(K3D_BUILD_QTUI_TEXT_EDITOR_MODULE "Build the Qt graphical user interface text editor module" OFF) OPTION(K3D_BUILD_QUADRICS_MODULE "Build the quadrics module" ON) OPTION(K3D_BUILD_REFERENCE_OPENGL_PAINTERS_MODULE "Build the reference OpenGL mesh painters module" ON) OPTION(K3D_BUILD_RENDERMAN_ENGINES_MODULE "Provides integration with many RenderMan-compatible render engines." ON) OPTION(K3D_BUILD_RENDERMAN_MODULE "Build the RenderMan integration module" ON) OPTION(K3D_BUILD_RENDERMAN_PAINTERS_MODULE "Build the RenderMan mesh painters module" ON) OPTION(K3D_BUILD_RELEASE_MODULE "Build the release nag-messages module" ON) OPTION(K3D_BUILD_SCRIPTED_PLUGINS_MODULE "Build the scripted plugins module" ON) OPTION(K3D_BUILD_SCRIPTING_MODULE "Build the scripting module" ON) OPTION(K3D_BUILD_SELECTION_MODULE "Build the selection module" ON) OPTION(K3D_BUILD_SOLAR_MODULE "Build the solar module" ON) OPTION(K3D_BUILD_STL_IO_MODULE "Build the STL file format module" ON) OPTION(K3D_BUILD_SUBDIVISION_SURFACE_MODULE "Build the subdivision surface module" ON) OPTION(K3D_BUILD_SVG_IO_MODULE "Build the SVG file format module" ON) OPTION(K3D_BUILD_TEST_MODULE "Build the regression test module" ON) OPTION(K3D_BUILD_TIFF_IO_MODULE "Build the TIFF file format module" ON) OPTION(K3D_BUILD_TIME_MODULE "Build the time source module" ON) OPTION(K3D_BUILD_UNIFORM_POLYHEDRON_MODULE "Build the uniform polyhedron source module" ON) OPTION(K3D_BUILD_VIRTUAL_OFFSCREEN_MODULE "Build the virtual offscreen OpenGL rendering module" OFF) OPTION(K3D_BUILD_VIRTUAL_OPENGL_PAINTERS_MODULE "Build virtual OpenGL painters modules" ON) OPTION(K3D_BUILD_WGL_MODULE "Build the Windows offscreen rendering module" ${WIN32}) OPTION(K3D_BUILD_WINDOWS_MODULE "Build the Windows integration module" ${WIN32}) OPTION(K3D_BUILD_XTRACKCAD_MODULE "Build the XTrackCAD Model Railroad integration module" ON) OPTION(K3D_BUILD_YAFRAY_MODULE "Build the YAFRAY render engine integration module" ON) OPTION(K3D_BUILD_DOCS "Build the documentation" OFF) OPTION(K3D_BUILD_GUIDE "Build the html guide" OFF) OPTION(K3D_ENABLE_OSX_BUNDLE "Package K-3D as an OSX bundle (ignored on other platforms)." OFF) OPTION(K3D_ENABLE_DISTRIBUTION "Enable distribution targets." OFF) OPTION(K3D_ENABLE_NLS "Build K-3D with native language support" ON) OPTION(K3D_ENABLE_PARALLEL "Enable parallel computation using the Threaded Building Blocks library." OFF) OPTION(K3D_ENABLE_PROFILING "Enable code profiling using GPerftools." OFF) OPTION(K3D_ENABLE_PYTHON "Build K-3D with Python support" ON) OPTION(K3D_ENABLE_SYMBOL_VISIBILITY "Minimize the number of symbols exported from shared libraries." ${K3D_ENABLE_SYMBOL_VISIBILITY_DEFAULT}) OPTION(K3D_ENABLE_TESTING "Build the K-3D regression test suite." OFF) # Find Boost - this logic must follow all user-definable options SET(K3D_BOOST_COMPONENTS date_time program_options regex system unit_test_framework) IF(K3D_ENABLE_PYTHON) LIST(APPEND K3D_BOOST_COMPONENTS python) ENDIF() IF(K3D_BUILD_COLLADA_IO_MODULE) LIST(APPEND K3D_BOOST_COMPONENTS filesystem) ENDIF() IF(K3D_BUILD_CGAL_MODULE) LIST(APPEND K3D_BOOST_COMPONENTS thread) ENDIF() INCLUDE(K3DFindBoost) # Find required external packages K3D_CHECK("K-3D" REQUIRES Boost_FOUND RESOURCE "Boost" URL "http://www.boost.org" MESSAGE "Note: K-3D requires many of the compiled Boost libraries, which may be distributed separately on some systems.") K3D_CHECK("K-3D" REQUIRES K3D_GLIBMM_FOUND RESOURCE "glibmm" URL "http://gtkmm.org") K3D_CHECK("K-3D" REQUIRES K3D_OPENGL_FOUND RESOURCE "OpenGL" URL "http://opengl.org") K3D_CHECK("K-3D" REQUIRES K3D_SIGC_FOUND RESOURCE "libsigc++" URL "http://libsigc.sourceforge.net") K3D_CHECK("K-3D" REQUIRES K3D_XML_FOUND RESOURCE "XML parser" URL "http://xmlsoft.org") K3D_CHECK("K-3D" REQUIRES K3D_ZLIB_FOUND RESOURCE "zlib" URL "http://www.zlib.net") K3D_CHECK(K3D_BUILD_3DS_IO_MODULE REQUIRES K3D_3DS_FOUND RESOURCE "lib3ds") K3D_CHECK(K3D_BUILD_ANNOTATION_MODULE REQUIRES K3D_FREETYPE2_FOUND RESOURCE "freetype2") K3D_CHECK(K3D_BUILD_AQSIS_MODULE REQUIRES Aqsis_FOUND MESSAGE "To build this module you need to set Aqsis_DIR to the path to an Aqsis build directory.") K3D_CHECK(K3D_BUILD_CARVE_MODULE REQUIRES K3D_CARVE_FOUND RESOURCE "CARVE") K3D_CHECK(K3D_BUILD_CGAL_MODULE REQUIRES K3D_CGAL_FOUND RESOURCE "CGAL") K3D_CHECK(K3D_BUILD_COLLADA_MODULE REQUIRES K3D_COLLADA_FOUND RESOURCE "Collada DOM") K3D_CHECK(K3D_BUILD_COMPIZ_MODULE REQUIRES K3D_DBUS_FOUND RESOURCE "libdbus") K3D_CHECK(K3D_BUILD_FREETYPE2_MODULE REQUIRES K3D_FREETYPE2_FOUND RESOURCE "freetype2") K3D_CHECK(K3D_BUILD_GTS_MODULE REQUIRES K3D_GTS_FOUND RESOURCE "GNU Triangulated Surface") K3D_CHECK(K3D_BUILD_IMAGEMAGICK_IO_MODULE REQUIRES K3D_IMAGEMAGICK_FOUND RESOURCE "ImageMagick") K3D_CHECK(K3D_BUILD_JPEG_IO_MODULE REQUIRES K3D_JPEG_FOUND RESOURCE "JPEG") K3D_CHECK(K3D_BUILD_NGUI_ABOUT_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_ANIMATION_TIMELINE_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_ASSIGN_HOTKEYS_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_ATK_EVENT_RECORDER_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_KNOT_VECTOR_CONTROL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_LEARNING_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_LOG_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_MESH_CONTROL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_MODULE REQUIRES K3D_GTKGLEXT_FOUND RESOURCE "gtkglext") K3D_CHECK(K3D_BUILD_NGUI_MODULE REQUIRES K3D_GTKGLEXT_FOUND RESOURCE "gtkglext") K3D_CHECK(K3D_BUILD_NGUI_MODULE REQUIRES K3D_GTKMM_FOUND RESOURCE "gtkmm") K3D_CHECK(K3D_BUILD_NGUI_MODULE REQUIRES K3D_GTKMM_FOUND RESOURCE "gtkmm") K3D_CHECK(K3D_BUILD_NGUI_MORPH_POINTS_PAGE_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_NODE_HISTORY_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_NODE_LIST_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_NODE_PROPERTIES_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_OPENGL_DIALOG_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_PARENT_TOOL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_PIPELINE_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_PIPELINE_PANEL_MODULE REQUIRES K3D_CAIROMM_FOUND RESOURCE "cairomm") K3D_CHECK(K3D_BUILD_NGUI_PIPELINE_PANEL_MODULE REQUIRES K3D_CAIROMM_FOUND RESOURCE "cairomm") K3D_CHECK(K3D_BUILD_NGUI_PIPELINE_PROFILER_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_PYTHON_SHELL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_PYTHON_SHELL_MODULE REQUIRES K3D_ENABLE_PYTHON) K3D_CHECK(K3D_BUILD_NGUI_PYTHON_SHELL_MODULE REQUIRES K3D_ENABLE_PYTHON) K3D_CHECK(K3D_BUILD_NGUI_RECTANGLE_CONTROL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_RENDER_REGION_TOOL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_SELECTION_CONTROL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_SNAP_TOOL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_SPACE_NAVIGATOR_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_TEXT_EDITOR_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_TIMELINE_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_TOOLBAR_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_TOOL_PROPERTIES_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_UNDO_TREE_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_NGUI_UV_EDITOR_PANEL_MODULE REQUIRES K3D_BUILD_NGUI_MODULE) K3D_CHECK(K3D_BUILD_OPENEXR_IO_MODULE REQUIRES K3D_OPENEXR_FOUND RESOURCE "OpenEXR") K3D_CHECK(K3D_BUILD_OSMESA_MODULE REQUIRES K3D_OSMESA_FOUND RESOURCE "OSMesa") K3D_CHECK(K3D_BUILD_PGP_REMESH_MODULE REQUIRES K3D_GMM_FOUND RESOURCE "gmm") K3D_CHECK(K3D_BUILD_PNG_IO_MODULE REQUIRES K3D_PNG_FOUND RESOURCE "PNG") K3D_CHECK(K3D_BUILD_PYTHON_MODULE REQUIRES K3D_ENABLE_PYTHON) K3D_CHECK(K3D_BUILD_PYUI_MODULE REQUIRES K3D_ENABLE_PYTHON) K3D_CHECK(K3D_BUILD_QTUI_ABOUT_DIALOG_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_AQSIS_MODULE REQUIRES Aqsis_FOUND K3D_BUILD_QTUI_MODULE MESSAGE "To build this module you need to set Aqsis_DIR to the path to an Aqsis build directory.") K3D_CHECK(K3D_BUILD_QTUI_AQSIS_MODE_MODULE REQUIRES Aqsis_FOUND K3D_BUILD_QTUI_MODULE MESSAGE "To build this module you need to set Aqsis_DIR to the path to an Aqsis build directory.") K3D_CHECK(K3D_BUILD_QTUI_BOOLEAN_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_COLOR_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_DEFAULT_MODE_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_JAVASCRIPT_SHELL_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_LOG_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_MATRIX_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_MODULE REQUIRES QT4_FOUND RESOURCE "Qt4") K3D_CHECK(K3D_BUILD_QTUI_MOVE_MODE_MODULE REQUIRES QT4_FOUND) K3D_CHECK(K3D_BUILD_QTUI_NODE_LIST_MODULE REQUIRES QT4_FOUND) K3D_CHECK(K3D_BUILD_QTUI_NODE_PROPERTIES_MODULE REQUIRES QT4_FOUND) K3D_CHECK(K3D_BUILD_QTUI_OPENGL_MODULE REQUIRES K3D_BUILD_QTUI_MODULE K3D_BUILD_OSMESA_MODULE) K3D_CHECK(K3D_BUILD_QTUI_PATH_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_PROGRAMMABLE_MODE_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_STRING_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_QTUI_TEXT_EDITOR_MODULE REQUIRES K3D_BUILD_QTUI_MODULE) K3D_CHECK(K3D_BUILD_TIFF_IO_MODULE REQUIRES K3D_TIFF_FOUND RESOURCE "libtiff") K3D_CHECK(K3D_ENABLE_NLS REQUIRES K3D_INTL_FOUND RESOURCE "intl") K3D_CHECK(K3D_ENABLE_PARALLEL REQUIRES K3D_TBB_FOUND RESOURCE "Threading Building Blocks" URL "http://threadingbuildingblocks.org") K3D_CHECK(K3D_ENABLE_PROFILING REQUIRES K3D_GPERFTOOLS_FOUND RESOURCE "GPerftools" URL "https://github.com/gperftools/gperftools") K3D_CHECK(K3D_ENABLE_PYTHON REQUIRES K3D_PYTHON_FOUND RESOURCE "Python") # Setup testing SET(BUILD_TESTING ${K3D_ENABLE_TESTING} CACHE INTERNAL "" FORCE) INCLUDE(CTest) IF(K3D_ENABLE_TESTING) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake @ONLY) ENDIF() # Capture system configuration INCLUDE(K3DSystemConfiguration) # Win32 configuration IF(WIN32 AND NOT MSVC) SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-runtime-pseudo-reloc" CACHE STRING "" FORCE) SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols" CACHE STRING "" FORCE) ENDIF() # Setup output directories ... SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/bin) SET(K3D_LIBDIR lib) # Allows us to handle 64-bit libs if/when it becomes necessary. IF(APPLE AND K3D_ENABLE_OSX_BUNDLE) SET(K3D_BUNDLE_DIRECTORY ${k3d_BINARY_DIR}/K-3D.app/Contents) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${K3D_BUNDLE_DIRECTORY}/${K3D_LIBDIR}) SET(K3D_RUNTIME_OUTPUT_DIRECTORY ${K3D_BUNDLE_DIRECTORY}/MacOS) SET(K3D_MODULE_OUTPUT_DIRECTORY ${K3D_BUNDLE_DIRECTORY}/${K3D_LIBDIR}/k3d/plugins) SET(K3D_SHARE_OUTPUT_DIRECTORY ${K3D_BUNDLE_DIRECTORY}/share) ELSEIF(WIN32) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/bin) SET(K3D_RUNTIME_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/bin) SET(K3D_MODULE_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/${K3D_LIBDIR}/k3d/plugins) SET(K3D_SHARE_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/share) ELSE() SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/${K3D_LIBDIR}) SET(K3D_RUNTIME_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/bin) SET(K3D_MODULE_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/${K3D_LIBDIR}/k3d/plugins) SET(K3D_SHARE_OUTPUT_DIRECTORY ${k3d_BINARY_DIR}/share) ENDIF() # Setup subdirectories ... K3D_ADD_SUBDIRECTORY(gendef REQUIRES MSVC) ADD_SUBDIRECTORY(k3dsdk) ADD_SUBDIRECTORY(resource-compiler) ADD_SUBDIRECTORY(application) ADD_SUBDIRECTORY(desktop) ADD_SUBDIRECTORY(make-module-proxy) ADD_SUBDIRECTORY(renderjob) ADD_SUBDIRECTORY(renderframe) ADD_SUBDIRECTORY(sl2xml) ADD_SUBDIRECTORY(uuidgen) ADD_SUBDIRECTORY(modules) ADD_SUBDIRECTORY(share) K3D_ADD_SUBDIRECTORY(tests REQUIRES K3D_ENABLE_TESTING) K3D_ADD_SUBDIRECTORY(po REQUIRES K3D_ENABLE_NLS) ADD_SUBDIRECTORY(bugs) K3D_ADD_SUBDIRECTORY(docs REQUIRES K3D_BUILD_DOCS) ADD_SUBDIRECTORY(web) K3D_ADD_SUBDIRECTORY(distribution REQUIRES K3D_ENABLE_DISTRIBUTION) # Hide some cruft ... MARK_AS_ADVANCED(A2X_COMMAND) MARK_AS_ADVANCED(AQSIS_COMMAND) MARK_AS_ADVANCED(AQSL_COMMAND) MARK_AS_ADVANCED(ASCIIDOC_COMMAND) MARK_AS_ADVANCED(ASSISTANT_COMMAND) MARK_AS_ADVANCED(ASTYLE_COMMAND) MARK_AS_ADVANCED(Aqsis_DIR) MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY) MARK_AS_ADVANCED(CMAKE_EXECUTABLE_FORMAT) MARK_AS_ADVANCED(CMAKE_LIBRARY_OUTPUT_DIRECTORY) MARK_AS_ADVANCED(CMAKE_OSX_ARCHITECTURES) MARK_AS_ADVANCED(CMAKE_OSX_DEPLOYMENT_TARGET) MARK_AS_ADVANCED(CMAKE_OSX_SYSROOT) MARK_AS_ADVANCED(CMAKE_RUNTIME_OUTPUT_DIRECTORY) MARK_AS_ADVANCED(CMAKE_USE_CHRPATH) MARK_AS_ADVANCED(CUDA_FOUND CUDA_COMPILER CUDA_RUNTIME_LIBRARY) MARK_AS_ADVANCED(DART_TESTING_TIMEOUT) MARK_AS_ADVANCED(DITZ_EXECUTABLE) MARK_AS_ADVANCED(GDB_COMMAND) MARK_AS_ADVANCED(GIT_COMMAND) MARK_AS_ADVANCED(K3D_AQSIS_COMMAND) MARK_AS_ADVANCED(K3D_BOOST_INCLUDE_DIR) MARK_AS_ADVANCED(K3D_BOOST_LIBRARY_DIR) MARK_AS_ADVANCED(K3D_BOOST_USE_MULTITHREADED) MARK_AS_ADVANCED(K3D_ENABLE_PARALLEL) MARK_AS_ADVANCED(K3D_ENABLE_PROFILING) MARK_AS_ADVANCED(K3D_ENABLE_SYMBOL_VISIBILITY) MARK_AS_ADVANCED(K3D_EXTRA_GDB_ARGUMENTS) MARK_AS_ADVANCED(K3D_EXTRA_QT_PLUGINS) MARK_AS_ADVANCED(K3D_GTK_DIR) MARK_AS_ADVANCED(K3D_INTLTOOL_UPDATE) MARK_AS_ADVANCED(K3D_MACPORTS_DIR) MARK_AS_ADVANCED(K3D_MINGW_GCC) MARK_AS_ADVANCED(K3D_MSGFMT) MARK_AS_ADVANCED(K3D_MSGMERGE) MARK_AS_ADVANCED(K3D_PYTHON_COMMAND) MARK_AS_ADVANCED(K3D_PYTHON_LIBRARY) MARK_AS_ADVANCED(K3D_SOURCEFORGE_USERNAME) MARK_AS_ADVANCED(K3D_XGETTEXT) MARK_AS_ADVANCED(MAKO_COMMAND) MARK_AS_ADVANCED(QCOLLECTIONGENERATOR_COMMAND) MARK_AS_ADVANCED(QHELPGENERATOR_COMMAND) MARK_AS_ADVANCED(QT_MKSPECS_DIR) MARK_AS_ADVANCED(QT_PLUGINS_DIR) MARK_AS_ADVANCED(QT_QMAKE_EXECUTABLE) MARK_AS_ADVANCED(QT_QTMOTIF_INCLUDE_DIR) MARK_AS_ADVANCED(QT_QTMOTIF_LIBRARY_DEBUG) MARK_AS_ADVANCED(QT_QTMOTIF_LIBRARY_RELEASE) MARK_AS_ADVANCED(QT_X11_X11_LIBRARY) MARK_AS_ADVANCED(QT_X11_Xext_LIBRARY) MARK_AS_ADVANCED(QT_X11_m_LIBRARY) MARK_AS_ADVANCED(RNDR_COMMAND) MARK_AS_ADVANCED(RSVG_COMMAND) MARK_AS_ADVANCED(SDRC_COMMAND) ================================================ FILE: COPYING ================================================ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details. The hypothetical commands 'show w' and 'show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than 'show w' and 'show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program 'Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ================================================ FILE: CTestConfig.cmake ================================================ SET(CTEST_PROJECT_NAME "K-3D") SET(CTEST_NIGHTLY_START_TIME "02:00:00 MST") SET(CTEST_DROP_METHOD "http") SET(CTEST_DROP_SITE "www.k-3d.org") SET(CTEST_DROP_LOCATION "/cdash/submit.php?project=K-3D") SET(CTEST_DROP_SITE_CDASH TRUE) ================================================ FILE: CTestCustom.cmake.in ================================================ SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 400) SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 400) SET(CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} "[/]usr[/]include[/]c[+][+][/]4.3[/]backward[/]backward_warning.h[:]33[:]2" ) ================================================ FILE: INSTALL ================================================ This is K-3D, the free-as-in-freedom 3D modeling, animation, and rendering system. You will need CMake, http://www.cmake.org, to build K-3D on all platforms. For detailed, platform-specific instructions on how to build and install K-3D, please visit the "Getting Started" section of the K-3D website, located at: http://www.k-3d.org/wiki/Getting_Started Thank you, The K-3D Team ================================================ FILE: README ================================================ This is K-3D, the free-as-in-freedom 3D modeling, animation, and rendering system. For instructions on building the project, refer to INSTALL, located within this directory. The project is licensed under the GNU General Public License. A copy of the license is located in COPYING. Contributors to the project are listed in the AUTHORS file. For further information, visit the K-3D web site: http://www.k-3d.org Thank You, The K-3D Team ================================================ FILE: application/CMakeLists.txt ================================================ PROJECT(application) CONFIGURE_FILE(config.h.in config.h) CONFIGURE_FILE(Info.plist.in Info.plist @ONLY) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) INCLUDE_DIRECTORIES(${k3d_SOURCE_DIR}) INCLUDE_DIRECTORIES(${k3dsdk_BINARY_DIR}) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_GLIBMM_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_SIGC_INCLUDE_DIRS}) LINK_DIRECTORIES(${K3D_SIGC_LIB_DIRS}) SET(SOURCES k3d_main.cpp) IF(WIN32 AND MSVC) SET(SOURCES ${SOURCES} winmain.cpp) ELSE(WIN32 AND MSVC) SET(SOURCES ${SOURCES} main.cpp) ENDIF(WIN32 AND MSVC) IF(WIN32) IF(MINGW) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon.o COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/icon.rc -o ${CMAKE_CURRENT_BINARY_DIR}/icon.o ) SET(SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/icon.o) ELSE(MINGW) SET(SOURCES ${SOURCES} icon.rc) ENDIF(MINGW) ENDIF(WIN32) ADD_EXECUTABLE(k3d WIN32 ${SOURCES}) SET_TARGET_PROPERTIES(k3d PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${K3D_RUNTIME_OUTPUT_DIRECTORY} ) TARGET_LINK_LIBRARIES(k3d k3dsdk k3dsdk-opengl ) IF(UNIX AND NOT APPLE) SET_TARGET_PROPERTIES(k3d PROPERTIES LINK_FLAGS -Wl,-E) ENDIF() IF(K3D_ENABLE_NLS) INCLUDE_DIRECTORIES(${K3D_INTL_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(k3d ${K3D_INTL_LIBS}) ENDIF(K3D_ENABLE_NLS) IF(APPLE AND K3D_ENABLE_OSX_BUNDLE) ADD_CUSTOM_COMMAND( DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Info.plist COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/Info.plist ${K3D_BUNDLE_DIRECTORY} OUTPUT ${K3D_BUNDLE_DIRECTORY}/Info.plist ) ADD_CUSTOM_COMMAND( DEPENDS k3d COMMAND ${CMAKE_COMMAND} -E make_directory ${K3D_BUNDLE_DIRECTORY}/Resources OUTPUT ${K3D_BUNDLE_DIRECTORY}/Resources ) ADD_CUSTOM_COMMAND( DEPENDS ${K3D_BUNDLE_DIRECTORY}/Resources ${share_SOURCE_DIR}/k3d/icons/k3d.icns COMMAND ${CMAKE_COMMAND} -E copy ${share_SOURCE_DIR}/k3d/icons/k3d.icns ${K3D_BUNDLE_DIRECTORY}/Resources/K-3D.icns OUTPUT ${K3D_BUNDLE_DIRECTORY}/Resources/K-3D.icns ) ADD_CUSTOM_TARGET(bundle ALL DEPENDS ${K3D_BUNDLE_DIRECTORY}/Info.plist ${K3D_BUNDLE_DIRECTORY}/Resources/K-3D.icns ) ENDIF() # Setup convenience targets for running the application out of the build directory ... FIND_PROGRAM(GDB_COMMAND gdb) SET(K3D_EXTRA_GDB_ARGUMENTS "" CACHE STRING "Extra arguments to pass to gdb for debugging.") GET_TARGET_PROPERTY(K3D_COMMAND k3d LOCATION) SET(K3D_DEFAULT_ARGUMENTS "") LIST(APPEND K3D_DEFAULT_ARGUMENTS "--color") LIST(APPEND K3D_DEFAULT_ARGUMENTS "--log-level=debug") LIST(APPEND K3D_DEFAULT_ARGUMENTS "--add-path=${k3d_BINARY_DIR}/bin") LIST(APPEND K3D_DEFAULT_ARGUMENTS "--locale=${k3d_BINARY_DIR}/po") SET(K3D_GDB_COMMAND_LINE ${GDB_COMMAND} ${K3D_EXTRA_GDB_ARGUMENTS}) SET(K3D_NGUI_COMMAND_LINE ${K3D_COMMAND} ${K3D_DEFAULT_ARGUMENTS} --ui=ngui) SET(K3D_NUI_COMMAND_LINE ${K3D_COMMAND} ${K3D_DEFAULT_ARGUMENTS} --ui=nui) SET(K3D_PYUI_COMMAND_LINE ${K3D_COMMAND} ${K3D_DEFAULT_ARGUMENTS} --ui=pyui) SET(K3D_QTUI_COMMAND_LINE ${K3D_COMMAND} ${K3D_DEFAULT_ARGUMENTS} --ui=qtui) K3D_ADD_CUSTOM_TARGET(run-ngui REQUIRES K3D_BUILD_NGUI_MODULE COMMAND ${K3D_NGUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-ngui-gdb REQUIRES K3D_BUILD_NGUI_MODULE GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} --args ${K3D_NGUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-nui REQUIRES K3D_BUILD_NUI_MODULE COMMAND ${K3D_NUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-nui-gdb REQUIRES K3D_BUILD_NUI_MODULE GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} --args ${K3D_NUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-pyui REQUIRES K3D_BUILD_PYUI_MODULE COMMAND ${K3D_PYUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-pyui-gdb REQUIRES K3D_BUILD_PYUI_MODULE GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} --args ${K3D_PYUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-qtui REQUIRES K3D_BUILD_QTUI_MODULE COMMAND ${K3D_QTUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-qtui-gdb REQUIRES K3D_BUILD_QTUI_MODULE GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} --args ${K3D_QTUI_COMMAND_LINE}) IF(K3D_BUILD_NGUI_MODULE) K3D_ADD_CUSTOM_TARGET(run REQUIRES K3D_BUILD_NGUI_MODULE COMMAND ${K3D_NGUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-gdb REQUIRES K3D_BUILD_NGUI_MODULE GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} --args ${K3D_NGUI_COMMAND_LINE}) ELSEIF(K3D_BUILD_QTUI_MODULE) K3D_ADD_CUSTOM_TARGET(run REQUIRES K3D_BUILD_QTUI_MODULE COMMAND ${K3D_QTUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-gdb REQUIRES K3D_BUILD_QTUI_MODULE GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} --args ${K3D_QTUI_COMMAND_LINE}) ELSEIF(K3D_BUILD_PYUI_MODULE) K3D_ADD_CUSTOM_TARGET(run REQUIRES K3D_BUILD_PYUI_MODULE COMMAND ${K3D_PYUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-gdb REQUIRES K3D_BUILD_PYUI_MODULE GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} --args ${K3D_PYUI_COMMAND_LINE}) ELSEIF(K3D_BUILD_NUI_MODULE) K3D_ADD_CUSTOM_TARGET(run REQUIRES K3D_BUILD_NUI_MODULE COMMAND ${K3D_NUI_COMMAND_LINE}) K3D_ADD_CUSTOM_TARGET(run-gdb REQUIRES K3D_BUILD_NUI_MODULE GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} --args ${K3D_NUI_COMMAND_LINE}) ENDIF() K3D_ADD_CUSTOM_TARGET(run-gdb-core REQUIRES GDB_COMMAND COMMAND ${K3D_GDB_COMMAND_LINE} ${K3D_COMMAND} core) #ADD_CUSTOM_TARGET(run-valgrind COMMAND valgrind -v ${k3d_BINARY_DIR}/bin/k3d ${K3D_DEFAULT_ARGUMENTS} --ui=${K3D_NGUI_BINARY}) #ADD_CUSTOM_TARGET(run-strace COMMAND strace ${k3d_BINARY_DIR}/bin/k3d ${K3D_DEFAULT_ARGUMENTS} --ui=${K3D_NGUI_BINARY}) INSTALL(TARGETS k3d DESTINATION bin) ================================================ FILE: application/Info.plist.in ================================================ CFBundleDevelopmentRegion English CFBundleExecutable K-3D CFBundleGetInfoString @K3D_VERSION@, @K3D_COPYRIGHT@ CFBundleIconFile K-3D CFBundleIdentifier org.k-3d.K-3D CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType APPL CFBundleShortVersionString @K3D_VERSION@ CFBundleSignature K-3D CFBundleVersion @K3D_VERSION@ NSHumanReadableCopyright @K3D_COPYRIGHT@ ================================================ FILE: application/config.h.in ================================================ #ifndef APPLICATION_CONFIG_H #define APPLICATION_CONFIG_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #cmakedefine K3D_ENABLE_OSX_BUNDLE #define K3D_LIBDIR "@K3D_LIBDIR@" #endif // !APPLICATION_CONFIG_H ================================================ FILE: application/icon.rc ================================================ IDI_ICON1 ICON DISCARDABLE "../share/k3d/icons/k3d.ico" ================================================ FILE: application/k3d_main.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include // Specialized K-3D interfaces for embedding #include #include #include #include #include #include // Standard K-3D interfaces #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef K3D_API_WIN32 #include #endif // K3D_API_WIN32 namespace { /// Defines storage for parsed command-line arguments typedef std::vector > arguments_t; ///////////////////////////////////////////////////////////////////////////// // User options specified on the command line k3d::bool_t g_show_timestamps = false; k3d::bool_t g_show_process = false; k3d::bool_t g_syslog = false; k3d::bool_t g_color_level = false; k3d::log_level_t g_minimum_log_level = k3d::K3D_LOG_LEVEL_WARNING; k3d::filesystem::path g_default_ngui_path; k3d::filesystem::path g_default_nui_path; k3d::filesystem::path g_default_options_path; k3d::filesystem::path g_default_pyui_path; k3d::filesystem::path g_default_qtui_path; k3d::filesystem::path g_default_shader_cache_path; k3d::filesystem::path g_default_share_path; k3d::filesystem::path g_default_tutorials_path; k3d::filesystem::path g_default_user_interface_path; k3d::string_t g_default_plugin_paths; k3d::filesystem::path g_override_locale_path; k3d::filesystem::path g_options_path; k3d::filesystem::path g_shader_cache_path; k3d::filesystem::path g_share_path; k3d::filesystem::path g_user_interface_path; k3d::string_t g_plugin_paths; k3d::ievent_loop* g_user_interface = 0; ///////////////////////////////////////////////////////////////////////////// // handle_error void handle_error(const k3d::string_t& Message, k3d::bool_t& Quit, k3d::bool_t& Error) { Quit = true; Error = true; throw std::runtime_error(Message); } ///////////////////////////////////////////////////////////////////////////// // startup_message_handler /// Called during application startup to display progress to the user void startup_message_handler(const k3d::string_t& Message) { k3d::log() << info << Message << std::endl; if(g_user_interface) g_user_interface->startup_message_handler(Message); } ///////////////////////////////////////////////////////////////////////////// // exit_request_handler /// Called when the user wants to shut everything down k3d::bool_t exit_request_handler() { if(g_user_interface) g_user_interface->stop_event_loop(); return true; } ///////////////////////////////////////////////////////////////////////////// // set_default_options /// Sets-up default user options for various platforms void set_default_options(k3d::bool_t& Quit, k3d::bool_t& Error) { // Setup default paths based on the location of the executable ... const k3d::filesystem::path executable_dir = k3d::system::executable_path().branch_path(); const k3d::filesystem::path user_dir = k3d::system::get_home_directory() / k3d::filesystem::generic_path(".k3d"); g_default_ngui_path = executable_dir / k3d::filesystem::generic_path("../" K3D_LIBDIR "/k3d/plugins/k3d-ngui.module"); g_default_nui_path = executable_dir / k3d::filesystem::generic_path("../" K3D_LIBDIR "/k3d/plugins/k3d-nui.module"); g_default_options_path = user_dir / k3d::filesystem::generic_path("options.k3d"); g_default_plugin_paths = (executable_dir / k3d::filesystem::generic_path("../" K3D_LIBDIR "/k3d/plugins")).native_filesystem_string(); g_default_pyui_path = executable_dir / k3d::filesystem::generic_path("../" K3D_LIBDIR "/k3d/plugins/k3d-pyui.module"); g_default_qtui_path = executable_dir / k3d::filesystem::generic_path("../" K3D_LIBDIR "/k3d/plugins/k3d-qtui.module"); g_default_shader_cache_path = user_dir / k3d::filesystem::generic_path("shadercache"); g_default_share_path = executable_dir / k3d::filesystem::generic_path("../share/k3d"); #ifdef K3D_ENABLE_OSX_BUNDLE g_default_user_interface_path = g_default_qtui_path; #else g_default_user_interface_path = g_default_ngui_path; #endif // Setup path options based on the defaults ... g_options_path = g_default_options_path; g_plugin_paths = g_default_plugin_paths; g_shader_cache_path = g_default_shader_cache_path; g_share_path = g_default_share_path; g_user_interface_path = g_default_user_interface_path; // Optionally override paths using environment variables ... if(!k3d::system::getenv("K3D_LOCALE_PATH").empty()) g_override_locale_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(k3d::system::getenv("K3D_LOCALE_PATH"))); if(!k3d::system::getenv("K3D_OPTIONS_PATH").empty()) g_options_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(k3d::system::getenv("K3D_OPTIONS_PATH"))); if(!k3d::system::getenv("K3D_PLUGIN_PATHS").empty()) g_plugin_paths = k3d::system::getenv("K3D_PLUGIN_PATHS"); if(!k3d::system::getenv("K3D_SHADER_CACHE_PATH").empty()) g_shader_cache_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(k3d::system::getenv("K3D_SHADER_CACHE_PATH"))); if(!k3d::system::getenv("K3D_SHARE_PATH").empty()) g_share_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(k3d::system::getenv("K3D_SHARE_PATH"))); if(!k3d::system::getenv("K3D_USER_INTERFACE_PATH").empty()) g_user_interface_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(k3d::system::getenv("K3D_USER_INTERFACE_PATH"))); #ifdef K3D_API_WIN32 // Add the executable directory to PATH k3d::system::setenv("PATH", executable_dir.native_filesystem_string() + ";" + k3d::system::getenv("PATH")); #endif // K3D_API_WIN32 } ///////////////////////////////////////////////////////////////////////////// // parse_log_arguments /// Looks for command-line arguments that apply to logging (so we can set them up right away) const arguments_t parse_log_arguments(const arguments_t& Arguments, k3d::bool_t& Quit, k3d::bool_t& Error) { // Keep track of "unused" options ... arguments_t unused; for(arguments_t::const_iterator argument = Arguments.begin(); argument != Arguments.end(); ++argument) { if(argument->string_key == "show-timestamps") { g_show_timestamps = true; } else if(argument->string_key == "show-process") { g_show_process = true; } else if(argument->string_key == "syslog") { g_syslog = true; } else if(argument->string_key == "color") { g_color_level = true; } else if(argument->string_key == "no-color") { g_color_level = false; } else if(argument->string_key == "log-level") { if(argument->value[0] == "warning") g_minimum_log_level = k3d::K3D_LOG_LEVEL_WARNING; else if(argument->value[0] == "information") g_minimum_log_level = k3d::K3D_LOG_LEVEL_INFO; else if(argument->value[0] == "debug") g_minimum_log_level = k3d::K3D_LOG_LEVEL_DEBUG; else { handle_error("Valid values for the --log-level option are \"warning\", \"information\", or \"debug\"", Quit, Error); return arguments_t(); } } else { unused.push_back(*argument); } } k3d::log_show_timestamps(g_show_timestamps); k3d::log_set_tag(g_show_process ? "[k3d]" : k3d::string_t()); k3d::log_color_level(g_color_level); k3d::log_show_level(true); k3d::log_syslog(g_syslog); k3d::log_minimum_level(g_minimum_log_level); return unused; } ///////////////////////////////////////////////////////////////////////////// // parse_startup_arguments /// Handles "normal" command-line arguments that specify initial application state const arguments_t parse_startup_arguments(const arguments_t& Arguments, k3d::bool_t& Quit, k3d::bool_t& Error) { // We return any "unused" options ... arguments_t unused; // For each command-line argument ... for(arguments_t::const_iterator argument = Arguments.begin(); argument != Arguments.end(); ++argument) { if(argument->string_key == "batch") { k3d::set_batch_mode(true); } else if(argument->string_key == "ui") { if(argument->value[0] == "nui" || argument->value[0] == "none") g_user_interface_path = g_default_nui_path; else if(argument->value[0] == "ngui") g_user_interface_path = g_default_ngui_path; else if(argument->value[0] == "qtui") g_user_interface_path = g_default_qtui_path; else if(argument->value[0] == "pyui") g_user_interface_path = g_default_pyui_path; else g_user_interface_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(argument->value[0])); } else if(argument->string_key == "plugins") { g_plugin_paths = argument->value[0]; g_plugin_paths = k3d::replace_all("&", g_default_plugin_paths, g_plugin_paths); } else if(argument->string_key == "shadercache") { g_shader_cache_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(argument->value[0])); } else if(argument->string_key == "share") { g_share_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(argument->value[0])); } else if(argument->string_key == "options") { g_options_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(argument->value[0])); } else if(argument->string_key == "add-path") { #ifdef K3D_API_WIN32 k3d::system::setenv("PATH", argument->value[0] + ";" + k3d::system::getenv("PATH")); #else // K3D_API_WIN32 k3d::system::setenv("PATH", argument->value[0] + ":" + k3d::system::getenv("PATH")); #endif // !K3D_API_WIN32 } else if(argument->string_key == "disable-gl-extension") { k3d::gl::extension::disable(argument->value[0]); } else if(argument->string_key == "enable-gl-extension") { k3d::gl::extension::enable(argument->value[0]); } else if(argument->string_key == "setenv") { k3d::system::setenv(argument->value[0]); } else if(argument->string_key == "locale") { g_override_locale_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(argument->value[0])); } else { unused.push_back(*argument); } } return unused; } ///////////////////////////////////////////////////////////////////////////// // check_dependencies /// Checks for any runtime resources required to continue program execution void check_dependencies(k3d::bool_t& Quit, k3d::bool_t& Error) { k3d::log() << info << "package: " << K3D_PACKAGE << std::endl; k3d::log() << info << "version: " << K3D_VERSION << std::endl; k3d::log() << info << "platform: " << K3D_HOST << std::endl; k3d::log() << info << "compiler: " << K3D_COMPILER_NAME << std::endl; k3d::log() << info << "build time: " << __DATE__ << " " << __TIME__ << " local" << std::endl; #ifdef K3D_HAVE_EXPAT k3d::log() << info << "xml parser: expat" << std::endl; #elif defined K3D_HAVE_LIBXML2 k3d::log() << info << "xml parser: libxml2" << std::endl; #else k3d::log() << warning "xml parser: unknown" << std::endl; #endif k3d::log() << info << "executable: " << k3d::system::executable_path().native_console_string() << std::endl; k3d::log() << info << "options file: " << g_options_path.native_console_string() << std::endl; k3d::log() << info << "plugin path(s): " << g_plugin_paths << std::endl; k3d::log() << info << "shader cache path: " << g_shader_cache_path.native_console_string() << std::endl; k3d::log() << info << "share path: " << g_share_path.native_console_string() << std::endl; k3d::log() << info << "user interface: " << g_user_interface_path.native_console_string() << std::endl; k3d::log() << info << "home directory: " << k3d::system::get_home_directory().native_console_string() << std::endl; k3d::log() << info << "temp directory: " << k3d::system::get_temp_directory().native_console_string() << std::endl; // The options file must be specified and must exist ... if(g_options_path.empty()) { handle_error("Options path must be specified using --options .", Quit, Error); return; } k3d::filesystem::create_directories(g_options_path.branch_path()); if(!k3d::filesystem::exists(g_options_path.branch_path())) { handle_error("Options directory [" + g_options_path.branch_path().native_console_string() + "] does not exist and could not be created.", Quit, Error); return; } // Every specified plugin path must exist ... const k3d::system::paths_t plugin_paths = k3d::system::decompose_path_list(g_plugin_paths); for(k3d::system::paths_t::const_iterator plugin_path = plugin_paths.begin(); plugin_path != plugin_paths.end(); ++plugin_path) { if(!k3d::filesystem::exists(*plugin_path)) { handle_error("Plugin path [" + plugin_path->native_console_string() + "] does not exist.", Quit, Error); return; } } // The shader cache path must be specified, and must already exist or be successfully created ... if(g_shader_cache_path.empty()) { handle_error("Shader cache path must be specified using --shadercache .", Quit, Error); return; } k3d::filesystem::create_directories(g_shader_cache_path); if(!k3d::filesystem::exists(g_shader_cache_path)) { handle_error("Shader cache path [" + g_shader_cache_path.native_console_string() + "] does not exist and could not be created.", Quit, Error); return; } // The share path must exist ... if(!k3d::filesystem::exists(g_share_path)) { handle_error("Share path [" + g_share_path.native_console_string() + "] does not exist.", Quit, Error); return; } } ///////////////////////////////////////////////////////////////////////////// // create_user_interface /// Instantiates the (optional) user interface plugin void create_user_interface(k3d::plugin_factory_collection& Plugins, k3d::bool_t& Quit, k3d::bool_t& Error) { const k3d::string_t module_name = g_user_interface_path.native_console_string(); if(!g_user_interface_path.empty() && !k3d::filesystem::exists(g_user_interface_path)) { handle_error("UI plugin module [" + module_name + "] does not exist", Quit, Error); return; } Plugins.load_module(g_user_interface_path, k3d::plugin_factory_collection::IGNORE_PROXIES); if(Plugins.factories().empty()) { handle_error("UI plugin module [" + module_name + "] does not contain any K-3D plugins", Quit, Error); return; } if(Plugins.factories().size() > 1) { handle_error("UI plugin module [" + module_name + "] contains more than one K-3D plugin", Quit, Error); return; } g_user_interface = k3d::plugin::create(**Plugins.factories().begin()); if(!g_user_interface) { handle_error("UI plugin module [" + module_name + "] does not contain a user interface plugin", Quit, Error); return; } if(!dynamic_cast(g_user_interface)) { delete g_user_interface; g_user_interface = 0; handle_error("UI plugin module [" + module_name + "] does not implement k3d::iuser_interface", Quit, Error); return; } } ///////////////////////////////////////////////////////////////////////////// // load_modules /// Loads (statically- or dynamically-linked) plugin modules void load_modules(k3d::plugin_factory_collection& Plugins, k3d::bool_t& Quit, k3d::bool_t& Error) { Plugins.load_modules(g_plugin_paths, true, k3d::plugin_factory_collection::LOAD_PROXIES); } ///////////////////////////////////////////////////////////////////////////// // parse_runtime_arguments /// Handles any command-line options that run once startup is complete (e.g. running a script / tutorial) const arguments_t parse_runtime_arguments(const arguments_t& Arguments, k3d::bool_t& Quit, k3d::bool_t& Error, k3d::iapplication& Application) { // Keep track of "unused" arguments ... arguments_t unused; // Provide a single script context object that will be used by all scripts, so they can share state ... k3d::iscript_engine::context context; // For each command-line argument ... for(arguments_t::const_iterator argument = Arguments.begin(); argument != Arguments.end(); ++argument) { if(argument->string_key == "script" || argument->string_key == "script-file") { k3d::bool_t recognized = false; k3d::bool_t executed = false; k3d::string_t script_name; k3d::script::code script_code(""); if(argument->string_key == "script") { script_name = "COMMANDLINE"; script_code = k3d::script::code(argument->value[0]); } else if(argument->string_key == "script-file") { if(argument->value[0] == "-") { script_name = "STDIN"; script_code = k3d::script::code(std::cin); } else { script_name = argument->value[0]; const k3d::filesystem::path script_path = k3d::filesystem::native_path(k3d::ustring::from_utf8(script_name)); if(!k3d::filesystem::exists(script_path)) { k3d::log() << error << "Script [" << script_name << "] doesn't exist" << std::endl; Quit = true; Error = true; return arguments_t(); } k3d::log() << info << "Running script [" << script_name << "]" << std::endl; k3d::filesystem::igzstream script_stream(script_path); script_code = k3d::script::code(script_stream); } } k3d::script::execute(script_code, script_name, context, recognized, executed); if(!recognized) { k3d::log() << error << "Couldn't recognize scripting language for script [ " << script_name << " ]" << std::endl; Quit = true; Error = true; return arguments_t(); } if(!executed) { k3d::log() << error << "Error executing script [ " << script_name << " ]" << std::endl; Quit = true; Error = true; return arguments_t(); } } else if(argument->string_key == "list-gl-extensions") { const std::set extensions = k3d::gl::extension::list(); for(std::set::const_iterator extension = extensions.begin(); extension != extensions.end(); ++extension) std::cout << *extension << "\n"; Quit = true; return arguments_t(); } else if(argument->string_key == "exit") { Quit = true; return arguments_t(); } else { unused.push_back(*argument); } } return unused; } ///////////////////////////////////////////////////////////////////////////// // check_unused_arguments /// Handles any arguments that weren't recognized by either the application or the user interface plugin void check_unused_arguments(const arguments_t& Arguments, k3d::bool_t& Quit, k3d::bool_t& Error) { // If there aren't any leftover arguments, we're done ... if(Arguments.empty()) return; k3d::log() << warning << "The following unknown command-line arguments will be ignored: " << std::endl; for(arguments_t::const_iterator argument = Arguments.begin(); argument != Arguments.end(); ++argument) k3d::log() << warning << "name: " << argument->string_key << " value: " << argument->value[0] << std::endl; } ///////////////////////////////////////////////////////////////////////////// // create_auto_start_plugins typedef std::vector auto_start_plugins_t; void create_auto_start_plugins(auto_start_plugins_t& Plugins) { const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); for(k3d::plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { k3d::iplugin_factory::metadata_t metadata = (**factory).metadata(); if(!metadata.count("k3d:application-start")) continue; k3d::log() << info << "Creating plugin [" << (**factory).name() << "] via k3d:application-start" << std::endl; k3d::iunknown* const plugin = k3d::plugin::create(**factory); if(!plugin) { k3d::log() << error << "Error creating plugin [" << (**factory).name() << "] via k3d:application-start" << std::endl; continue; } Plugins.push_back(plugin); if(k3d::iscripted_action* const scripted_action = dynamic_cast(plugin)) { k3d::iscript_engine::context context; context["command"] = k3d::string_t("startup"); scripted_action->execute(context); } } } ///////////////////////////////////////////////////////////////////////////// // delete_auto_start_plugins void delete_auto_start_plugins(auto_start_plugins_t& Plugins) { for(auto_start_plugins_t::iterator plugin = Plugins.begin(); plugin != Plugins.end(); ++plugin) { if(k3d::iscripted_action* const scripted_action = dynamic_cast(*plugin)) { k3d::iscript_engine::context context; context["command"] = k3d::string_t("shutdown"); scripted_action->execute(context); } } for(auto_start_plugins_t::iterator plugin = Plugins.begin(); plugin != Plugins.end(); ++plugin) delete *plugin; Plugins.clear(); } } // namespace int k3d_main(std::vector raw_arguments) { // Append extra options from the environment ... std::istringstream buffer(k3d::system::getenv("K3D_EXTRA_OPTIONS")); std::copy(std::istream_iterator(buffer), std::istream_iterator(), std::back_inserter(raw_arguments)); try { k3d::bool_t quit = false; k3d::bool_t error = false; // Set default values for all user-configurable options ... set_default_options(quit, error); if(quit) return error ? 1 : 0; // Parse command-line options ... boost::program_options::options_description description("K-3D options"); description.add_options() ("add-path", boost::program_options::value(), "Prepend a path to the PATH environment variable at runtime.") ("batch", "Enable batch (no user intervention) mode.") ("color", "Color-code log messages based on their level.") ("disable-gl-extension", boost::program_options::value(), "Disables the given OpenGL extension.") ("enable-gl-extension", boost::program_options::value(), "Enables the given OpenGL extension.") ("exit", "Exits the program (useful after running scripts in batch mode.") ("help,h", "Prints this help message and exits.") ("list-gl-extensions", "List available OpenGL extensions and exit.") #ifdef K3D_ENABLE_NLS ("locale", boost::program_options::value(), "Overrides the path for loading locales") #endif // K3D_ENABLE_NLS ("log-level", boost::program_options::value(), "Specifies the minimum message priority to log - valid values are \"warning\", \"information\", \"debug\" [default: warning].") ("no-color", "Disable color-coding of log messages based on their level.") ("options", boost::program_options::value(), "Overrides the filepath for storing user options [default: /home/tshead/.k3d/options.k3d].") ("plugins", boost::program_options::value(), "Overrides the path(s) for loading plugin libraries [default: /usr/local/k3d/lib/k3d].") ("script,e", boost::program_options::value(), "Executes the given script text after startup.") ("script-file,f", boost::program_options::value(), "Executes the given script file after startup (use - for stdin).") ("setenv", boost::program_options::value(), "Set an environment variable using name=value syntax.") ("shadercache", boost::program_options::value(), "Overrides the path for storing compiled shaders [default: /home/tshead/.k3d/shadercache].") ("share", boost::program_options::value(), "Overrides the path for loading shared data files [default: /usr/local/k3d/share/k3d].") ("show-process", "Prints the process name next to log messages.") ("show-timestamps", "Prints timestamps next to log messages.") ("syslog", "Logs messages to syslog.") ("ui,u", boost::program_options::value(), "Specifies the user interface plugin to use - valid values are a plugin path, \"nui\", \"ngui\", \"qtui\", or \"pyui\" [default: qtui].") ("user-interface-help,H", "Prints user interface help message and exits.") ("version", "Prints program version information and exits.") ; arguments_t arguments = boost::program_options::command_line_parser(raw_arguments) .options(description) .allow_unregistered() .style( boost::program_options::command_line_style::allow_long | boost::program_options::command_line_style::allow_short | boost::program_options::command_line_style::allow_dash_for_short | boost::program_options::command_line_style::long_allow_adjacent | boost::program_options::command_line_style::long_allow_next | boost::program_options::command_line_style::short_allow_adjacent | boost::program_options::command_line_style::short_allow_next ) .run() .options; // Handle arguments that cause an immediate exit ... for(arguments_t::const_iterator argument = arguments.begin(); argument != arguments.end(); ++argument) { if(argument->string_key == "help") { std::cout << description << "\n"; return 0; } else if(argument->string_key == "version") { std::cout << "K-3D Version " << K3D_VERSION << "\n"; std::cout << K3D_COPYRIGHT << " See the AUTHORS file for contributors.\n"; std::cout << "Licensed under the GNU General Public License. See the COPYING file for details.\n"; std::cout << "K-3D home page: http://k3d.sourceforge.net\n"; std::cout << "Bug reports to: tshead@k-3d.com\n"; return 0; } } // Setup our logging options before going any further ... arguments = parse_log_arguments(arguments, quit, error); if(quit) return error ? 1 : 0; // Look for command-line options that will configure our subsequent behavior ... arguments = parse_startup_arguments(arguments, quit, error); if(quit) return error ? 1 : 0; // Make sure we have all resources required to run ... check_dependencies(quit, error); if(quit) return error ? 1 : 0; // Initialize parallel processing ... k3d::parallel::set_thread_count(k3d::parallel::automatic); // Set the shader cache path ... k3d::set_shader_cache_path(g_shader_cache_path); // Set the share path ... k3d::set_share_path(g_share_path); #ifdef K3D_ENABLE_NLS k3d::filesystem::path locale_path = g_share_path / k3d::filesystem::generic_path("locale"); if(!g_override_locale_path.empty()) locale_path = g_override_locale_path; k3d::log() << info << "locale path: " << locale_path.native_console_string() << std::endl; setlocale(LC_ALL, ""); bindtextdomain("k3d", locale_path.native_filesystem_string().c_str()); bind_textdomain_codeset("k3d", "UTF-8"); textdomain("k3d"); #endif // K3D_ENABLE_NLS // Load user options ... k3d::options::file_storage user_options(g_options_path); k3d::options::set_storage(user_options); // Handle creation of the required user interface plugin ... k3d::plugin_factory_collection ui_plugins; ui_plugins.connect_message_signal(sigc::ptr_fun(startup_message_handler)); create_user_interface(ui_plugins, quit, error); if(quit) return error ? 1 : 0; return_val_if_fail(g_user_interface, 1); // Handle more arguments that may cause our immediate exit ... for(arguments_t::const_iterator argument = arguments.begin(); argument != arguments.end(); ++argument) { if(argument->string_key == "user-interface-help") { boost::program_options::options_description description("User interface options"); g_user_interface->get_command_line_arguments(description); std::cout << description << "\n"; return 0; } } // Register our user interface ... k3d::set_user_interface(*dynamic_cast(g_user_interface)); // Ensure the user interface gets cleaned-up ... boost::scoped_ptr ui_cleanup(g_user_interface); // Give the UI a chance to handle command-line arguments ... arguments = g_user_interface->parse_startup_arguments(arguments, quit, error); if(quit) return error ? 1 : 0; // Load plugins ... k3d::plugin_factory_collection plugins; plugins.connect_message_signal(sigc::ptr_fun(startup_message_handler)); load_modules(plugins, quit, error); if(quit) return error ? 1 : 0; // Setup a render farm ... k3d::network_render_farm render_farm(g_options_path); k3d::set_network_render_farm(render_farm); // Register plugins ... k3d::register_plugin_factories(plugins); // Create the main application object ... k3d::application_implementation application; // We want to be notified when the user requests a shutdown ... application.connect_exit_signal(sigc::ptr_fun(exit_request_handler)); // Register it with the library as the global application object ... k3d::register_application(application.interface()); // Switch the UI to its "normal" (post-startup) layout ... startup_message_handler(_("Starting user interface")); g_user_interface->display_user_interface(); // Instantiate "auto-start" plugins ... auto_start_plugins_t auto_start_plugins; create_auto_start_plugins(auto_start_plugins); // Let the UI parse arguments now that startup is complete ... arguments = g_user_interface->parse_runtime_arguments(arguments, quit, error); if(quit) return error ? 1 : 0; // Parse any remaining arguments now that startup is complete ... arguments = parse_runtime_arguments(arguments, quit, error, application.interface()); if(quit) return error ? 1 : 0; // Check for "unused" command-line arguments ... check_unused_arguments(arguments, quit, error); if(quit) return error ? 1 : 0; // Main UI event-loop ... g_user_interface->start_event_loop(); // Cleanup "auto-start" plugins ... delete_auto_start_plugins(auto_start_plugins); //g_user_interface.reset(); return 0; } catch(std::exception& e) { k3d::string_t message = "Caught exception ["; message += k3d::demangle(typeid(e)); message += "] - "; message += e.what(); k3d::log() << critical << message << std::endl; #ifdef K3D_API_WIN32 MessageBox(0, message.c_str(), _("K-3D Fatal Error"), MB_OK | MB_ICONSTOP); #endif // K3D_API_WIN32 return 1; } catch(...) { const k3d::string_t message = "Caught unknown exception."; k3d::log() << critical << message << std::endl; #ifdef K3D_API_WIN32 MessageBox(0, message.c_str(), _("K-3D Fatal Error"), MB_OK | MB_ICONSTOP); #endif // K3D_API_WIN32 return 1; } } ================================================ FILE: application/k3d_main.h ================================================ #ifndef APPLICATION_K3D_MAIN_H #define APPLICATION_K3D_MAIN_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include /// Main entry-point for the application ... callers should pass all command-line arguments *except for* the program name (i.e. argv[0]) int k3d_main(std::vector arguments); #endif // !APPLICATION_K3D_MAIN_H ================================================ FILE: application/main.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include "k3d_main.h" #include int main(int argc, char* argv[]) { k3d::system::initialize_executable_path(argc, argv); std::vector arguments(argv, argv + argc); if(arguments.size()) arguments.erase(arguments.begin()); return k3d_main(arguments); } ================================================ FILE: application/winmain.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include "k3d_main.h" #include #include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { k3d::system::initialize_executable_path(__argc, __argv); std::vector arguments(__argv, __argv + __argc); if(arguments.size()) arguments.erase(arguments.begin()); return k3d_main(arguments); } ================================================ FILE: bugs/CMakeLists.txt ================================================ PROJECT(ditz) FIND_PROGRAM(DITZ_EXECUTABLE ditz) ADD_CUSTOM_TARGET(bugs-html WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMAND ${DITZ_EXECUTABLE} html "${CMAKE_CURRENT_BINARY_DIR}/html" ) ================================================ FILE: bugs/issue-000e833956e3ebedbddc7a8f239368296cef05cf.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Remove legacy code from CollapseEdges. desc: Like it says. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-12-29 03:13:38.485549 Z references: [] id: 000e833956e3ebedbddc7a8f239368296cef05cf log_events: - - 2009-12-29 03:13:39.029483 Z - Timothy M. Shead - created - "" - - 2010-01-01 02:50:23.773581 Z - Timothy M. Shead - edited title - "" - - 2010-01-10 20:14:22.182315 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-01d720a02d5558508a3b56a7ad0e603d0b8e57f7.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " Bug while moving vertices, edges and faces on a tutorial" desc: "Resuming:\n\ 1-Start recording a tutorial\n\ 2-Select a face/edge/vertex\n\ 3-Move it\n\ 4-Without changing the move tool select and move another face/edge/vertex\n\ 5-Play the script\n\n\ I attach a k3dscript file for reproducing the bug.\n\ It throws on the terminal (in 0.6.7 and 0.7.0)\n\ WARNING: Selection contained records without nodes\n\ ERROR Command node [move_tool] unhandled command: [lmb_click_replace]\n\ [/document/window/viewport0.418126\n\ 0.638689]\n\n\ This script was recorded on k3d 0.6.7 and when played on 0.7 it selects a\n\ different face. Seems like coordinates are upside down. I'll will submit\n\ another bug report on this subject.\n\n\ Thanks for merging the mug script!\n\n\ Cheers,\n\ Joaqu\xC3\xADn." type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:46:01.911919 Z references: [] id: 01d720a02d5558508a3b56a7ad0e603d0b8e57f7 log_events: - - 2009-05-19 03:46:02.495726 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:03:39.979069 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:06:42.765331 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-028d81eef227a051d03293c46b451db439f0c460.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Black screen on the work area desc: |- Contact: hiper_army@hotmail.com Summary: Black screen on the work area Report Generated: 2008-Mar-07 21:25:28 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.1.3 20070831 (prerelease) (Ubuntu 4.1.2-16ubuntu1) Build Time: Sep 13 2007 03:47:14 local Description of problem: i have a black screen on the place ho i put 3d object Steps to reproduce problem: 1. just simply open K-3D 2. 3. Expected results: Actual results: How often does this happen? ALAWS wen i open it Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:32:48.800093 Z references: [] id: 028d81eef227a051d03293c46b451db439f0c460 log_events: - - 2009-05-19 03:32:49.536497 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:23.503077 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:42:08.446849 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-02e36eaa0b39160335d6eb8d576d75c56577c5f7.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: NURBS OpenGL rendering weird on OSX desc: On OSX, NURBS patches have strange render artifacts, as if normals are flipped or something. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-08-03 14:54:17.959519 Z references: [] id: 02e36eaa0b39160335d6eb8d576d75c56577c5f7 log_events: - - 2009-08-03 14:54:19.159406 Z - Timothy M. Shead - created - "" - - 2009-12-26 17:18:11.644487 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-067c122609d0478c12319a8cfebda9c4f290bc78.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Path User Properties are not well serialized desc: |- Inspecting the file, they are serialized This xml above won't load any property If I edit it it will load well Cheers! type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-06 04:10:14.184556 Z references: [] id: 067c122609d0478c12319a8cfebda9c4f290bc78 log_events: - - 2009-05-06 04:10:15.376459 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:07.015080 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-21 05:47:33.209467 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-0ca786b59608c113bdb0a99f16c1e0e8e0076d8f.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 Cannot correctly Undo a \"Delete All\" from a script " desc: "1-Run the following code on the script editor\n\n\ #python\n\n\ import k3d\n\ doc = Document\n\ doc.start_change_set()\n\ for i in doc.nodes():\n\ doc.delete_node(i)\n\ doc.finish_change_set(\"Delete All\")\n\n\ 2- Undo the script\n\ 3- The viewport stays grayed\n\ Users need to change the viewport to another panel then back to viewport\n\n\ not a big deal :D\n\n\ Saludos!\n\ Joaqu\xC3\xADn" type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:39:30.848536 Z references: [] id: 0ca786b59608c113bdb0a99f16c1e0e8e0076d8f log_events: - - 2009-05-19 03:39:31.639851 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:53:28.335169 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-21 05:49:42.137469 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-0f0dc8929f4bd8dd646aedbab164defb8b01ba68.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Closing main window during tutorial playback causes errors desc: |- Contact: hendra_uzia@yahoo.com Summary: Errored Mouse after Tutorial Report Generated: 2007-Mar-12 03:15:06 UTC Package: k3d Version: 0.6.6.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 6 2007 13:08:21 local Description of problem: When I Finished my Tutorial, but unfortunately, I don't realy finished it yet by closing the tutorial panel, my mouse becomes errored and and cannot be controled. Even if I Force to end task, it ends in minutes, not in an immediate seconds. Steps to reproduce problem: I Use Windows XP 1. Start tutorial 2. When it finished (the mouse is moving to the help button), press [Alt]+[F4], so the tutorial window will clossed 3. Switch to other apps. 4. Bingo, The mouse cannot be controled anymore. Expected results: Non errored mouse after unfinished tutorial. Actual results: How often does this happen? This is my first error. Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:48:51.360421 Z references: [] id: 0f0dc8929f4bd8dd646aedbab164defb8b01ba68 log_events: - - 2009-05-19 03:48:51.983381 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:03:48.675051 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:06:46.355156 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-0f2e779987beba2c16355000e49002e668efe3cd.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Provide manual creation of points. desc: Like it says ... this is a very common request. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-12-19 02:20:11.452512 Z references: [] id: 0f2e779987beba2c16355000e49002e668efe3cd log_events: - - 2009-12-19 02:20:12.541491 Z - Timothy M. Shead - created - "" ================================================ FILE: bugs/issue-12ac6cbd6ff111c686796d107c8a9b8338158e8f.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "hings keep freezing and images stay up even after they've been exited out of " desc: |- Contact: Junin_Ninja@yahoo.com Summary: Things keep freezing and images stay up even after they've been exited out of Report Generated: 2009-Jan-25 01:52:18 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: Whenever I start up the program it shows a block of my desktop picture. Also after tutorial windows are exited out of the image still remains. Steps to reproduce problem:open program 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-06 04:04:37.984268 Z references: [] id: 12ac6cbd6ff111c686796d107c8a9b8338158e8f log_events: - - 2009-05-06 04:04:38.847914 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:03.279071 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:48:25.623078 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue da8965ea23097589e5b98a3b8c42580329dad12c}. ================================================ FILE: bugs/issue-13cd1ca286fd727add47164d6b9829a864732688.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Support display of non-SI units of measure. desc: K-3D uses SI units internally for all data storage. The UI supports automatic conversion from other units to SI, but there is no provision currently to display alternate units. It should be possible to set global user preferences for display units, as-well-as changing preferences on a control-by-control basis. Similarly, it should be possible to specify the number of digits to display. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-11-14 23:18:23.284634 Z references: [] id: 13cd1ca286fd727add47164d6b9829a864732688 log_events: - - 2009-11-14 23:18:24.252580 Z - Timothy M. Shead - created - "" - - 2009-11-21 05:08:42.265667 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-1478f28b825b4003e89e19fd6627210de42670f1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix MergeCoplanarFaces. desc: Need to update MergeCoplanarFaces to match changes to the polyhedron schema for shells. type: :task component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-01 03:16:51.261549 Z references: [] id: 1478f28b825b4003e89e19fd6627210de42670f1 log_events: - - 2010-01-01 03:16:51.966218 Z - Timothy M. Shead - created - "" - - 2010-01-17 16:54:24.893287 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-02-21 06:13:49.194877 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-162c9fd22b62e2228b4963639d7cd652b4af2e5d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Polygon meshes and NURBS meshes don't snap when translated. desc: |- Polygon meshes and NURBS meshes don't snap when translated. That's pretty much all I need to say, I believe. -leiget leiget at gmail type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-06 04:06:43.128689 Z references: [] id: 162c9fd22b62e2228b4963639d7cd652b4af2e5d log_events: - - 2009-05-06 04:06:44.424268 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:04.559088 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:23:56.838746 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-164f2e0cd8b280e764bc49d2f1db806e4fef7fa3.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Create a test to ensure that const_cast isn't abused. desc: "" type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-07-19 20:53:20.743085 Z references: [] id: 164f2e0cd8b280e764bc49d2f1db806e4fef7fa3 log_events: - - 2009-07-19 20:53:22.023030 Z - Timothy M. Shead - created - "" - - 2009-07-19 21:23:29.542665 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-1787ece116f7300528f97ab0a9eb6c128a4ae826.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "Wiever doesn't show block being still, when moved it diplays. What's wrong? drivers are from ati " desc: |- Contact: etteeeee@hotmail.com Summary: Wiever doesn't show block being still, when moved it diplays. What's wrong? drivers are from ati Report Generated: 2008-Jul-22 13:47:31 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.2.3 (Ubuntu 4.2.3-2ubuntu1) Build Time: Feb 27 2008 23:29:50 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-07 04:13:46.669585 Z references: [] id: 1787ece116f7300528f97ab0a9eb6c128a4ae826 log_events: - - 2009-05-07 04:13:47.533432 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:12.839075 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:56:19.950674 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue deed7f51f539b6c62b97c585ed7453b3242c9992}. ================================================ FILE: bugs/issue-1850897e4259a756faf449a72ea07ac863d83cd0.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 shifted gizmo desc: |- I created 3x3 cube, turned it to SDS, then selected a face; the transform/rotate/etc. gizmo is shifted, there is offset between the selected face and the gizmo. (See screenshots.) [K-3D .7.3 on Vista 64b, K-3D started with desktop composition disabled] type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:26:56.312764 Z references: [] id: 1850897e4259a756faf449a72ea07ac863d83cd0 log_events: - - 2009-05-19 03:26:57.120619 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:18.999069 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-10-19 05:05:17.831079 Z - Timothy M. Shead - closed with disposition wontfix - This is expected behavior - the transform tools are transforming the SDS mesh, not the limit surface. ================================================ FILE: bugs/issue-1ae2d51bee03627b3d7136008951efc67ab7766e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: GUI widgets to help users know direction and orientation of lights. desc: |- All lights that are directional, including those with maps need a visual clue in the 3D view-port as to their orientation, even if it is fixed. Mapping an environment light's EXR file to the back of the veiw-port would be ideal, but in truth a luxury. All that is needed a simple arrow or other way of showing where the map's 0,0 point is and it's orientation. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-06-27 15:33:51.240727 Z references: [] id: 1ae2d51bee03627b3d7136008951efc67ab7766e log_events: - - 2009-06-27 15:33:52.232586 Z - Timothy M. Shead - created - "" - - 2009-08-02 22:46:56.006937 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-1af4c139c1c4fe06ca2e3fbe31f1237cf963a20e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: program freezing desc: |- Contact: db_silvis@yahoo.com Summary: program freezing Report Generated: 2008-Oct-21 22:42:24 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: Steps to reproduce problem: 1.as soon as I start the program 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:04:40.125460 Z references: [] id: 1af4c139c1c4fe06ca2e3fbe31f1237cf963a20e log_events: - - 2009-05-07 04:04:42.333757 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:08.382631 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:29:59.534875 Z - Timothy M. Shead - closed with disposition wontfix - "" ================================================ FILE: bugs/issue-1e7b3a952423fcf332c8f369ee0646873cafb877.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "Python Script: bug on Document.delete_node()" desc: "Steps:\n\n\ 1- Select a node (A) property on connect it to another's node property\n\ (B).\n\ 2- Delete node B from the python engine.\n\ 3- Node A property is still connected to node B property although B doesn't\n\ exist anymore.\n\n\ I attach an example file.\n\ 1- Open test_doc.k3d\n\ 2- select polycube instance (the cube on the right)\n\ 3- run the delete_selected_instance.py\n\n\ Go and see the input_mesh property of MeshInstance node.\n\ It can't be disconnected unless you connect it first to other node.\n\n\ Cheers!\n\ Joaqu\xC3\xADn" type: :bugfix component: K-3D release: 0.8.1.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:40:06.207476 Z references: [] id: 1e7b3a952423fcf332c8f369ee0646873cafb877 log_events: - - 2009-05-19 03:40:06.904099 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:50:30.231031 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-21 05:49:56.041474 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-05-22 00:36:19.846768 Z - Timothy M. Shead - assigned to release 0.8.1.0 from 1.0.0.0 - "" - - 2010-05-22 00:44:32.070902 Z - Timothy M. Shead - edited title - "" claimer: ================================================ FILE: bugs/issue-1f0827906ae4174800898596b0c8e4c623425ebd.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " k3d 0.7.8 does not build in x86_64 arch" desc: |- In file included from /home/mandrake/rpm/BUILD/k3d-source-0.7.8.0/modules/nurbs/nurbs_curve_modif ier.h:48, from /home/mandrake/rpm/BUILD/k3d-source-0.7.8.0/modules/nurbs/insert_knot.cpp:4 4: /home/mandrake/rpm/BUILD/k3d-source-0.7.8.0/modules/nurbs/nurbs_patch_modif ier.h:56: warning: 'typedef' was ignored in this declaration /home/mandrake/rpm/BUILD/k3d-source-0.7.8.0/modules/nurbs/nurbs_patch_modif ier.h:66: warning: 'typedef' was ignored in this declaration /home/mandrake/rpm/BUILD/k3d-source-0.7.8.0/modules/nurbs/insert_knot.cpp: In member function 'virtual void module::nurbs::insert_knot::on_update_mesh(const k3d::mesh&, k3d::mesh&)': /home/mandrake/rpm/BUILD/k3d-source-0.7.8.0/modules/nurbs/insert_knot.cpp:9 8: error: no matching function for call to 'module::nurbs::nurbs_curve_modifier::knot_vector_adaption(std::vector >&)' /home/mandrake/rpm/BUILD/k3d-source-0.7.8.0/modules/nurbs/nurbs_curve_modif ier.h:166: note: candidates are: void module::nurbs::nurbs_curve_modifier::knot_vector_adaption(std::vector status: :closed disposition: :fixed creation_time: 2009-05-07 04:10:55.493673 Z references: [] id: 1f0827906ae4174800898596b0c8e4c623425ebd log_events: - - 2009-05-07 04:10:57.069963 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:11.975067 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:58:53.103151 Z - Timothy M. Shead - closed with disposition fixed - Should be fixed in mercurial. ================================================ FILE: bugs/issue-20324fd0e902a7a6bdb85dbf5f2ae4ce8180a61a.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix CatmullClark implementation. desc: Need to update the CatmullClark implementation to handle changes to the polyhedron schema for shells. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-01 03:13:49.689458 Z references: [] id: 20324fd0e902a7a6bdb85dbf5f2ae4ce8180a61a log_events: - - 2010-01-01 03:13:50.285467 Z - Timothy M. Shead - created - "" - - 2010-01-19 03:50:27.733213 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-20c18a2b4fe16b8e1a3982d83be136220b4cf863.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Restore robust picking. desc: Robust primitive picking by looking at nearby components was commented-out during the transition to generic primitives / selections. Restore it. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-21 05:52:31.977624 Z references: [] id: 20c18a2b4fe16b8e1a3982d83be136220b4cf863 log_events: - - 2009-08-21 05:52:32.593544 Z - Timothy M. Shead - created - "" - - 2009-08-27 03:43:59.461666 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-250f99eac16ec2eda3d6b7e324592efc46a1e250.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Duplicated / instantiated objects aren't visible when rendered. desc: This is an error-of-omission, the duplicate / instantiate UI code needs to make the new objects visible to render engines. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-09 17:21:52.037546 Z references: [] id: 250f99eac16ec2eda3d6b7e324592efc46a1e250 log_events: - - 2010-01-09 17:21:52.725491 Z - Timothy M. Shead - created - "" - - 2010-02-12 06:51:38.878192 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-25c0b2699b08309f7452d4d7390d05a3fa78bf57.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Harmless warning messages when ATK is disabled. desc: |- At startup, ATK code emits warning messages if the user hasn't enabled accessibility. Typically (but not exclusively), this is done by checking "Enable assistive technologies" in the Gnome Assistive Technologies Preferences control center applet. Ideally, we should try to disable, prevent, or hide these warnings, since they generate support requests. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-03 01:58:46.629278 Z references: [] id: 25c0b2699b08309f7452d4d7390d05a3fa78bf57 log_events: - - 2010-02-03 01:58:47.589285 Z - Timothy M. Shead - created - "" - - 2010-02-06 06:04:53.400647 Z - Timothy M. Shead - closed with disposition fixed - Forcing GTK to load atk-bridge at startup when the user didn't have accessibility turned-on for their desktop caused these warning messages. We dont' actually need atk-bridge, since we call ATK interfaces directly in-process. So turning this off fixes everything. claimer: ================================================ FILE: bugs/issue-26470a23cd083556484c98f6120b5f33661775c6.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Remove legacy code from BevelFaces. desc: Like it says. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-12-29 03:15:26.813547 Z references: [] id: 26470a23cd083556484c98f6120b5f33661775c6 log_events: - - 2009-12-29 03:15:27.445492 Z - Timothy M. Shead - created - "" - - 2010-01-15 06:13:06.225749 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-28d83330170a35565ca1ada32317f34b2daf37a2.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: when doing "unparent", the software crashes. desc: |- Contact: ingirafn@this.is Summary: when doing "unparent", the software crashes. Report Generated: 2009-Mar-29 22:47:16 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.3.1 Build Time: Jun 22 2008 18:41:27 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? everytime Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 03:55:34.072363 Z references: [] id: 28d83330170a35565ca1ada32317f34b2daf37a2 log_events: - - 2009-05-06 03:55:36.184301 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:07:14.907209 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:18:54.550887 Z - Timothy M. Shead - closed with disposition wontfix - Already fixed. ================================================ FILE: bugs/issue-28e8b98350d458dfe53427f2497401663b0dc97a.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: the K-3D wont start desc: |- Contact: colonization1@yahoo.com Summary: the K-3D wont start Report Generated: 2008-Sep-01 07:13:28 UTC Package: k3d Version: 0.7.9.0 Platform: Windows-5.1;x86 Compiler: 3.4.5 (mingw special) Build Time: Aug 13 2008 17:13:57 local Description of problem:it wont start Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:07:15.781672 Z references: [] id: 28e8b98350d458dfe53427f2497401663b0dc97a log_events: - - 2009-05-07 04:07:17.245500 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:09.815133 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:33:17.679161 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-2c158e15ef869a5b8ec01db38e4ed19a507b0bc2.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Tried to render desc: |- Contact: jfmotion@gmail.com Summary: Tried to render Report Generated: 2007-Jul-25 07:03:36 UTC Package: k3d Version: 0.6.6.0 Platform: i486-pc-linux-gnu Compiler: 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7) Build Time: Jan 16 2007 15:55:06 local Description of problem: Without it, RIB files cannot be rendered. Check to ensure that you have Aqsis installed, and that the PATH envrionment variable points to the Aqsis binary installation directory. Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:44:08.808584 Z references: [] id: 2c158e15ef869a5b8ec01db38e4ed19a507b0bc2 log_events: - - 2009-05-19 03:44:09.503967 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:49:43.231031 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:18:04.038993 Z - Timothy M. Shead - closed with disposition wontfix - The OP is describing expected behavior. The real solution is to ensure that downstream distributors setup appropriate render engine support. ================================================ FILE: bugs/issue-2c5ca49215d98ef29255e323180b3715cee1b1c1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: By default, automatically select both half-edges in the UI layer. desc: Like it says. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-09-02 04:39:47.798984 Z references: [] id: 2c5ca49215d98ef29255e323180b3715cee1b1c1 log_events: - - 2009-09-02 04:39:48.518792 Z - Timothy M. Shead - created - "" - - 2010-02-07 17:48:33.240632 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-2e6128ca3bb63de99d369f1ae2f4f457cf7a1470.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: viewport doesn't work desc: |- Contact: 4d3l.jarrah@gmail.com Summary: viewport doesn't work Report Generated: 2009-Apr-07 22:33:06 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.2.3 (Ubuntu 4.2.3-2ubuntu1) Build Time: Feb 27 2008 23:29:50 local Description of problem: When i chose the viewport tab from any window the viewport keeps on disappearing giving me a blank screen, i can only see the objects when i move the objects Steps to reproduce problem: At startup always. 1. 2. 3. Expected results: Actual results: How often does this happen? Since i first installed k-3d til now Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 03:53:31.136389 Z references: [] id: 2e6128ca3bb63de99d369f1ae2f4f457cf7a1470 log_events: - - 2009-05-06 03:53:33.160309 Z - Beverly L. Shead - created - "" - - 2009-07-22 02:50:05.268385 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:13:03.198817 Z - Timothy M. Shead - closed with disposition wontfix - Works for me on Ubuntu 8.10, 9.04 with nvidia graphics cards. ================================================ FILE: bugs/issue-3074be871fbce4de2da49a1abc0432d8e49e30c1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Complete LuxRender material set. desc: |- With materials the the missing part is texture input not a color, treat color as a 1x1 map of a given color, all the attributes of textures need map input to allow for realism and also to simulate things such as mesh http://images.google.com.au/images?q=architectural mesh and fritted glass http://images.google.com.au/images?q=fritted+glass which is a common method of sun control in architecture. type: :feature component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-06-27 15:34:38.921913 Z references: [] id: 3074be871fbce4de2da49a1abc0432d8e49e30c1 log_events: - - 2009-06-27 15:34:39.657825 Z - Timothy M. Shead - created - "" - - 2009-07-19 21:09:04.326798 Z - Timothy M. Shead - closed with disposition fixed - "" - - 2009-07-22 02:45:42.372434 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" ================================================ FILE: bugs/issue-361aa608201ea4f1ec2fd204a7c62df2ebfeb1b8.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: My view port is blank. does not show coordinates. desc: |- Contact: justshonuff@yahoo.com Summary: My view port is blank. does not show coordinates. Report Generated: 2008-Nov-05 11:58:32 UTC Package: k3d Version: 0.5.14.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jul 9 2006 10:24:48 local Description of problem: my viewport has been blank since i installed the software. please help Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 04:12:57.304498 Z references: [] id: 361aa608201ea4f1ec2fd204a7c62df2ebfeb1b8 log_events: - - 2009-05-06 04:12:58.232230 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:07.463065 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:28:25.942855 Z - Timothy M. Shead - closed with disposition wontfix - This is an extremely out-of-date version of K-3D. ================================================ FILE: bugs/issue-363308f0b4815dcf1b3fb24103eb8b40f6645779.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Add filtering to the Node List Panel. desc: Like it says, much of the content in the Node List Panel is overkill for the casual user. Need to add some reasonable filtering capabilities, i.e. show "common" nodes, nodes in specific categories (lights, materials, etc), nodes of a specific type, name matching, etc. type: :feature component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-05-22 00:43:21.654820 Z references: [] id: 363308f0b4815dcf1b3fb24103eb8b40f6645779 log_events: - - 2010-05-22 00:43:22.270780 Z - Timothy M. Shead - created - "" - - 2010-05-22 00:44:06.238848 Z - Timothy M. Shead - edited title, description - "" claimer: ================================================ FILE: bugs/issue-38ed366c277ad6ad3cbf7113a50c73ab0dc6ecb9.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Ensure primitive attributes are updated correctly. desc: Many (probably most) current modifiers that create new geometry fail to update primitive attributes, meaning that those modifiers will fail when applied to primitives with attributes. Since it's really easy to write code that doesn't take attributes into account, we need a way to consistently catch such errors. One heavy-handed way to do it would be to simply update every mesh source to generate output with attributes - then, current tests would automatically start failing in an obvious way. On the down-side, this means increasing memory usage for everyone for what is basically a test case. Second alternative would be to do something in the test layer that automatically adds attributes to sources. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-12-26 17:27:03.044526 Z references: [] id: 38ed366c277ad6ad3cbf7113a50c73ab0dc6ecb9 log_events: - - 2009-12-26 17:27:03.964468 Z - Timothy M. Shead - created - "" - - 2010-01-09 17:50:08.324400 Z - Timothy M. Shead - closed with disposition fixed - Enabled aggressive testing of primitive attributes on the dashboard - all mesh-related tests now generate attributes and enforce the validity of their output tests, so it should be impossible for a plugin to pass a regression test without generating valid attributes." ================================================ FILE: bugs/issue-3c77f6ba4e20fe744f97629df5b855476eaefef0.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Separate cuda bitmap functionality from cuda mesh functionality that doesn't build. desc: In theory, the bitmap stuff works fine, just needs to be moved into a separate module. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-08-02 21:19:56.399190 Z references: [] id: 3c77f6ba4e20fe744f97629df5b855476eaefef0 log_events: - - 2009-08-02 21:19:56.895141 Z - Timothy M. Shead - created - "" ================================================ FILE: bugs/issue-3cb4616e3fdf2b348db28c1ec4761759e7570b91.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Segmentation fault on startup (Linux/PPC) desc: |- Hi, I'm running Debian etch (gcc-4.2, libstdc++.so.6.0.9, libc-2.5.so, let me know whatever else you need) on a powerpc (G4). I compiled a 0.6.6 tree and everything went fine: $ ./configure $ make (sleep a couple of hours) $ make install Unfortunately when I launch $ /usr/local/k3d/bin/k3d I get for a while the splash screen and a sudden /usr/local/k3d/bin/k3d: line 180: 23586 Segmentation fault /usr/local/k3d/bin/k3d-bin --options /home/alex/.k3d/options.k3d --plugins /usr/local/k3d/lib/k3d --shadercache /home/alex/.k3d/shadercache --share /usr/local/k3d/share/k3d --tutorials /usr/local/k3d/share/k3d/tutorials --ui /usr/local/k3d/lib/libk3dngui.so Just to keep doing something, I tried $ make check in the tree top directory; I attach the last part of the output: make check-TESTS make[3]: Entering directory `/home/alex/install/k3d-0.6.6.0/tests' ../application/k3d: line 180: 29954 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /ho../alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../nui/.libs/libk3dnui.so --batch --color --log-level warning --no-splash --shaders ../share/shaders --show-process --exit FAIL: testharness.startFAIL: testharness.startFAIcriptrecognition.null.001 ../application/k3d: line 180: 30003 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../nui/.libs/libk3dnui.so --batch --color --log-level warning --no-splash --shad--shad--shad--shad--shad--shad--shad--s--shad--shad--shad--shad--shad--shadipt--shad--sha.k3--shad--shad--shad--shad--shad--shad--shad--s--shad--shad--shadult--shad--shad--s/k--shad--shad--shad--shad--shad--shad--shad--s--shad--shad--shad--gi--shad--shad--shad--shad--shad--shad--shad--s--shad--../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../nui/.libs/libk3dnui.so --batch --color --log-level warning --no-splash --shaders ..--shaders ..--shaders ..--shaders ..--shaders ..--IL: testharness.scriptrecognition.python.001 PASS: testharness.scriptfailure.k3dscript.001 PASS: testharness.scriptfailure.pyPASS: testharness.scriptfailure.pyPASS: testharness.scriptfailure.pyPASS: 4PASS: testharness.scriptfailure.pyPASS: testharness.snsPASS: testharness.scriptfailure.pyPASS: testharness.scriptfailure.pyPhoPASS: testharness.scriptfailure.pyPASS: testharness.scriptfailure.pyPASSre/k3d/tutorials --ui ../nui/.libs/libk3dnui.so --batch --color --log-level warning --no-splash --shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/shaders --sho--shaders ../share/s--ui ../nui/.libs/libk3dnui.so --batch --color --log-l../nui/.libs/libk3dnui.so --batch --color --log-l../nui/.libs/libk3dnui.ip../nui/.libs/libk3dnui.so --batch --color --log-l../nui/.libs/libk3dnui.so --batch --color --log-l../nui/lication/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../nui/.libs/libk3dnui.so --batch --color --log-level warning --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: document.stress_test.001 ../application/k3d: l../application/k3d: l../application/k3d: l../application/k3d: l../applical../application/k3d: l../application/k3d: l../application/k3d: l../application/k3d: l../applical../application/k3d: l../application/k3d: l../application/k3d: l../application/k3d: l../applical../application/k3d: l../application/k3d: l../application/k3d: l../application/k3d: l../applical../application/k3d: l../application/k3d: l../application/kne../application/k3d: l../application/k3d: l../application/k3d: l../application/k3d: l../applical../application/k3d: l../application/k3d: l../application/k3d: l../application/k3d: l../applical../application/k3d: l../application/k3d: l../application/k3d: l../application/k3d: l../applical../appno../application/k3d: l../application/k3d: l../application/k3d: l../applic: ../application/k3d: l../application/k3d: l../appli0: 4961 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../s../bin/plugins --shadercache /home/alex/.k3d/shadercacui../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../se/ns.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.menu.activate.001 ../application/k3d: line 180: 5101 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.menu.activate.002 ../application/k3d: line 180: 5124 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.add_viewport.001 ../application/k3d: line 180: 51../application/k3d: line 180: 51../application/k3d: line 180: 51../applipt../application/kns../application/k3d: line 18he../application/k3d: line 180: 51../application/k3d: rials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so../ngui/.libs/libk3dngui.so../ngui/.libs/libk3dngui.so../ngui/.libs/libkhaders ../share/shaders --show-process --script - --exit FAIL: ngui.assign_hotkeys.001 ../application/k3d: line 180: 5172 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --sh--no-custom-layouts --no-splash --sh--no-custom-la-e--no-custom-layouts --no-splash --sh--no-custom-layouts --no-s19--no-custom-layouts --no-splash --sh--no-custom-layouts --no-splash --shtions.k3d --plugins --no-custom-layouts --no-she /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.bitmaps.color_monochrome.001 ../application/k3d: line 180: 5222 Segmentation fault ../application/k3d-bin --options /home/al../application/kk3d --plugins ../bin/plugins --s../bin/plugins --s../bin/plugins --s../bin/plugins -ar../bin/plugins --s../bin/plugins --s../bin/plugins --s../bin/plugins ibk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.bitmaps.gamma.001 ../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li../application/k3d: li/l../application/k3d: li../application/k3d: li../application/k3d: li../appo-../application/k3d: li../application/k3d: li../app-script - --exit FAIL: ngui.bitmaps.matte_colordiff.001 ../applica../applica../applica../applica../applica../applica../applica../applica..ions /home/alex/.k3d/options.k3d --plugins ../bin/plugins --../bin/plugins --../bin/plugins --../bin/plugins --.ha../bin/plugins --../bin/plugins --../bin/plugins --../bin/plugins --.libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.bitmaps.multiply.001 ../application/k3d: line 180: 5291 Segmentation fault ../application/k3d-bin --options /home../application/kns../application/k3d-bin --opns --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.bitmaps.subtract.001 ../application/k3d: line 180: 5315 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.bitmaps.threshold.001 ../application/k3d: line 180: 5338 Segmentation fault ../application/k3d-bin --options /home/al../application/kk3../application/k3d-bin --optioha../application/k3d-bin --options /home/al../applicate ../application/k3d-bin --options /home/al../application/kk3../application/k3d-bin --optioha../application/k3d-bin --options /home/al../applicatlash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.shaders.undo_selection.001 ../application/k3d: line 180: 5362 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script - --exit FAIL: ngui.tools.unparent.001 ../application/k3../application/k3../application/k3../application/k3../application/k3../aome/alex/.k3d/options.k3d --plugins ../bin/plugins --../bin/plugins --../bin/plugins --../bin/plugins --.hare --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-s--no-custom-layouts --no-s--no-custom-layouts --no-s--no-custom-layouts --no-s--no-custom-layouts --no-s--no-custom-layouts --no-s--no-custom-layouts --no-s--no-custom-layouts --no-s--no-cions /home/alex/.k3d--no-custom-layouts --no-s--no-custos --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no--no-custom-layouts --no--no-custom-layouts --no----script ../share/tutorials/getting_started.k3dscript --exit FAIL: ngui.tutorials.getting_started.001 ../application/k3d: line 180: 5431 Segmentation fault ../application/k3d-bin --options../application/k3d-bin --options../application/k3d-bin --options../application/k3d-bin --options../application/k3d-bin --ops ../application/k3d-bin --options../application/k3d-bin --options../applitc../application/k3d-bin --options../application/k3d--../application/k3d-bin --options../application/k3d-bin --optio./share/tutorials/panel_basics.k3dscript --exit FAIL: ngui.tutorials.panel_basics.001 ../application/k3d: line 180: 5455 Segmentation fault ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials ---tutorials /usr/local/k3d/share/k3d/tutorials ---log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script ../share/tutorials/navigation.k3dscript --exit FAIL: ngui.tutorials.navigation.001 ../application/k3../application/k3../application/k3../ap/a../application/k3../application/k3../application/k3..k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shadercache --share ../share --tutorials /usr/local/k3d/share/k3d/tutorials --ui ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script ../share/tutorials/basic_selection.k3dscript --exit FAIL: ngui.tutorials.basic_selection.001 ../application../application../application../appliult ../application/k3d-bin --options /home/alex/.k3d/options.k3d --plugins ../bin/plugins --shadercache /home/alex/.k3d/shaderc../bin/plugins --shadercache /home/alex/.k3d/shaderc../bin/plugins --shai ../ngui/.libs/libk3dngui.so --batch --color --log-level warning --no-custom-layouts --no-splash --shaders ../share/shaders --show-process --script ../share/tutorials/gts_boolean.py --exit FAIL: ngui.tutorials.gts_boolean.001 ====================================================================================================================================================================================[c========================================================================6.0/tests' make[1]: *** [check-recursive] Error 1 makemakemakemakemakemakemakemakemakemakemakemakemakemakemakemakemamake: *** [check-recursive] Error 1 type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:47:18.127477 Z references: [] id: 3cb4616e3fdf2b348db28c1ec4761759e7570b91 log_events: - - 2009-05-19 03:47:18.928081 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:49:12.119165 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:37:46.415099 Z - Timothy M. Shead - closed with disposition wontfix - From the OP, 'make check' implies a really out-of-date version of K-3D. ================================================ FILE: bugs/issue-4084f1c41c9a58ab4b0b49b7c8f988f45328edcc.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: My Viewport is Blank. No Grid/ Axis Lines desc: |- Contact: justshonuff@yahoo.com Summary: My Viewport is Blank. No Grid/ Axis Lines Report Generated: 2008-Oct-31 12:38:58 UTC Package: k3d Version: 0.5.14.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jul 9 2006 10:24:48 local Description of problem: This has been the case since I installed the sofware. Any Remedy? Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:03:49.116953 Z references: [] id: 4084f1c41c9a58ab4b0b49b7c8f988f45328edcc log_events: - - 2009-05-07 04:04:01.981448 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:07.934634 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:28:39.766838 Z - Timothy M. Shead - closed with disposition wontfix - This is an extremely out-of-date version of K-3D. ================================================ FILE: bugs/issue-40ed654ea75987f34bbe51980b5622cc079d3c7e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Optionally create 'back' faces in ExtrudeFaces. desc: When extruding outlines (such as 2D text), it would be useful for ExtrudeFaces to create 'back' faces, so the result is a solid polyhedron. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-02-23 04:03:15.931930 Z references: [] id: 40ed654ea75987f34bbe51980b5622cc079d3c7e log_events: - - 2010-02-23 04:03:16.451870 Z - Timothy M. Shead - created - "" - - 2010-02-27 06:42:08.882958 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" claimer: ================================================ FILE: bugs/issue-413564006de7bfe4283dc79f9165dedd9b49c271.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: SDSCorner modifier should produce vertex attributes instead of point attributes. desc: Like it says. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-03 15:48:36.044517 Z references: [] id: 413564006de7bfe4283dc79f9165dedd9b49c271 log_events: - - 2010-01-03 15:48:36.604554 Z - Timothy M. Shead - created - "" - - 2010-01-19 17:05:05.148549 Z - Bart Janssens - closed with disposition fixed - "" ================================================ FILE: bugs/issue-41f14db348415ee631409034dafa0d42d0deddea.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Make the K-3D guide readable from the NGUI. desc: |- Users should be able to open the K-3D guide from the NGUI, i.e. it should be distributed with the app and openable, either via HTML or PDF or both. Notes: we could use GtkHtml, or open the guide in the user's browser. type: :feature component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-07-04 19:13:18.774227 Z references: [] id: 41f14db348415ee631409034dafa0d42d0deddea log_events: - - 2010-07-04 19:13:19.629998 Z - Timothy M. Shead - created - "" claimer: ================================================ FILE: bugs/issue-42a7588ab85a23f2a39a9fb36b63b6fa9d7af0f5.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 (k3d:26077): GdkGLExt-WARNING **: cannot load PangoFont Segmentation fault (core dumped)" desc: |- Contact: jiricka@ints.cz Summary: (k3d:26077): GdkGLExt-WARNING **: cannot load PangoFont Segmentation fault (core dumped) Report Generated: 2008-Mar-25 23:27:24 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.1.3 20070831 (prerelease) (Ubuntu 4.1.2-16ubuntu1) Build Time: Sep 13 2007 03:47:14 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:30:12.528467 Z references: [] id: 42a7588ab85a23f2a39a9fb36b63b6fa9d7af0f5 log_events: - - 2009-05-19 03:30:13.703998 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:21.926641 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:27:15.247046 Z - Timothy M. Shead - closed with disposition wontfix - Can't reproduce. ================================================ FILE: bugs/issue-432f8b1d7711eb5d22d6046d20bc006c18d5090b.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Empty viewport on Windows Vista desc: |- Contact: matts-address@hotmail.com Summary: The viewport does not display anything. Report Generated: 2007-Dec-12 23:28:38 UTC Package: k3d Version: 0.6.6.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 6 2007 13:08:21 local Description of problem: Upon opening, the viewport does not display anything, unless a shape has just been inserted. I'm running Vista. Steps to reproduce problem: Open up K-3D 1. 2. 3. Expected results: Actual results: How often does this happen? All the time. Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-19 03:35:47.936321 Z references: [] id: 432f8b1d7711eb5d22d6046d20bc006c18d5090b log_events: - - 2009-05-19 03:35:48.712753 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:53:05.446654 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-11 05:42:44.867642 Z - Timothy M. Shead - edited title - "" - - 2009-11-15 16:12:46.718277 Z - Timothy M. Shead - closed with disposition reorg - This is already fixed in 0.7, using the DisableDesktopComposition plugin. ================================================ FILE: bugs/issue-43ed5f6b35f29c0788a75461bf33f3120387f6c1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Texture baking from RM SL to bitmaps. desc: |- CGKit lets you bake a Renderman texture http://cgkit.sourceforge.net/tutorials/baking/baking.html this method would allow renderman shaders as input to Luxrender textures, or any of the bitmap nodes for that matter. Perhaps not now, but in the future having GEGL in the pipeline would be very powerful (replace imagemagik?) http://gegl.org/ their way of doing things is very similar to your design of K-3D's architecture. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-06-27 15:35:19.707036 Z references: [] id: 43ed5f6b35f29c0788a75461bf33f3120387f6c1 log_events: - - 2009-06-27 15:35:20.466978 Z - Timothy M. Shead - created - "" - - 2009-08-02 22:46:45.047080 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-44735744038c3434abe3f3a7e13f881e2e2cc48e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Remove legacy code from FilletEdges desc: Like it says. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-12-29 03:13:14.813546 Z references: [] id: 44735744038c3434abe3f3a7e13f881e2e2cc48e log_events: - - 2009-12-29 03:13:15.781482 Z - Timothy M. Shead - created - "" - - 2010-01-15 06:12:48.958327 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-4523543999b211ff2977debc785b31e70964ea2b.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: compilation errors desc: |- hi, i have compilation errors... version 0.7.9.0 [ 26%] Building CXX object k3dsdk/ngui/CMakeFiles/k3dsdk-ngui.dir/widget_manip.o In file included from /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/inode.h:28, from /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/data.h:28, from /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/ngui/application_state.h: 27, from /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/ngui/widget_manip.cpp:24: /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/almost_equal.h: In member function 'const bool k3d::almost_equal::operator()(k3d::double_t, k3d::double_t) const': /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/almost_equal.h:149: warning: comparison between signed and unsigned integer expressions /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/almost_equal.h:149: warning: comparison between signed and unsigned integer expressions /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/almost_equal.h: In static member function 'static const k3d::int64_t k3d::almost_equal::to_integer(k3d::double_t)': /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/almost_equal.h:156: warning: dereferencing type-punned pointer will break strict-aliasing rules Linking CXX shared library ../../lib/libk3dsdk-ngui.so [ 26%] Built target k3dsdk-ngui Scanning dependencies of target k3dsdk-python-types [ 26%] Building CXX object k3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3frok3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3dsdk/k3dhok3r/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/algebra.h:30, from /usr/src/p/usr/src/p/usr/src/p/rce-0.7.9.0/k3dsdk/python/angle_axis_python. h:27, from /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/python/angle_axis_python. cpp:24: cpp:24: /packages/BUILD/k3d-source-0.7.9.0/k3dsdk/python/angle_axis_ m/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/python/angle_axis_ m/pac3d/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/python/angle_axis_ m/packages/BU9.0/k3dsdk/almost_equal.h:149: warning: comparison between signed and unsigned integer expressions /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/almost_equal.h:149: warning: comparison between signed and unsigned integer expressions /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/almost_equal.h/usr/src/packages/BUILD/k3d-sota/usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/to_integer(k3d::double_t)': /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/almost_equal.h:156: warning: dereferencing type-punned pointer will break strict-aliasing rules In file included from /usr/include/boost/python/class.hpp:29, from /usr/includefroost/python.hpp:18, from /usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/pyth/usrngle_ax/usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/pyth/usrngle_ax/usr/src/ba/usr/se:/usr/sin/usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/pyth/usrngle_ax/usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/pyth/usrngle_ax/usr/src/ba/usr/se:/usr/sin/usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/pyth/usrngle_ax/usr/src/pa::/usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/pyth/usrngle_ax/t_/usr/src/packages/BUILD/k3d-source-0.7.9.0/k3dsdk/pyth/usrngle_ax/us >::result_type boost::python::detail::def_helper::keyboost::python::detail::def_helper::keyboost::python::detail::def_helper::keyboost::python::detail::def_helper::keyboost::pyt/Cboost::python::detail::def_helper::keyboost::python:1]boost::python::detail::def_helper::keyboost::python: mmmmm *** [all] Error 2 can i fix it? type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:21:42.809002 Z references: [] id: 4523543999b211ff2977debc785b31e70964ea2b log_events: - - 2009-05-19 03:21:44.305029 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:16.102653 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-09-27 01:14:35.122172 Z - Timothy M. Shead - closed with disposition wontfix - Can't reproduce. ================================================ FILE: bugs/issue-45a8e81c24329d52763349b662988a9969e2a929.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Cleanup icons desc: We have many misnamed, obsolete, and missing icons - clean 'em up. type: :bugfix component: K-3D release: 0.8.0.1 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-04-17 03:12:11.601190 Z references: [] id: 45a8e81c24329d52763349b662988a9969e2a929 log_events: - - 2010-04-17 03:12:12.249148 Z - Timothy M. Shead - created - "" - - 2010-04-17 21:17:47.089170 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-478fd768c3286ce365c29af422175f8b9969ca11.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Revisit how to properly interpolate integer attributes. desc: Currently, interpolation of weighted integer primitive attributes produces wildly different results in some cases. We need to figure-out how to get consistent results - perhaps we should simply pick the attribute with the largest weight, as we do with pointer attributes? type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-04-04 05:05:15.345316 Z references: [] id: 478fd768c3286ce365c29af422175f8b9969ca11 log_events: - - 2010-04-04 05:05:16.225256 Z - Timothy M. Shead - created - "" claimer: ================================================ FILE: bugs/issue-49b3bc440ae6da65fec9979da016681ccdd7df24.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 .7.3 crashes (SelectEdgeLoops Undo) desc: |- 0: Start K-3D, 1: create a PolyCone (or make your choice), 2: use ";" to SelectEdgeLoops, 3: Undo the last operation 4: Start K-3D again ;) Vista 64bit type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:26:22.464921 Z references: [] id: 49b3bc440ae6da65fec9979da016681ccdd7df24 log_events: - - 2009-05-19 03:26:23.576851 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:18.583071 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-15 16:16:05.094276 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-4a400f4d42a40bb64cb5df9e83481ec74ea8974e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed " desc: |- I typed in "shadowdistant" in the shader path string space, and then pressed the "Relative" pulldown menu, and then pressed it really fast, again. The error I get is: ERROR Gtk: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed K3D is still going, and when I highlight something with my cursor(like "Shader Path"), it shows a tooltip. I am not able to exit using the "X" in the upperright corner of K3D. I had to "Ctrl+C" K3D in the console I ran it from. Unfortunatly, I am not able to reproduce this bug on purpose, only on accident. But I know for a positive, 100% fact that it has to do with the "Relative, Absolute, Inline" pulldown menu. I hope this was descriptive enough. I've had a lot of problems with this in the past 2 days of working with K3D, and think it's a pretty big bug. System specs: PCLinuxOS 2007 GTK 2.12.2-4pclos2007 K3D 0.6.7.0 K3D is nice, btw. I hope it "grows up" more. email: leiget at gmail . com type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 04:07:21.056584 Z references: [] id: 4a400f4d42a40bb64cb5df9e83481ec74ea8974e log_events: - - 2009-05-06 04:07:22.384467 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:05.111069 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-10-17 20:25:20.674081 Z - Timothy M. Shead - closed with disposition wontfix - Can't reproduce. ================================================ FILE: bugs/issue-4a7cea3d5863e1dec9aa8e78e239963e9c451926.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Restore BridgeFaces desc: Now that I understand how BridgeFaces differs from BridgeEdges, bring it back. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-21 06:15:36.907229 Z references: [] id: 4a7cea3d5863e1dec9aa8e78e239963e9c451926 log_events: - - 2010-02-21 06:15:37.562852 Z - Timothy M. Shead - created - "" - - 2010-02-24 08:18:57.627879 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-4ac006d705b9b7b5b3468932c4e7750d95564cce.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: no images come up on viewport desc: |- Contact: markbaird88@hotmail.co.uk Summary: no images come up on viewport Report Generated: 2008-May-04 17:17:47 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:22:32.920909 Z references: [] id: 4ac006d705b9b7b5b3468932c4e7750d95564cce log_events: - - 2009-05-19 03:22:33.936926 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:16.470642 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:31:01.095070 Z - Timothy M. Shead - closed with disposition wontfix - Works here. ================================================ FILE: bugs/issue-52654f9476391c6612de54e91d54e4dcda7bb847.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: build error desc: "In file included from\n\ /home/7eggert/l/k3d-source-0.7.10.0/k3dsdk/python/const_typed_array_python.\n\ cpp:27:\n\ /home/7eggert/l/k3d-source-0.7.10.0/k3dsdk/python/utility_python.h: In\n\ function \xE2\x80\x98void k3d::python::utility::copy(const boost::python::list&,\n\ target_t&)\xE2\x80\x99:\n\ /home/7eggert/l/k3d-source-0.7.10.0/k3dsdk/python/utility_python.h:102:\n\ error: \xE2\x80\x98len\xE2\x80\x99 is not a member of \xE2\x80\x98boost::python\xE2\x80\x99\n\ make[2]: ***\n\ [k3dsdk/python/CMakeFiles/k3dsdk-python-const-arrays.dir/const_typed_array_\n\ python.o] Error 1\n\ make[1]: *** [k3dsdk/python/CMakeFiles/k3dsdk-python-const-arrays.dir/all]\n\ Error 2\n\ make: *** [all] Error 2" type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 03:57:46.656158 Z references: [] id: 52654f9476391c6612de54e91d54e4dcda7bb847 log_events: - - 2009-05-06 03:57:48.248324 Z - Beverly L. Shead - created - "" - - 2009-07-22 02:51:26.468479 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:22:09.566809 Z - Timothy M. Shead - closed with disposition wontfix - Works fine here; there's been enough change in the file that it's difficult to tell whether this could be an issue for someone else, so punt. ================================================ FILE: bugs/issue-538f9fab4a345ba7c88ba39b4faa0ef55cfffaad.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Manipulators dissapear when changing the selection mode. desc: "Steps:\n\ 1- New document\n\ 2- Create cube\n\ 3- Switch to vertex selection and select something\n\ 4- Change the selection mode. Manipulators are gone.\n\n\ Seems that manipulators and transformations tools are acting weird. More\n\ bugs on this later\n\n\ Cheers!\n\ Joaqu\xC3\xADn" type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:41:03.800783 Z references: [] id: 538f9fab4a345ba7c88ba39b4faa0ef55cfffaad log_events: - - 2009-05-19 03:41:04.512090 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:50:15.382652 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-20 06:33:06.249464 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-555cc14dcbca30e03f0a333f0236c8f653e0a7f1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: keeps just closing (as if i had told it to do so, no error message) when using the tutorial desc: |- Contact: wpi2@aol.com Summary: keeps just closing (as if i had told it to do so, no error message) when using the tutorial Report Generated: 2008-Mar-11 17:15:31 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.1.3 20070831 (prerelease) (Ubuntu 4.1.2-16ubuntu1) Build Time: Sep 13 2007 03:47:14 local Description of problem: Steps to reproduce problem: 1. I start the tutorial normally 2. everything goes fine until it just closes everything and that's it. 3. Particularly when i get to the fourth chapter in tuto, but also did the same a few times before getting that far Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:32:22.176629 Z references: [] id: 555cc14dcbca30e03f0a333f0236c8f653e0a7f1 log_events: - - 2009-05-19 03:32:22.696225 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:03:05.939119 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:06:15.859240 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-5970a8d939cc358d1ab2bef5c0eeabf2baa2a9e8.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Remove legacy code from DissolveComponents. desc: Like it says. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-12-29 03:14:04.757547 Z references: [] id: 5970a8d939cc358d1ab2bef5c0eeabf2baa2a9e8 log_events: - - 2009-12-29 03:14:05.717480 Z - Timothy M. Shead - created - "" - - 2010-02-02 01:37:53.526297 Z - Timothy M. Shead - issue claimed - "" - - 2010-02-06 04:59:42.583540 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-02-21 06:16:04.978883 Z - Timothy M. Shead - assigned to release 0.8.0.0 from 1.0.0.0 - "" - - 2010-03-17 05:23:06.705251 Z - Timothy M. Shead - closed with disposition fixed - "Replaced DissolveComponents with DissolveFaces. TODO in a later release: create DissolveEdges and DissolvePoints to match." claimer: Timothy M. Shead ================================================ FILE: bugs/issue-5d9c8400eb4dcb02edcf8dc56ce8bcd91955a53c.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: MakeCreases has no implementation. desc: Like it says ... we either need to provide an implementation or remove it. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :wontfix creation_time: 2009-12-01 06:34:31.520276 Z references: [] id: 5d9c8400eb4dcb02edcf8dc56ce8bcd91955a53c log_events: - - 2009-12-01 06:34:32.432220 Z - Timothy M. Shead - created - "" - - 2010-01-11 16:42:28.958175 Z - Bart Janssens - commented - Implementation should be postponed until we have a complete set of EUler operations. The last implementation dates back to the legacy mesh structure and was quite complex, but Euler operations would greatly simplify things. - - 2010-01-12 06:16:55.565269 Z - Timothy M. Shead - closed with disposition wontfix - We are going to postpone work on this. ================================================ FILE: bugs/issue-5f88eac8fa3003c363a0364ee8827a438bcda2ca.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Viewport Display Not functioning desc: |- Contact: truswellj@gmail.com Summary: Viewport Display Not functioning Report Generated: 2008-Mar-17 19:29:32 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.1.3 20070831 (prerelease) (Ubuntu 4.1.2-16ubuntu1) Build Time: Sep 13 2007 03:47:14 local Description of problem: Upon opening the program, the viewport area is black. I can get it to show the display but as soon as I click anyway, the display changes to completely gray. Steps to reproduce problem: 1. Open K-3D 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:31:42.280743 Z references: [] id: 5f88eac8fa3003c363a0364ee8827a438bcda2ca log_events: - - 2009-05-19 03:31:42.880562 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:23.094726 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:43:10.879146 Z - Timothy M. Shead - closed with disposition wontfix - This might be a duplicate of {issue deed7f51f539b6c62b97c585ed7453b3242c9992}. ================================================ FILE: bugs/issue-5fde01d7a4fcdff886003dbaeb9773d33e2b9f18.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Selection issues when moving from 64-bit to 32-bit platforms. desc: We store "select all" and "deselect all" operations as an assignment of selection weights to the entire range of values that can be stored in uint_t. Because the range varies depending on platform word size, documents saved on a 64-bit platform cannot be deserialized on 32-bit platforms. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-07-19 22:11:44.622812 Z references: [] id: 5fde01d7a4fcdff886003dbaeb9773d33e2b9f18 log_events: - - 2009-07-19 22:11:46.198687 Z - Timothy M. Shead - created - "" - - 2009-07-20 05:07:10.686826 Z - Timothy M. Shead - closed with disposition fixed - Clamp 64-bit values when loading files on a 32-bit platform. This provides the correct semantics for selections, which will continue to work. ================================================ FILE: bugs/issue-607cbe27448028c9efc67e008d01f1e507bb1fbd.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Review plugin names desc: |- Among other proposals: Should JoinPoints be changed to FusePoints, or UnitePoints, because join points means form a line between two points (or more if there is sequence data in the selection set)? "Join" has also been misused elsewhere so if we change join to a more appropriate word it should be done consistently. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-10 05:20:59.666799 Z references: [] id: 607cbe27448028c9efc67e008d01f1e507bb1fbd log_events: - - 2009-08-10 05:21:00.458739 Z - Timothy M. Shead - created - "" - - 2010-02-23 03:48:27.282805 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-624ea57c7b26a27eba7f3bfd65f0dee40eb814d3.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 when I try to point element, viewport become black, and after it return grid, but I cannot select nothing desc: |- Contact: win22@pochta.ru Summary: when I try to point element, viewport become black, and after it return grid, but I cannot select nothing Report Generated: 2007-Dec-06 19:54:18 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.1.3 20070831 (prerelease) (Ubuntu 4.1.2-16ubuntu1) Build Time: Sep 13 2007 03:47:14 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:36:44.719801 Z references: [] id: 624ea57c7b26a27eba7f3bfd65f0dee40eb814d3 log_events: - - 2009-05-19 03:36:46.816197 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:53:09.039044 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:40:20.167186 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-630255130a08cc316bba010d111dad725f7f9258.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Doesn't work with Windows 7 desc: |- This program isn't work with Windows 7 (Vienna). It gave about 55% of CPU and do nothing. version 0.6.7.0 os Windows 7 Ultimate build 7000 I've installed full of package downloaded from http://switch.dl.sourceforge.net/sourceforge/k3d/k3d-all-in-one-setup-0.6.7 .0.exe What about this reason? type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 03:48:51.680121 Z references: [] id: 630255130a08cc316bba010d111dad725f7f9258 log_events: - - 2009-05-06 03:48:56.640234 Z - Timothy M. Shead - created - "" - - 2009-07-22 02:48:29.156378 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:49:54.607054 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-637f683833589ed1b5cd3f5028206c80ec97d3e9.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: NurbsEditCurveKnotVector segfaults when created. desc: "" type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-23 20:49:00.397697 Z references: [] id: 637f683833589ed1b5cd3f5028206c80ec97d3e9 log_events: - - 2009-08-23 20:49:01.117777 Z - Timothy M. Shead - created - "" - - 2009-10-07 01:24:35.873135 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-63e3d51ee3915a539f21adf515ed7275f359295b.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix broken NURBS tests. desc: "" type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-23 23:44:54.773621 Z references: [] id: 63e3d51ee3915a539f21adf515ed7275f359295b log_events: - - 2009-08-23 23:44:55.413561 Z - Timothy M. Shead - created - "" - - 2009-12-12 03:57:42.028512 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-66dbf9444de6bcf5ef19d5ad94b51e0e5b58c3cd.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "black box were the model should be " desc: |- Contact: macfuehrbush@gmail.com Summary: black box were the model should be Report Generated: 2008-Jun-08 02:45:05 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.2.3 (Ubuntu 4.2.3-2ubuntu1) Build Time: Feb 27 2008 23:29:50 local black box were the model should be Steps to reproduce problem: 1. open k 3d in extra efecks mode on ubuntu 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-07 04:15:37.261676 Z references: [] id: 66dbf9444de6bcf5ef19d5ad94b51e0e5b58c3cd log_events: - - 2009-05-07 04:15:37.813342 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:14.078701 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:33:26.079051 Z - Timothy M. Shead - closed with disposition reorg - This appears to be a duplicate of {issue deed7f51f539b6c62b97c585ed7453b3242c9992}. ================================================ FILE: bugs/issue-6a66838dfc4773a21c04575103c92d8e8802f5ff.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Remove legacy code from CollapseFaces. desc: Like it says. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-12-29 03:14:35.677573 Z references: [] id: 6a66838dfc4773a21c04575103c92d8e8802f5ff log_events: - - 2009-12-29 03:14:36.509493 Z - Timothy M. Shead - created - "" - - 2010-01-14 21:58:15.053279 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-6aedc6869efacb25e643f2bb3d447338cc7307e5.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 Das Tutorial Skript Nr. 5 st\xC3\xBCrzt ab" desc: "Contact: hans.frericks@web.de\n\ Summary: Das Tutorial Skript Nr. 5 st\xC3\xBCrzt ab\n\ Report Generated: 2008-Oct-12 09:57:46 UTC\n\ Package: k3d\n\ Version: 0.6.7.0\n\ Platform: i486-pc-linux-gnu\n\ Compiler: 4.2.3 (Ubuntu 4.2.3-2ubuntu1)\n\ Build Time: Feb 27 2008 23:29:50 local\n\ Description of problem:\n\n\ Steps to reproduce problem:\n\n\ 1. Help - Tutorial - GTS Boolean (Advanced) --> Programmabsturz\n\ 2.\n\ 3.\n\n\ Expected results:\n\n\ Actual results:\n\n\ How often does this happen?\n\n\ Additional information:" type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:05:21.149679 Z references: [] id: 6aedc6869efacb25e643f2bb3d447338cc7307e5 log_events: - - 2009-05-07 04:05:22.205545 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:01:29.067072 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:05:33.043156 Z - Timothy M. Shead - closed with disposition fixed - "" - - 2009-08-03 00:30:04.398851 Z - Timothy M. Shead - closed with disposition wontfix - "" ================================================ FILE: bugs/issue-6b7163b333419334ced5dd726d5b5a5c669cb9c8.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Rendering of files does not work desc: |- Contact: shashank.araokar@gmail.com Summary: Rendering of files does not work Report Generated: 2007-Aug-14 20:21:32 UTC Package: k3d Version: 0.6.6.0 Platform: i486-pc-linux-gnu Compiler: 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7) Build Time: Jan 16 2007 15:55:06 local Description of problem: Steps to reproduce problem: 1. Create any simple model 2. Say render (either press F12 or render frame) 3. Save the file as needed (if needed) Expected results: Anything sensible (say a preview or something) Actual results: Nothing happens. File is not saved. No error is reported. No warnings, no results How often does this happen? Each time Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:43:08.584443 Z references: [] id: 6b7163b333419334ced5dd726d5b5a5c669cb9c8 log_events: - - 2009-05-19 03:43:09.280302 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:49:54.479171 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:19:42.470995 Z - Timothy M. Shead - closed with disposition wontfix - Works here. ================================================ FILE: bugs/issue-6d0f5f71bcca568aab7d418c23ea12de51a07b88.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Bug while moving vertices, edges and faces on a tutorial desc: "Resuming:\n\ 1-Start recording a tutorial\n\ 2-Select a face/edge/vertex\n\ 3-Move it\n\ 4-Without changing the move tool select and move another face/edge/vertex\n\ 5-Play the script\n\n\ I attach a k3dscript file for reproducing the bug.\n\ It throws on the terminal (in 0.6.7 and 0.7.0)\n\ WARNING: Selection contained records without nodes\n\ ERROR Command node [move_tool] unhandled command: [lmb_click_replace]\n\ [/document/window/viewport0.418126\n\ 0.638689]\n\n\ This script was recorded on k3d 0.6.7 and when played on 0.7 it selects a\n\ different face. Seems like coordinates are upside down. I'll will submit\n\ another bug report on this subject.\n\n\ Thanks for merging the mug script!\n\n\ Cheers,\n\ Joaqu\xC3\xADn." type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:45:29.375947 Z references: [] id: 6d0f5f71bcca568aab7d418c23ea12de51a07b88 log_events: - - 2009-05-19 03:45:29.871867 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:03:32.795165 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:06:39.795088 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-6e358533fc719d3b3c1fe8b061f7091cd046453e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: lots of soft of this packages are unsigned , loaded from mandriva 2008.0.rpm.I586 desc: |- Contact: mgb-system@wanadoo.fr Summary: lots of soft of this packages are unsigned , loaded from mandriva 2008.0.rpm.I586 Report Generated: 2008-Aug-30 14:21:44 UTC Package: k3d Version: 0.6.7.0 Platform: i586-mandriva-linux-gnu Compiler: 4.1.2 20070302 (prerelease) (4.1.2-1mdv2007.1) Build Time: Jun 12 2007 17:42:53 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:08:41.813615 Z references: [] id: 6e358533fc719d3b3c1fe8b061f7091cd046453e log_events: - - 2009-05-07 04:08:42.533530 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:10.686639 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-02 23:17:10.927021 Z - Timothy M. Shead - closed with disposition wontfix - This is a downstream distribution issue, if I understand the OP's meaning correctly. ================================================ FILE: bugs/issue-703980e3eb7434bec1481e3f7b5558bf64926f9e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Segfault right after the splash screen comes up desc: |- Contact: tuomi6@cs.tut.fi Summary: Segfault right after the splash screen comes up Report Generated: 2007-Jun-11 14:59:03 UTC Package: k3d Version: 0.6.0.0 Platform: x86_64-pc-linux-gnu Compiler: 4.1.2 20061115 (prerelease) (Debian 4.1.1-20) Build Time: Dec 3 2006 00:16:05 local Description of problem: Program starts up, displays splash screen, then segfaults: /usr/bin/k3d: line 180: 12802 Segmentation fault /usr/bin/k3d-bin --options /home/tuomi/.k3d/options.k3d --plugins /usr/lib/k3d --shadercache /home/tuomi/.k3d/shadercache --share /usr/share/k3d --tutorials /usr/share/k3d/tutorials --ui /usr/lib/libk3dngui.so Steps to reproduce problem: 1. Start program. 2. 3. Crash and burn. Expected results: Wanted to try out this program. Actual results: It segfaulted before I even got it to load. How often does this happen? Every time I try. Additional information: Using k3d 0.6.0.0 (Debian package) on Debian 2.6.18-3-amd64 (testing), on my home computer. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:46:30.983802 Z references: [] id: 703980e3eb7434bec1481e3f7b5558bf64926f9e log_events: - - 2009-05-19 03:46:31.664463 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:49:18.510706 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:38:48.783075 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-7186061f7d139f1591333c49d6bc53b93cb6ecc3.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: RenderManArrayXD plugins should be more generic. desc: |- I think that RenderManArray... (http://www.k-3d.org/wiki/Array_Plugins) should be converted into a more generic RenderingProxyArray and that it should also be able to generate an array of actual object instances so that it can be used as a modeling tool and for cases where a proxy cannot be used in the chosen output format. At the moment it will not work with LuxRender but Lux does support geometry instancing. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-07-14 03:54:59.949374 Z references: [] id: 7186061f7d139f1591333c49d6bc53b93cb6ecc3 log_events: - - 2009-07-14 03:55:01.277314 Z - Timothy M. Shead - created - "" - - 2009-08-02 22:46:31.191045 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-71a4669f4804254394b5e170afb5ca0fc537ad62.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Hint Refactoring desc: Complete the action items documented in http://www.k-3d.org/wiki/Hint_Refactoring - in particular, update all pipeline components to implement hint-mapping when updating their state in response to property changed signals. type: :task component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-04-29 01:55:58.107159 Z references: [] id: 71a4669f4804254394b5e170afb5ca0fc537ad62 log_events: - - 2009-04-29 01:55:59.307170 Z - Timothy M. Shead - created - "" - - 2009-08-21 05:53:07.681355 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-05-22 00:34:48.558807 Z - Timothy M. Shead - assigned to release 0.8.1.0 from 1.0.0.0 - "" claimer: ================================================ FILE: bugs/issue-71abd763037b718e574529c33c58a458f05af48c.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "User properties Order and NullOutputScript " desc: |- On 0.7 rev 899, ubuntu feisty fawn When user properties are created via script, when the file is reloaded, they are reordered missing it's original order. (this doesn't happen on manually created user properties) NullOutputScript When opening a file it evaluates its script before its user properties are created. I guess is has to do with /scripting/null_output_script.cpp line 51: connect_script_changed_signal(sigc::mem_fun(*this, &null_output_script::on_execute)); type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:24:08.601156 Z references: [] id: 71abd763037b718e574529c33c58a458f05af48c log_events: - - 2009-05-19 03:24:09.880832 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:17.303072 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-21 05:48:04.465475 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-71e0e500fc3a528e690296d69e5f6c8d62cb0076.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Add support for merging polyhedra. desc: |- The MergeMesh modifier generates the 'union' of geometric primitives in its output, but many operations (BridgeFaces and BridgeEdges come to mind) can only work on individual primitives. Similarly, multiple polyhedron primitives must be merged into one to create a solid / manifold for operations such as CatmullClark. Create a MergePolyhedra filter to address these cases. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-02-27 06:47:22.555937 Z references: [] id: 71e0e500fc3a528e690296d69e5f6c8d62cb0076 log_events: - - 2010-02-27 06:47:23.178841 Z - Timothy M. Shead - created - "" claimer: ================================================ FILE: bugs/issue-720f97d969465f88647103a679fccfba9fdfe595.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Interactive node selection doesn't update node properties panel. desc: When selecting nodes interactively, the node properties panel no longer updates to display properties for the selected node. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-03 15:29:18.385155 Z references: [] id: 720f97d969465f88647103a679fccfba9fdfe595 log_events: - - 2009-08-03 15:29:19.233178 Z - Timothy M. Shead - created - "" - - 2009-10-12 01:33:23.928497 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-726036fd940e69af892483f4fb81ced5076343c0.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Add information on materials to the Guide. desc: Like it says - there are a lot of support requests around material management. type: :feature component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-07-04 19:13:56.370134 Z references: [] id: 726036fd940e69af892483f4fb81ced5076343c0 log_events: - - 2010-07-04 19:13:57.177396 Z - Timothy M. Shead - created - "" claimer: ================================================ FILE: bugs/issue-72b9eb7ea6f2ee49a1aa6de0f9bdda95fd8226af.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Nothing showing in the view port desc: |- Contact: vnhg@yahoo.com Summary: Nothing showing in the view port Report Generated: 2008-Jan-28 03:37:34 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:33:18.128479 Z references: [] id: 72b9eb7ea6f2ee49a1aa6de0f9bdda95fd8226af log_events: - - 2009-05-19 03:33:20.192201 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:23.959067 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:41:29.087182 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-734d997c30a2208e4cc49cfc83071a6e8c446203.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 The viewport does not update desc: |- Contact: wil.lemmelliw@gmail.com Summary: The viewport does not update Report Generated: 2008-Jun-17 02:45:04 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: I installed k3d-all-in-one-setup-0.6.7.0.exe on a Vista buisiness AsusG2 laptop with Nvidia geforce_8600M (1440x900) The viewport does not update or show at all I cannot rotate the view even if the grid shows. I have seen a reported framerate of 1000 or maybe even 4000 (can't repeat it right now) Steps to reproduce problem: Run the k3d-all-in-one-setup-0.6.7.0.exe installer on my system. Note: I did intall the components all in 1 directory on my D drive. How often does this happen? From the first run on. Additional information: I'm willing to test any (alpha) code that might solve this problem or can help to identify the bug. Cheers Willem. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-07 04:14:59.604742 Z references: [] id: 734d997c30a2208e4cc49cfc83071a6e8c446203 log_events: - - 2009-05-07 04:15:00.717527 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:13.712926 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 04:00:04.783041 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue da8965ea23097589e5b98a3b8c42580329dad12c}. ================================================ FILE: bugs/issue-73b9d9eaea5e3100dfbd016ed74852541fea45b3.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Nothing right desc: |- When i want to open K-3D it is on another language, like china or japan (i don't know). But that's not all: it don't work (with version 0.5.x, 0.6.x and 0.7.x type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:16:50.381733 Z references: [] id: 73b9d9eaea5e3100dfbd016ed74852541fea45b3 log_events: - - 2009-05-07 04:16:51.237604 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:14.910664 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-09-27 01:13:36.946174 Z - Timothy M. Shead - closed with disposition wontfix - Can't reproduce. ================================================ FILE: bugs/issue-748f4bfe0ef0aca0e383b81aa75f4ea91b90a9fb.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Use the solar position data in other parts of the pipeline. desc: A means of connecting a Sun Position (Vector3 ?) to a Matrix (rotation in particular) so I can point things at the sun, or calculate a building's roof overhang by intersecting a line along a vector from the base of it's wall to the sun, with another line from the top of the wall. e.g. say I want to let the (mid day) winter/fall sun into the windows of my house from a given date onwards, I need to plot the height of the sun at that time. Having what we know about the sun drive the geometry of the building is the key to energy efficient solar oriented design. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-06-27 15:30:14.762912 Z references: [] id: 748f4bfe0ef0aca0e383b81aa75f4ea91b90a9fb log_events: - - 2009-06-27 15:30:16.226721 Z - Timothy M. Shead - created - "" - - 2009-06-27 15:32:43.574722 Z - Timothy M. Shead - edited title, description - "" - - 2009-08-02 22:47:03.999068 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-7642bc88b925585b8359bf58a5e818edf5575823.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Create a test to validate that code never calls exit(). desc: "" type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-04-30 05:22:36.017534 Z references: [] id: 7642bc88b925585b8359bf58a5e818edf5575823 log_events: - - 2009-04-30 05:22:37.529359 Z - Timothy M. Shead - created - "" - - 2009-07-15 06:00:11.659989 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-19 21:33:24.462772 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-79d92fefbdd858ed65e5dcc7605f304a4d29f4db.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 After importing k3d file, render doesnt work. desc: |- Contact: marchalas@yahoo.com Summary: After importing k3d file, render doesnt work. Report Generated: 2007-Dec-03 15:27:35 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.1.3 20070831 (prerelease) (Ubuntu 4.1.2-16ubuntu1) Build Time: Sep 13 2007 03:47:14 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:37:15.816725 Z references: [] id: 79d92fefbdd858ed65e5dcc7605f304a4d29f4db log_events: - - 2009-05-19 03:37:16.591663 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:53:12.591024 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-21 05:48:34.665463 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-7b49e59fee09d9c477c0bc0099d17bda335bafc1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: k3d should use cmake's module to find system boost desc: |- cmake already provides a FindBoost module which could be used as a wrapper for boost. I've put a draft patch at here: http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/k3d/current/SOUR CES/k3d-0.7.8.0-fix-boost.patch type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-07 04:09:57.453669 Z references: [] id: 7b49e59fee09d9c477c0bc0099d17bda335bafc1 log_events: - - 2009-05-07 04:09:58.309676 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:11.550649 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-02 23:11:30.006875 Z - Timothy M. Shead - closed with disposition fixed - We've completely revamped our boost-related configuration; under the hood we use the standard CMake FindBoost module. ================================================ FILE: bugs/issue-7bc390041917f4dad49790f8eaf5b365add00512.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " Orthographic Toggle doesn't work inside a Tutorial " desc: "1-Run the mug tutorial\n\ 2-When it tries to toggle to Orthographic mode nothing happens. It seems\n\ that the focus on the current viewport is lost.\n\ Same thing for View->Set View menu.\n\n\ Cheers!\n\ Joaqu\xC3\xADn" type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:41:31.160261 Z references: [] id: 7bc390041917f4dad49790f8eaf5b365add00512 log_events: - - 2009-05-19 03:41:31.839724 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:03:28.627190 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:06:31.853531 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-7c1f591407ab1ed2d13f8d12ac20f23ba757029b.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fatal Error desc: |- Contact: zeletik@seznam.cz Summary: Fatal Error Report Generated: 2008-Dec-08 17:46:06 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: When I click on icon of K-3D it shows me a window with "Caught unknown exception. Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 04:09:37.344491 Z references: [] id: 7c1f591407ab1ed2d13f8d12ac20f23ba757029b log_events: - - 2009-05-06 04:09:38.336473 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:06.534647 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:32:34.998865 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-7d151b992517ccf1a476e994da4ae95f811a0f28.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " vertex selection is not visible" desc: |- Vertex selection is nigh unusable because the selected vertices are not visible. Please enlarge them (and maybe the non-selected vertices, too for easier selection). type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:31:15.272470 Z references: [] id: 7d151b992517ccf1a476e994da4ae95f811a0f28 log_events: - - 2009-05-19 03:31:16.008578 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:22.671075 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 14:49:27.355478 Z - Beverly L. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-7d2708ff9bb5cd775481c46e2c34639a6baece89.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: NGUI startup fails on FreeBSD. desc: |- During startup on FreeBSD 8, initialization of the user interface plugin fails, generating the following error message: CRITICAL: Caught exception [std::runtime_error] - UI plugin module [/home/jared/k3d-build/lib/k3d/plugins/k3d-ngui.module] does not implement k3d::iuser_interface *** Error code 1 ... this error means that a dynamic_cast to k3d::iuser_interface is failing, which should never happen since we know that the NGUI does, in fact, implement k3d::iuser_interface. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-03 02:02:04.445265 Z references: [] id: 7d2708ff9bb5cd775481c46e2c34639a6baece89 log_events: - - 2010-02-03 02:02:11.021207 Z - Timothy M. Shead - created - "" - - 2010-02-04 02:22:55.512064 Z - Timothy M. Shead - commented - It looks like this problem is solved using the description at http://gcc.gnu.org/faq.html#dso ... in light of what the FAQ says, it's surprising that this has ever worked with any gcc build !? - - 2010-02-06 03:03:49.773614 Z - Timothy M. Shead - closed with disposition fixed - Making executable symbols explicitly available to the dynamic linker fixes this issue. claimer: ================================================ FILE: bugs/issue-7f5736e37d226ef0df24d5ff0a103233993c1871.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "Crash deleting a node with property connections with undo/redo disabled:" desc: |- The following script causes a segfault: #python import k3d doc = context.document camera_name = "Camera Top" camera_pos = (0, 0, 10) camera = k3d.plugin.create("Camera", doc) camera.name = camera_name camera_position = k3d.plugin.create("FrozenMatrix", doc) camera_position.matrix = k3d.translate3(camera_pos) #no crash if the following line is commented out k3d.property.connect(doc, camera_position.get_property("output_matrix"), \ camera.get_property("input_matrix")) existing = k3d.node.lookup_one(doc, camera_name) doc.delete_node(existing) The segfault disappears if you a) don't make the property connection, or b) make the deletion undoable. type: :bugfix component: K-3D release: reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-11-05 04:19:41.731209 Z references: [] id: 7f5736e37d226ef0df24d5ff0a103233993c1871 log_events: - - 2010-11-05 04:19:43.067208 Z - Timothy M. Shead - created - "" claimer: ================================================ FILE: bugs/issue-809dbf8876e9da36c54d116410338e64ea634de7.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix SubdivideFaces. desc: Need to update SubdivideFaces to match changes to the polyhedron schema for shells. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-01 03:17:29.412511 Z references: [] id: 809dbf8876e9da36c54d116410338e64ea634de7 log_events: - - 2010-01-01 03:17:29.860444 Z - Timothy M. Shead - created - "" - - 2010-01-15 04:46:22.046305 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-80b04a4ce93501dca03dff1f05711e2e22a6cdf7.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 Tutorial and Examples - Panel Basics - Timeline short description - continue - Error executing script " desc: |- Contact: matachuk@gmail.com Summary: Tutorial and Examples - Panel Basics - Timeline short description - continue - Error executing script Report Generated: 2008-Aug-17 10:54:40 UTC Package: k3d Version: 0.7.6.0 Platform: Windows-5.1;x86 Compiler: 3.4.5 (mingw special) Build Time: Jun 23 2008 19:34:18 local Description of problem: I watched tutorial and after some steps the tutorial stops unexpectedly. Steps to reproduce problem: 1. Start Help->Tutorial and Examples and choose Panel Basics, ckick on the Continue Tutorial 2. continue with the tutorial 3. after Time Line is being mentioned, click on the Continue Tutorial and then the dialog 'Error executing script' will popup Expected results: Tutorial should continue with lessons Actual results: Tutorial is stopped and tutorial tool bar disapears How often does this happen? Every time you try to go to the step after Time Line explanation Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-07 04:11:35.805630 Z references: [] id: 80b04a4ce93501dca03dff1f05711e2e22a6cdf7 log_events: - - 2009-05-07 04:11:36.485562 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:02:43.227182 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:05:40.779132 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-810cbd67c6f6737ee2900a8a85fd107e81a416bf.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: help() in python shell locks up K-3D with 0% CPU usage. desc: "" type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-05 07:57:21.457261 Z references: [] id: 810cbd67c6f6737ee2900a8a85fd107e81a416bf log_events: - - 2010-02-05 07:57:22.321223 Z - Timothy M. Shead - created - "" - - 2010-02-05 07:57:56.969314 Z - Timothy M. Shead - closed with disposition fixed - Disabled interactive help() in the Python Shell. claimer: ================================================ FILE: bugs/issue-83af56cb47d6d6414fdc911fd5ae4ea45b23691b.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Add a nag message when using experimental plugins. desc: Like it says. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-21 05:46:25.778913 Z references: [] id: 83af56cb47d6d6414fdc911fd5ae4ea45b23691b log_events: - - 2010-02-21 05:46:26.330843 Z - Timothy M. Shead - created - "" - - 2010-02-21 07:08:20.594891 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-85307f5c478fef938ea9202d85d4fb6ca351f82b.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 uuid.random wrongly implemented " desc: |- uuid.random() implementation in Subversion generates only "00000 ..." . The code body missed "uuid_make" to produce correct uuid value. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:30:39.904679 Z references: [] id: 85307f5c478fef938ea9202d85d4fb6ca351f82b log_events: - - 2009-05-19 03:30:40.681825 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:22.303074 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-02 23:19:16.023057 Z - Timothy M. Shead - closed with disposition wontfix - Works for me. ================================================ FILE: bugs/issue-87422f875fafba82217cb6ea9926431c664008e1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Problems selecting points in instanced geometry. desc: |- Steps to reproduce: * Start K-3D. * Create a PolyCube. * Right click on the cube and choose Instantiate. * Use the Translate Tool to offset the new instance so it doesn't overlap with the original. * Choose Select > Points. * Try to select some points in the new instance - doesn't work. * Choose Select > Nodes. * Shift-click on the original instance so both instances are selected. * Choose Select > Points. * Try to select some points in the original instance - corresponding points in both instances are selected. * Choose Select > Edges. * Make selections in both instances - works fine. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-01-02 00:18:21.628527 Z references: [] id: 87422f875fafba82217cb6ea9926431c664008e1 log_events: - - 2010-01-02 00:18:22.388479 Z - Timothy M. Shead - created - "" - - 2010-02-13 01:25:48.086236 Z - Timothy M. Shead - commented - Turning-off K3D_BUILD_ADVANCED_OPENGL_PAINTERS fixes this issue, need to figure-out where things are going wrong ... VBO point painters? - - 2010-02-14 01:35:45.277214 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - We've disabled the experimental VBO points painter, so this will only be an issue when it is finally ready to be released. claimer: ================================================ FILE: bugs/issue-880751463fbb518318275de1613945c253d371d4.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Script with NURBS desc: |- mpetion1@gmail.com writes This attached script is for importing a bv file, which is used here at the Univerisity for research purposes. Initially the script was written in version .6.7 the current script imports a polyhedron type mesh ########################### sample bv file of a cube where 1 denotes the file type (polyhedron)and 8 represents the # of vertices, 6 the # of faces 1 8 6 1.0 1.0 -1.0 #points that describe the cube 1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 1.0 -1.0 1.0 0.999999 1.0 0.999999 -1.000001 1.0 -1.0 -1.0 1.0 -1.0 1.0 1.0 4 0 1 2 3 #gives the connecting points 4 4 7 6 5 4 0 4 5 1 4 1 5 6 2 4 2 6 7 3 4 4 0 3 7 type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:27:38.616463 Z references: [] id: 880751463fbb518318275de1613945c253d371d4 log_events: - - 2009-05-19 03:27:39.296825 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:19.446661 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-11 05:35:23.011551 Z - Timothy M. Shead - closed with disposition wontfix - The new generic geometric primitive API makes this item obsolete. ================================================ FILE: bugs/issue-895d272b3cce6c0d083757a9b1d22066be7e8d48.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Desktop is all horz lines desc: |- Contact: ladrnbrgr@gmail.com Summary: Desktop is all horz lines Report Generated: 2009-Mar-01 04:46:04 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.3.1 Build Time: Aug 26 2008 08:33:39 local Description of problem: When program starts and opens to an untitled document, the screen is full of Horizontal lines Steps to reproduce problem: Launch program 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-06 03:57:04.568248 Z references: [] id: 895d272b3cce6c0d083757a9b1d22066be7e8d48 log_events: - - 2009-05-06 03:57:06.040297 Z - Beverly L. Shead - created - "" - - 2009-07-22 02:50:51.236490 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:50:40.439152 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue deed7f51f539b6c62b97c585ed7453b3242c9992}. ================================================ FILE: bugs/issue-8b7048ef71c42a4ddfbd754d0eec458ced28cabb.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix the Delete modifier implementation. desc: Need to update the Delete implementation to handle changes to the polyhedron schema for shells. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-01 03:14:42.452522 Z references: [] id: 8b7048ef71c42a4ddfbd754d0eec458ced28cabb log_events: - - 2010-01-01 03:14:43.245471 Z - Timothy M. Shead - created - "" - - 2010-01-01 19:32:19.028475 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-8e23f26186d044718dee4d0c597684d194ebb3ab.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix (non-VBO) SDS painter. desc: "" type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-02 21:17:24.375092 Z references: [] id: 8e23f26186d044718dee4d0c597684d194ebb3ab log_events: - - 2009-08-02 21:17:25.359020 Z - Timothy M. Shead - created - "" - - 2010-01-11 06:56:37.845209 Z - Bart Janssens - changed status from unstarted to in_progress - "" - - 2010-01-12 07:21:33.075814 Z - Bart Janssens - closed with disposition fixed - "" ================================================ FILE: bugs/issue-91df55f58cd343ef052644a22be6ed6da975f4ff.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Review plugin categories. desc: Before the release we need to review plugin categories. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-03 15:34:22.468855 Z references: [] id: 91df55f58cd343ef052644a22be6ed6da975f4ff log_events: - - 2009-08-03 15:34:23.444788 Z - Timothy M. Shead - created - "" - - 2010-02-18 05:59:46.467914 Z - Timothy M. Shead - edited title, description - "" - - 2010-02-18 06:00:45.930868 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-9340867dbd5c408b4505e0a5aac01dfd7cf13531.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 the viewport is black and i can't see anything thats on it,,, and every window i open leaves a print on the screen like it won't go away " desc: |- Contact: lordofthedrum@yahoo.com Summary: the viewport is black and i can't see anything thats on it,,, and every window i open leaves a print on the screen like it won't go away Report Generated: 2008-Sep-18 01:55:36 UTC Package: k3d Version: 0.7.9.0 Platform: Windows-5.1;x86 Compiler: 3.4.5 (mingw special) Build Time: Aug 13 2008 17:13:57 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-07 04:06:40.213645 Z references: [] id: 9340867dbd5c408b4505e0a5aac01dfd7cf13531 log_events: - - 2009-05-07 04:06:41.213557 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:09.343073 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:54:56.247058 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue da8965ea23097589e5b98a3b8c42580329dad12c}. ================================================ FILE: bugs/issue-93918136ae33aada69f7550025c0fc8b9844630f.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Pick a better component name for "varying" components. desc: Choose something other than "varying" for K-3D components to avoid confusion with RenderMan "varying". type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-12-29 02:44:08.925548 Z references: [] id: 93918136ae33aada69f7550025c0fc8b9844630f log_events: - - 2009-12-29 02:44:10.013477 Z - Timothy M. Shead - created - "" - - 2010-01-02 06:50:29.364479 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-94d550d30436720fef32ba3311fd367a4b5317d2.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: The last Tutorial cannot be loaded , because of the wrong language desc: |- Contact: SuperMarc1301@gmx.de Summary: The last Tutorial cannot be loaded , because of the wrong language Report Generated: 2008-May-01 19:23:05 UTC Package: k3d Version: 0.6.6.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 6 2007 13:08:21 local Description of problem: Steps to reproduce problem: 1. klick on help --> Tutorials 2. klick the last tutorial 3. an error occured. Expected results: That the last tut opens Actual results: an error occured How often does this happen? every time Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:24:44.858168 Z references: [] id: 94d550d30436720fef32ba3311fd367a4b5317d2 log_events: - - 2009-05-19 03:24:45.608982 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:02:50.771163 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:05:44.332356 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-956ceb914b4a6b27defd0c78bb54adc3c4893b32.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Create a test to validate copyright notices. desc: "" type: :task component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-05-08 21:50:27.127712 Z references: [] id: 956ceb914b4a6b27defd0c78bb54adc3c4893b32 log_events: - - 2009-05-08 21:50:28.887157 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:15.262689 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:36:10.495025 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-05-22 00:35:24.998811 Z - Timothy M. Shead - assigned to release 0.8.1.0 from 1.0.0.0 - "" claimer: ================================================ FILE: bugs/issue-9a2fb7311eae397db36e237be063404532b3b4a0.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Tutorial Error desc: |- Contact: rls@cx3.net Summary: Tutorial Error Report Generated: 2009-Apr-23 04:36:39 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem:Tried using tutorial after installation of software. On getting started section it would go for a few lines. Gave message: ERROR executing script Steps to reproduce problem: 1. Occurs on each part of the the tutorial 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-05-06 03:45:23.120332 Z references: [] id: 9a2fb7311eae397db36e237be063404532b3b4a0 log_events: - - 2009-05-06 03:45:25.512237 Z - Timothy M. Shead - created - "" - - 2009-07-15 06:00:29.787370 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:05:13.003551 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-9b2e091f7e3b9e36ff649b48155458080d7da913.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Errors creating VirtualOpenGLSDSPainter at startup with advanced painters disabled desc: |- We get harmless-but-annoying errors loading the VirtualOpenGLSDSFacePainter plugin at startup: ERROR: /home/jared/k3d/modules/virtual_opengl_painters/sds_point_painter.cpp line 73: assertion delegate' failed ERROR: Error creating document plugin: VirtualOpenGLSDSPointPainter ERROR: /home/jared/k3d/modules/virtual_opengl_painters/sds_edge_painter.cpp line 73: assertion `delegate' failed ERROR: Error creating document plugin: VirtualOpenGLSDSEdgePainter ERROR: /home/jared/k3d/modules/virtual_opengl_painters/sds_face_painter.cpp line 73: assertion `delegate' failed ERROR: Error creating document plugin: VirtualOpenGLSDSFacePainter ... this is because the UI layer unconditionally loads the virtual SDS painters at startup, but all the SDS painters are in the advanced painter module, which is off by default. We need to: move the SDS painters out of the advanced module; turn the advanced module on by default; don't create SDS painters by default; best - figure-out a way to avoid creating any painters until they're needed. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-03 02:04:10.510360 Z references: [] id: 9b2e091f7e3b9e36ff649b48155458080d7da913 log_events: - - 2010-02-03 02:04:11.830300 Z - Timothy M. Shead - created - "" - - 2010-02-06 05:16:24.063715 Z - Timothy M. Shead - edited title, description - "" - - 2010-02-14 01:34:32.062239 Z - Timothy M. Shead - closed with disposition fixed - In the short-term, we've disabled all of the experimental painters and enabled the SDS painters, so the advanced painter module can be enabled by default. claimer: ================================================ FILE: bugs/issue-9c495b89016c7cceebed30b1c37286a935f9a2eb.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Update regression tests to use CMake labels desc: Recent versions of CMake allow assignment of user-defined labels to tests, and filtering of tests based on those labels. Update the current tests to use labels for categorization so we don't have to rely on test names for running categories of tests. type: :task component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-05-17 06:02:44.983929 Z references: [] id: 9c495b89016c7cceebed30b1c37286a935f9a2eb log_events: - - 2009-05-17 06:02:46.135798 Z - Timothy M. Shead - created - "" - - 2009-08-02 22:52:15.703064 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:36:21.503067 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-02-21 06:16:44.794873 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-9cc79c6fd45d45ec92cdac3eef3ad3f050bae375.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Double-check that all scripts are working desc: Preferably, create tests to run all scripts. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-07-26 16:51:18.929858 Z references: [] id: 9cc79c6fd45d45ec92cdac3eef3ad3f050bae375 log_events: - - 2009-07-26 16:51:19.817759 Z - Timothy M. Shead - created - "" - - 2010-03-13 19:30:23.947488 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-9d6b0d8eaf8d80a966066c342bf1de0dd67869cf.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " the program froze and the clicker got stuck in the top left corner and would not let me move " desc: |- Contact: william1029384756@yahoo.com Summary: the program froze and the clicker got stuck in the top left corner and would not let me move Report Generated: 2007-Jul-10 05:24:34 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:44:37.681832 Z references: [] id: 9d6b0d8eaf8d80a966066c342bf1de0dd67869cf log_events: - - 2009-05-19 03:44:38.376192 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:49:38.399126 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:39:28.927130 Z - Timothy M. Shead - closed with disposition wontfix - The OP doesn't provide enough context to know what was happening at the time; I'm going to assume that is was tutorial-related, since that's the main place where we manipulate the mouse pointer. ================================================ FILE: bugs/issue-9e18e7eda2cde5ef31f3c5d75099f7e5aafbbb70.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Create DissolveEdges and DissolvePoints modifiers. desc: Like it says. type: :task component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-03-17 05:23:47.137293 Z references: [] id: 9e18e7eda2cde5ef31f3c5d75099f7e5aafbbb70 log_events: - - 2010-03-17 05:23:48.314235 Z - Timothy M. Shead - created - "" claimer: ================================================ FILE: bugs/issue-9e5b6f8facf5da51725b10a558ac3560e03d651d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Rotate and Scale Tools don't work around correct center desc: |- When using the scale or rotate tools on component selections such as faces, the tools don't rotate around the center of the selected geometry. In much earlier versions of k3d this used to work correctly. Something has changed. Tested in SVN from 2007 Nov 27th on Ubuntu Gnu/Linux 7.10 Gutsy. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:38:26.040406 Z references: [] id: 9e5b6f8facf5da51725b10a558ac3560e03d651d log_events: - - 2009-05-19 03:38:26.983623 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:53:20.367034 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-20 06:32:53.313466 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-a121afe2e22a6a972946c3f90472758987ca1d11.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Add LuxRender usage to the Guide. desc: Like it says - there seems to be a fair amount of confusion on how to use LuxRender. type: :feature component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-07-04 19:14:39.467840 Z references: [] id: a121afe2e22a6a972946c3f90472758987ca1d11 log_events: - - 2010-07-04 19:14:40.115653 Z - Timothy M. Shead - created - "" claimer: ================================================ FILE: bugs/issue-a30d997fb6cf859f56794c2ba693d986d109a143.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Replace 'mesh' with 'geometry' in all classes / tests / documentation desc: As discussed at length on the mailing list, the term 'mesh' has strong associations with polygonal meshes, causing confusion for many potential developers. We have agreed that we will change all related source and documentation to use the more generic term 'geometry' in place of 'mesh'. type: :task component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-05-17 04:16:39.648417 Z references: [] id: a30d997fb6cf859f56794c2ba693d986d109a143 log_events: - - 2009-05-17 04:16:40.872238 Z - Timothy M. Shead - created - "" - - 2009-05-17 06:17:33.916931 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" - - 2010-05-22 00:36:08.598810 Z - Timothy M. Shead - assigned to release 0.8.1.0 from 1.0.0.0 - "" claimer: ================================================ FILE: bugs/issue-a35971476137c99b326c5df30dc1c65c05d251fa.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Generic Primitive Refactoring desc: Complete the action items documented in http://www.k-3d.org/wiki/Generic_Mesh_Primitives - fix all broken plugins and tests. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-04-29 02:07:25.539153 Z references: [] id: a35971476137c99b326c5df30dc1c65c05d251fa log_events: - - 2009-04-29 02:07:26.514654 Z - Timothy M. Shead - created - "" - - 2009-07-15 05:31:48.939321 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-a51f6fb9050dd6b4fc6b07052508b122ad181762.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Transform manipulators don't appear when selecting in transform mode desc: |- When starting from an empty selection, selecting something while the transform modifier is active does not make the manipulators appear. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Bart Janssens status: :unstarted disposition: creation_time: 2010-01-19 07:11:57.663235 Z references: [] id: a51f6fb9050dd6b4fc6b07052508b122ad181762 log_events: - - 2010-01-19 07:12:03.535418 Z - Bart Janssens - created - "" - - 2010-02-12 06:54:12.782219 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" claimer: ================================================ FILE: bugs/issue-a8c5a1d70781b39476748bd155c24a309d8ff50f.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Add support for binary STL files to STLMeshReader and STLMeshWriter. desc: Like it says. type: :feature component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-23 03:49:39.323943 Z references: [] id: a8c5a1d70781b39476748bd155c24a309d8ff50f log_events: - - 2010-02-23 03:49:39.970843 Z - Timothy M. Shead - created - "" - - 2010-05-22 00:29:14.374781 Z - Timothy M. Shead - assigned to release 0.8.1.0 from 1.0.0.0 - "" - - 2010-05-22 00:33:25.078865 Z - Timothy M. Shead - edited title - "" - - 2010-06-08 02:20:28.647834 Z - Timothy M. Shead - closed with disposition fixed - Implemented by Bart Janssens. claimer: ================================================ FILE: bugs/issue-ab67e65a87a4e7a37e5d858119e62a23fe218e09.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " selecting viewport after exiting tutorial " desc: |- Contact: mikeh@gopettibone.com Summary: selecting viewport after exiting tutorial Report Generated: 2007-Dec-12 17:16:57 UTC Package: k3d Version: 0.6.6.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 6 2007 13:08:21 local Description of problem:consistent error when selecting within viewport after exiting tutorial Steps to reproduce problem:close tutorial then click LMB in viewport 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:36:16.744345 Z references: [] id: ab67e65a87a4e7a37e5d858119e62a23fe218e09 log_events: - - 2009-05-19 03:36:17.424219 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:03:19.115334 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:06:22.243337 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-ab989d228e5a69168eb8a345a1dd5d59e0e264c0.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " viewport black except when clicking" desc: |- Contact: ginkgo389@gmail.com Summary: viewport black except when clicking Report Generated: 2008-Dec-13 06:26:38 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.3.1 Build Time: Aug 26 2008 08:33:39 local Description of problem: started with viewport incomplete, and black. Steps to reproduce problem: 1. Start k-3d ` 2. look 3.observe viewport Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-06 04:09:10.899577 Z references: [] id: ab989d228e5a69168eb8a345a1dd5d59e0e264c0 log_events: - - 2009-05-06 04:09:11.648489 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:06.094719 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:52:25.255063 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue deed7f51f539b6c62b97c585ed7453b3242c9992}. ================================================ FILE: bugs/issue-abb391e69f742b790e8da66ffaa784db0a5988bb.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Create image-based regression tests for reference painters. desc: "" type: :task component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-08-23 23:55:00.567730 Z references: [] id: abb391e69f742b790e8da66ffaa784db0a5988bb log_events: - - 2009-08-23 23:55:01.367688 Z - Timothy M. Shead - created - "" - - 2010-01-01 03:21:32.180481 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-ac1657b6dc20fb04947f9d412ada980948978fb5.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: the screens gone crazy, just a mess of colors, fresh install, could be driver issue. desc: |- Contact: oliclarke@hotmail.com Summary: the screens gone crazy, just a mess of colors, fresh install, could be driver issue. Report Generated: 2009-Jan-22 21:21:16 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.3.1 Build Time: Aug 26 2008 08:33:39 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-06 04:05:16.296456 Z references: [] id: ac1657b6dc20fb04947f9d412ada980948978fb5 log_events: - - 2009-05-06 04:05:17.040390 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:03.982676 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:45:16.727176 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue deed7f51f539b6c62b97c585ed7453b3242c9992}. ================================================ FILE: bugs/issue-acffc0b1158b9235a406f1e988c574800e4cd368.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: The Tutorial Crashed desc: |- Contact: deskr@comcast.net Summary: The tutorial crashed. Report Generated: 2009-Jan-12 11:02:53 UTC Package: k3d Version: 0.7.6.0 Platform: Windows-5.1;x86 Compiler: 3.4.5 (mingw special) Build Time: Jun 23 2008 19:34:18 local Description of problem: During the Panel Basics Tutorial, I clicked the green button that advances to the next step, and I recieved an 'Error executing script' message with an OK button. I clicked OK, and it closed the tutorial. I attempted to run the tutorial again, and the same event ocurred at the same point. Steps to reproduce problem: 1. Help -> Tutorials and Examples -> Panel Basics 2. Run through tutorial. Expected results: The tutorial runs... Actual results: After the step "The Tool Properties Panel is used to Display Tool-specific options (and resembles the Node Properties Panel) ...," pressing the green button to advance instead brings up the "Error executing script" window. How often does this happen? Every time i have tried running the tutorial. Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-06 04:05:57.848472 Z references: [] id: acffc0b1158b9235a406f1e988c574800e4cd368 log_events: - - 2009-05-06 04:05:58.720443 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:01:15.987193 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:05:29.539200 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-ad39f08267111c35c8e26b5264df5d06af65f718.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Remove legacy code from JoinPoints. desc: Like it says. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-12-29 03:15:04.101551 Z references: [] id: ad39f08267111c35c8e26b5264df5d06af65f718 log_events: - - 2009-12-29 03:15:04.708447 Z - Timothy M. Shead - created - "" - - 2010-01-10 04:52:01.220464 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-ad7ebb0ae83ac37ee352a9775b601e181d460e3d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " Fatal error \"Caught unknown exception\"" desc: |- Contact: itsikbe@gmail.com Summary: Fatal error "Caught unknown exception" Report Generated: 2008-Aug-26 22:22:26 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: I've installed k3d all-in-one, then I've launched the fix for the PATH and reLogged in but when I've tried to start k3d.exe I've got: "K - 3D Fatal Error" (title) "Caught unknown exception" Steps to reproduce problem: 1. Run k3d.exe Expected results: Run the program Actual results:Fatal Error: Caught unknown exception How often does this happen? each time when I run it Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:09:21.477649 Z references: [] id: ad7ebb0ae83ac37ee352a9775b601e181d460e3d log_events: - - 2009-05-07 04:09:22.301550 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:11.126668 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:55:37.679061 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-ae912d5a99e4737fe82a9576842bf25a9b7a83bf.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Create tests to ensure that new code uses the standard K-3D types. desc: "" type: :task component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-04-30 05:26:34.718270 Z references: [] id: ae912d5a99e4737fe82a9576842bf25a9b7a83bf log_events: - - 2009-04-30 05:26:35.581870 Z - Timothy M. Shead - created - "" - - 2009-07-15 06:00:22.427191 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-02 23:09:43.439069 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-05-22 00:34:59.750775 Z - Timothy M. Shead - assigned to release 0.8.1.0 from 1.0.0.0 - "" claimer: ================================================ FILE: bugs/issue-afe8a5c7a2db5849096010a7e4e37ffd246fc5de.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Modifiers break per-face attributes (among others) desc: |- The way things work in RenderMan, you have a lot of flexibility to "tag" geometry with attributes of various types - colors, scalars, strings, normals, matrices, etc. You do this tagging at many levels: per-face, per-vertex, per-edge, etc. However, you do have to be consistent: if you provide (in this case) per-face colors for some faces, you must provide them for *all* faces. Polyhedron is doing that fine, but what's happening is that the subsequent ExtrudeFaces modifiers aren't assigning per-face colors for the new faces they create. So the RIB output produced by K-3D isn't valid in this case. The short-term workaround is to use the TagColors modifier with the "tag faces" property enabled, to assign colors to all the faces. I will add some sanity checking in our RIB output to catch this scenario and correct it. Longer-term, it's going to be a bear to fix all of the modifiers that aren't generating tags ... doh! But it'll have to be done. I will postpone it to after 0.6 because there are some other performance-related changes to k3d::mesh that will have an impact on the work. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-19 03:51:38.407653 Z references: [] id: afe8a5c7a2db5849096010a7e4e37ffd246fc5de log_events: - - 2009-05-19 03:51:39.103767 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:47:17.207032 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" - - 2010-01-09 17:52:03.796477 Z - Timothy M. Shead - closed with disposition reorg - The generic mesh primitives introduced in K-3D 0.7 prevent this from happening. ================================================ FILE: bugs/issue-b143f0495234766027975401fdc8c071ceaccdc2.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Viewport black, unusable. desc: |- The viewport has a large rectangular black hole across it. I cannot do anything. I am Using the Ubuntu 7.10 OS. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:33:52.205809 Z references: [] id: b143f0495234766027975401fdc8c071ceaccdc2 log_events: - - 2009-05-19 03:33:52.856340 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:24.383070 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:40:56.351170 Z - Timothy M. Shead - closed with disposition wontfix - Works here. ================================================ FILE: bugs/issue-b56196fba885cf00f611139e6b09a9135d465338.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Prog quits loading in same place each attempt (see log). Veiwport not active. Pop-up menus, windows,etc won't close ( stay visible in viewport area ) after requested action completes. desc: |- Contact: vorpman@yahoo.com Summary: Prog quits loading in same place each attempt (see log). Veiwport not active. Pop-up menus, windows,etc won't close ( stay visible in viewport area ) after requested action completes. Report Generated: 2008-Jan-05 16:10:23 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem:See above. Steps to reproduce problem: Launch K3d on XP SP2 1. 2. 3. Expected results: Actual results: How often does this happen? Each attempt to launch. Additional information: Most tools respond in some fashion. Veiwport never created. Always stops loading when Tutorial window opens. Log window shows where loading stops each time. Paste from Log window follows: 01/05/2008 10:59:35 INFO: Starting user interface 01/05/2008 10:59:35 INFO: Loading hotkeys from C:\Documents and Settings\Fred\Application Data\.k3d\hotkeys 01/05/2008 10:59:35 INFO: Loading icons from C:\k3d\share\ngui\rasterized 01/05/2008 10:59:35 INFO: Loading icons from C:\k3d\share\ngui\pixmap 01/05/2008 10:59:36 INFO: Loading toolbar layout from C:\k3d\share\ngui\toolbar_layout.k3d 01/05/2008 10:01/05/2008 10:01/05/2008 10:01/05/2008 10:01/05/].01/05/2008 10:01/05/2008 10:01/05/2008 10t_01/05/2008 em01/05/2008 10:0tt01/05/2008 10:01/05/2008ewport::control&, const GdkEventBu01/05/2008 10:01/05/2008 10:01/05/200ode. If that works, could it poossibly be interferance from some other process? Is thisIa Inown bug? Any patch? The FAQ on your site does not seem to address this issue. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:35:21.320424 Z references: [] id: b56196fba885cf00f611139e6b09a9135d465338 log_events: - - 2009-05-19 03:35:22.112314 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:57.135034 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-10-19 23:41:54.175004 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-baacef33fb990943146dd8064244e33486e5ea09.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Review plugin status desc: Before the release we need to review each plugin's stable / experimental / deprecated status. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-18 06:00:27.643930 Z references: [] id: baacef33fb990943146dd8064244e33486e5ea09 log_events: - - 2010-02-18 06:00:28.315875 Z - Timothy M. Shead - created - "" - - 2010-02-21 05:57:36.498845 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-c08027d5b63ee4951a747d366509431f86626ce3.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Selected polygon face colors rendered incorrectly. desc: |- Is anyone else having trouble seeing the selected face color (red) when selecting polygon faces? Debug output shows the color gets set, but somehow it doesn't show in the viewport (only orientation and normal show up). The code (regular_opengl_painters/face_painter.cpp) seems fine to me, so I suspect this is another bug in the Intel X driver for laptop chipsets. I am using a GM965/GL960 and Ubuntu Jaunty. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-23 23:46:39.829705 Z references: [] id: c08027d5b63ee4951a747d366509431f86626ce3 log_events: - - 2009-08-23 23:46:40.749610 Z - Timothy M. Shead - created - "" - - 2009-11-17 05:00:20.826238 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-c15440cffbee3a681e073542040ad92aaa03e211.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: K-3D Fatal Error - Caught unknown exception. desc: |- Contact: jneo@lnsystem.pl Summary: K-3D Fatal Error - Caught unknown exception. Report Generated: 2009-Jan-29 19:33:23 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: when I start up program the falowing info has came Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 04:03:23.816486 Z references: [] id: c15440cffbee3a681e073542040ad92aaa03e211 log_events: - - 2009-05-06 04:03:25.104351 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:01.735073 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:51:10.751059 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-c24cff95ec0290dc053789f3749c2d3a576427e6.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Owning document not visible in the NGUIPythonShellDialog context. desc: Although the Python interactive shell is tied to a specific document, the document isn't visible in the shell context. type: :bugfix component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-10-08 02:41:07.619195 Z references: [] id: c24cff95ec0290dc053789f3749c2d3a576427e6 log_events: - - 2010-10-08 02:41:08.316141 Z - Timothy M. Shead - created - "" - - 2010-10-08 02:41:58.032158 Z - Timothy M. Shead - closed with disposition fixed - Not much to say - it's fixed :) claimer: ================================================ FILE: bugs/issue-c3442cdcfa64300b26c4e16560338858110051e0.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 The 3D view only updates when i hit a buoon that moves or rotates an object " desc: |- Contact: matt_9999@hotmail.com Summary: The 3D view only updates when i hit a buoon that moves or rotates an object Report Generated: 2008-Apr-25 20:24:11 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: email me and i can sent you a video about it, you probabily cant reproduce it type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:25:50.528831 Z references: [] id: c3442cdcfa64300b26c4e16560338858110051e0 log_events: - - 2009-05-19 03:25:51.568731 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:18.150669 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-09-27 01:16:12.818118 Z - Timothy M. Shead - closed with disposition wontfix - Can't reproduce. ================================================ FILE: bugs/issue-c35b6212ab0df100143b32254a41325252ffec42.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Cleanup RenderMan shaders desc: "We have lots of shaders that are: redundant, weird, broken, won't build. Fix the ones that we should keep, and get rid of the ones we shouldn't." type: :bugfix component: K-3D release: 0.8.0.1 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-04-16 04:44:03.593225 Z references: [] id: c35b6212ab0df100143b32254a41325252ffec42 log_events: - - 2010-04-16 04:44:04.177148 Z - Timothy M. Shead - created - "" - - 2010-04-17 21:17:15.809169 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-c38bd09d7aa33d18d9df72894e7d7f4231a7afa4.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Eliminate legacy mesh code. desc: ExtrudeFaces (and all other legacy plugins) are broken, since conversion between legacy meshes and generic primitives isn't implemented. Either do the conversion, or refactor the legacy plugins. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :reorg creation_time: 2009-11-21 23:57:59.537310 Z references: [] id: c38bd09d7aa33d18d9df72894e7d7f4231a7afa4 log_events: - - 2009-11-21 23:58:00.769253 Z - Timothy M. Shead - created - "" - - 2009-12-01 06:35:52.416307 Z - Timothy M. Shead - edited title - "" - - 2009-12-29 03:12:38.645492 Z - Timothy M. Shead - closed with disposition reorg - Splitting this into several individual items, to better reflect the scope of the work. ================================================ FILE: bugs/issue-c3ec9bb8e635c2592d8ee6f80f29b56e939c7be4.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Rubber band selection not visible on OSX. desc: It seems that graphic XOR operations just aren't available on OSX at all, we likely have to completely revisit how we render rubber-band selections. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-03 14:52:24.626335 Z references: [] id: c3ec9bb8e635c2592d8ee6f80f29b56e939c7be4 log_events: - - 2009-08-03 14:52:25.403251 Z - Timothy M. Shead - created - "" - - 2009-11-14 04:22:27.956574 Z - Timothy M. Shead - closed with disposition fixed - Switched to rendered-highlighting, instead of playing tricks with framebuffer bits. ================================================ FILE: bugs/issue-c4141d8b96026e37fc47c03ec3a610eb76d255e4.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Need alternative interaction modes for use with trackpads. desc: Currently, K-3D is difficult to use without a three-button mouse, and totally unusable with trackpads. Explore alternative keyboard/mouse mappings to address this. type: :feature component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-08-03 15:46:31.379461 Z references: [] id: c4141d8b96026e37fc47c03ec3a610eb76d255e4 log_events: - - 2009-08-03 15:46:32.215311 Z - Timothy M. Shead - created - "" ================================================ FILE: bugs/issue-c4fac5d4134a27c60a732f65c7aca6d081d888bd.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Pass normals to the LuxRender engine. desc: Currently, normal attribute data is ignored when rendering in LuxRender. Pass the data along. type: :feature component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-07-19 23:34:29.094984 Z references: [] id: c4fac5d4134a27c60a732f65c7aca6d081d888bd log_events: - - 2009-07-19 23:34:30.782971 Z - Timothy M. Shead - created - "" - - 2009-07-20 06:18:18.478924 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-c566b10c51cf9be076002e098a80e627f7e57ad7.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 \"Duplicated\" nodes after importing a .k3d " desc: "Steps\n\ 1- Run the script from\n\ http://k-3d.org/wiki/User:JoaquinDuo/Freeze_Script\n\ with the \"new\" mode\n\ 2- This will create a document containing only the freezed objects.\n\ 3- Save it\n\ 4- New document -> import the last file\n\ 5- Try to set the default GL painter for the object\n\ 6- Displays Duplicated GL default painter node\n\n\ Saludos!\n\ Joaqu\xC3\xADn" type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:38:57.032547 Z references: [] id: c566b10c51cf9be076002e098a80e627f7e57ad7 log_events: - - 2009-05-19 03:38:57.799861 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:53:23.183212 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 14:56:17.750756 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-c5bb24ef560d028232ce7243e179caf89232424a.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Ensure polyhedron shells are updated correctly. desc: There is probably a lot of code that doesn't update polyhedron shells correctly. In particular, when appending faces to a polyhedron we usually just increment the shell face count, but this isn't correct, since the current schema assumes that all faces for a given shell are adjacent within the face table. That means that filters that create new faces need to do inserts instead of appends, or we need to rethink how we handle shells. One option would be to add a "shell number" array to the face table, so that it wouldn't matter whether the faces in a given shell are scattered throughout the face table. This would have the additional benefit of simplifying lots of code that otherwise has to update the face count for a shell. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-12-26 17:22:42.581537 Z references: [] id: c5bb24ef560d028232ce7243e179caf89232424a log_events: - - 2009-12-26 17:22:43.365497 Z - Timothy M. Shead - created - "" - - 2010-01-09 17:47:32.420464 Z - Timothy M. Shead - closed with disposition fixed - After changing the way the polyhedron schema stores shells, it should be much more difficult to get them wrong. ================================================ FILE: bugs/issue-c60b33c866619f09ee3d9d98a588097c246dce9d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Eliminate libuuid dependency. desc: It would be nice if we could switch to using the uuid support in Boost to eliminate our dependency on libuuid (requires Boost 1.42). This assumes that Boost 1.42-or-better is widely available (i.e. on Ubuntu). type: :bugfix component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-05-14 04:30:13.142803 Z references: [] id: c60b33c866619f09ee3d9d98a588097c246dce9d log_events: - - 2010-05-14 04:30:16.262745 Z - Timothy M. Shead - created - "" - - 2010-05-22 00:33:06.414879 Z - Timothy M. Shead - edited title, description - "" - - 2010-06-08 04:50:30.243459 Z - Timothy M. Shead - closed with disposition fixed - Updated our Boost dependency to 1.42, which provides UUID functionality, and provided our own fallback implementation of the Boost 1.43 boost::uuids::random_generator. claimer: ================================================ FILE: bugs/issue-c62d4189ed3035ce0a2c7896f97007ac715a1159.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Prompt for camera when splitting viewport panel desc: |- Like it says ... we prompt for a camera when the user *mounts* a new viewport panel, we should do the same when splitting an existing viewport panel. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:49:19.479814 Z references: [] id: c62d4189ed3035ce0a2c7896f97007ac715a1159 log_events: - - 2009-05-19 03:49:20.128404 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:48:45.551021 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-c7068025feb6bc837b3c8238689cbd2808e602ec.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: The 3d environment view is not stable; scrambles and freezes when moving objects desc: |- Contact: jocceus@live.com Summary: The 3d environment view is not stable; scrambles and freezes when moving objects Report Generated: 2009-Jan-25 21:11:55 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.3.1 Build Time: Aug 26 2008 08:33:39 local Description of problem: When running any 3d program the enviroment freezes or scrambles when moving objects Steps to reproduce problem: Open program, insert object, and attempt to move object. 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-06 04:04:00.656484 Z references: [] id: c7068025feb6bc837b3c8238689cbd2808e602ec log_events: - - 2009-05-06 04:04:01.736181 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:02.567069 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:51:50.071048 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue deed7f51f539b6c62b97c585ed7453b3242c9992}. ================================================ FILE: bugs/issue-c88402eb19c30deba7254e8583c5554e169b4ee2.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Edge selection broken. desc: Currently, interactive selection of polyhedron edges does nothing. Point and face selection still seem to work fine. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-03 03:25:39.263237 Z references: [] id: c88402eb19c30deba7254e8583c5554e169b4ee2 log_events: - - 2009-08-03 03:25:39.807127 Z - Timothy M. Shead - created - "" - - 2009-08-21 05:26:50.809458 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-c920698bb22ce982c3f377ceebe1c146ff08fa9e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Add explicit check / nag screen when loading legacy documents. desc: Like it says. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-01 03:51:58.501547 Z references: [] id: c920698bb22ce982c3f377ceebe1c146ff08fa9e log_events: - - 2010-01-01 03:51:59.029477 Z - Timothy M. Shead - created - "" - - 2010-02-27 23:42:23.922874 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-caa327a1b446cc943f4f8563d11862bb9a323006.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Make SUSE 10.2, make install, try to run and go boom.. LOL desc: |- Contact: prh@cemtach.com Summary: Make SUSE 10.2, make install, try to run and go boom.. LOL Report Generated: 2007-Apr-21 07:32:24 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-linux-gnu Compiler: 4.1.2 20061115 (prerelease) (SUSE Linux) Build Time: Apr 20 2007 15:29:04 local Description of problem: Did standard install with internal boost library and it dies upon starting. The initial screens come up (with the little guy), but dies shortly after that.. hayes/src> /usr/local/k3d/bin/k3d (k3d:22286): GdkGLExt-WARNING **: cannot load PangoFont /usr/local/k3d/bin/k3d: line 180: 22286 Segmentation fault /usr/local/k3d/bin/k3d-bin --options /home/hayes/.k3d/options.k3d --plugins /usr/local/k3d/lib/k3d --shadercache /home/hayes/.k3d/shadercache --share /usr/local/k3d/share/k3d --tutorials /usr/local/k3d/share/k3d/tutorials --ui /usr/local/k3d/lib/libk3dngui.so Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:48:19.199766 Z references: [] id: caa327a1b446cc943f4f8563d11862bb9a323006 log_events: - - 2009-05-19 03:48:19.903752 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:48:58.287127 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-11 05:37:55.931560 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-cbc65707315095a3c85694e09e179f711248ae01.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Display component selections when adding a selection modifier. desc: When adding a geometry selection modifier to the pipeline, component selection visibility isn't enabled, making it impossible to see the effects of the modifier and causing user confusion. We need a mechanism so the UI layer can turn-on component selection visibility in the MeshInstance when a selection modifier is created. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-11-24 07:09:39.658326 Z references: [] id: cbc65707315095a3c85694e09e179f711248ae01 log_events: - - 2009-11-24 07:09:40.442279 Z - Timothy M. Shead - created - "" ================================================ FILE: bugs/issue-cf2cdc4985a66db59f55052f03c3c620237b451f.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Program hang loading documents in OSX release build. desc: Like it says ... document.serialization.properties and sdk.xml-xpath display this behavior - the process is 'hung' with zero CPU, and can't be killed. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-03-14 04:38:33.032053 Z references: [] id: cf2cdc4985a66db59f55052f03c3c620237b451f log_events: - - 2010-03-14 04:38:34.423257 Z - Timothy M. Shead - created - "" - - 2010-03-21 17:06:48.779232 Z - Timothy M. Shead - closed with disposition fixed - |- This issue manifests during k3d::xml::xpath parsing as a program hang when doing XPath matching with an attribute-value test. For example, line 101 of k3d/tests/sdk/xml_xpath.cpp when doing a match on /k3d/nodes/node/properties/property[@user_property][@type='double'] Upgrading from Apple gcc 4.0.1 to XCode 3.1.4 and 686-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5577) fixes the problem. claimer: ================================================ FILE: bugs/issue-cfefcca75810ec3b784ee014ff12c2b345d0e37d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Components move via typeng wont be saved desc: |- Details: Steps to reproduce it. 1- create an object 2- Select one or more vertexes 3- Select a transformation tool 3- Type a transformation from the Tool properties panel 4- Save the document 5- Open it again 6- You won't see any transformation on points. Ubuntu 8.10 type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-06 04:08:15.024350 Z references: [] id: cfefcca75810ec3b784ee014ff12c2b345d0e37d log_events: - - 2009-05-06 04:08:16.496431 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:05.623076 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-21 05:47:18.897465 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-d171dd355a94e4b8c639dce81bab88f3b30ad4c1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: K3D disappeared desc: |- Contact: b.lewkow@chello.fr Summary: K3D disappeared Report Generated: 2008-May-23 00:50:49 UTC Package: k3d Version: 0.6.7.0 Platform: i586-mandriva-linux-gnu Compiler: 4.2.2 20071128 (prerelease) (4.2.2-2mdv2008.1) Build Time: Feb 3 2008 00:45:58 local Description of problem: i klicked some many symbols on the create tab and then it disappeared Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:16:09.749696 Z references: [] id: d171dd355a94e4b8c639dce81bab88f3b30ad4c1 log_events: - - 2009-05-07 04:16:10.453719 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:14.503066 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:31:30.943039 Z - Timothy M. Shead - closed with disposition wontfix - Works here. ================================================ FILE: bugs/issue-d33d9c38e1484b8ca1380cee2cc381a58073f2b8.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Confirm that all sample documents are working. desc: "" type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-15 16:21:29.338826 Z references: [] id: d33d9c38e1484b8ca1380cee2cc381a58073f2b8 log_events: - - 2009-08-15 16:21:30.330763 Z - Timothy M. Shead - created - "" - - 2010-02-06 08:01:53.951609 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-d641db2e9857dad68c2cb5cddad523f6a11a9f4c.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Problems with rendering desc: |- Contact: shashank.araokar@gmail.com Summary: Problems with rendering Report Generated: 2007-Aug-14 20:26:51 UTC Package: k3d Version: 0.6.6.0 Platform: i486-pc-linux-gnu Compiler: 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7) Build Time: Jan 16 2007 15:55:06 local Description of problem: The program often simply crashes when F12 is pressed. Changing the preview engine is often not reflected. Trying to create a preview simply does nothing. Steps to reproduce problem: 1. Add a cone in the viewport 2. Press F12 and try the same with engines (the program said I did not have any installed) Expected results: Either a result or an error Actual results: Program crashes or does absolutely nothing How often does this happen? Always Additional information: The program simply says that some engine executable is missing (only once in the runtime). Thereafter neither an error nor a result is seen. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:42:35.864548 Z references: [] id: d641db2e9857dad68c2cb5cddad523f6a11a9f4c log_events: - - 2009-05-19 03:42:36.631966 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:50:04.407070 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:20:23.631068 Z - Timothy M. Shead - closed with disposition wontfix - Works here. ================================================ FILE: bugs/issue-d7a44bff78ad31a7e7a6762e37c67cc721882f83.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix MergeCollinearEdges. desc: Need to update MergeCollinearEdges to match changes to the polyhedron schema for shells. type: :task component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-01 03:16:11.910723 Z references: [] id: d7a44bff78ad31a7e7a6762e37c67cc721882f83 log_events: - - 2010-01-01 03:16:12.821467 Z - Timothy M. Shead - created - "" - - 2010-01-01 03:18:58.036546 Z - Timothy M. Shead - edited title - "" - - 2010-01-17 16:54:15.430299 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-02-21 06:13:44.962876 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-d8ead7e3cb76c1f6312855dfb1007959bf2a81a3.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix Collada reader. desc: Doesn't compile due to code changes. type: :bugfix component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-08-02 21:17:51.231052 Z references: [] id: d8ead7e3cb76c1f6312855dfb1007959bf2a81a3 log_events: - - 2009-08-02 21:17:52.454985 Z - Timothy M. Shead - created - "" - - 2010-02-06 05:01:07.295628 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" - - 2010-05-22 00:36:29.918796 Z - Timothy M. Shead - assigned to release 0.8.1.0 from 1.0.0.0 - "" claimer: ================================================ FILE: bugs/issue-da7d93a9b31ed0769f5b56af3f388737dd957b7f.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Normals flipped when extruding 0 m desc: |- Summary: Normals are flipped (point inwards) when extruding a face 0m and moving the face afterwards via the move tool. Steps to reproduce: 1. Create a cube (or whatever) 2. Go into face mode and select a face 3. Use the "Modify|Mesh|Extrude Faces" command 4. Go into the Node Properties panel and change the distance value to "0 m" 5. Go into move mode (press w) and move the face manually. Than you will see that the normals of the newly created polygons of the extrusion point inwards. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:28:11.072707 Z references: [] id: da7d93a9b31ed0769f5b56af3f388737dd957b7f log_events: - - 2009-05-19 03:28:12.272543 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:19.806678 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-21 05:49:16.809456 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-da8965ea23097589e5b98a3b8c42580329dad12c.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "Viewport update problems with Windows Vista " desc: |- Contact: tammys-dad@hotmail.com Summary: viewport won't clear.It keeps overwriting previous material. Report Generated: 2007-Apr-26 02:49:57 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem:anything in viewport remains there.It keeps stacking up on itself. Steps to reproduce problem:I tried uninstalling and reinstalling,problem remains. Using Vista. 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-19 03:47:43.767814 Z references: [] id: da8965ea23097589e5b98a3b8c42580329dad12c log_events: - - 2009-05-19 03:47:44.448534 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:49:05.206955 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-11 05:37:01.892575 Z - Timothy M. Shead - closed with disposition reorg - This is a duplicate of {issue 432f8b1d7711eb5d22d6046d20bc006c18d5090b}. ================================================ FILE: bugs/issue-daee8a01c7a1e37079658831fb65738559dc0493.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Replace interactive tutorial code with ATK-based tests desc: As described in http://www.k-3d.org/wiki/User_Interface_Testing - remove K-3D's interactive tutorial code, simplify all UI components, and replace existing UI regression tests with alternatives such as ATK-based tests. type: :task component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :closed disposition: :wontfix creation_time: 2009-04-29 02:14:17.324186 Z references: [] id: daee8a01c7a1e37079658831fb65738559dc0493 log_events: - - 2009-04-29 02:14:18.668078 Z - Timothy M. Shead - created - "" - - 2010-05-22 00:30:21.166779 Z - Timothy M. Shead - closed with disposition wontfix - Because the Qt work is going so well, this would be wasted effort. claimer: ================================================ FILE: bugs/issue-dbaae5eafd86c96dd10c4636fee6dbcf4a6223d2.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Paint-deselection broken. desc: Although paint *selection* works, paint *deselection* seems to be broken. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-03 15:28:25.625127 Z references: [] id: dbaae5eafd86c96dd10c4636fee6dbcf4a6223d2 log_events: - - 2009-08-03 15:28:26.945147 Z - Timothy M. Shead - created - "" - - 2009-08-28 07:12:08.445775 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-dbc9bdf294e3af3096d5b7b0777fbd501dbec183.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " We need edge bevelling" desc: We need edge bevelling type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:50:17.799652 Z references: [] id: dbc9bdf294e3af3096d5b7b0777fbd501dbec183 log_events: - - 2009-05-19 03:50:18.519703 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:48:09.694995 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-dbddd7fdc90195a94e62d0ae6440ac9d90308f40.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: ConnectVertices problem with concave polys desc: See attached. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:52:05.479968 Z references: [] id: dbddd7fdc90195a94e62d0ae6440ac9d90308f40 log_events: - - 2009-05-19 03:52:06.151593 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:47:11.967028 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-dc74ee9aa83bfe125ef4948bd8e8a46d3b895167.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "closed tutorial window, created nurb sphere, app crashed - ID: 2761553" desc: |- Contact: youngpj@tesco.net Summary: closed tutorial window, created nurb sphere, app crashed Report Generated: 2009-Apr-14 10:13:55 UTC Package: k3d Version: 0.6.7.0 Platform: i386-redhat-linux-gnu Compiler: 4.3.0 20080326 (Red Hat 4.3.0-5) Build Time: Apr 1 2008 17:35:02 local Description of problem:the prog keeps crashing! that's about as descriptive as it gets, sorry Steps to reproduce problem: see summary 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-06 03:52:10.368356 Z references: [] id: dc74ee9aa83bfe125ef4948bd8e8a46d3b895167 log_events: - - 2009-05-06 03:52:16.024324 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:02:34.259245 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:05:26.251097 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-dcaa8d49244983968dcc3d24b45671270e0238ba.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Fix cuda mesh functionality. desc: "" type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2009-08-02 21:19:11.047050 Z references: [] id: dcaa8d49244983968dcc3d24b45671270e0238ba log_events: - - 2009-08-02 21:19:11.918991 Z - Timothy M. Shead - created - "" ================================================ FILE: bugs/issue-deed7f51f539b6c62b97c585ed7453b3242c9992.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: K-3D viewport onlys shows a black screen when starting application while Compiz fusion enabled on Ubuntu 8.04 desc: |- Contact: fate.bennett@gmail.com Summary: K-3D viewport onlys shows a black screen when starting application while Compiz fusion enabled on Ubuntu 8.04 Report Generated: 2008-Aug-31 05:39:14 UTC Package: k3d Version: 0.6.7.0 Platform: i486-pc-linux-gnu Compiler: 4.2.3 (Ubuntu 4.2.3-2ubuntu1) Build Time: Feb 27 2008 23:29:50 local Description of problem: When starting K-3D, only a black screen is visible in the main window under Viewport. I'm new to this application, and I do see an X and Y Grid pop up for a second when I attempt to create a new object such as a cube or cone, and then the screen goes black again. Steps to reproduce problem: 1. Install Ubuntu 8.04 2. Enable desktop effects 3. Install K-3D using Synaptic package manager 4. Start the application, and only a black screen under Viewport should be visible 5. Try creating a cube, and the black screen should display the workspace grid for about a half second. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:08:04.573467 Z references: [] id: deed7f51f539b6c62b97c585ed7453b3242c9992 log_events: - - 2009-05-07 04:08:05.125307 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:10.263073 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-10-19 04:18:21.199118 Z - Timothy M. Shead - closed with disposition wontfix - This is a known issue with Compiz and DRI, it is addressed by DRI2. To mitigate the problem, I've added a CheckCompiz plugin that warns end-users if Compiz is running when they start K-3D. ================================================ FILE: bugs/issue-e200400ec942d61b5d25ff523fbc59331e5cd00c.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: bug report for scripting issue desc: |- http://sourceforge.net/forum/forum.php?thread_id=1772963&forum_id=34831 keeping in mind that I'm a total newbie to this and I should probably just learn how to create before I tackle scripting; that said Ive tried opening/playing any and all scripts that I have. Basically ones that came with the program upon installation. There's a file extention of py and pyc for each file. I tried editing a file and adding #python on the 1st line but that didnt work. Ive attached a file for you. hope this helps a bit. lemme know if you need any more info. thanks type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:45:02.880102 Z references: [] id: e200400ec942d61b5d25ff523fbc59331e5cd00c log_events: - - 2009-05-19 03:45:03.599829 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:49:34.607030 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-14 06:32:28.644573 Z - Timothy M. Shead - closed with disposition wontfix - Can't reproduce. ================================================ FILE: bugs/issue-e223abcb170a54b129321cb4020ec090b91aa06d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Restore selection-conversion functionality. desc: Selection conversion when switching selection modes in the UI was commented-out during the transition to generic primitives / selections. Restore it. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-21 05:51:29.057538 Z references: [] id: e223abcb170a54b129321cb4020ec090b91aa06d log_events: - - 2009-08-21 05:51:29.889466 Z - Timothy M. Shead - created - "" - - 2009-10-17 03:45:51.769060 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-e24dc27f9e5a9b6debdc7fbacdaef0390aa835b5.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Rotate manipulator works wrong on multiple viewports desc: "Having multiples viewports makes the rotate manipulator work wrong.\n\n\ Steps:\n\ 1-Create several viewports\n\ 2-Try to manipulate an object on one viewport other that the \"main\"\n\ viewport\n\ 3-The selected manipulator is chosen as if the user were clicking on the\n\ \"main\" viewport (using the current user coordinates to select the\n\ manipulator on the \"main\" viewport coordinates).\n\n\ I guess this should also happen to the move and rotate manipulator.\n\n\ Cheers!\n\ Joaqu\xC3\xADn" type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:37:50.096255 Z references: [] id: e24dc27f9e5a9b6debdc7fbacdaef0390aa835b5 log_events: - - 2009-05-19 03:37:51.168218 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:53:16.463128 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-20 06:32:40.393454 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-e345f325aab4099f88dfc47616a86d4ddea54db3.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 K-3D crashes on pipeline panel " desc: |- On k3d 0.7 on linux ubuntu while selecting a object if the user makes several undos and the pipeline panel is open the system crashes type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:25:18.866223 Z references: [] id: e345f325aab4099f88dfc47616a86d4ddea54db3 log_events: - - 2009-05-19 03:25:19.664928 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:17.694650 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-11 03:46:00.899548 Z - Timothy M. Shead - closed with disposition fixed - The tree extraction filter was crashing if the requested root vertex was out-of-bounds. ================================================ FILE: bugs/issue-e4ab51a81942250ae3e8a0ecff44c1e0b329859e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: will not let me use polygons desc: |- Contact: SeamonkeyC1@AOL.com Summary: will not let me use polygons Report Generated: 2008-May-03 05:47:56 UTC Package: k3d Version: 0.7.3.0 Platform: Windows-5.1;x86 Compiler: 3.4.5 (mingw special) Build Time: Apr 19 2008 21:46:44 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:23:33.224471 Z references: [] id: e4ab51a81942250ae3e8a0ecff44c1e0b329859e log_events: - - 2009-05-19 03:23:34.097240 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:16.951069 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:30:21.838658 Z - Timothy M. Shead - closed with disposition wontfix - Works here. ================================================ FILE: bugs/issue-e4e3a8d3d7b0effd24b47227a38154c7f9ad1af1.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Material Manager crashes desc: Mount a material manager panel -> boom! type: :bugfix component: K-3D release: 1.0.0.0 reporter: Timothy M. Shead status: :unstarted disposition: creation_time: 2010-04-17 15:23:53.081184 Z references: [] id: e4e3a8d3d7b0effd24b47227a38154c7f9ad1af1 log_events: - - 2010-04-17 15:23:53.593123 Z - Timothy M. Shead - created - "" - - 2010-04-17 21:19:57.921139 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.1 - "" claimer: ================================================ FILE: bugs/issue-e695dc7181caa53d244666975fcb9416d23456d6.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: shortcuts assignment is wacky desc: |- Contact: kartalgoz@bluebottle.com Summary: shortcuts assignment is wacky Report Generated: 2007-Jan-15 14:32:04 UTC Package: k3d Version: 0.6.6.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 6 2007 13:08:21 local Description of problem:i cannot assign keys like "a" to any function Steps to reproduce problem: 1. start shortcut mode by pressing insert 2. goto face from select menu 3. press "aa Expected results:using a as shortcut Actual results: does not happen How often does this happen?everytime Additional information: type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:51:09.376554 Z references: [] id: e695dc7181caa53d244666975fcb9416d23456d6 log_events: - - 2009-05-19 03:51:10.047953 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:47:29.015138 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-e7da3769c8568a8dd24b895d954ce0f2afb278fb.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "It can't read the 5th tutorial. " desc: |- Contact: daniel.craven@hotmail.com Summary: It can't read the 5th tutorial. Report Generated: 2008-Mar-29 12:46:53 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem: A box appears which sais that it can't read the 5th chapter of the tutorials, because it has a different scripting language. Steps to reproduce problem: Open menu Help, open submenu Tutorials, open chapter 5. GTS Boolean (Advanced). 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:29:10.912901 Z references: [] id: e7da3769c8568a8dd24b895d954ce0f2afb278fb log_events: - - 2009-05-19 03:29:11.584033 Z - Beverly L. Shead - created - "" - - 2009-07-15 06:02:56.067209 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-07-15 06:06:11.459166 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-e7e2260686f43af5350ced8daf3fd52f748b7d4d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: programs not starting desc: |- Contact: darius_persaud@yahoo.com Summary: programs not starting Report Generated: 2008-Oct-01 00:59:35 UTC Package: k3d Version: 0.7.9.0 Platform: Windows-5.1;x86 Compiler: 3.4.5 (mingw special) Build Time: Aug 13 2008 17:13:57 local Description of problem: Steps to reproduce problem: 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-07 04:05:59.285456 Z references: [] id: e7e2260686f43af5350ced8daf3fd52f748b7d4d log_events: - - 2009-05-07 04:06:00.693561 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:08.847077 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:30:40.318846 Z - Timothy M. Shead - closed with disposition wontfix - "" ================================================ FILE: bugs/issue-e7f06c793e88c43060dc24a5e7b645e87f5c3372.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Segfault using autocompletion in the NGUIPythonShellDialog desc: Entering "context.__class__;." then hitting "tab" in the shell caused a segfault. type: :bugfix component: K-3D release: 0.8.1.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-10-08 02:39:58.782010 Z references: [] id: e7f06c793e88c43060dc24a5e7b645e87f5c3372 log_events: - - 2010-10-08 02:40:01.091118 Z - Timothy M. Shead - created - "" - - 2010-10-08 02:41:40.339124 Z - Timothy M. Shead - closed with disposition fixed - Reimplemented autocompletion using the rlcompleter module that is part of the official Python distribution. claimer: ================================================ FILE: bugs/issue-e83e4967aac6828eb4e02208edacd68d23252cde.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Animation rendering code can't handle negative time values desc: |- The main animation loops in the RenderMan and Yafray engines convert the start and end times to unsigned integers, then loop over them to create frames. This won't work for ranges of negative time - we need to be smarter about how we map the range of times to be rendered to frame names. type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:49:47.991804 Z references: [] id: e83e4967aac6828eb4e02208edacd68d23252cde log_events: - - 2009-05-19 03:49:48.527694 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:47:48.734983 Z - Timothy M. Shead - assigned to release 1.0.0.0 from unassigned - "" ================================================ FILE: bugs/issue-e86ef362f926037001e1c60a9fedea2822620595.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 Array out of bounds in point painter " desc: |- I'm not sure how to reproduce this, since it actually happened when my cat jumped up on the keyboard. :) Either way, in point_vbo::on_execute, an array range check failed on line 114: glBufferData(GL_ARRAY_BUFFER, sizeof(points[0]) * points.size(), &points[0], GL_STATIC_DRAW); It seems like the "points" array is empty, which means the points[0] will fail. Not sure if it's even supposed to get there if point size is zero, which is why someone who knows about it should have a look. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-07 04:13:10.997672 Z references: [] id: e86ef362f926037001e1c60a9fedea2822620595 log_events: - - 2009-05-07 04:13:11.981614 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:12.399083 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-05 06:47:45.919072 Z - Timothy M. Shead - closed with disposition fixed - Changes to the way we validate geometric primitives should prevent this from happening from now on. ================================================ FILE: bugs/issue-eab8f46b39c3ce8da3052e6c33ad2942556f3c8d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " BevelFaces only works on one face at a time? " desc: |- I am trying to bevel faces. SO i select the faces and apply bevel from create-polygons-bevel faces. It does not do anything. But if i use right click mesh modifier-bevel, it works. Problem with that one is that it does not work with multiple face selection, it only applies to one of the selected faces type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:50:42.743748 Z references: [] id: eab8f46b39c3ce8da3052e6c33ad2942556f3c8d log_events: - - 2009-05-19 03:50:43.407681 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:47:39.919075 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-21 05:49:05.441464 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-ebaf6c348e0fa045023a7a486ea7c70969f96dde.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: "5 Didn't do much of anything exept mess with a tube, and import another tube, tried to render, no preview, no frame render, no nothing, messed with the render settings, tried to make a new one, nothing, saved, quit K3d reloded K3d loaded the file, still can't render. " desc: |- Contact: mayapaladin@gmail.com Summary: Didn't do much of anything exept mess with a tube, and import another tube, tried to render, no preview, no frame render, no nothing, messed with the render settings, tried to make a new one, nothing, saved, quit K3d reloded K3d loaded the file, still can't render. Report Generated: 2007-Aug-23 16:44:44 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem:No rendering Steps to reproduce problem: 1.create poly tube 2.rotate 90` save as 90` tube 3. save as 90` tube 4.mess with the faces, extruding and undoing a few times. 5.import 90`tube file 6.resise new tube 7.try and render while inside the objects 8.it doesn't work so zoom out. 9.no render Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:42:05.504249 Z references: [] id: ebaf6c348e0fa045023a7a486ea7c70969f96dde log_events: - - 2009-05-19 03:42:06.176001 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:50:09.431027 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-11 05:41:41.227550 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-ec7e14fd48fc42fd5b2ca9a3d30caf4f1b027c1a.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " Segmentation fault (core dumped)" desc: |- Contact: gabriel.andrey@medecine.unige.ch Summary: Segmentation fault (core dumped) Report Generated: 2007-Aug-08 15:51:33 UTC Package: k3d Version: 0.6.6.0 Platform: i486-pc-linux-gnu Compiler: 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7) Build Time: Jan 16 2007 15:55:06 local Description of problem: Steps to reproduce problem: 1. in command line k3d it crash after the splah screen 2. launching with log-level debug it crash right after: INFO: Loading toolbar layout from /usr/share/k3d/ngui/toolbar_layout.k3d 3. Expected results: Actual results: How often does this happen? all the time Additional information: Ubuntu Feisty 7.04 type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:43:41.544049 Z references: [] id: ec7e14fd48fc42fd5b2ca9a3d30caf4f1b027c1a log_events: - - 2009-05-19 03:43:42.192236 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:49:48.407028 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:19:02.639170 Z - Timothy M. Shead - closed with disposition wontfix - Works fine here. ================================================ FILE: bugs/issue-ee2fe3f71ced0add4f940683db864c5cfe7422d9.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Generic Selection Refactoring desc: Complete the action items documented at http://www.k-3d.org/wiki/Generic_Mesh_Selection type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-04-29 02:08:16.267882 Z references: [] id: ee2fe3f71ced0add4f940683db864c5cfe7422d9 log_events: - - 2009-04-29 02:08:17.867786 Z - Timothy M. Shead - created - "" - - 2009-07-19 23:37:03.630949 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-eefe2f1c031bdf2fbe9723b6baf8aaa7a6daac91.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: k3d crashes. File not saved. Frame not saved desc: |- Contact: super_bisquit@yahoo.com Summary: k3d crashes. File not saved. Frame not saved Report Generated: 2009-Feb-03 02:53:15 UTC Package: k3d Version: 0.6.7.0 Platform: x86_64-pc-linux-gnu Compiler: 4.3.1 Build Time: Jun 22 2008 18:29:22 local Description of problem: k3d would crash when rendring a previewframe. Steps to reproduce problem: I don't know. I'm not trying to reproduce it, I'm trying to stop it. 1. 2. 3. Expected results: Actual results: How often does this happen? Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 03:59:55.792278 Z references: [] id: eefe2f1c031bdf2fbe9723b6baf8aaa7a6daac91 log_events: - - 2009-05-06 03:59:56.768496 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:51:57.951068 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-22 01:02:32.601499 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-efc598f7db94d366529406ccc835541ed77da749.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Segfault connecting an output property to an input property desc: "Steps:\n\ 1- create a cube\n\ 2- go to the instance node\n\ 3- connect the input_mesh property to the output_mesh property of the same\n\ node\n\ 4- crashes\n\n\ Cheers!\n\ Joaqu\xC3\xADn" type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-19 03:40:35.960222 Z references: [] id: efc598f7db94d366529406ccc835541ed77da749 log_events: - - 2009-05-19 03:40:36.736067 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:50:23.879022 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 14:59:10.253048 Z - Timothy M. Shead - closed with disposition wontfix - Cannot reproduce. ================================================ FILE: bugs/issue-f0214576609193a60f014f6c1b55e5b01af8197d.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Problems with Axes text labels desc: |- But I still have a problem with the text labels of the Axes node, they all seem to read Z but it is in wire-frame and light gray, basically unreadable, and changing the font does not help, but you can see the size change. This is using "make run" from the build directory. I also tried copying the fonts to the /k3d-build/share/fonts dir and also installing them on my system with sudo cp *.ttf /usr/share/fonts/truetype/; sudo fc-cache -f -v Text annotations 2D and 3D work without a problem. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-07-20 04:12:18.454952 Z references: [] id: f0214576609193a60f014f6c1b55e5b01af8197d log_events: - - 2009-07-20 04:12:19.622889 Z - Timothy M. Shead - created - "" - - 2009-11-15 06:38:16.986581 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-f20b5cc0c3904cfa8ec18ee3c7753e4bbff69d4e.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: White Screen on startup desc: |- Contact: whitejediguy@gmail.com Summary: White Screen on startup Report Generated: 2008-Jul-20 04:07:04 UTC Package: k3d Version: 0.6.7.0 Platform: i686-pc-mingw32 Compiler: 3.4.4 (mingw special) Build Time: Jan 23 2007 09:37:14 local Description of problem:Just open in updated VistaWhere it should be black when I open the program, it is white.. If I minimize then maximize, it will be black. Cannot see anything I have made previously.. This is windows vista Steps to reproduce problem 1. :Just open in updated Vista 2. try adding anything to the viewport and nothing happens 3. Expected results: should work normally as before Actual results: white screen, cannot do anything How often does this happen? everytime now Additional information: type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :reorg creation_time: 2009-05-07 04:14:21.541544 Z references: [] id: f20b5cc0c3904cfa8ec18ee3c7753e4bbff69d4e log_events: - - 2009-05-07 04:14:22.662315 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:13.262679 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 03:57:06.399199 Z - Timothy M. Shead - closed with disposition reorg - This may be a duplicate of {issue da8965ea23097589e5b98a3b8c42580329dad12c}. ================================================ FILE: bugs/issue-f70081ac577a3f841537885c3d1d3af7f23f5aef.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: CMakeCache.txt have wrong path desc: |- CMakeCache.txt have your own path, wrong on any other pcs: CMake Error: The current CMakeCache.txt directory /home/anubis/Desktop/k3d-source-0.7.11.0/CMakeCache.txt is different than the directory /home/bartj/d/3d/k3d-release where CMackeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :wontfix creation_time: 2009-05-06 03:54:28.096410 Z references: [] id: f70081ac577a3f841537885c3d1d3af7f23f5aef log_events: - - 2009-05-06 03:54:32.488316 Z - Beverly L. Shead - created - "" - - 2009-07-22 02:47:47.436479 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-03 00:16:14.526852 Z - Timothy M. Shead - closed with disposition wontfix - Can't find anyplace in the code where there's a hard-coded path as described by the OP. Either it's already cleaned-up, or some other issue. ================================================ FILE: bugs/issue-f7a6867233d707004a53404495ec68af38de7dc2.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: MakeSDS segfault. desc: |- Steps to reproduce: * Start K-3D. * Create a PolyCube. * Right-click on the cube and choose Mesh Modifier > MakeSDS * Segfault with the following output: DEBUG: SDS create timings: Total: 0.0007319, copy input: 1.6909e-05 (2.31029%), calculate companions/point to face: 0.00032312 (44.1482%), calculate indices: 0.000109156 (14.914%), allocate memory: 7.10989e-05 (9.7143%), subdivide topology: 2.19508e-05 (2.99916%), vertex valences: 2.81077e-05 (3.84037%) DEBUG: SDS update timings: Total: 0.00153288, face centers: 0.000555908 (36.2655%), edge midpoints: 0.000259009 (16.8968%), point positions: 0.000253795 (16.5567%) Segmentation fault (core dumped) type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-01-01 03:48:25.796512 Z references: [] id: f7a6867233d707004a53404495ec68af38de7dc2 log_events: - - 2010-01-01 03:48:26.509507 Z - Timothy M. Shead - created - "" - - 2010-01-19 03:53:50.509215 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/issue-f838455f2a342a4d7c1d2aa13e3bd4d459d9c289.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Support grouped inset in ExtrudeFaces desc: Currently, the inset property is ignored when grouping is enabled in ExtrudeFaces. Make it work again. type: :bugfix component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2010-02-23 04:02:01.458926 Z references: [] id: f838455f2a342a4d7c1d2aa13e3bd4d459d9c289 log_events: - - 2010-02-23 04:02:02.026851 Z - Timothy M. Shead - created - "" - - 2010-02-27 06:35:42.570878 Z - Timothy M. Shead - closed with disposition fixed - "" claimer: ================================================ FILE: bugs/issue-fd6e33c28fa0b3d7a02b1c4972bc5577b61d8838.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: 5 Mouse jumps to right screen border with manipulators desc: |- My mouse cursor jumps to the right border of my primary screen (note: I have a dual screen setup, my primary is on the right). This happens whenever you have nothing selected and select something while you either use the move, rotate or scale tool (those with manipulators). I used an svn build of today (30.03.08) which is build via mingw on windows xp. Steps to reproduce: 1. Open K3D 2. Create a poly cube 3. Press space to deselect it 4. go into either move, rotate or scale mode (w,e,r) 5. Click on the cube and the mouse jumps to the right border of your screen type: :bugfix component: K-3D release: 1.0.0.0 reporter: Beverly L. Shead status: :unstarted disposition: creation_time: 2009-05-19 03:28:41.368708 Z references: [] id: fd6e33c28fa0b3d7a02b1c4972bc5577b61d8838 log_events: - - 2009-05-19 03:28:42.240542 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:20.230708 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-08-20 06:32:25.281472 Z - Timothy M. Shead - assigned to release 1.0.0.0 from 0.8.0.0 - "" ================================================ FILE: bugs/issue-ff8b9cee50b4d5422d195a8a64467eaca0b11ded.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: Complete refactoring the set of geometric primitive component names and selections. desc: Like it says. type: :task component: K-3D release: 0.8.0.0 reporter: Timothy M. Shead status: :closed disposition: :fixed creation_time: 2009-08-02 21:16:35.958951 Z references: [] id: ff8b9cee50b4d5422d195a8a64467eaca0b11ded log_events: - - 2009-08-02 21:16:36.935002 Z - Timothy M. Shead - created - "" - - 2009-08-23 20:50:33.213543 Z - Timothy M. Shead - closed with disposition fixed - Done, and not a minute too soon. ================================================ FILE: bugs/issue-ff93d0f500a475dc818ff0f85fa530f5fbc58be0.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/issue title: " Mesh disappears after Modify|Mesh|CatmullClark " desc: |- Meshes always disappear when using the CatmullClark command. I'm using the "official" 0.7.2.0 build for windows. Steps to reproduce: 1. Create a cube 2. Select the cube 3. Click on Modify|Mesh|CatmullClark type: :bugfix component: K-3D release: 0.8.0.0 reporter: Beverly L. Shead status: :closed disposition: :fixed creation_time: 2009-05-19 03:29:41.768645 Z references: [] id: ff93d0f500a475dc818ff0f85fa530f5fbc58be0 log_events: - - 2009-05-19 03:29:42.536589 Z - Beverly L. Shead - created - "" - - 2009-08-02 22:52:21.471071 Z - Timothy M. Shead - assigned to release 0.8.0.0 from unassigned - "" - - 2009-11-15 16:17:09.197260 Z - Timothy M. Shead - closed with disposition fixed - "" ================================================ FILE: bugs/project.yaml ================================================ --- !ditz.rubyforge.org,2008-03-06/project name: K-3D version: "0.5" components: - !ditz.rubyforge.org,2008-03-06/component name: K-3D releases: - !ditz.rubyforge.org,2008-03-06/release name: 0.7.11.0 status: :released release_time: 2009-03-19 04:17:40.762513 Z log_events: - - 2009-03-19 04:17:30.288207 Z - Timothy M. Shead - created - "" - - 2009-03-19 04:17:40.762532 Z - Timothy M. Shead - released - "" - !ditz.rubyforge.org,2008-03-06/release name: 0.8.0.0 status: :released release_time: 2010-04-07 04:41:08.206138 Z log_events: - - 2009-04-29 01:21:57.847477 Z - Timothy M. Shead - created - "" - - 2010-04-07 04:41:08.206160 Z - Timothy M. Shead - released - "" - !ditz.rubyforge.org,2008-03-06/release name: 0.8.0.1 status: :released release_time: 2010-04-20 17:04:23.619456 Z log_events: - - 2010-04-16 04:43:07.032042 Z - Timothy M. Shead - created - "" - - 2010-04-20 17:04:23.619477 Z - Timothy M. Shead - released - "" - !ditz.rubyforge.org,2008-03-06/release name: 0.8.1.0 status: :unreleased release_time: log_events: - - 2010-05-14 04:28:28.798785 Z - Timothy M. Shead - created - "" - !ditz.rubyforge.org,2008-03-06/release name: 1.0.0.0 status: :unreleased release_time: log_events: - - 2009-04-29 01:22:55.792756 Z - Timothy M. Shead - created - "" ================================================ FILE: cmake/dashboards/continuous-debug.cmake ================================================ # Setup default test variables ... SET(CTEST_CMAKE_COMMAND "\"${CMAKE_EXECUTABLE_NAME}\"") SET(CTEST_COMMAND "\"${CTEST_EXECUTABLE_NAME}\" -D Continuous -E benchmark -A \"${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}\"") SET(CTEST_SOURCE_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}/../..") #SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE TRUE) SET(CTEST_INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Debug K3D_BUILD_GLX_MODULE:BOOL=OFF K3D_BUILD_VIRTUAL_OFFSCREEN_MODULE:BOOL=OFF K3D_ENABLE_TESTING:BOOL=ON $ENV{K3D_EXTRA_INITIAL_CACHE} ") SET(CTEST_CONTINUOUS_DURATION 960) SET(CTEST_CONTINUOUS_MINIMUM_INTERVAL 10) # Allow the caller to override test variables ... note that the caller MUST specify CTEST_BINARY_DIRECTORY at-a-minimum. SET(VARIABLE) FOREACH(ARGUMENT ${CTEST_SCRIPT_ARG}) IF(VARIABLE) SET(${VARIABLE} ${ARGUMENT}) SET(VARIABLE) ELSE(VARIABLE) SET(VARIABLE ${ARGUMENT}) ENDIF(VARIABLE) ENDFOREACH(ARGUMENT) ================================================ FILE: cmake/dashboards/nightly-coverage.cmake ================================================ # Setup default test variables ... SET(CTEST_CMAKE_COMMAND "\"${CMAKE_EXECUTABLE_NAME}\"") SET(CTEST_COMMAND "\"${CTEST_EXECUTABLE_NAME}\" -D Nightly -A \"${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}\"") SET(CTEST_SOURCE_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}/../..") SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) SET(CTEST_INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Debug K3D_BUILD_GLX_MODULE:BOOL=OFF K3D_BUILD_VIRTUAL_OFFSCREEN_MODULE:BOOL=OFF K3D_ENABLE_TESTING:BOOL=ON $ENV{K3D_EXTRA_INITIAL_CACHE} ") SET(CTEST_ENVIRONMENT "CFLAGS=-g -O0 -fprofile-arcs -ftest-coverage" "CXXFLAGS=-g -O0 -fprofile-arcs -ftest-coverage" "LDFLAGS=-fprofile-arcs -ftest-coverage" ) # Allow the caller to override test variables ... note that the caller MUST specify CTEST_BINARY_DIRECTORY at-a-minimum. SET(VARIABLE) FOREACH(ARGUMENT ${CTEST_SCRIPT_ARG}) IF(VARIABLE) SET(${VARIABLE} ${ARGUMENT}) SET(VARIABLE) ELSE(VARIABLE) SET(VARIABLE ${ARGUMENT}) ENDIF(VARIABLE) ENDFOREACH(ARGUMENT) ================================================ FILE: cmake/dashboards/nightly-debug.cmake ================================================ # Setup default test variables ... SET(CTEST_CMAKE_COMMAND "\"${CMAKE_EXECUTABLE_NAME}\"") SET(CTEST_COMMAND "\"${CTEST_EXECUTABLE_NAME}\" -D Nightly -A \"${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}\"") SET(CTEST_SOURCE_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}/../..") SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) SET(CTEST_INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Debug K3D_BUILD_GLX_MODULE:BOOL=OFF K3D_BUILD_VIRTUAL_OFFSCREEN_MODULE:BOOL=OFF K3D_ENABLE_TESTING:BOOL=ON $ENV{K3D_EXTRA_INITIAL_CACHE} ") # Allow the caller to override test variables ... note that the caller MUST specify CTEST_BINARY_DIRECTORY at-a-minimum. SET(VARIABLE) FOREACH(ARGUMENT ${CTEST_SCRIPT_ARG}) IF(VARIABLE) SET(${VARIABLE} ${ARGUMENT}) SET(VARIABLE) ELSE(VARIABLE) SET(VARIABLE ${ARGUMENT}) ENDIF(VARIABLE) ENDFOREACH(ARGUMENT) ================================================ FILE: cmake/dashboards/nightly-release.cmake ================================================ # Setup default test variables ... SET(CTEST_CMAKE_COMMAND "\"${CMAKE_EXECUTABLE_NAME}\"") SET(CTEST_COMMAND "\"${CTEST_EXECUTABLE_NAME}\" --track Nightly-Release -D Nightly -A \"${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}\"") SET(CTEST_SOURCE_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}/../..") SET(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) SET(CTEST_INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release K3D_BUILD_DEVELOPMENT_MODULE:BOOL=OFF K3D_BUILD_EULER_OPERATIONS_MODULE:BOOL=OFF K3D_BUILD_GLX_MODULE:BOOL=OFF K3D_BUILD_LSYSTEM_MODULE:BOOL=OFF K3D_BUILD_QSLIM_MODULE:BOOL=OFF K3D_BUILD_VIRTUAL_OFFSCREEN_MODULE:BOOL=OFF K3D_ENABLE_DISTRIBUTION:BOOL=ON K3D_ENABLE_TESTING:BOOL=ON $ENV{K3D_EXTRA_INITIAL_CACHE} ") # Allow the caller to override test variables ... note that the caller MUST specify CTEST_BINARY_DIRECTORY at-a-minimum. SET(VARIABLE) FOREACH(ARGUMENT ${CTEST_SCRIPT_ARG}) IF(VARIABLE) SET(${VARIABLE} ${ARGUMENT}) SET(VARIABLE) ELSE(VARIABLE) SET(VARIABLE ${ARGUMENT}) ENDIF(VARIABLE) ENDFOREACH(ARGUMENT) ================================================ FILE: cmake/modules/FindK3DAsciiDoc.cmake ================================================ INCLUDE(K3DParseArguments) FIND_PROGRAM(ASCIIDOC_COMMAND asciidoc) FIND_PROGRAM(A2X_COMMAND a2x) FUNCTION(K3D_ADD_ASCIIDOC_MAN_PAGE DOCUMENT_NAME) K3D_PARSE_ARGUMENTS(DOCUMENT "SOURCE;DESTINATION" "" ${ARGN}) SET(ARGUMENTS "") # LIST(APPEND ARGUMENTS --attribute docinfo) # LIST(APPEND ARGUMENTS --doctype manpage) # LIST(APPEND ARGUMENTS --backend docbook) # LIST(APPEND ARGUMENTS --out-file ${CMAKE_CURRENT_BINARY_DIR}/${DOCUMENT_NAME}.xml) LIST(APPEND ARGUMENTS --format manpage) LIST(APPEND ARGUMENTS --destination-dir ${DOCUMENT_DESTINATION}) ADD_CUSTOM_COMMAND( COMMAND ${CMAKE_COMMAND} -E make_directory ${DOCUMENT_DESTINATION} OUTPUT ${DOCUMENT_DESTINATION} ) ADD_CUSTOM_COMMAND( DEPENDS ${DOCUMENT_SOURCE} ${DOCUMENT_DESTINATION} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${A2X_COMMAND} ${ARGUMENTS} ${DOCUMENT_SOURCE} OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DOCUMENT_NAME} ) ADD_CUSTOM_TARGET(${DOCUMENT_NAME} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${DOCUMENT_NAME} ) ENDFUNCTION() ================================================ FILE: cmake/modules/K3DCompileResource.cmake ================================================ # Setup a macro for compiling resources ... MACRO(K3D_COMPILE_RESOURCE OUTPUT INPUT RESOURCE_PATH) SET(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${INPUT}") SET(OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/${INPUT}.cpp") GET_FILENAME_COMPONENT(OUTPUT_PATH ${OUTPUT_FILE} PATH) GET_TARGET_PROPERTY(K3D_RESOURCE_COMPILER k3d-resource-compiler LOCATION) ADD_CUSTOM_COMMAND( DEPENDS k3d-resource-compiler DEPENDS ${INPUT_FILE} COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUT_PATH} COMMAND ${K3D_RESOURCE_COMPILER} --input ${INPUT_FILE} --path \"${RESOURCE_PATH}\" --output ${OUTPUT_FILE} OUTPUT ${OUTPUT_FILE} COMMENT "Compiling resource ${INPUT_FILE}" ) LIST(APPEND ${OUTPUT} ${OUTPUT_FILE}) ENDMACRO(K3D_COMPILE_RESOURCE) ================================================ FILE: cmake/modules/K3DCompiler.cmake ================================================ IF(APPLE AND CMAKE_BUILD_TYPE STREQUAL "Release") EXECUTE_PROCESS( COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE K3D_COMPILER_VERSION ) IF(K3D_COMPILER_VERSION MATCHES "4.0.1") MESSAGE(SEND_ERROR "The Apple gcc 4.0.1 compiler produces release binaries that fail at runtime. Try the gcc 4.2 compiler included in recent version of XCode instead. See http://developer.k-3d.org/tracker/issue-cf2cdc4985a66db59f55052f03c3c620237b451f.html for details.") ENDIF() ENDIF() ================================================ FILE: cmake/modules/K3DDependencies.cmake ================================================ INCLUDE(K3DParseArguments) FUNCTION(K3D_CHECK CONFIG) K3D_PARSE_ARGUMENTS(BUILD "REQUIRES;RESOURCE;URL;MESSAGE" "" ${ARGN}) IF(CONFIG STREQUAL "K-3D" OR ${CONFIG}) FOREACH(REQUIREMENT ${BUILD_REQUIRES}) IF(NOT ${REQUIREMENT}) IF(BUILD_RESOURCE AND BUILD_URL) MESSAGE(SEND_ERROR "${CONFIG} requires ${BUILD_RESOURCE}, which can be obtained from ${BUILD_URL}. ${BUILD_MESSAGE}") ELSEIF(BUILD_RESOURCE) MESSAGE(SEND_ERROR "${CONFIG} requires ${BUILD_RESOURCE}. ${BUILD_MESSAGE}") ELSE() MESSAGE(SEND_ERROR "${CONFIG} requires ${REQUIREMENT}. ${BUILD_MESSAGE}") ENDIF() ENDIF() ENDFOREACH() ENDIF() ENDFUNCTION() FUNCTION(K3D_ADD_SUBDIRECTORY DIRECTORY) K3D_PARSE_ARGUMENTS(DIRECTORY "REQUIRES" "" ${ARGN}) FOREACH(REQUIREMENT ${DIRECTORY_REQUIRES}) IF(NOT ${REQUIREMENT}) RETURN() ENDIF() ENDFOREACH() ADD_SUBDIRECTORY(${DIRECTORY}) ENDFUNCTION() FUNCTION(K3D_ADD_CUSTOM_TARGET TARGET_NAME) K3D_PARSE_ARGUMENTS(TARGET "REQUIRES;COMMAND" "" ${ARGN}) FOREACH(REQUIREMENT ${TARGET_REQUIRES}) IF(NOT ${REQUIREMENT}) RETURN() ENDIF() ENDFOREACH() ADD_CUSTOM_TARGET(${TARGET_NAME} COMMAND ${TARGET_COMMAND}) ENDFUNCTION() FUNCTION(K3D_ADD_LIBRARY LIBRARY_NAME) ADD_LIBRARY(${LIBRARY_NAME} ${ARGN}) SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES VERSION "${K3D_SO_VERSION}") ENDFUNCTION() MACRO(K3D_ADD_LIBRARY LIBRARY_NAME) ADD_LIBRARY(${LIBRARY_NAME} ${ARGN}) SET_TARGET_PROPERTIES(${LIBRARY_NAME} PROPERTIES VERSION "${K3D_SO_VERSION}") ENDMACRO() ================================================ FILE: cmake/modules/K3DFind3ds.cmake ================================================ SET(K3D_3DS_FOUND FALSE) #Unix configuration IF(UNIX AND NOT APPLE) FIND_PATH(K3D_3DS_INCLUDE_PATH /lib3ds /usr/local/include /usr/include DOC "Directory where the lib3ds header files are located" ) FIND_LIBRARY(K3D_3DS_LIBRARY NAMES 3ds PATHS /usr/local/lib /usr/lib DOC "The lib3ds library" ) ENDIF(UNIX AND NOT APPLE) #Apple configuration IF(UNIX AND APPLE) FIND_PATH(K3D_COLLADA_DOM_INCLUDE_PATH /lib3ds /Library/Frameworks/lib3ds.framework DOC "Directory where the lib3ds header files are located" ) FIND_LIBRARY(K3D_3DS_LIBRARY NAMES lib3ds PATHS /Library/Frameworks/lib3ds.framework DOC "The lib3ds library" ) ENDIF(UNIX AND APPLE) #Windows configuration IF(WIN32) FIND_PATH(K3D_3DS_INCLUDE_PATH lib3ds/ C:/Program Files/lib3ds/include DOC "Directory where the lib3ds header files are located" ) FIND_LIBRARY(K3D_3DS_LIBRARY NAMES lib3ds PATHS C:/Program Files/lib3ds/lib/ DOC "The lib3ds library" ) ENDIF(WIN32) MARK_AS_ADVANCED(K3D_3DS_INCLUDE_PATH) MARK_AS_ADVANCED(K3D_3DS_LIBRARY) SET(K3D_3DS_INCLUDE_DIRS ${K3D_3DS_INCLUDE_PATH}) SET(K3D_3DS_LIBS ${K3D_3DS_LIBRARY}) IF(WIN32) SET(K3D_3DS_LIBS ${K3D_3DS_LIBS}) # pcrecpp pcre) ENDIF(WIN32) IF(K3D_3DS_INCLUDE_PATH AND K3D_3DS_LIBRARY) SET(K3D_3DS_FOUND TRUE) ENDIF(K3D_3DS_INCLUDE_PATH AND K3D_3DS_LIBRARY) ================================================ FILE: cmake/modules/K3DFindBoost.cmake ================================================ SET(K3D_BOOST_INCLUDE_DIR "" CACHE PATH "Override the default location for Boost header files.") SET(K3D_BOOST_LIBRARY_DIR "" CACHE PATH "Override the default location for Boost libraries.") SET(K3D_BOOST_USE_MULTITHREADED OFF CACHE BOOL "Use multithreaded Boost libraries.") SET(BOOST_INCLUDEDIR ${K3D_BOOST_INCLUDE_DIR}) SET(BOOST_LIBRARYDIR ${K3D_BOOST_LIBRARY_DIR}) SET(Boost_ADDITIONAL_VERSIONS 1.43 1.43.0) SET(Boost_USE_MULTITHREADED ${K3D_BOOST_USE_MULTITHREADED}) FIND_PACKAGE(Boost 1.42 COMPONENTS ${K3D_BOOST_COMPONENTS} REQUIRED) ================================================ FILE: cmake/modules/K3DFindCARVE.cmake ================================================ SET(K3D_CARVE_FOUND 0) FIND_PATH(K3D_CARVE_INCLUDE_DIR carve /usr/include /usr/local/include DOC "Directory where the carve directory, containing the headers, is located" ) MARK_AS_ADVANCED(K3D_CARVE_INCLUDE_DIR) FIND_LIBRARY(K3D_CARVE_LIBRARY intersect DOC "The CARVE polyhedron boolean library" ) MARK_AS_ADVANCED(K3D_CARVE_LIBRARY) IF(K3D_CARVE_INCLUDE_DIR AND K3D_CARVE_LIBRARY) SET(K3D_CARVE_FOUND 1) ENDIF() ================================================ FILE: cmake/modules/K3DFindCGAL.cmake ================================================ SET(K3D_CGAL_FOUND 0) FIND_PATH(K3D_CGAL_INCLUDE_DIR CGAL /usr/include /usr/local/include DOC "Directory where the CGAL header directory is located" ) MARK_AS_ADVANCED(K3D_CGAL_INCLUDE_DIR) FIND_LIBRARY(K3D_CGAL_LIBRARY CGAL DOC "The CGAL library" ) MARK_AS_ADVANCED(K3D_CGAL_LIBRARY) FIND_LIBRARY(K3D_MPFR_LIBRARY mpfr DOC "The mpfr library" ) MARK_AS_ADVANCED(K3D_MPFR_LIBRARY) FIND_LIBRARY(K3D_GMP_LIBRARY gmp DOC "The GMP library" ) MARK_AS_ADVANCED(K3D_GMP_LIBRARY) IF(K3D_CGAL_INCLUDE_DIR AND K3D_CGAL_LIBRARY AND K3D_MPFR_LIBRARY AND K3D_GMP_LIBRARY) SET(K3D_CGAL_FOUND 1) ENDIF(K3D_CGAL_INCLUDE_DIR AND K3D_CGAL_LIBRARY AND K3D_MPFR_LIBRARY AND K3D_GMP_LIBRARY) ================================================ FILE: cmake/modules/K3DFindCairomm.cmake ================================================ SET(K3D_CAIROMM_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(CAIROMM cairomm-1.0) IF(CAIROMM_FOUND) SET(K3D_CAIROMM_INCLUDE_DIRS ${CAIROMM_INCLUDE_DIRS} ) SET(K3D_CAIROMM_LIB_DIRS ${CAIROMM_LIBRARY_DIRS} ) SET(K3D_CAIROMM_LIBS ${CAIROMM_LIBRARIES} ) SET(K3D_CAIROMM_FOUND 1) ENDIF(CAIROMM_FOUND) ================================================ FILE: cmake/modules/K3DFindCollada.cmake ================================================ SET(K3D_COLLADA_FOUND FALSE) IF(NOT APPLE) FIND_PATH(K3D_COLLADA_BASE_INCLUDE_PATH 1.4 /usr/include/collada-dom2.4 /usr/include/colladadom /usr/local/include/collada-dom2.4 /usr/local/include/colladadom DOC "Directory where the collada includes are located" ) SET(K3D_COLLADA_DAE_INCLUDE_PATH ${K3D_COLLADA_BASE_INCLUDE_PATH} CACHE PATH "Directoy containing the Collada dae.h include file") SET(K3D_COLLADA_DOM_INCLUDE_PATH ${K3D_COLLADA_BASE_INCLUDE_PATH}/1.4 CACHE PATH "Directoy containing the Collada dom includes") FIND_LIBRARY(K3D_COLLADA_LIBRARY NAMES collada14dom collada-dom2.4-dp collada-dom2.4 PATHS /usr/local/lib /usr/lib DOC "The ColladaDOM 1.4 library" ) ENDIF(NOT APPLE) #Apple configuration IF(UNIX AND APPLE) FIND_PATH(K3D_COLLADA_DAE_INCLUDE_PATH dae.h /Library/Frameworks/Collada14Dom.framework DOC "Directory where the ColladaDOM dae.h file is located" ) FIND_PATH(K3D_COLLADA_DOM_INCLUDE_PATH dom/ /Library/Frameworks/Collada14Dom.framework/1.4 DOC "Directory where the ColladaDOM 1.4 header files are located" ) FIND_LIBRARY(K3D_COLLADA_LIBRARY NAMES Collada14Dom PATHS /Library/Frameworks/Collada14Dom.framework DOC "The ColladaDOM 1.4 library" ) ENDIF(UNIX AND APPLE) MARK_AS_ADVANCED(K3D_COLLADA_BASE_INCLUDE_PATH) MARK_AS_ADVANCED(K3D_COLLADA_DAE_INCLUDE_PATH) MARK_AS_ADVANCED(K3D_COLLADA_DOM_INCLUDE_PATH) MARK_AS_ADVANCED(K3D_COLLADA_LIBRARY) SET(K3D_COLLADA_INCLUDE_DIRS ${K3D_COLLADA_DAE_INCLUDE_PATH} ${K3D_COLLADA_DOM_INCLUDE_PATH}) SET(K3D_COLLADA_LIBS ${K3D_COLLADA_LIBRARY}) IF(K3D_COLLADA_DAE_INCLUDE_PATH AND K3D_COLLADA_DOM_INCLUDE_PATH AND K3D_COLLADA_LIBRARY) SET(K3D_COLLADA_FOUND TRUE) ENDIF(K3D_COLLADA_DAE_INCLUDE_PATH AND K3D_COLLADA_DOM_INCLUDE_PATH AND K3D_COLLADA_LIBRARY) ================================================ FILE: cmake/modules/K3DFindDBus.cmake ================================================ SET(K3D_DBUS_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(DBUS dbus-glib-1) IF(DBUS_FOUND) SET(K3D_DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIRS} ) SET(K3D_DBUS_LIB_DIRS ${DBUS_LIBRARY_DIRS} ) SET(K3D_DBUS_LIBS ${DBUS_LIBRARIES} ) SET(K3D_DBUS_FOUND 1) ENDIF(DBUS_FOUND) ================================================ FILE: cmake/modules/K3DFindFTGL.cmake ================================================ SET(K3D_FTGL_FOUND 0) FIND_PATH(K3D_FTGL_INCLUDE_DIR FTGL/ftgl.h DOC "Directory where the FTGL directory, containing the ftgl headers, is located" ) MARK_AS_ADVANCED(K3D_FTGL_INCLUDE_DIR) FIND_LIBRARY(K3D_FTGL_LIBRARY ftgl DOC "The FTGL library" ) MARK_AS_ADVANCED(K3D_FTGL_LIBRARY) IF(K3D_FTGL_INCLUDE_DIR AND K3D_FTGL_LIBRARY) SET(K3D_FTGL_FOUND 1) ENDIF() ================================================ FILE: cmake/modules/K3DFindFreetype2.cmake ================================================ SET(K3D_FREETYPE2_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(FREETYPE2 freetype2) IF(FREETYPE2_FOUND) SET(K3D_FREETYPE2_INCLUDE_DIRS ${FREETYPE2_INCLUDE_DIRS} ) SET(K3D_FREETYPE2_LIB_DIRS ${FREETYPE2_LIBRARY_DIRS} ) SET(K3D_FREETYPE2_LIBS ${FREETYPE2_LIBRARIES} ) SET(K3D_FREETYPE2_FOUND 1) ENDIF(FREETYPE2_FOUND) ================================================ FILE: cmake/modules/K3DFindGMM.cmake ================================================ SET(K3D_GMM_FOUND 0) FIND_PATH(K3D_GMM_INCLUDE_DIR gmm/gmm.h /usr/include DOC "Directory where the gmm directory containing header files is located" ) MARK_AS_ADVANCED(K3D_GMM_INCLUDE_DIR) IF(EXISTS ${K3D_GMM_INCLUDE_DIR}/gmm/gmm.h) SET(K3D_GMM_FOUND 1) ENDIF(EXISTS ${K3D_GMM_INCLUDE_DIR}/gmm/gmm.h) ================================================ FILE: cmake/modules/K3DFindGPerftools.cmake ================================================ SET(K3D_GPERFTOOLS_FOUND 0) FIND_PATH(K3D_GPERFTOOLS_INCLUDE_DIR gperftools /usr/include /usr/local/include DOC "Directory where the gperftools directory, containing the perftools headers, is located" ) MARK_AS_ADVANCED(K3D_GPERFTOOLS_INCLUDE_DIR) FIND_LIBRARY(K3D_PROFILER_LIBRARY profiler DOC "The gperftools profiler library" ) MARK_AS_ADVANCED(K3D_PROFILER_LIBRARY) IF(K3D_GPERFTOOLS_INCLUDE_DIR AND K3D_PROFILER_LIBRARY) SET(K3D_GPERFTOOLS_FOUND 1) ENDIF() ================================================ FILE: cmake/modules/K3DFindGTS.cmake ================================================ SET(K3D_GTS_FOUND 0) ###################################################################### # Posix specific configuration IF(UNIX) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(GTS gts) IF(GTS_FOUND) SET(K3D_GTS_INCLUDE_DIRS ${GTS_INCLUDE_DIRS} ) SET(K3D_GTS_LIB_DIRS ${GTS_LIBRARY_DIRS} ) SET(K3D_GTS_LIBS ${GTS_LIBRARIES} ) SET(K3D_GTS_FOUND 1) ENDIF(GTS_FOUND) ENDIF(UNIX) ###################################################################### # Win32 specific configuration IF(WIN32) ENDIF(WIN32) ###################################################################### # Mac OS X specific configuration IF(APPLE) ENDIF(APPLE) ================================================ FILE: cmake/modules/K3DFindGiomm.cmake ================================================ SET(K3D_GIOMM_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(GIOMM giomm-2.4) IF(GIOMM_FOUND) SET(K3D_GIOMM_INCLUDE_DIRS ${GIOMM_INCLUDE_DIRS} ) SET(K3D_GIOMM_LIB_DIRS ${GIOMM_LIBRARY_DIRS} ) SET(K3D_GIOMM_LIBS ${GIOMM_LIBRARIES} ) SET(K3D_GIOMM_FOUND 1) ENDIF(GIOMM_FOUND) ================================================ FILE: cmake/modules/K3DFindGlibmm.cmake ================================================ SET(K3D_GLIBMM_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(GLIBMM glibmm-2.4>=2.26) IF(GLIBMM_FOUND) SET(K3D_GLIBMM_INCLUDE_DIRS ${GLIBMM_INCLUDE_DIRS} ) SET(K3D_GLIBMM_LIB_DIRS ${GLIBMM_LIBRARY_DIRS} ) SET(K3D_GLIBMM_LIBS ${GLIBMM_LIBRARIES} ) SET(K3D_GLIBMM_FOUND 1) ENDIF(GLIBMM_FOUND) ================================================ FILE: cmake/modules/K3DFindGthread.cmake ================================================ SET(K3D_GTHREAD_FOUND 0) ###################################################################### # Posix specific configuration INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(GTHREAD gthread-2.0) IF(GTHREAD_FOUND) SET(K3D_GTHREAD_INCLUDE_DIRS ${GTHREAD_INCLUDE_DIRS} ) SET(K3D_GTHREAD_LIB_DIRS ${GTHREAD_LIBRARY_DIRS} ) SET(K3D_GTHREAD_LIBS ${GTHREAD_LIBRARIES} ) SET(K3D_GTHREAD_FOUND 1) ENDIF(GTHREAD_FOUND) ================================================ FILE: cmake/modules/K3DFindGtkGLExt.cmake ================================================ SET(K3D_GTKGLEXT_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(GTKGLEXT gtkglext-1.0) IF(GTKGLEXT_FOUND) SET(K3D_GTKGLEXT_INCLUDE_DIRS ${GTKGLEXT_INCLUDE_DIRS} ) SET(K3D_GTKGLEXT_LIB_DIRS ${GTKGLEXT_LIBRARY_DIRS} ) SET(K3D_GTKGLEXT_LIBS ${GTKGLEXT_LIBRARIES} ) SET(K3D_GTKGLEXT_FOUND 1) ENDIF(GTKGLEXT_FOUND) ================================================ FILE: cmake/modules/K3DFindGtkSourceView.cmake ================================================ SET(K3D_GTKSOURCEVIEW_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(GTKSOURCEVIEW gtksourceview-2.0) IF(GTKSOURCEVIEW_FOUND) SET(K3D_GTKSOURCEVIEW_INCLUDE_DIRS ${GTKSOURCEVIEW_INCLUDE_DIRS} ) SET(K3D_GTKSOURCEVIEW_LIBRARY_DIRS ${GTKSOURCEVIEW_LIBRARY_DIRS} ) SET(K3D_GTKSOURCEVIEW_LIBRARIES ${GTKSOURCEVIEW_LIBRARIES} ) SET(K3D_GTKSOURCEVIEW_FOUND 1) ENDIF(GTKSOURCEVIEW_FOUND) ================================================ FILE: cmake/modules/K3DFindGtkmm.cmake ================================================ SET(K3D_GTKMM_FOUND 0) ###################################################################### # Posix specific configuration INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(GTKMM gtkmm-2.4) IF(GTKMM_FOUND) SET(K3D_GTKMM_INCLUDE_DIRS ${GTKMM_INCLUDE_DIRS} ) SET(K3D_GTKMM_LIB_DIRS ${GTKMM_LIBRARY_DIRS} ) SET(K3D_GTKMM_LIBS ${GTKMM_LIBRARIES} ) SET(K3D_GTKMM_FOUND 1) ENDIF(GTKMM_FOUND) ================================================ FILE: cmake/modules/K3DFindImageMagick.cmake ================================================ SET(K3D_IMAGEMAGICK_FOUND 0) find_package(ImageMagick COMPONENTS Magick++) IF(ImageMagick_FOUND) SET(K3D_IMAGEMAGICK_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} ) SET(K3D_IMAGEMAGICK_LIBS ${ImageMagick_LIBRARIES} ) SET(K3D_IMAGEMAGICK_FOUND 1) ENDIF(ImageMagick_FOUND) ================================================ FILE: cmake/modules/K3DFindInotify.cmake ================================================ SET(K3D_INOTIFY_FOUND 0) FIND_PATH(K3D_INOTIFY_INCLUDE_DIR sys/inotify.h /usr/include DOC "Directory where the sys/inotify.h header file is located" ) MARK_AS_ADVANCED(K3D_INOTIFY_INCLUDE_DIR) IF(K3D_INOTIFY_INCLUDE_DIR) SET(K3D_INOTIFY_FOUND 1) ENDIF() ================================================ FILE: cmake/modules/K3DFindIntl.cmake ================================================ INCLUDE(FindGTK) FIND_PATH(K3D_INTL_INCLUDE_DIR libintl.h /usr/include c:/gtk/include ${K3D_GTK_DIR}/include DOC "Directory where the libintl header files are located" ) MARK_AS_ADVANCED(K3D_INTL_INCLUDE_DIR) IF(WIN32 OR APPLE) SET(K3D_INTL_LIB intl CACHE FILEPATH "") MARK_AS_ADVANCED(K3D_INTL_LIB) ENDIF() SET(K3D_INTL_INCLUDE_DIRS ${K3D_INTL_INCLUDE_DIR} ) SET(K3D_INTL_LIBS ${K3D_INTL_LIB} ) SET(K3D_INTL_FOUND 1) ================================================ FILE: cmake/modules/K3DFindJPEG.cmake ================================================ INCLUDE(FindGTK) FIND_PATH(K3D_JPEG_INCLUDE_DIR jpeglib.h /usr/include c:/gtk/include ${K3D_GTK_DIR}/include DOC "Directory where the jpeg header files are located" ) MARK_AS_ADVANCED(K3D_JPEG_INCLUDE_DIR) SET(K3D_JPEG_LIB jpeg CACHE STRING "") MARK_AS_ADVANCED(K3D_JPEG_LIB) SET(K3D_JPEG_INCLUDE_DIRS ${K3D_JPEG_INCLUDE_DIR} ) SET(K3D_JPEG_LIBS ${K3D_JPEG_LIB} ) SET(K3D_JPEG_FOUND 1) ================================================ FILE: cmake/modules/K3DFindODE.cmake ================================================ SET(K3D_ODE_FOUND 0) FIND_PATH(K3D_ODE_INCLUDE_DIR ode/ode.h ) FIND_LIBRARY(K3D_ODE_LIBRARY ode ) IF(K3D_ODE_INCLUDE_DIR AND K3D_ODE_LIBRARY) SET(K3D_ODE_FOUND 1) ENDIF() MARK_AS_ADVANCED( K3D_ODE_INCLUDE_DIR K3D_ODE_LIBRARY ) ================================================ FILE: cmake/modules/K3DFindOSMesa.cmake ================================================ SET(K3D_OSMESA_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(OSMESA osmesa) IF(OSMESA_FOUND) SET(K3D_OSMESA_INCLUDE_DIRECTORIES ${OSMESA_INCLUDE_DIRS} ) SET(K3D_OSMESA_LIB_DIRECTORIES ${OSMESA_LIBRARY_DIRS} ) SET(K3D_OSMESA_LIBRARIES ${OSMESA_LIBRARIES} ) SET(K3D_OSMESA_FOUND 1) ENDIF() ================================================ FILE: cmake/modules/K3DFindOpenEXR.cmake ================================================ SET(K3D_OPENEXR_FOUND 0) ###################################################################### # Posix specific configuration IF(UNIX) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(OPENEXR OpenEXR) IF(OPENEXR_FOUND) SET(K3D_OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIRS} ) SET(K3D_OPENEXR_LIB_DIRS ${OPENEXR_LIBRARY_DIRS} ) SET(K3D_OPENEXR_LIBS ${OPENEXR_LIBRARIES} ) SET(K3D_OPENEXR_FOUND 1) ENDIF(OPENEXR_FOUND) ENDIF(UNIX) ###################################################################### # Win32 specific configuration IF(WIN32) ENDIF(WIN32) ###################################################################### # Mac OS X specific configuration IF(APPLE) ENDIF(APPLE) ================================================ FILE: cmake/modules/K3DFindOpenGL.cmake ================================================ SET(K3D_OPENGL_FOUND 0) FIND_PACKAGE(OpenGL) pkg_search_module(GLEW glewmx glew) IF(OPENGL_FOUND AND OPENGL_GLU_FOUND AND GLEW_FOUND) SET(K3D_OPENGL_INCLUDE_DIR ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIRS}) SET(K3D_OPENGL_LIBRARIES ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES}) SET(K3D_GLEW_VERSION ${GLEW_VERSION}) string(REPLACE "." ";" GLEW_VERSION_LIST ${GLEW_VERSION}) list(GET GLEW_VERSION_LIST 0 K3D_GLEW_MAJOR_VERSION) SET(K3D_OPENGL_FOUND 1) ENDIF() ================================================ FILE: cmake/modules/K3DFindPNG.cmake ================================================ SET(K3D_PNG_FOUND 0) find_package(PNG) IF(PNG_FOUND) SET(K3D_PNG_INCLUDE_DIRS ${PNG_INCLUDE_DIRS} ) SET(K3D_PNG_LIB_DIRS ${PNG_LIBRARY_DIRS} ) SET(K3D_PNG_LIBS ${PNG_LIBRARIES} ) SET(K3D_PNG_FOUND 1) ENDIF(PNG_FOUND) ================================================ FILE: cmake/modules/K3DFindPkgConfig.cmake ================================================ # - a pkg-config module for CMake # # Usage: # pkg_check_modules( [REQUIRED] []*) # checks for all the given modules # # pkg_search_module( [REQUIRED] []*) # checks for given modules and uses the first working one # # When the 'REQUIRED' argument was set, macros will fail with an error # when module(s) could not be found # # It sets the following variables: # PKG_CONFIG_FOUND ... true iff pkg-config works on the system # PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program # _FOUND ... set to 1 iff module(s) exist # # For the following variables two sets of values exist; first one is the # common one and has the given PREFIX. The second set contains flags # which are given out when pkgconfig was called with the '--static' # option. # _LIBRARIES ... only the libraries (w/o the '-l') # _LIBRARY_DIRS ... the paths of the libraries (w/o the '-L') # _LDFLAGS ... all required linker flags # _LDFLAGS_OTHERS ... all other linker flags # _INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I') # _CFLAGS ... all required cflags # _CFLAGS_OTHERS ... the other compiler flags # # = for common case # = _STATIC for static linking # # There are some special variables whose prefix depends on the count # of given modules. When there is only one module, stays # unchanged. When there are multiple modules, the prefix will be # changed to _: # _VERSION ... version of the module # _PREFIX ... prefix-directory of the module # _INCLUDEDIR ... include-dir of the module # _LIBDIR ... lib-dir of the module # # = when |MODULES| == 1, else # = _ # # A parameter can have the following formats: # {MODNAME} ... matches any version # {MODNAME}>={VERSION} ... at least version is required # {MODNAME}={VERSION} ... exactly version is required # {MODNAME}<={VERSION} ... modules must not be newer than # # Examples # pkg_check_modules (GLIB2 glib-2.0) # # pkg_check_modules (GLIB2 glib-2.0>=2.10) # requires at least version 2.10 of glib2 and defines e.g. # GLIB2_VERSION=2.10.3 # # pkg_check_modules (FOO glib-2.0>=2.10 gtk+-2.0) # requires both glib2 and gtk2, and defines e.g. # FOO_glib-2.0_VERSION=2.10.3 # FOO_gtk+-2.0_VERSION=2.8.20 # # pkg_check_modules (XRENDER REQUIRED xrender) # defines e.g.: # XRENDER_LIBRARIES=Xrender;X11 # XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp # # pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2) # Copyright (C) 2006 Enrico Scholz # # Redistribution and use, with or without modification, are permitted # provided that the following conditions are met: # # 1. Redistributions must retain the above copyright notice, this # list of conditions and the following disclaimer. # 2. The name of the author may not be used to endorse or promote # products derived from this software without specific prior # written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ### Common stuff #### set(PKG_CONFIG_VERSION 1) set(PKG_CONFIG_FOUND 0) find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable") mark_as_advanced(PKG_CONFIG_EXECUTABLE) if(PKG_CONFIG_EXECUTABLE) set(PKG_CONFIG_FOUND 1) endif(PKG_CONFIG_EXECUTABLE) # Unsets the given variables macro(_pkgconfig_unset var) set(${var} "" CACHE INTERNAL "") endmacro(_pkgconfig_unset) macro(_pkgconfig_set var value) set(${var} ${value} CACHE INTERNAL "") endmacro(_pkgconfig_set) # Invokes pkgconfig, cleans up the result and sets variables macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) set(_pkgconfig_invoke_result) execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist} OUTPUT_VARIABLE _pkgconfig_invoke_result RESULT_VARIABLE _pkgconfig_failed) if (_pkgconfig_failed) set(_pkgconfig_${_varname} "") _pkgconfig_unset(${_prefix}_${_varname}) else(_pkgconfig_failed) string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") if (NOT ${_regexp} STREQUAL "") string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") endif(NOT ${_regexp} STREQUAL "") separate_arguments(_pkgconfig_invoke_result) #message(STATUS " ${_varname} ... ${_pkgconfig_invoke_result}") set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result}) _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}") endif(_pkgconfig_failed) endmacro(_pkgconfig_invoke) # Invokes pkgconfig two times; once without '--static' and once with # '--static' macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) _pkgconfig_invoke("${_pkglist}" ${_prefix} ${_varname} "${cleanup_regexp}" ${ARGN}) _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static ${ARGN}) endmacro(_pkgconfig_invoke_dyn) # Splits given arguments into options and a package list macro(_pkgconfig_parse_options _result _is_req) set(${_is_req} 0) foreach(_pkg ${ARGN}) if (_pkg STREQUAL "REQUIRED") set(${_is_req} 1) endif (_pkg STREQUAL "REQUIRED") endforeach(_pkg ${ARGN}) set(${_result} ${ARGN}) list(REMOVE_ITEM ${_result} "REQUIRED") endmacro(_pkgconfig_parse_options) ### macro(_pkg_check_modules_internal _is_required _is_silent _prefix) _pkgconfig_unset(${_prefix}_FOUND) _pkgconfig_unset(${_prefix}_VERSION) _pkgconfig_unset(${_prefix}_PREFIX) _pkgconfig_unset(${_prefix}_INCLUDEDIR) _pkgconfig_unset(${_prefix}_LIBDIR) _pkgconfig_unset(${_prefix}_LIBS) _pkgconfig_unset(${_prefix}_LIBS_L) _pkgconfig_unset(${_prefix}_LIBS_PATHS) _pkgconfig_unset(${_prefix}_LIBS_OTHER) _pkgconfig_unset(${_prefix}_CFLAGS) _pkgconfig_unset(${_prefix}_CFLAGS_I) _pkgconfig_unset(${_prefix}_CFLAGS_OTHER) _pkgconfig_unset(${_prefix}_STATIC_LIBDIR) _pkgconfig_unset(${_prefix}_STATIC_LIBS) _pkgconfig_unset(${_prefix}_STATIC_LIBS_L) _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS) _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER) _pkgconfig_unset(${_prefix}_STATIC_CFLAGS) _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I) _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER) # create a better addressable variable of the modules and calculate its size set(_pkg_check_modules_list ${ARGN}) list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt) if(PKG_CONFIG_EXECUTABLE) # give out status message telling checked module if (NOT ${_is_silent}) if (_pkg_check_modules_cnt EQUAL 1) message(STATUS "checking for module '${_pkg_check_modules_list}'") else(_pkg_check_modules_cnt EQUAL 1) message(STATUS "checking for modules '${_pkg_check_modules_list}'") endif(_pkg_check_modules_cnt EQUAL 1) endif(NOT ${_is_silent}) set(_pkg_check_modules_packages) set(_pkg_check_modules_failed) # iterate through module list and check whether they exist and match the required version foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list}) set(_pkg_check_modules_exist_query) # check whether version is given if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op "${_pkg_check_modules_pkg}") string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver "${_pkg_check_modules_pkg}") else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}") set(_pkg_check_modules_pkg_op) set(_pkg_check_modules_pkg_ver) endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*") # handle the operands if (_pkg_check_modules_pkg_op STREQUAL ">=") list(APPEND _pkg_check_modules_exist_query --atleast-version) endif(_pkg_check_modules_pkg_op STREQUAL ">=") if (_pkg_check_modules_pkg_op STREQUAL "=") list(APPEND _pkg_check_modules_exist_query --exact-version) endif(_pkg_check_modules_pkg_op STREQUAL "=") if (_pkg_check_modules_pkg_op STREQUAL "<=") list(APPEND _pkg_check_modules_exist_query --max-version) endif(_pkg_check_modules_pkg_op STREQUAL "<=") # create the final query which is of the format: # * --atleast-version # * --exact-version # * --max-version # * --exists if (_pkg_check_modules_pkg_op) list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}") else(_pkg_check_modules_pkg_op) list(APPEND _pkg_check_modules_exist_query --exists) endif(_pkg_check_modules_pkg_op) _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION) _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX) _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR) _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR) list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}") list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}") # execute the query execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query} RESULT_VARIABLE _pkgconfig_retval) # evaluate result and tell failures if (_pkgconfig_retval) if(NOT ${_is_silent}) message(STATUS " package '${_pkg_check_modules_pkg}' not found") endif(NOT ${_is_silent}) set(_pkg_check_modules_failed 1) endif(_pkgconfig_retval) endforeach(_pkg_check_modules_pkg) if(_pkg_check_modules_failed) # fail when requested if (${_is_required}) message(SEND_ERROR "A required package was not found") endif (${_is_required}) else(_pkg_check_modules_failed) # when we are here, we checked whether requested modules # exist. Now, go through them and set variables _pkgconfig_set(${_prefix}_FOUND 1) list(LENGTH _pkg_check_modules_packages pkg_count) # iterate through all modules again and set individual variables foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages}) # handle case when there is only one package required if (pkg_count EQUAL 1) set(_pkg_check_prefix "${_prefix}") else(pkg_count EQUAL 1) set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}") endif(pkg_count EQUAL 1) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) message(STATUS " found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") endforeach(_pkg_check_modules_pkg) # set variables which are combined for multiple modules _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) endif(_pkg_check_modules_failed) else(PKG_CONFIG_EXECUTABLE) if (${_is_required}) message(SEND_ERROR "pkg-config tool not found") endif (${_is_required}) endif(PKG_CONFIG_EXECUTABLE) endmacro(_pkg_check_modules_internal) ### ### User visible macros start here ### ### macro(pkg_check_modules _prefix _module0) # check cached value # if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION}) _pkgconfig_parse_options (_pkg_modules _pkg_is_required "${_module0}" ${ARGN}) _pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules}) # _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) # endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION}) endmacro(pkg_check_modules) ### macro(pkg_search_module _prefix _module0) # check cached value # if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION}) set(_pkg_modules_found 0) _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN}) message(STATUS "checking for one of the modules '${_pkg_modules_alt}'") # iterate through all modules and stop at the first working one. foreach(_pkg_alt ${_pkg_modules_alt}) if(NOT _pkg_modules_found) _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}") endif(NOT _pkg_modules_found) if (${_prefix}_FOUND) set(_pkg_modules_found 1) endif(${_prefix}_FOUND) endforeach(_pkg_alt) if (NOT ${_prefix}_FOUND) if(${_pkg_is_required}) message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found") endif(${_pkg_is_required}) endif(NOT ${_prefix}_FOUND) # _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) # endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION}) endmacro(pkg_search_module) ### Local Variables: ### mode: cmake ### End: ================================================ FILE: cmake/modules/K3DFindPython.cmake ================================================ SET(K3D_PYTHON_FOUND 0) IF(APPLE) FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python ) IF(PYTHON_EXECUTABLE) EXECUTE_PROCESS( COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.stdout.write(sys.prefix + '/include/python' + sys.version[:3])" OUTPUT_VARIABLE PYTHON_INCLUDE_PATH ) EXECUTE_PROCESS( COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.stdout.write(sys.exec_prefix + '/Python')" OUTPUT_VARIABLE PYTHON_LIBRARY ) SET(K3D_PYTHON_INCLUDE_PATH ${PYTHON_INCLUDE_PATH} CACHE PATH "Path to the directory containg Python header files." ) SET(K3D_PYTHON_LIBRARY ${PYTHON_LIBRARY} CACHE FILEPATH "Path to the Python link library." ) MARK_AS_ADVANCED(K3D_PYTHON_INCLUDE_PATH) MARK_AS_ADVANCED(K3D_PYTHON_LIBRARY) MARK_AS_ADVANCED(PYTHON_EXECUTABLE) IF(K3D_PYTHON_INCLUDE_PATH AND K3D_PYTHON_LIBRARY) SET(K3D_PYTHON_INCLUDE_DIRS ${K3D_PYTHON_INCLUDE_PATH} ) SET(K3D_PYTHON_LIBS ${K3D_PYTHON_LIBRARY} ) SET(K3D_PYTHON_FOUND 1) ENDIF() ENDIF() ELSE(APPLE) INCLUDE(FindPythonInterp) INCLUDE(FindPythonLibs) IF(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND) SET(K3D_PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH} ) SET(K3D_PYTHON_LIBS ${PYTHON_LIBRARY} ) MARK_AS_ADVANCED(PYTHON_INCLUDE_PATH) MARK_AS_ADVANCED(PYTHON_LIBRARY) MARK_AS_ADVANCED(PYTHON_DEBUG_LIBRARIES) MARK_AS_ADVANCED(PY_MODULES_LIST) MARK_AS_ADVANCED(PY_STATIC_MODULES_LIST) SET(K3D_PYTHON_FOUND 1) ENDIF() ENDIF(APPLE) ================================================ FILE: cmake/modules/K3DFindSigC.cmake ================================================ SET(K3D_SIGC_FOUND 0) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(SIGC sigc++-2.0) IF(SIGC_FOUND) SET(K3D_SIGC_INCLUDE_DIRS ${SIGC_INCLUDE_DIRS} ) SET(K3D_SIGC_LIB_DIRS ${SIGC_LIBRARY_DIRS} ) SET(K3D_SIGC_LIBS ${SIGC_LIBRARIES} ) SET(K3D_SIGC_FOUND 1) ADD_DEFINITIONS(-DK3D_HAVE_SIGC_2_0) ENDIF(SIGC_FOUND) ================================================ FILE: cmake/modules/K3DFindSuperLU.cmake ================================================ SET(K3D_SUPERLU_FOUND 0) #note: Include files are assumed to be in the standard include path, in the superlu dir FIND_LIBRARY(K3D_SUPERLU_LIBRARY superlu DOC "The SuperLU library" ) MARK_AS_ADVANCED(K3D_SUPERLU_LIBRARY) FIND_LIBRARY(K3D_BLAS_LIBRARY blas DOC "The BLAS library used by SuperLU" ) MARK_AS_ADVANCED(K3D_BLAS_LIBRARY) IF(K3D_SUPERLU_LIBRARY AND K3D_BLAS_LIBRARY) SET(K3D_SUPERLU_FOUND 1) ENDIF(K3D_SUPERLU_LIBRARY AND K3D_BLAS_LIBRARY) ================================================ FILE: cmake/modules/K3DFindTBB.cmake ================================================ SET(K3D_TBB_FOUND 0) FIND_PATH(K3D_TBB_INCLUDE_DIR parallel_for.h /usr/local/include /usr/include PATH_SUFFIXES tbb ) FIND_LIBRARY(K3D_TBB_LIBRARY tbb /usr/local/lib /usr/lib ) IF(K3D_TBB_INCLUDE_DIR AND K3D_TBB_LIBRARY) SET(K3D_TBB_FOUND 1) ENDIF(K3D_TBB_INCLUDE_DIR AND K3D_TBB_LIBRARY) MARK_AS_ADVANCED( K3D_TBB_INCLUDE_DIR K3D_TBB_LIBRARY ) ================================================ FILE: cmake/modules/K3DFindTIFF.cmake ================================================ INCLUDE(FindGTK) FIND_PATH(K3D_TIFF_INCLUDE_DIR tiff.h /usr/include c:/gtk/include ${K3D_GTK_DIR}/include DOC "Directory where the libtiff header files are located" ) MARK_AS_ADVANCED(K3D_TIFF_INCLUDE_DIR) SET(K3D_TIFF_LIB tiff CACHE STRING "") MARK_AS_ADVANCED(K3D_TIFF_LIB) SET(K3D_TIFF_INCLUDE_DIRS ${K3D_TIFF_INCLUDE_DIR} ) SET(K3D_TIFF_LIBS ${K3D_TIFF_LIB} ) SET(K3D_TIFF_FOUND 1) ================================================ FILE: cmake/modules/K3DFindXML.cmake ================================================ SET(K3D_XML_FOUND 0) MESSAGE(STATUS "checking for package 'EXPAT'") FIND_PACKAGE(EXPAT) IF(EXPAT_FOUND) ADD_DEFINITIONS(-DK3D_HAVE_EXPAT) SET(K3D_XML_INCLUDE_DIR ${EXPAT_INCLUDE_DIRS}) SET(K3D_XML_LIB ${EXPAT_LIBRARIES}) SET(K3D_XML_FOUND 1) MESSAGE(STATUS " found EXPAT") ELSE() MESSAGE(STATUS " package 'EXPAT' not found") MESSAGE(STATUS "checking for package 'LibXml2'") FIND_PACKAGE(LibXml2) IF(LIBXML2_FOUND) ADD_DEFINITIONS(-DK3D_HAVE_LIBXML2) SET(K3D_XML_INCLUDE_DIR ${LIBXML2_INCLUDE_DIR}) SET(K3D_XML_LIB ${LIBXML2_LIBRARIES}) SET(K3D_XML_FOUND 1) MESSAGE(STATUS " found LibXml2") ELSE() MESSAGE(STATUS " package 'LibXml2' not found") ENDIF() ENDIF() ================================================ FILE: cmake/modules/K3DFindZlib.cmake ================================================ SET(K3D_ZLIB_FOUND 0) find_package(ZLIB) IF(ZLIB_FOUND) SET(K3D_ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ) SET(K3D_ZLIB_LIB_DIRS ${ZLIB_LIBRARY_DIRS} ) SET(K3D_ZLIB_LIBS ${ZLIB_LIBRARIES} ) SET(K3D_ZLIB_FOUND 1) ENDIF(ZLIB_FOUND) ================================================ FILE: cmake/modules/K3DGenerateDEF.cmake ================================================ MACRO(K3D_GENERATE_DEF_FILE TARGET_NAME) IF(MSVC) ADD_DEPENDENCIES(${TARGET_NAME} k3d-gendef) GET_TARGET_PROPERTY(gendef_EXE k3d-gendef LOCATION) ADD_CUSTOM_COMMAND(TARGET ${TARGET_NAME} PRE_LINK COMMAND ${gendef_EXE} $(IntDir)\\$(InputName).def $(TargetFileName) $(IntDir)\\*.obj) SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES LINK_FLAGS "/DEF:$(IntDir)\\$(InputName).def") ENDIF(MSVC) ENDMACRO(K3D_GENERATE_DEF_FILE) ================================================ FILE: cmake/modules/K3DOutOfSourceBuild.cmake ================================================ # Disallow in-source build STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" K3D_IN_SOURCE) IF(K3D_IN_SOURCE) MESSAGE(FATAL_ERROR "K-3D requires an out of source build. Please create a separate build directory and run 'cmake path_to_k3d [options]' there.") ENDIF(K3D_IN_SOURCE) ================================================ FILE: cmake/modules/K3DParseArguments.cmake ================================================ MACRO(K3D_PARSE_ARGUMENTS prefix arg_names option_names) SET(DEFAULT_ARGS) FOREACH(arg_name ${arg_names}) SET(${prefix}_${arg_name}) ENDFOREACH(arg_name) FOREACH(option ${option_names}) SET(${prefix}_${option} FALSE) ENDFOREACH(option) SET(current_arg_name DEFAULT_ARGS) SET(current_arg_list) FOREACH(arg ${ARGN}) SET(larg_names ${arg_names}) LIST(FIND larg_names "${arg}" is_arg_name) IF (is_arg_name GREATER -1) SET(${prefix}_${current_arg_name} ${current_arg_list}) SET(current_arg_name ${arg}) SET(current_arg_list) ELSE (is_arg_name GREATER -1) SET(loption_names ${option_names}) LIST(FIND loption_names "${arg}" is_option) IF (is_option GREATER -1) SET(${prefix}_${arg} TRUE) ELSE (is_option GREATER -1) SET(current_arg_list ${current_arg_list} ${arg}) ENDIF (is_option GREATER -1) ENDIF (is_arg_name GREATER -1) ENDFOREACH(arg) SET(${prefix}_${current_arg_name} ${current_arg_list}) ENDMACRO(K3D_PARSE_ARGUMENTS) ================================================ FILE: cmake/modules/K3DSystemConfiguration.cmake ================================================ # Compiler configuration IF(WIN32) IF(MSVC) SET(K3D_COMPILER_MSVC TRUE) ELSE(MSVC) SET(K3D_COMPILER_GCC TRUE) ENDIF(MSVC) ELSE(WIN32) SET(K3D_COMPILER_GCC TRUE) ENDIF(WIN32) # Win32 API configuration IF(WIN32) SET(K3D_API_WIN32 TRUE) ENDIF(WIN32) # Darwin API configuration IF(APPLE) SET(K3D_API_DARWIN TRUE) EXECUTE_PROCESS( COMMAND sw_vers -productVersion OUTPUT_VARIABLE K3D_OSX_VERSION ) STRING(REGEX REPLACE "([0-9]*)[.]([0-9]*)[.]([0-9]*).*" "\\1" K3D_OSX_MAJOR_VERSION "${K3D_OSX_VERSION}") STRING(REGEX REPLACE "([0-9]*)[.]([0-9]*)[.]([0-9]*).*" "\\2" K3D_OSX_MINOR_VERSION "${K3D_OSX_VERSION}") ENDIF(APPLE) ================================================ FILE: cmake/modules/K3DWordSize.cmake ================================================ # Detect the word-size for the current platform ... MESSAGE(STATUS "checking the width of std::vector<>::size_type for this platform") TRY_RUN( K3D_PLATFORM_SIZE_TYPE K3D_PLATFORM_SIZE_TYPE_COMPILE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/configuration/size_type.cpp) MESSAGE(STATUS " std::vector<>::size_type is ${K3D_PLATFORM_SIZE_TYPE} bits") IF(K3D_PLATFORM_SIZE_TYPE EQUAL 32) SET(K3D_UINT_T_32_BITS 1) ELSEIF(K3D_PLATFORM_SIZE_TYPE EQUAL 64) SET(K3D_UINT_T_64_BITS 1) ELSE(K3D_PLATFORM_SIZE_TYPE EQUAL 32) MESSAGE(SEND_ERROR "Error detecting platform word-size.") ENDIF(K3D_PLATFORM_SIZE_TYPE EQUAL 32) ================================================ FILE: configuration/size_type.cpp ================================================ #include int main(int argc, char* argv[]) { return sizeof(std::vector::size_type) * 8; } ================================================ FILE: desktop/CMakeLists.txt ================================================ configure_file(k3d.desktop.in k3d.desktop) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/k3d.desktop DESTINATION share/applications) ================================================ FILE: desktop/k3d.desktop.in ================================================ [Desktop Entry] Encoding=UTF-8 Version=1.0 Type=Application Name=K-3D GenericName=3D modeling and animation software Comment=Free-as-in-freedom 3D modeling and animation software TryExec=@CMAKE_INSTALL_PREFIX@/bin/k3d Exec=@CMAKE_INSTALL_PREFIX@/bin/k3d Categories=Graphics;3DGraphics Icon=@CMAKE_INSTALL_PREFIX@/share/k3d/icons/k3d.png Terminal=false ================================================ FILE: distribution/CMakeLists.txt ================================================ # Setup automatic generation of the changelog ADD_CUSTOM_TARGET(changelog COMMAND ${HGCOMMAND} log > ${k3d_BINARY_DIR}/ChangeLog WORKING_DIRECTORY ${k3d_SOURCE_DIR} ) # Setup convenience targets for tagging and branching SET(K3D_VERSION_TAG "k3d-${K3D_MAJOR_VERSION}.${K3D_MINOR_VERSION}.${K3D_RELEASE_VERSION}.${K3D_BUILD_VERSION}") ADD_CUSTOM_TARGET(tag-version COMMAND ${HGCOMMAND} tag ${K3D_VERSION_TAG} WORKING_DIRECTORY ${k3d_SOURCE_DIR} ) #SET(K3D_BRANCH_TAG "k3d-release-${K3D_MAJOR_VERSION}.${K3D_MINOR_VERSION}") #ADD_CUSTOM_TARGET(tag-branch # COMMAND ${SVNCOMMAND} cp ${K3D_SVN_TRUNK} # ${K3D_SVN_BRANCHES}/${K3D_BRANCH_TAG} -m "COMP: Branched K-3D Version ${K3D_MAJOR_VERSION}.${K3D_MINOR_VERSION}" # WORKING_DIRECTORY ${k3d_SOURCE_DIR} # ) # Get a SourceForge username so we can upload distributables to the FRS IF(WIN32) SET(K3D_SOURCEFORGE_USERNAME "$ENV{USERNAME}" CACHE STRING "SourceForge user account name, for uploading distribution files.") ELSE(WIN32) SET(K3D_SOURCEFORGE_USERNAME "$ENV{USER}" CACHE STRING "SourceForge user account name, for uploading distribution files.") ENDIF(WIN32) # Setup default packaging parameters (deprecated) ... SET(CPACK_PACKAGE_DESCRIPTION "K-3D free-as-in-freedom modeling, animation and rendering system") SET(CPACK_PACKAGE_FILE_NAME "k3d-setup-${K3D_VERSION}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "K-3D ${K3D_VERSION}") SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "K-3D ${K3D_VERSION}") SET(CPACK_PACKAGE_NAME "k3d") SET(CPACK_PACKAGE_VENDOR "www.k-3d.org") SET(CPACK_PACKAGE_VERSION ${K3D_VERSION}) SET(CPACK_PACKAGE_VERSION_MAJOR ${K3D_MAJOR_VERSION}) SET(CPACK_PACKAGE_VERSION_MINOR ${K3D_MINOR_VERSION}) SET(CPACK_PACKAGE_VERSION_PATCH ${K3D_RELEASE_VERSION}) SET(CPACK_RESOURCE_FILE_LICENSE "${k3d_SOURCE_DIR}/COPYING") # Setup global packaging parameters ... SET(K3D_CPACK_INSTALL_CMAKE_PROJECTS "${k3d_BINARY_DIR};k3d;ALL;/") SET(K3D_CPACK_PACKAGE_DESCRIPTION "K-3D free-as-in-freedom modeling, animation, and rendering system.") SET(K3D_CPACK_PACKAGE_FILE_NAME "k3d-setup-${K3D_VERSION}") SET(K3D_CPACK_PACKAGE_NAME "k3d") SET(K3D_CPACK_PACKAGE_VERSION "${K3D_VERSION}") SET(K3D_CPACK_RESOURCE_FILE_LICENSE "${k3d_SOURCE_DIR}/COPYING") SET(K3D_CPACK_SOURCE_IGNORE_FILES "/CVS/;/.svn/;/.hg/") SET(K3D_CPACK_SOURCE_INSTALLED_DIRECTORIES "${k3d_SOURCE_DIR};/") SET(K3D_CPACK_SOURCE_PACKAGE_FILE_NAME "k3d-source-${K3D_VERSION}") # Setup some macros that can be used by the platform-specific distribution logic MACRO(K3D_CHECK_INSTALLED_VERSION FOUND PACKAGE EXPECTED) IF(NOT ${FOUND} STREQUAL ${EXPECTED}) MESSAGE(SEND_ERROR "Found ${PACKAGE} version ${FOUND} - for installation, version ${EXPECTED} is required.") ENDIF(NOT ${FOUND} STREQUAL ${EXPECTED}) ENDMACRO(K3D_CHECK_INSTALLED_VERSION) MACRO(K3D_CHECK_INSTALLED_PYTHON_DEPENDENCY CONFIG) IF(${CONFIG} AND NOT K3D_INSTALL_PYTHON) MESSAGE(SEND_ERROR "K3D_INSTALL_PYTHON is required by ${CONFIG}.") ENDIF(${CONFIG} AND NOT K3D_INSTALL_PYTHON) ENDMACRO(K3D_CHECK_INSTALLED_PYTHON_DEPENDENCY) # Generate source packages ADD_SUBDIRECTORY(source) # Generate platform-specific binary packages IF(APPLE) ADD_SUBDIRECTORY(osx) ENDIF(APPLE) IF(UNIX AND NOT APPLE) ADD_SUBDIRECTORY(posix) ENDIF(UNIX AND NOT APPLE) IF(WIN32) ADD_SUBDIRECTORY(win32) ENDIF(WIN32) ================================================ FILE: distribution/genslmeta.bat ================================================ :: Check fie name was passed IF [%1]==[] GOTO E_FLAG :: pass shader file through preprocessor then pass results to sl2xml cpp.exe -E -P -x c %1 | k3d-sl2xml.exe > %1.slmeta EXIT :E_FLAG ECHO. shader name missing ECHO. ================================================ FILE: distribution/osx/CMakeLists.txt ================================================ OPTION(K3D_CREATE_PACKAGEMAKER_PACKAGE "Include an option to build a MacOSX PackageMaker package." OFF) # This is an ugly hack, we should be able to detect this automatically, but I'm feeling lazy ... SET(K3D_MACPORTS_DIR "/opt/local" CACHE PATH "Root directory containing installed MacPorts packages") INSTALL( PROGRAMS ${K3D_MACPORTS_DIR}/lib/libgailutil.18.dylib DESTINATION lib ) INSTALL( DIRECTORY ${K3D_MACPORTS_DIR}/lib/gtk-2.0/2.10.0 DESTINATION lib/gtk-2.0 USE_SOURCE_PERMISSIONS ) INSTALL( DIRECTORY ${K3D_MACPORTS_DIR}/lib/gtk-2.0/modules DESTINATION lib/gtk-2.0/2.10.0 USE_SOURCE_PERMISSIONS ) INSTALL( DIRECTORY ${K3D_MACPORTS_DIR}/lib/pango DESTINATION lib USE_SOURCE_PERMISSIONS ) INSTALL( DIRECTORY ${K3D_MACPORTS_DIR}/etc/gtk-2.0 ${K3D_MACPORTS_DIR}/etc/fonts ${K3D_MACPORTS_DIR}/etc/pango DESTINATION etc ) # Dependencies from MacPorts not caught elsewhere INSTALL( DIRECTORY ${K3D_MACPORTS_DIR}/lib/gdk-pixbuf-2.0 DESTINATION lib USE_SOURCE_PERMISSIONS ) # Enable automatic installation of library dependencies ... CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/dependencies.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake" @ONLY) INSTALL(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/dependencies.cmake") # More accurate guess of the OS architecture EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE K3D_OSX_ARCH) # Bundle packaging is always available ... ADD_SUBDIRECTORY(bundle) # We optionally support creating packagemaker packages ... IF(K3D_CREATE_PACKAGEMAKER_PACKAGE) ADD_SUBDIRECTORY(packagemaker) ENDIF(K3D_CREATE_PACKAGEMAKER_PACKAGE) ================================================ FILE: distribution/osx/bundle/CMakeLists.txt ================================================ # Generate an application bundle (new-style) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-binary-bundle.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-binary-bundle.cpack) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY) ADD_CUSTOM_TARGET(package-binary-bundle ${CMAKE_CPACK_COMMAND} --config ${CMAKE_CURRENT_BINARY_DIR}/package-binary-bundle.cpack ) # Upload the binary bundle to SourceForge for use with the FRS ADD_CUSTOM_TARGET(upload-binary-bundle rsync -avP -e ssh ${CMAKE_CURRENT_BINARY_DIR}/k3d-setup-${K3D_VERSION}-${K3D_OSX_ARCH}.dmg ${K3D_SOURCEFORGE_USERNAME}@frs.sourceforge.net:uploads/ ) ================================================ FILE: distribution/osx/bundle/Info.plist.in ================================================ CFBundleDevelopmentRegion English CFBundleExecutable K-3D CFBundleGetInfoString @K3D_VERSION@, @K3D_COPYRIGHT@ CFBundleIconFile K-3D CFBundleIdentifier org.k-3d.K-3D CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType APPL CFBundleShortVersionString @K3D_VERSION@ CFBundleSignature K-3D CFBundleVersion @K3D_VERSION@ NSHumanReadableCopyright @K3D_COPYRIGHT@ LSMinimumSystemVersion 10.5 ================================================ FILE: distribution/osx/bundle/k3d-startup ================================================ #!/bin/sh # # Author: Aaron Voisine # Inkscape Modifications: Michael Wybrow # K-3D Modifications: Timothy M. Shead echo "INFO: Starting $0" K3D_BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/K-3D//'`" K3D_RESOURCES="$K3D_BUNDLE/Contents/Resources" K3D_TEMP="/tmp/k3d/$(id -ru)" K3D_ETC="$K3D_TEMP/etc" K3D_PANGO_RC_FILE="$K3D_ETC/pango/pangorc" rm -rf "$K3D_TEMP" mkdir -p "$K3D_ETC/pango" sed -e 's|/opt/local/etc|'"$K3D_ETC|g" "$K3D_RESOURCES/etc/pango/pangorc" > "$K3D_ETC/pango/pangorc" sed -e 's|/opt/local|\"'"$K3D_RESOURCES|g" -e "s/\.so/.so\"/g" "$K3D_RESOURCES/etc/pango/pango.modules" > "$K3D_ETC/pango/pango.modules" sed -e 's|/opt/local|'"$K3D_RESOURCES|g" -e "s/\.so/.so\"/g" "$K3D_RESOURCES/etc/gtk-2.0/gdk-pixbuf.loaders" > "$K3D_ETC/gdk-pixbuf.loaders" cp -f "$K3D_RESOURCES/etc/pango/pangox.aliases" "$K3D_ETC/pango/pangox.aliases" export "FONTCONFIG_PATH=$K3D_RESOURCES/etc/fonts" export "GDK_PIXBUF_MODULE_FILE=$K3D_ETC/gdk-pixbuf.loaders" export "GTK_PATH=$K3D_RESOURCES/lib/gtk-2.0" export "PANGO_RC_FILE=$K3D_PANGO_RC_FILE" export "PATH=$K3D_RESOURCES/bin:$PATH" export exec "$K3D_RESOURCES/bin/k3d" "--log-level=debug" "--plugins=$K3D_RESOURCES/lib/k3d/plugins" "--share=$K3D_RESOURCES/share/k3d" "--ui=$K3D_RESOURCES/lib/k3d/plugins/k3d-ngui.module" echo "INFO: Finishing $0" ================================================ FILE: distribution/osx/bundle/package-binary-bundle.cpack.in ================================================ SET(CPACK_BUNDLE_ICON "${share_SOURCE_DIR}/k3d/icons/k3d.icns") SET(CPACK_BUNDLE_NAME "K-3D") SET(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist") SET(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/k3d-startup") SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") SET(CPACK_GENERATOR "Bundle") SET(CPACK_INSTALL_CMAKE_PROJECTS "${K3D_CPACK_INSTALL_CMAKE_PROJECTS}") SET(CPACK_PACKAGE_DESCRIPTION "${K3D_CPACK_PACKAGE_DESCRIPTION}") SET(CPACK_PACKAGE_FILE_NAME "k3d-setup-${K3D_VERSION}-${K3D_OSX_ARCH}") SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/volume.icns") SET(CPACK_PACKAGE_NAME "${K3D_CPACK_PACKAGE_NAME}") SET(CPACK_PACKAGE_VERSION "${K3D_CPACK_PACKAGE_VERSION}") ================================================ FILE: distribution/osx/dependencies.cmake.in ================================================ include(BundleUtilities) function(gp_item_default_embedded_path_override item default_embedded_path_var) set(${default_embedded_path_var} "@executable_path/../lib" PARENT_SCOPE) endfunction(gp_item_default_embedded_path_override) set(K3D_BUNDLE_DYLIBS "") file(GLOB_RECURSE dylib_list "${CMAKE_INSTALL_PREFIX}/*.so" "${CMAKE_INSTALL_PREFIX}/*.dylib" "${CMAKE_INSTALL_PREFIX}/*.module") foreach(lib ${dylib_list}) if(NOT IS_SYMLINK ${lib}) list(APPEND K3D_BUNDLE_DYLIBS ${lib}) endif() endforeach() set(DEP_LIB_DIRS "/opt/local/lib") message("prefix path: ${CMAKE_PREFIX_PATH}") foreach(prefix_path @CMAKE_PREFIX_PATH@) list(APPEND DEP_LIB_DIRS "${prefix_path}/lib" ) endforeach() list(APPEND DEP_LIB_DIRS @BOOST_ROOT@) message("Getting dependencies from ${DEP_LIB_DIRS}") fixup_bundle(${CMAKE_INSTALL_PREFIX}/bin/k3d "${K3D_BUNDLE_DYLIBS}" "${DEP_LIB_DIRS}") verify_bundle_prerequisites(${CMAKE_INSTALL_PREFIX} verify_result verify_info) message("Bundle verify returned ${verify_result} with info ${verify_info}") ================================================ FILE: distribution/osx/packagemaker/CMakeLists.txt ================================================ # The CPack PackageMaker generator ignores CMAKE_INSTALL_PREFIX and places everything in /usr, complain if there is a mismatch IF(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") MESSAGE(SEND_ERROR "K3D_CREATE_PACKAGEMAKER_PACKAGE requires CMAKE_INSTALL_PREFIX set to \"/usr\".") ENDIF(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr") # Generate a packagemaker package ... CONFIGURE_FILE(${k3d_SOURCE_DIR}/COPYING ${CMAKE_CURRENT_BINARY_DIR}/COPYING.txt COPYONLY) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-binary-packagemaker.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-binary-packagemaker.cpack) ADD_CUSTOM_TARGET(package-binary-packagemaker ${CMAKE_CPACK_COMMAND} --config ${CMAKE_CURRENT_BINARY_DIR}/package-binary-packagemaker.cpack ) ================================================ FILE: distribution/osx/packagemaker/package-binary-packagemaker.cpack.in ================================================ SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") SET(CPACK_GENERATOR "PackageMaker") SET(CPACK_INSTALL_CMAKE_PROJECTS "${K3D_CPACK_INSTALL_CMAKE_PROJECTS}") SET(CPACK_PACKAGE_DESCRIPTION "${K3D_CPACK_PACKAGE_DESCRIPTION}") SET(CPACK_PACKAGE_EXECUTABLES "k3d" "K-3D ${K3D_VERSION}") SET(CPACK_PACKAGE_FILE_NAME "k3d-setup-${K3D_VERSION}-${CMAKE_SYSTEM_PROCESSOR}") SET(CPACK_PACKAGE_NAME "K-3D") SET(CPACK_PACKAGE_VENDOR "www.k-3d.org") SET(CPACK_PACKAGE_VERSION "${K3D_CPACK_PACKAGE_VERSION}") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.txt") SET(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/readme.txt") SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/welcome.txt") ================================================ FILE: distribution/osx/packagemaker/readme.txt ================================================ An X11 server is required to run K-3D! K-3D is licensed under the GNU General Public License. For further information, visit the K-3D web site: http://www.k-3d.org Thank You, The K-3D Team ================================================ FILE: distribution/osx/packagemaker/welcome.txt ================================================ K-3D is a complete free-as-in-freedom 3D modeling, animation, and rendering system. K-3D features a robust plugin architecture and visualization pipeline, designed to scale to the needs of professional artists. K-3D has been written from the ground up to generate motion picture quality animation using RenderMan render engines. ================================================ FILE: distribution/posix/CMakeLists.txt ================================================ SET(K3D_PACKAGE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/K-3D ${K3D_VERSION}") FILE(MAKE_DIRECTORY "${K3D_PACKAGE_DIRECTORY}") # Generate self-extracting tarballs CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-binary-stgz.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-binary-stgz.cpack) ADD_CUSTOM_TARGET(package-binary-stgz WORKING_DIRECTORY "${K3D_PACKAGE_DIRECTORY}" COMMAND ${CMAKE_CPACK_COMMAND} --config ${CMAKE_CURRENT_BINARY_DIR}/package-binary-stgz.cpack ) # Generate tarballs CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-binary-tbz2.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-binary-tbz2.cpack) ADD_CUSTOM_TARGET(package-binary-tbz2 WORKING_DIRECTORY "${K3D_PACKAGE_DIRECTORY}" COMMAND ${CMAKE_CPACK_COMMAND} --config ${CMAKE_CURRENT_BINARY_DIR}/package-binary-tbz2.cpack ) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-binary-tgz.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-binary-tgz.cpack) ADD_CUSTOM_TARGET(package-binary-tgz WORKING_DIRECTORY "${K3D_PACKAGE_DIRECTORY}" COMMAND ${CMAKE_CPACK_COMMAND} --config ${CMAKE_CURRENT_BINARY_DIR}/package-binary-tgz.cpack ) # Note ... we intentionally don't provide upload capability for Posix packages, and leave distribution to the experts ================================================ FILE: distribution/posix/package-binary-stgz.cpack.in ================================================ SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") SET(CPACK_GENERATOR "STGZ") SET(CPACK_INSTALL_CMAKE_PROJECTS "${K3D_CPACK_INSTALL_CMAKE_PROJECTS}") SET(CPACK_PACKAGE_DESCRIPTION "${K3D_CPACK_PACKAGE_DESCRIPTION}") SET(CPACK_PACKAGE_FILE_NAME "${K3D_CPACK_PACKAGE_FILE_NAME}") SET(CPACK_PACKAGE_NAME "${K3D_CPACK_PACKAGE_NAME}") SET(CPACK_PACKAGE_VERSION "${K3D_CPACK_PACKAGE_VERSION}") SET(CPACK_RESOURCE_FILE_LICENSE "${K3D_CPACK_RESOURCE_FILE_LICENSE}") ================================================ FILE: distribution/posix/package-binary-tbz2.cpack.in ================================================ SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") SET(CPACK_GENERATOR "TBZ2") SET(CPACK_INSTALL_CMAKE_PROJECTS "${K3D_CPACK_INSTALL_CMAKE_PROJECTS}") SET(CPACK_PACKAGE_DESCRIPTION "${K3D_CPACK_PACKAGE_DESCRIPTION}") SET(CPACK_PACKAGE_FILE_NAME "${K3D_CPACK_PACKAGE_FILE_NAME}") SET(CPACK_PACKAGE_NAME "${K3D_CPACK_PACKAGE_NAME}") SET(CPACK_PACKAGE_VERSION "${K3D_CPACK_PACKAGE_VERSION}") SET(CPACK_RESOURCE_FILE_LICENSE "${K3D_CPACK_RESOURCE_FILE_LICENSE}") ================================================ FILE: distribution/posix/package-binary-tgz.cpack.in ================================================ SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") SET(CPACK_GENERATOR "TGZ") SET(CPACK_INSTALL_CMAKE_PROJECTS "${K3D_CPACK_INSTALL_CMAKE_PROJECTS}") SET(CPACK_PACKAGE_DESCRIPTION "${K3D_CPACK_PACKAGE_DESCRIPTION}") SET(CPACK_PACKAGE_FILE_NAME "${K3D_CPACK_PACKAGE_FILE_NAME}") SET(CPACK_PACKAGE_NAME "${K3D_CPACK_PACKAGE_NAME}") SET(CPACK_PACKAGE_VERSION "${K3D_CPACK_PACKAGE_VERSION}") SET(CPACK_RESOURCE_FILE_LICENSE "${K3D_CPACK_RESOURCE_FILE_LICENSE}") ================================================ FILE: distribution/source/CMakeLists.txt ================================================ SET(K3D_PACKAGE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/K-3D ${K3D_VERSION}") FILE(MAKE_DIRECTORY "${K3D_PACKAGE_DIRECTORY}") # Generate source packages CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-source-tbz2.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-source-tbz2.cpack) ADD_CUSTOM_TARGET(package-source-tbz2 WORKING_DIRECTORY "${K3D_PACKAGE_DIRECTORY}" COMMAND ${CMAKE_CPACK_COMMAND} --config "${CMAKE_CURRENT_BINARY_DIR}/package-source-tbz2.cpack" ) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-source-tgz.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-source-tgz.cpack) ADD_CUSTOM_TARGET(package-source-tgz WORKING_DIRECTORY "${K3D_PACKAGE_DIRECTORY}" COMMAND ${CMAKE_CPACK_COMMAND} --config "${CMAKE_CURRENT_BINARY_DIR}/package-source-tgz.cpack" ) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-source-zip.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-source-zip.cpack) ADD_CUSTOM_TARGET(package-source-zip WORKING_DIRECTORY "${K3D_PACKAGE_DIRECTORY}" COMMAND ${CMAKE_CPACK_COMMAND} --config "${CMAKE_CURRENT_BINARY_DIR}/package-source-zip.cpack" ) # Upload source packages to SourceForge ADD_CUSTOM_TARGET(upload-package-source-tbz2 DEPENDS "${K3D_PACKAGE_DIRECTORY}/${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMAND rsync -e ssh -R --progress --protect-args "K-3D ${K3D_VERSION}/${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2" "${K3D_SOURCEFORGE_USERNAME},k3d@frs.sourceforge.net:/home/frs/project/k/k3/k3d/K-3D Source/" ) ADD_CUSTOM_TARGET(upload-package-source-tgz DEPENDS "${K3D_PACKAGE_DIRECTORY}/${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMAND rsync -e ssh -R --progress --protect-args "K-3D ${K3D_VERSION}/${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz" "${K3D_SOURCEFORGE_USERNAME},k3d@frs.sourceforge.net:/home/frs/project/k/k3/k3d/K-3D Source/" ) ADD_CUSTOM_TARGET(upload-package-source-zip DEPENDS "${K3D_PACKAGE_DIRECTORY}/${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}.zip" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMAND rsync -e ssh -R --progress --protect-args "K-3D ${K3D_VERSION}/${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}.zip" "${K3D_SOURCEFORGE_USERNAME},k3d@frs.sourceforge.net:/home/frs/project/k/k3/k3d/K-3D Source/" ) ================================================ FILE: distribution/source/package-source-tbz2.cpack.in ================================================ SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") SET(CPACK_GENERATOR "TBZ2") SET(CPACK_IGNORE_FILES "${K3D_CPACK_SOURCE_IGNORE_FILES}") SET(CPACK_INSTALLED_DIRECTORIES "${K3D_CPACK_SOURCE_INSTALLED_DIRECTORIES}") SET(CPACK_PACKAGE_DESCRIPTION "${K3D_CPACK_PACKAGE_DESCRIPTION}") SET(CPACK_PACKAGE_FILE_NAME "${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}") SET(CPACK_PACKAGE_NAME "${K3D_CPACK_PACKAGE_NAME}") SET(CPACK_PACKAGE_VERSION "${K3D_CPACK_PACKAGE_VERSION}") ================================================ FILE: distribution/source/package-source-tgz.cpack.in ================================================ SET(CPACK_GENERATOR "TGZ") SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") SET(CPACK_IGNORE_FILES "${K3D_CPACK_SOURCE_IGNORE_FILES}") SET(CPACK_INSTALLED_DIRECTORIES "${K3D_CPACK_SOURCE_INSTALLED_DIRECTORIES}") SET(CPACK_PACKAGE_DESCRIPTION "${K3D_CPACK_PACKAGE_DESCRIPTION}") SET(CPACK_PACKAGE_FILE_NAME "${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}") SET(CPACK_PACKAGE_NAME "${K3D_CPACK_PACKAGE_NAME}") SET(CPACK_PACKAGE_VERSION "${K3D_CPACK_PACKAGE_VERSION}") ================================================ FILE: distribution/source/package-source-zip.cpack.in ================================================ SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") SET(CPACK_GENERATOR "ZIP") SET(CPACK_IGNORE_FILES "${K3D_CPACK_SOURCE_IGNORE_FILES}") SET(CPACK_INSTALLED_DIRECTORIES "${K3D_CPACK_SOURCE_INSTALLED_DIRECTORIES}") SET(CPACK_PACKAGE_DESCRIPTION "${K3D_CPACK_PACKAGE_DESCRIPTION}") SET(CPACK_PACKAGE_FILE_NAME "${K3D_CPACK_SOURCE_PACKAGE_FILE_NAME}") SET(CPACK_PACKAGE_NAME "${K3D_CPACK_PACKAGE_NAME}") SET(CPACK_PACKAGE_VERSION "${K3D_CPACK_PACKAGE_VERSION}") ================================================ FILE: distribution/win32/CMakeLists.txt ================================================ OPTION(K3D_INSTALL_AQSIS "Include Aqsis in the K-3D installer" OFF) OPTION(K3D_INSTALL_BOOST "Include Boost in the K-3D installer" OFF) OPTION(K3D_INSTALL_CGKIT "Include cgkit in the K-3D installer" OFF) OPTION(K3D_INSTALL_GTKMM "Include gtkmm in the K-3D installer" OFF) OPTION(K3D_INSTALL_PYGTK "Include PyGTK in the K-3D installer" OFF) OPTION(K3D_INSTALL_PYOPENGL "Include PyOpenGL in the K-3D installer" OFF) OPTION(K3D_INSTALL_PYTHON "Include Python in the K-3D installer" OFF) K3D_CHECK_INSTALLED_PYTHON_DEPENDENCY(K3D_INSTALL_CGKIT) K3D_CHECK_INSTALLED_PYTHON_DEPENDENCY(K3D_INSTALL_PYGTK) K3D_CHECK_INSTALLED_PYTHON_DEPENDENCY(K3D_INSTALL_PYOPENGL) #install mingwm10.dll FIND_PROGRAM(K3D_MINGW_GCC mingw32-gcc.exe C:/mingw/bin DOC "Path to the MinGW GCC command") GET_FILENAME_COMPONENT(K3D_MINGW_PATH ${K3D_MINGW_GCC} PATH) INSTALL(FILES ${K3D_MINGW_PATH}/mingwm10.dll ${K3D_MINGW_PATH}/libstdc++-6.dll ${K3D_MINGW_PATH}/pthreadGC2.dll DESTINATION bin) # manually copy the HTML docs, since actually generating these on mingw is a royal pain INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/share/k3d/guide/html/ DESTINATION share/k3d/guide/html) SET(K3D_QT_DIR "c:/qt" CACHE PATH "Root directory containing Qt") IF(K3D_EXTRA_INSTALL_ROOT) INSTALL(DIRECTORY ${K3D_EXTRA_INSTALL_ROOT}/bin/ DESTINATION bin FILES_MATCHING PATTERN "*.dll" ) ENDIF() IF(K3D_INSTALL_AQSIS) FIND_PROGRAM(K3D_AQSIS_COMMAND aqsis.exe DOC "Path to an installed aqsis.exe." ) IF(NOT K3D_AQSIS_COMMAND) MESSAGE(SEND_ERROR "Could not locate aqsis.exe.") ENDIF(NOT K3D_AQSIS_COMMAND) IF(NOT K3D_BUILD_BUNDLED_RENDERMAN_ENGINES_MODULE) MESSAGE(SEND_ERROR "K3D_INSTALL_AQSIS requires K3D_BUILD_BUNDLED_RENDERMAN_ENGINES_MODULE") ENDIF(NOT K3D_BUILD_BUNDLED_RENDERMAN_ENGINES_MODULE) EXECUTE_PROCESS( COMMAND ${K3D_AQSIS_COMMAND} --version OUTPUT_VARIABLE K3D_AQSIS_VERSION ) IF(K3D_AQSIS_VERSION) STRING(REGEX REPLACE " \\(revision.*" "" K3D_AQSIS_VERSION ${K3D_AQSIS_VERSION}) STRING(REGEX REPLACE "aqsis version " "" K3D_AQSIS_VERSION ${K3D_AQSIS_VERSION}) K3D_CHECK_INSTALLED_VERSION(${K3D_AQSIS_VERSION} "Aqsis" "1.7.0") ELSE(K3D_AQSIS_VERSION) MESSAGE(SEND_ERROR "Error determining Aqsis version.") ENDIF(K3D_AQSIS_VERSION) GET_FILENAME_COMPONENT(K3D_AQSIS_PATH ${K3D_AQSIS_COMMAND} PATH) INSTALL(DIRECTORY ${K3D_AQSIS_PATH}/ DESTINATION bin USE_SOURCE_PERMISSIONS PATTERN aqsisrc EXCLUDE ) INSTALL(FILES ${K3D_QT_DIR}/bin/QtCore4.dll ${K3D_QT_DIR}/bin/QtGui4.dll DESTINATION bin) # Install generic aqsisrc, omitting paths (those are set at runtime through command line options) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/aqsisrc DESTINATION bin) ENDIF(K3D_INSTALL_AQSIS) IF(K3D_INSTALL_BOOST) INSTALL(DIRECTORY ${Boost_LIBRARY_DIRS}/ DESTINATION bin FILES_MATCHING PATTERN "*.dll" PATTERN "*-d-*" EXCLUDE ) ENDIF(K3D_INSTALL_BOOST) IF(K3D_BUILD_COLLADA_IO_MODULE) INSTALL(FILES ${K3D_COLLADA_LIBRARY} DESTINATION bin) ENDIF(K3D_BUILD_COLLADA_IO_MODULE) IF(K3D_INSTALL_GTKMM) INCLUDE(K3DFindPkgConfig) PKG_CHECK_MODULES(ATK atk) PKG_CHECK_MODULES(ATKMM atkmm-1.6) PKG_CHECK_MODULES(CAIRO cairo) PKG_CHECK_MODULES(CAIROMM cairomm-1.0) PKG_CHECK_MODULES(GDK gdk-2.0) PKG_CHECK_MODULES(GDKGLEXT gdkglext-1.0) PKG_CHECK_MODULES(GDKGLEXTW gdkglext-win32-1.0) PKG_CHECK_MODULES(GDKMM gdkmm-2.4) PKG_CHECK_MODULES(GTK gtk+-2.0) PKG_CHECK_MODULES(GTKMM gtkmm-2.4) # This is an ugly hack, we should be able to detect this automatically, but I'm feeling lazy ... SET(K3D_GTK_DIR "c:/gtk" CACHE PATH "Root directory containing GTK/gtkmm") INSTALL(DIRECTORY ${K3D_GTK_DIR}/bin/ DESTINATION bin USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN libgtk*.dll PATTERN libgdk*.dll PATTERN libpango*.dll PATTERN libatk*.dll PATTERN libcairo*.dll PATTERN libgio*.dll PATTERN libglib*.dll PATTERN libsigc*.dll PATTERN libgmodule*.dll PATTERN libgobject*.dll PATTERN libgthread*.dll PATTERN libexpat*.dll PATTERN libfontconfig*.dll PATTERN libpng*.dll PATTERN libintl*.dll PATTERN libfreetype*.dll PATTERN libzlib*.dll PATTERN libgcc*.dll PATTERN gspawn* PATTERN zlib1.dll PATTERN intl.dll PATTERN freetype6.dll ) INSTALL(DIRECTORY ${K3D_GTK_DIR}/etc/ DESTINATION etc USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN pango PATTERN gtk* ) INSTALL(DIRECTORY ${K3D_GTK_DIR}/lib/gtk-2.0 DESTINATION ${K3D_LIBDIR} USE_SOURCE_PERMISSIONS ) # Override the default gtkrc file with our own INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gtkrc DESTINATION etc/gtk-2.0) ENDIF(K3D_INSTALL_GTKMM) IF(K3D_INSTALL_PYTHON) FIND_PROGRAM(K3D_PYTHON_COMMAND python.exe PATHS "c:/python26" DOC "Path to an installed python.exe." ) IF(NOT K3D_PYTHON_COMMAND) MESSAGE(SEND_ERROR "Could not locate python.exe.") ENDIF(NOT K3D_PYTHON_COMMAND) FIND_PROGRAM(K3D_PYTHON_LIBRARY python26.dll DOC "Path to the installed python26.dll" ) IF(NOT K3D_PYTHON_LIBRARY) MESSAGE(SEND_ERROR "Could not locate python26.dll.") ENDIF(NOT K3D_PYTHON_LIBRARY) EXECUTE_PROCESS( COMMAND ${K3D_PYTHON_COMMAND} -V ERROR_VARIABLE K3D_PYTHON_VERSION ) IF(K3D_PYTHON_VERSION) STRING(REGEX REPLACE "^Python ([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" K3D_PYTHON_VERSION ${K3D_PYTHON_VERSION}) K3D_CHECK_INSTALLED_VERSION(${K3D_PYTHON_VERSION} "Python" "2.6.1") ELSE(K3D_PYTHON_VERSION) MESSAGE(SEND_ERROR "Error determining Python version.") ENDIF(K3D_PYTHON_VERSION) INSTALL(PROGRAMS ${K3D_PYTHON_COMMAND} ${K3D_PYTHON_LIBRARY} DESTINATION bin ) GET_FILENAME_COMPONENT(K3D_PYTHON_PATH ${K3D_PYTHON_COMMAND} PATH) FILE(GLOB K3D_PYTHON_MODULES ${K3D_PYTHON_PATH}/Lib/*.py) INSTALL(PROGRAMS ${K3D_PYTHON_MODULES} DESTINATION ${K3D_LIBDIR} ) SET(K3D_PYTHON_SITE_PACKAGES ${K3D_PYTHON_PATH}/Lib/site-packages) IF(K3D_INSTALL_CGKIT) EXECUTE_PROCESS( COMMAND ${K3D_PYTHON_COMMAND} -c "import cgkit.cgkitinfo;print cgkit.cgkitinfo.version" OUTPUT_VARIABLE K3D_CGKIT_VERSION ) IF(K3D_CGKIT_VERSION) STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+[^ ]*).*" "\\1" K3D_CGKIT_VERSION ${K3D_CGKIT_VERSION}) K3D_CHECK_INSTALLED_VERSION(${K3D_CGKIT_VERSION} "cgkit" "2.0.0alpha8") ELSE(K3D_CGKIT_VERSION) MESSAGE(SEND_ERROR "Error determining cgkit version.") ENDIF(K3D_CGKIT_VERSION) INSTALL(DIRECTORY ${K3D_PYTHON_SITE_PACKAGES}/cgkit DESTINATION ${K3D_LIBDIR}/site-packages PATTERN *.pyc EXCLUDE PATTERN *.pyo EXCLUDE ) ENDIF(K3D_INSTALL_CGKIT) IF(K3D_INSTALL_PYGTK) EXECUTE_PROCESS( COMMAND ${K3D_PYTHON_COMMAND} -c "import gtk;print gtk.pygtk_version" OUTPUT_VARIABLE K3D_PYGTK_VERSION ) IF(K3D_PYGTK_VERSION) STRING(REGEX REPLACE ".*([0-9]+), ([0-9]+), ([0-9]+).*" "\\1.\\2.\\3" K3D_PYGTK_VERSION ${K3D_PYGTK_VERSION}) K3D_CHECK_INSTALLED_VERSION(${K3D_PYGTK_VERSION} "PyGTK" "2.12.1") ELSE(K3D_PYGTK_VERSION) MESSAGE(SEND_ERROR "Error determining PyGTK version.") ENDIF(K3D_PYGTK_VERSION) INSTALL(DIRECTORY ${K3D_PYTHON_SITE_PACKAGES}/cairo DESTINATION ${K3D_LIBDIR}/site-packages PATTERN *.pyc EXCLUDE PATTERN *.pyo EXCLUDE ) INSTALL(DIRECTORY ${K3D_PYTHON_SITE_PACKAGES}/gtk-2.0 DESTINATION ${K3D_LIBDIR}/site-packages PATTERN *.pyc EXCLUDE PATTERN *.pyo EXCLUDE ) INSTALL(PROGRAMS ${K3D_PYTHON_SITE_PACKAGES}/pygtk.py DESTINATION ${K3D_LIBDIR}/site-packages ) ENDIF(K3D_INSTALL_PYGTK) IF(K3D_INSTALL_PYOPENGL) EXECUTE_PROCESS( COMMAND ${K3D_PYTHON_COMMAND} -c "import OpenGL.version;print OpenGL.version.__version__" OUTPUT_VARIABLE K3D_PYOPENGL_VERSION ) IF(K3D_PYOPENGL_VERSION) STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" K3D_PYOPENGL_VERSION ${K3D_PYOPENGL_VERSION}) K3D_CHECK_INSTALLED_VERSION(${K3D_PYOPENGL_VERSION} "PyOpenGL" "3.0.0") ELSE(K3D_PYOPENGL_VERSION) MESSAGE(SEND_ERROR "Error determining PyOpenGL version.") ENDIF(K3D_PYOPENGL_VERSION) INSTALL(DIRECTORY ${K3D_PYTHON_SITE_PACKAGES}/OpenGL DESTINATION ${K3D_LIBDIR}/site-packages PATTERN *.pyc EXCLUDE PATTERN *.pyo EXCLUDE ) ENDIF(K3D_INSTALL_PYOPENGL) ENDIF(K3D_INSTALL_PYTHON) ADD_SUBDIRECTORY(nsis) ================================================ FILE: distribution/win32/aqsisrc ================================================ Option "display" "string file" ["file_dspy.dll"] Option "display" "string framebuffer" ["piqsl_dspy.dll"] Option "display" "string zfile" ["file_dspy.dll"] Option "display" "string zframebuffer" ["piqsl_dspy.dll"] Option "display" "string shadow" ["file_dspy.dll"] Option "display" "string tiff" ["file_dspy.dll"] Option "display" "string xpm" ["xpm_dspy.dll"] Option "display" "string exr" ["exr_dspy.dll"] Option "display" "string bmp" ["bmp_dspy.dll"] Option "display" "string debugdd" ["debugdd"] Option "display" "string piqsl" ["piqsl_dspy.dll"] Option "searchpath" "string shader" [".:@:%SIMBIONT_RM_COMPONENTS%/../SimbiontRM:%SIMBIONT_RM_COMPONENTS%/..:%SIMBIONT_RM_COMPONENTS%/../SimbiontRM:%SIMBIONT_RM_COMPONENTS%/..:"] Option "searchpath" "string archive" [".:@:"] Option "searchpath" "string texture" [".:@:"] Option "searchpath" "string display" [".:@:"] Option "searchpath" "string procedural" [".:@:%MASSIVE_HOME%/bin:%MASSIVE_HOME%/bin:"] Option "searchpath" "string resource" [".:@:"] ================================================ FILE: distribution/win32/gtkrc ================================================ gtk-icon-sizes = "gtk-menu=13,13:gtk-small-toolbar=16,16:gtk-large-toolbar=24,24:gtk-dnd=32,32" gtk-toolbar-icon-size = small-toolbar # disable images in buttons. i've only seen ugly delphi apps use this feature. gtk-button-images = 0 # enable/disable images in menus. most "stock" microsoft apps don't use these, except sparingly. # the office apps use them heavily, though. gtk-menu-images = 1 # use the win32 button ordering instead of the GNOME HIG one, where applicable gtk-alternative-button-order = 1 style "msw-default" { GtkWidget::interior-focus = 1 GtkOptionMenu::indicator-size = { 9, 5 } GtkOptionMenu::indicator-spacing = { 7, 5, 2, 2 } GtkSpinButton::shadow-type = in # Owen and I disagree that these should be themable #GtkUIManager::add-tearoffs = 0 #GtkComboBox::add-tearoffs = 0 GtkComboBox::appears-as-list = 1 GtkComboBox::focus-on-click = 0 GOComboBox::add_tearoffs = 0 GtkTreeView::allow-rules = 0 GtkTreeView::expander-size = 12 GtkExpander::expander-size = 12 GtkScrolledWindow::scrollbar_spacing = 1 GtkSeparatorMenuItem::horizontal-padding = 2 engine "wimp" { } } class "*" style "msw-default" ================================================ FILE: distribution/win32/nsis/CMakeLists.txt ================================================ # Generate NSIS installer CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/package-binary-nsis.cpack.in ${CMAKE_CURRENT_BINARY_DIR}/package-binary-nsis.cpack) ADD_CUSTOM_TARGET(package-binary-nsis ${CMAKE_CPACK_COMMAND} --config ${CMAKE_CURRENT_BINARY_DIR}/package-binary-nsis.cpack ) ================================================ FILE: distribution/win32/nsis/package-binary-nsis.cpack.in ================================================ SET(CPACK_CMAKE_GENERATOR "@CMAKE_GENERATOR@") SET(CPACK_GENERATOR "NSIS") SET(CPACK_INSTALL_CMAKE_PROJECTS "@K3D_CPACK_INSTALL_CMAKE_PROJECTS@") SET(CPACK_NSIS_HELP_LINK "http://www.k-3d.org/wiki/Support") SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\k3d.exe") SET(CPACK_NSIS_MENU_LINKS "http://www.k-3d.org/wiki/Support" "K-3D Help") SET(CPACK_NSIS_MUI_ICON "@share_SOURCE_DIR@/k3d/icons\\\\k3d.ico") SET(CPACK_PACKAGE_DESCRIPTION "@K3D_CPACK_PACKAGE_DESCRIPTION@") SET(CPACK_PACKAGE_EXECUTABLES "k3d" "K-3D @K3D_VERSION@") SET(CPACK_PACKAGE_FILE_NAME "@K3D_CPACK_PACKAGE_FILE_NAME@") SET(CPACK_PACKAGE_ICON "@CMAKE_CURRENT_SOURCE_DIR@\\\\headerimage.bmp") SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "K-3D @K3D_VERSION@") SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "K-3D @K3D_VERSION@") SET(CPACK_PACKAGE_NAME "@K3D_CPACK_PACKAGE_NAME@") SET(CPACK_NSIS_PACKAGE_NAME "K-3D") SET(CPACK_PACKAGE_VENDOR "www.k-3d.org") SET(CPACK_PACKAGE_VERSION "@K3D_CPACK_PACKAGE_VERSION@") SET(CPACK_RESOURCE_FILE_LICENSE "@K3D_CPACK_RESOURCE_FILE_LICENSE@") SET(CPACK_NSIS_MODIFY_PATH "ON") SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@") ================================================ FILE: docs/CMakeLists.txt ================================================ ADD_SUBDIRECTORY(coding_style) ADD_SUBDIRECTORY(doxygen) ADD_SUBDIRECTORY(epydoc) ADD_SUBDIRECTORY(wiki) ================================================ FILE: docs/coding_style/CMakeLists.txt ================================================ FIND_PROGRAM(ASTYLE_COMMAND NAMES astyle DOC "Path to the Artistic Style source-code formatter." ) IF(ASTYLE_COMMAND) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/k3d-style.in ${CMAKE_CURRENT_BINARY_DIR}/k3d-style @ONLY) EXECUTE_PROCESS( COMMAND chmod u+x ${CMAKE_CURRENT_BINARY_DIR}/k3d-style ) ENDIF(ASTYLE_COMMAND) ================================================ FILE: docs/coding_style/astylerc ================================================ # This is a style file for the "Artistic Style" code formatting program, astyle. # # It encodes roughly how we'd like the code to look in K-3D, but isn't really # a substitute for writing neat code by hand. # # See the files codestyle.{cpp,h} for a better introduction to the K-3D coding # style. #------------------------------------------------------------------------------- # C/C++ indenting mode. mode=c style=ansi #------------------------------------------------------------------------------- # Always put block brackets on seperate lines. #brackets=break # If two statements are on a line, leave them that way. #one-line=keep-statements #------------------------------------------------------------------------------- ### Indenting # Indent 'class' blocks so that the blocks 'public:', 'protected:' and 'private:' are indented. #indent-classes # Indent with tabs equal to four spaces. #indent=tab=4 # Indent switch blocks. The astyle docs seem a bit confused about this (ie, # indent-cases seems to do what indent-switches is advertised to do in the docs...) #indent-switches #indent-cases #------------------------------------------------------------------------------- ### Space-padding # We could also insert padding of a single space around all operators: #pad=oper # And also pad the brackets: #pad=paren # Space is better chosen carefully for emphasis however. Compare: # # x = 2*(a-f) + b*(c-d)/2; # # x = 2 * (a - f) + b * (c - d) / 2; # # x = 2 * ( a - f ) + b * ( c - d ) / 2; # # The first is rather clearer than the others. Unfortunately, we've gotta # forgo any astyle padding to get it to stay that way. ================================================ FILE: docs/coding_style/k3d-style.in ================================================ #!/bin/sh @ASTYLE_COMMAND@ --mode=c --style=ansi --indent=tab=2 --pad=oper --unpad=paren --suffix=none $* ================================================ FILE: docs/doxygen/CMakeLists.txt ================================================ PROJECT(doxygen) INCLUDE(FindDoxygen) CONFIGURE_FILE(${doxygen_SOURCE_DIR}/Doxyfile.in ${doxygen_BINARY_DIR}/Doxyfile) ADD_CUSTOM_TARGET(docs-doxygen COMMAND ${CMAKE_COMMAND} -E remove_directory ${doxygen_BINARY_DIR}/html COMMAND ${DOXYGEN_EXECUTABLE} ${doxygen_BINARY_DIR}/Doxyfile COMMAND ${CMAKE_COMMAND} -E copy ${doxygen_SOURCE_DIR}/k3d.css ${doxygen_BINARY_DIR}/html/k3d.css ) ================================================ FILE: docs/doxygen/Doxyfile.in ================================================ # Doxyfile 1.3.7 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = K-3D # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @VERSION@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = @doxygen_BINARY_DIR@ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 2 levels of 10 sub-directories under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of source # files, where putting all generated files in the same directory would otherwise # cause performance problems for the file system. CREATE_SUBDIRS = YES # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, # Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en # (Japanese with English messages), Korean, Korean-en, Norwegian, Polish, Portuguese, # Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is used # as the annotated text. Otherwise, the brief description is used as-is. If left # blank, the following values are used ("$name" is automatically replaced with the # name of the entity): "The $name class" "The $name widget" "The $name file" # "is" "provides" "specifies" "contains" "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited # members of a class in the documentation of that class as if those members were # ordinary class members. Constructors, destructors and assignment operators of # the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 2 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources # only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = YES # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @k3d_SOURCE_DIR@ # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = @k3d_SOURCE_DIR@/.hg \ @k3d_SOURCE_DIR@/k3dsdk/ftgl \ @k3d_SOURCE_DIR@/k3dsdk/gil \ @k3d_SOURCE_DIR@/k3dsdk/glew \ @k3d_SOURCE_DIR@/k3dsdk/gmm \ @k3d_SOURCE_DIR@/k3dsdk/Half \ @k3d_SOURCE_DIR@/k3dsdk/tests \ @k3d_SOURCE_DIR@/po \ @k3d_SOURCE_DIR@/share # The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories # that are symbolic links (a Unix filesystem feature) are excluded from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = @k3d_SOURCE_DIR@/modules/qslim/Mx* # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. INPUT_FILTER = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = @doxygen_SOURCE_DIR@/header.html # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = @doxygen_SOURCE_DIR@/footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse the # parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. Note that this # option is superseded by the HAVE_DOT option below. This is only a fallback. It is # recommended to install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = NO # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = NO # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = @DOXYGEN_DOT_PATH@ # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes that # lay further from the root node will be omitted. Note that setting this option to # 1 or 2 may greatly reduce the computation time needed for large code bases. Also # note that a graph may be further truncated if the graph's image dimensions are # not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). # If 0 is used for the depth value (the default), the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO ================================================ FILE: docs/doxygen/footer.html ================================================
Generated on $datetime for $projectname by doxygen $doxygenversion
================================================ FILE: docs/doxygen/header.html ================================================ $title ================================================ FILE: docs/doxygen/k3d.css ================================================ DIV.tabs A:link, DIV.tabs A:visited, DIV.tabs A:active, DIV.tabs A:hover { color: DarkRed; } a, a:visited, a:active, a:hover { color: DarkRed; } a.qindex, a.qindex:visited, a.qindex:active, a.qindex:hover { color: DarkRed; } a.el, a.el:visited, a.el:active, a.el:hover { color: DarkRed; } .memitem { background-color: #eedddd; border-top-color: #886666; border-right-color: #886666; border-bottom-color: #886666; border-left-color: #886666; } .memproto { background-color: #f2f2f2; border-top-color: #bbbbbb; border-right-color: #bbbbbb; border-bottom-color: #bbbbbb; border-left-color: #bbbbbb; } ================================================ FILE: docs/epydoc/CMakeLists.txt ================================================ PROJECT(epydoc) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/make-epydoc-docs.py ${CMAKE_CURRENT_BINARY_DIR}/make-epydoc-docs.py) ADD_CUSTOM_TARGET(docs-epydoc COMMAND ${k3d_BINARY_DIR}/bin/k3d --log-level=debug --color --script-file=${CMAKE_CURRENT_BINARY_DIR}/make-epydoc-docs.py --ui=nui ) ================================================ FILE: docs/epydoc/epydoc.css ================================================ /* Epydoc CSS Stylesheet * * This stylesheet can be used to customize the appearance of epydoc's * HTML output. * */ /* Default Colors & Styles * - Set the default foreground & background color with 'body'; and * link colors with 'a:link' and 'a:visited'. * - Use bold for decision list terms. * - The heading styles defined here are used for headings *within* * docstring descriptions. All headings used by epydoc itself use * either class='epydoc' or class='toc' (CSS styles for both * defined below). */ body { background: #ffffff; color: #000000; } a:link { color: #880000; } a:visited { color: #880000; } dt { font-weight: bold; } h1 { font-size: +140%; font-style: italic; font-weight: bold; } h2 { font-size: +125%; font-style: italic; font-weight: bold; } h3 { font-size: +110%; font-style: italic; font-weight: normal; } code { font-size: 100%; } /* Page Header & Footer * - The standard page header consists of a navigation bar (with * pointers to standard pages such as 'home' and 'trees'); a * breadcrumbs list, which can be used to navigate to containing * classes or modules; options links, to show/hide private * variables and to show/hide frames; and a page title (using *

). The page title may be followed by a link to the * corresponding source code (using 'span.codelink'). * - The footer consists of a navigation bar, a timestamp, and a * pointer to epydoc's homepage. */ h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } h2.epydoc { font-size: +130%; font-weight: bold; } h3.epydoc { font-size: +115%; font-weight: bold; } td h3.epydoc { font-size: +115%; font-weight: bold; margin-bottom: 0; } table.navbar { background: #bbbbbb; color: #000000; border: 2px groove #c0d0d0; } table.navbar table { color: #000000; } th.navbar-select { background: #999999; color: #000000; } table.navbar a { text-decoration: none; } table.navbar a:link { color: #880000; } table.navbar a:visited { color: #880000; } span.breadcrumbs { font-size: 85%; font-weight: bold; } span.options { font-size: 70%; } span.codelink { font-size: 85%; } td.footer { font-size: 85%; } /* Table Headers * - Each summary table and details section begins with a 'header' * row. This row contains a section title (marked by * 'span.table-header') as well as a show/hide private link * (marked by 'span.options', defined above). * - Summary tables that contain user-defined groups mark those * groups using 'group header' rows. */ td.table-header { background: #bbbbbb; color: #000000; border: 1px solid #888888; } td.table-header table { color: #000000; } td.table-header table a:link { color: #880000; } td.table-header table a:visited { color: #880000; } span.table-header { font-size: 120%; font-weight: bold; } th.group-header { background: #c0e0f8; color: #000000; text-align: left; font-style: italic; font-size: 115%; border: 1px solid #608090; } /* Summary Tables (functions, variables, etc) * - Each object is described by a single row of the table with * two cells. The left cell gives the object's type, and is * marked with 'code.summary-type'. The right cell gives the * object's name and a summary description. * - CSS styles for the table's header and group headers are * defined above, under 'Table Headers' */ table.summary { border-collapse: collapse; background: #e8e8e8; color: #000000; border: 1px solid #808080; margin-bottom: 0.5em; } td.summary { border: 1px solid #808080; } code.summary-type { font-size: 85%; } table.summary a:link { color: #880000; } table.summary a:visited { color: #880000; } /* Details Tables (functions, variables, etc) * - Each object is described in its own div. * - A single-row summary table w/ table-header is used as * a header for each details section (CSS style for table-header * is defined above, under 'Table Headers'). */ table.details { border-collapse: collapse; background: #e8e8e8; color: #000000; border: 1px solid #808080; margin: .2em 0 0 0; } table.details table { color: #000000; } table.details a:link { color: #880000; } table.details a:visited { color: #880000; } /* Fields */ dl.fields { margin-left: 2em; margin-top: 1em; margin-bottom: 1em; } dl.fields dd ul { margin-left: 0em; padding-left: 0em; } div.fields { margin-left: 2em; } div.fields p { margin-bottom: 0.5em; } /* Index tables (identifier index, term index, etc) * - link-index is used for indices containing lists of links * (namely, the identifier index & term index). * - index-where is used in link indices for the text indicating * the container/source for each link. * - metadata-index is used for indices containing metadata * extracted from fields (namely, the bug index & todo index). */ table.link-index { border-collapse: collapse; background: #e8e8e8; color: #000000; border: 1px solid #808080; } td.link-index { border-width: 0px; } table.link-index a:link { color: #880000; } table.link-index a:visited { color: #880000; } span.index-where { font-size: 70%; } table.metadata-index { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin: .2em 0 0 0; } td.metadata-index { border-width: 1px; border-style: solid; } table.metadata-index a:link { color: #0000ff; } table.metadata-index a:visited { color: #204080; } /* Function signatures * - sig* is used for the signature in the details section. * - .summary-sig* is used for the signature in the summary * table, and when listing property accessor functions. * */ .sig-name { color: #000000; } .sig-arg { color: #000000; } .sig-default { color: #602000; } .summary-sig { font-family: monospace; } .summary-sig-name { color: #880000; font-weight: bold; } table.summary a.summary-sig-name:link { color: #880000; font-weight: bold; } table.summary a.summary-sig-name:visited { color: #880000; font-weight: bold; } .summary-sig-arg { color: #006040; } .summary-sig-default { color: #501800; } /* To render variables, classes etc. like functions */ table.summary .summary-name { color: #880000; font-weight: bold; font-family: monospace; } table.summary a.summary-name:link { color: #880000; font-weight: bold; font-family: monospace; } table.summary a.summary-name:visited { color: #880000; font-weight: bold; font-family: monospace; } /* Variable values * - In the 'variable details' sections, each varaible's value is * listed in a 'pre.variable' box. The width of this box is * restricted to 80 chars; if the value's repr is longer than * this it will be wrapped, using a backslash marked with * class 'variable-linewrap'. If the value's repr is longer * than 3 lines, the rest will be ellided; and an ellipsis * marker ('...' marked with 'variable-ellipsis') will be used. * - If the value is a string, its quote marks will be marked * with 'variable-quote'. * - If the variable is a regexp, it is syntax-highlighted using * the re* CSS classes. */ pre.variable { padding: .5em; margin: 0; background: #dce4ec; color: #000000; border: 1px solid #708890; } .variable-linewrap { color: #604000; font-weight: bold; } .variable-ellipsis { color: #604000; font-weight: bold; } .variable-quote { color: #604000; font-weight: bold; } .variable-group { color: #008000; font-weight: bold; } .variable-op { color: #604000; font-weight: bold; } .variable-string { color: #006030; } .variable-unknown { color: #a00000; font-weight: bold; } .re { color: #000000; } .re-char { color: #006030; } .re-op { color: #600000; } .re-group { color: #003060; } .re-ref { color: #404040; } /* Base tree * - Used by class pages to display the base class hierarchy. */ pre.base-tree { font-size: 80%; margin: 0; } /* Frames-based table of contents headers * - Consists of two frames: one for selecting modules; and * the other listing the contents of the selected module. * - h1.toc is used for each frame's heading * - h2.toc is used for subheadings within each frame. */ h1.toc { text-align: center; font-size: 105%; margin: 0; font-weight: bold; padding: 0; } h2.toc { font-size: 100%; font-weight: bold; margin: 0.5em 0 0 -0.3em; } /* Syntax Highlighting for Source Code * - doctest examples are displayed in a 'pre.py-doctest' block. * If the example is in a details table entry, then it will use * the colors specified by the 'table pre.py-doctest' line. * - Source code listings are displayed in a 'pre.py-src' block. * Each line is marked with 'span.py-line' (used to draw a line * down the left margin, separating the code from the line * numbers). Line numbers are displayed with 'span.py-lineno'. * The expand/collapse block toggle button is displayed with * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not * modify the font size of the text.) * - If a source code page is opened with an anchor, then the * corresponding code block will be highlighted. The code * block's header is highlighted with 'py-highlight-hdr'; and * the code block's body is highlighted with 'py-highlight'. * - The remaining py-* classes are used to perform syntax * highlighting (py-string for string literals, py-name for names, * etc.) */ pre.py-doctest { padding: .5em; margin: 1em; background: #e8f0f8; color: #000000; border: 1px solid #708890; } table pre.py-doctest { background: #dce4ec; color: #000000; } pre.py-src { border: 2px solid #000000; background: #f0f0f0; color: #000000; } .py-line { border-left: 2px solid #000000; margin-left: .2em; padding-left: .4em; } .py-lineno { font-style: italic; font-size: 90%; padding-left: .5em; } a.py-toggle { text-decoration: none; } div.py-highlight-hdr { border-top: 2px solid #000000; border-bottom: 2px solid #000000; background: #d8e8e8; } div.py-highlight { border-bottom: 2px solid #000000; background: #d0e0e0; } .py-prompt { color: #005050; font-weight: bold;} .py-more { color: #005050; font-weight: bold;} .py-string { color: #006030; } .py-comment { color: #003060; } .py-keyword { color: #600000; } .py-output { color: #404040; } .py-name { color: #000050; } .py-name:link { color: #000050 !important; } .py-name:visited { color: #000050 !important; } .py-number { color: #005000; } .py-defname { color: #000060; font-weight: bold; } .py-def-name { color: #000060; font-weight: bold; } .py-base-class { color: #000060; } .py-param { color: #000060; } .py-docstring { color: #006030; } .py-decorator { color: #804020; } /* Use this if you don't want links to names underlined: */ /*a.py-name { text-decoration: none; }*/ /* Graphs & Diagrams * - These CSS styles are used for graphs & diagrams generated using * Graphviz dot. 'img.graph-without-title' is used for bare * diagrams (to remove the border created by making the image * clickable). */ img.graph-without-title { border: none; } img.graph-with-title { border: 1px solid #000000; } span.graph-title { font-weight: bold; } span.graph-caption { } /* General-purpose classes * - 'p.indent-wrapped-lines' defines a paragraph whose first line * is not indented, but whose subsequent lines are. * - The 'nomargin-top' class is used to remove the top margin (e.g. * from lists). The 'nomargin' class is used to remove both the * top and bottom margin (but not the left or right margin -- * for lists, that would cause the bullets to disappear.) */ p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; margin: 0; } .nomargin-top { margin-top: 0; } .nomargin { margin-top: 0; margin-bottom: 0; } /* HTML Log */ div.log-block { padding: 0; margin: .5em 0 .5em 0; background: #e8f0f8; color: #000000; border: 1px solid #000000; } div.log-error { padding: .1em .3em .1em .3em; margin: 4px; background: #ffb0b0; color: #000000; border: 1px solid #000000; } div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; background: #ffffb0; color: #000000; border: 1px solid #000000; } div.log-info { padding: .1em .3em .1em .3em; margin: 4px; background: #b0ffb0; color: #000000; border: 1px solid #000000; } h2.log-hdr { background: #70b0ff; color: #000000; margin: 0; padding: 0em 0.5em 0em 0.5em; border-bottom: 1px solid #000000; font-size: 110%; } p.log { font-weight: bold; margin: .5em 0 .5em 0; } tr.opt-changed { color: #000000; font-weight: bold; } tr.opt-default { color: #606060; } pre.log { margin: 0; padding: 0; padding-left: 1em; } ================================================ FILE: docs/epydoc/make-epydoc-docs.py ================================================ #python import k3d import shutil import epydoc.docbuilder import epydoc.docwriter.html # Use restructured text as the default for docstrings #import epydoc.docstringparser #epydoc.docstringparser.DEFAULT_DOCFORMAT = "restructuredtext" index = epydoc.docbuilder.build_doc_index([k3d]) epydoc.docwriter.html.HTMLWriter(index).write("html") # Overwrite the default CSS shutil.copy("@epydoc_SOURCE_DIR@/epydoc.css", "@epydoc_BINARY_DIR@/html") ================================================ FILE: docs/sample_module/CMakeLists.txt ================================================ K3D_BUILD_MODULE(sample-module) K3D_CREATE_MODULE_PROXY(sample-module) ================================================ FILE: docs/sample_module/module.cpp ================================================ #include #include #include #include #include namespace module { namespace sample { class plugin : public k3d::node { public: plugin(k3d::iplugin_factory& Factory, k3d::idocument& Document) : k3d::node(Factory, Document) { k3d::log() << debug << "Howdy, World!" << std::endl; } ~plugin() { k3d::log() << debug << "Goodbye, Cruel World!" << std::endl; } static k3d::iplugin_factory& get_factory() { static k3d::document_plugin_factory factory( k3d::uuid(0x35b34163, 0xa1ee432a, 0x8f8503d2, 0xf09e7ac7), "SamplePlugin", "Sample K-3D document plugin", "Sample", k3d::iplugin_factory::EXPERIMENTAL); return factory; } }; } // namespace sample } // namespace module K3D_MODULE_START(Registry) Registry.register_factory(module::sample::plugin::get_factory()); K3D_MODULE_END ================================================ FILE: docs/uml/data.xmi ================================================ umbrello uml modeller http://uml.sf.net 1.4 UnicodeUTF8
================================================ FILE: docs/uml/network_rendering.xmi ================================================ umbrello uml modeller http://uml.sf.net 1.5.5 UnicodeUTF8 ================================================ FILE: docs/uml/subdivision_surface/sds_design.tex ================================================ % Class & Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[11pt]{article} % Options : fleqn \usepackage{a4wide} \usepackage[english]{babel} \usepackage[latin1]{inputenc} \usepackage{fancyhdr} \usepackage[]{graphicx} % OPtions : draft \usepackage[]{color} \usepackage{mathptm} \usepackage{subfigure} \usepackage{float} \usepackage{amsmath} \usepackage{palatino} \usepackage{multirow} \pdfadjustspacing=1 \bibliographystyle{plain} \usepackage{longtable} \usepackage{hyperref} %\usepackage{algorithmicx} %\usepackage{algorithm} %\usepackage{algpseudocode} % Style & Lengths %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \setlength{\parindent}{0cm} \setlength{\headheight}{26pt} \setlength{\textheight}{21cm} \frenchspacing % Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \renewcommand{\baselinestretch}{1} \renewcommand{\[}{\begin{equation}} \renewcommand{\]}{\end{equation}} \renewcommand{\(}{\begin{displaymath}} \renewcommand{\)}{\end{displaymath}} \newcommand{\dx}{\Delta x} \newcommand{\dy}{\Delta y} \newcommand{\dz}{\Delta z} \newcommand{\dt}{\Delta t} % Headers Foot %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pagestyle{fancy} \lhead{\leftmark} \rhead{} \renewcommand{\headrulewidth}{0.4pt} % Title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \title{SDS preview design} \author{Bart Janssens} \begin{document} \maketitle \begin{abstract} Introduction to the design of the SDS preview module, detailing what classes exist and what they do. \end{abstract} Figure \ref{classes} shows the class diagram for the SDS cache. \begin{figure}[H] \centering \includegraphics[width=15cm]{classes} \caption{The class diagram.} \label{classes} \end{figure} \section{catmull\_clark\_cache} This class provides the interface to the client program for all SDS operations. It can be seen as a mediator class, and has the advantage that it never becomes invalid, so the client only has to create it once. \texttt{set\_input} and \texttt{update} must be called (in this order) to update the cache. The \texttt{set\_input} method makes sure the \texttt{cache\_input} is valid, the \texttt{update} method handles the updating of point positions assuming a valid \texttt{cache\_input} is present, and creates or updates the \texttt{highr\_level\_cache}. Sequence diagrams for these operations under different circumstances are shown below. \begin{figure}[H] \centering \includegraphics[width=15cm]{set_input_initial} \caption{Input set when the cache is used for the first time.} \label{input_initial} \end{figure} \begin{figure}[H] \centering \includegraphics[width=15cm]{set_input_invalid} \caption{Input set when the cache is invalid.} \label{input_invalid} \end{figure} \begin{figure}[H] \centering \includegraphics[width=15cm]{update_invalid} \caption{Update in case the cache is invalid. All points are recalculated in this case, and a new \texttt{higher\_level\_cache} is created. THe old cache is deleted if needed, but this is not shown in the diagram.} \label{update_invalid} \end{figure} \begin{figure}[H] \centering \includegraphics[width=15cm]{update_valid} \caption{In case the cache is valid, \texttt{update\_detail} is called.} \label{update_valid} \end{figure} \begin{figure}[H] \centering \includegraphics[width=15cm]{update_detail} \caption{The \texttt{update\_detail} operation updates point positions in the first level cache and in the higher level cache. The parameter controls if all points are updated or if only the modified points (as determined by \texttt{cache\_input}) are updated.} \label{update_detail} \end{figure} In the \texttt{catmull\_clark\_cache} class there are two pure virtual functions: \texttt{create\_cache\_input} and \texttt{client\_output} These need to be defined by "client" software like k3d. The \texttt{create\_cache\_input} method is a factory method for creating a client-specific \texttt{cache\_input} class. The \texttt{client\_output} method is used to output the result of the subdivided mesh. Figure \ref{classes} shows there are three subclasses defined for k3d: \begin{enumerate} \item \texttt{k3d\_sds\_cache\_base} handles the input side of things. It is independent of what output module is used. \item \texttt{k3d\_opengl\_sds\_cache} handles output to opengl. \item \texttt{k3d\_mesh\_sds\_cache} handles output to a k3d::mesh. \end{enumerate} \section{cache\_input} This class forms the glue between the client mesh representation and the data structure used for the SDS calculations. It has the following tasks: \begin{enumerate} \item Apply the first level of SDS, converting the original mesh format to internal SDS format. The first level calculation is different from subsequent levels since the original mesh may contain non-quadrilateral faces. \item Keep track of what was changed on the original mesh. The faces affected by a chenge are placed in the \texttt{updated\_faces} parameter for \texttt{update}. \item Detect if the cache is still valid (notification is done through \texttt{set\_input}, which returns true if the cache is valid). \end{enumerate} If the \texttt{cache\_input} becomes invalid, it must be destroyed and recreated, as is shown in figure \ref{input_invalid}. The \texttt{catmull\_clark\_cache} makes this process transparent for the client.\\ As seen in figure \ref{classes}, only a single subclass is needed for k3d since there is only one mesh format. The face ordering is preserved by \texttt{k3d\_cache\_input}, which makes associating per-face properties of the original mesh with the resulting faces of the subdiveded mesh (accessed through the \texttt{face\_vertices} method) possible. \section{higher\_level\_cache} This class calculates SDS level 2 and up. It can work on the assumption that all faces are quadrilaterals, which makes an efficient representation using \texttt{boost::multi\_array} possible. The \texttt{update} method expects a list of faces that need updating. This list is filled by the \texttt{update} method from \texttt{cache\_input}. \end{document} ================================================ FILE: docs/wiki/CMakeLists.txt ================================================ PROJECT(wiki) IF(NOT WIN32) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/make-wiki-docs-plugins.py ${CMAKE_CURRENT_BINARY_DIR}/make-wiki-docs-plugins.py) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/make-wiki-docs-primitives.py ${CMAKE_CURRENT_BINARY_DIR}/make-wiki-docs-primitives.py) ADD_CUSTOM_TARGET(docs-wiki COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/wikitext COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/wikitext COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/wikitext/articles COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/wikitext/categories COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/wikitext/templates COMMAND ${k3d_BINARY_DIR}/bin/k3d --log-level=debug --color --script-file=${CMAKE_CURRENT_BINARY_DIR}/make-wiki-docs-plugins.py --ui=nui COMMAND ${k3d_BINARY_DIR}/bin/k3d --log-level=debug --color --script-file=${CMAKE_CURRENT_BINARY_DIR}/make-wiki-docs-primitives.py --ui=nui WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) ENDIF(NOT WIN32) ================================================ FILE: docs/wiki/make-wiki-docs-plugins.py ================================================ #python import k3d import sys import os doc = k3d.new_document() # Used to sort plugins by-name ... def plugin_sort(lhs, rhs): if lhs.name() < rhs.name(): return -1 elif lhs.name() == rhs.name(): return 0 return 1 # Generate a mapping of categories to plugins ... categories = { "All" : [], "Stable" : [], "Experimental" : [], "Deprecated" : [] } for plugin in k3d.plugin.factory.lookup(): if plugin.metadata().has_key("k3d:disable-documentation"): continue categories["All"].append(plugin) if plugin.quality() == "stable": categories["Stable"].append(plugin) elif plugin.quality() == "experimental": categories["Experimental"].append(plugin) elif plugin.quality() == "deprecated": categories["Deprecated"].append(plugin) for category in plugin.categories(): if category not in categories: categories[category] = [] categories[category].append(plugin) # Create the main article for each plugin ... for plugin in sorted(k3d.plugin.factory.lookup(), plugin_sort): if plugin.metadata().has_key("k3d:disable-documentation"): continue print """Creating main article for """ + plugin.name() + """ ...""" article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/articles/" + plugin.name(), "w") article.write("{{" + plugin.name() + "}}\n") # Create an article listing every plugin category ... print """Creating plugin categories article ...""" article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/categories/Plugin Categories", "w") article.write("""\n""") article.write("""\n""") article.write("""\n""") for category in sorted(categories.keys()): article.write("""\n""") article.write("""
Plugin Categories
[[""" + category + " Plugins]]
\n""") article.write("""\n""") # Create an article for each plugin category ... for category in sorted(categories.keys()): print """Creating plugin category article """ + category + """ ...""" article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/categories/" + category + " Plugins", "w") article.write("\n") article.write("""
\n""") article.write("""\n""") article.write("""\n""") article.write("""
Category:""" + category + """
Plugins:""" + str(len(categories[category])) + """
\n""") article.write("""\n""") article.write("""\n""") for plugin in sorted(categories[category], plugin_sort): article.write("""""") if os.path.exists("@share_SOURCE_DIR@/ngui/rasterized/" + plugin.name() + ".png"): article.write("""""") else: article.write("""""") article.write("""\n""") article.write("""
IconPluginDescription
[[Image:""" + plugin.name() + """.png]] [[""" + plugin.name() + """]]""" + plugin.short_description() + """
\n""") article.write("\n") # Create the reference documentation for each plugin ... for plugin in sorted(k3d.plugin.factory.lookup(), plugin_sort): if plugin.metadata().has_key("k3d:disable-documentation"): continue print """Creating reference documentation for """ + plugin.name() + """ ...""" plugin_quality = "" if plugin.quality() == "stable": plugin_quality = "Stable" elif plugin.quality() == "experimental": plugin_quality = "Experimental" elif plugin.quality() == "deprecated": plugin_quality = "Deprecated" article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/templates/" + plugin.name(), "w") article.write("\n") article.write("== Description == " + "\n") article.write("{| border=\"0\" cellpadding=\"5\" cellspacing=\"0\"\n") article.write("|-\n") if os.path.exists("@share_SOURCE_DIR@/ngui/rasterized/" + plugin.name() + ".png"): article.write("|[[Image:" + plugin.name() + ".png]]\n") article.write("|" + plugin.short_description() + "\n") article.write("|}\n") article.write("""\n""") article.write("""\n""") article.write("""\n""") article.write("""
Plugin Status:[[Plugin Status|""" + plugin_quality + """]]
Categories:""") article.write("""[[All Plugins]]""") article.write(""", [[""" + plugin_quality + " Plugins]]""") for category in plugin.categories(): article.write(""", [[""" + category + " Plugins]]""") article.write("""
\n""") article.write("== Metadata == " + "\n") article.write("{| border=\"1\" cellpadding=\"5\" cellspacing=\"0\"\n") article.write("! Name\n") article.write("! Value\n") for name in plugin.metadata(): article.write("|-\n") article.write("|'''" + name + "'''\n") article.write("|" + plugin.metadata()[name] + "\n") article.write("|}\n") if plugin.is_document_plugin(): node = k3d.plugin.create(plugin, doc) if node: article.write("== Properties == " + "\n") article.write("{| border=\"1\" cellpadding=\"5\" cellspacing=\"0\"\n") article.write("! Label\n") article.write("! Description\n") article.write("! Type\n") article.write("! Script Name\n") for property in node.properties(): # Skip the "name" property, which is a special-case ... if property.name() == "name": continue type_link = "[[Property Types#" + property.type() + "|" + property.type() + "]]" if len(property.type()) else "" article.write("|-\n") article.write("|'''" + property.label() + "'''\n") article.write("|" + property.description() + "\n") article.write("|" + type_link + "\n") article.write("|" + property.name() + "\n") article.write("|}\n") article.write("\n") k3d.close_document(doc) sys.stdout.flush() ================================================ FILE: docs/wiki/make-wiki-docs-primitives.py ================================================ #python import k3d import sys import os primitive_types = [k3d.bezier_triangle_patch, k3d.bicubic_patch, k3d.bilinear_patch, k3d.blobby, k3d.cone, k3d.cubic_curve, k3d.cylinder, k3d.disk, k3d.hyperboloid, k3d.linear_curve, k3d.nurbs_curve, k3d.nurbs_patch, k3d.paraboloid, k3d.particle, k3d.polyhedron, k3d.sphere, k3d.teapot, k3d.torus] primitive_names = ["Bezier Triangle Patch", "Bicubic Patch", "Bilinear Patch", "Blobby", "Cone", "Cubic Curve", "Cylinder", "Disk", "Hyperboloid", "Linear Curve", "NURBS Curve", "NURBS Patch", "Paraboloid", "Particle", "Polyhedron", "Sphere", "Teapot", "Torus"] # Create a table listing primitive components ... print """Creating primitive components table ...""" article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/templates/Primitive Components Table", "w") article.write("""\n""") article.write("""\n""") article.write("""\n""") for i in range(len(primitive_types)): primitive_type = primitive_types[i] primitive_name = primitive_names[i] document = k3d.new_document() source = k3d.plugin.create("FrozenMesh", document) mesh = source.create_mesh() primitive_type.create(mesh) primitive = mesh.primitives()[0] article.write("""""") article.write("""""") article.write("""""") article.write("""""") article.write("""\n""") k3d.close_document(document) article.write("""
Primitive TypeStructureAttributes
[[""" + primitive_name + """ Primitive]]""" + ", ".join(primitive.structure().keys()) + """""" + ", ".join(primitive.attributes().keys()) + """
\n""") article.write("""\n""") # Create the main article for each primitive type ... for primitive_name in primitive_names: print """Creating main article for """ + primitive_name + """ Primitive ...""" article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/articles/" + primitive_name + " Primitive", "w") article.write("""{{""" + primitive_name + """ Primitive}}\n""") # Create the reference material for each primitive type ... for i in range(len(primitive_types)): primitive_type = primitive_types[i] primitive_name = primitive_names[i] print """Creating reference documentation for """ + primitive_name + """ Primitive ...""" article = file("@CMAKE_CURRENT_BINARY_DIR@/wikitext/templates/" + primitive_name + " Primitive", "w") article.write("""\n""") article.write("""== Data Structure ==\n""") article.write("\n") document = k3d.new_document() source = k3d.plugin.create("FrozenMesh", document) mesh = source.create_mesh() primitive_type.create(mesh) need_points = False primitive = mesh.primitives()[0] for table_name in primitive.structure().keys(): table = primitive.structure()[table_name] for array_name in table.keys(): array = table[array_name] if array.get_metadata_value("k3d:domain") == "k3d:point-indices": need_points = True if need_points: mesh.create_points() mesh.create_point_selection() writer = k3d.plugin.create("GraphVizMeshWriter", document) k3d.property.connect(document, source.get_property("output_mesh"), writer.get_property("input_mesh")) article.write(writer.output_string) k3d.close_document(document) article.write("\n") article.write("""\n""") ================================================ FILE: docs/xml/document_schema.xsd ================================================ ================================================ FILE: docs/xml/slmeta_schema.xsd ================================================ ================================================ FILE: gendef/CMakeLists.txt ================================================ PROJECT(gendef) ADD_EXECUTABLE(k3d-gendef gendef.cc) ================================================ FILE: gendef/gendef.cc ================================================ /* * MICO --- an Open Source CORBA implementation * Copyright (c) 2003 Harald Bhme * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * For more information, visit the MICO Home Page at * http://www.mico.org/ */ /* Modified by Cedric Gustin on 2006/01/13 : * Redirect the output of dumpbin to dumpbin.out instead of reading the * output stream of popen, as it fails with Visual Studio 2005 in * pre-link build events. */ #include #include #include using namespace std; int main(int argc,char** argv) { if (argc < 4) { cerr << "Usage: " << argv[0] << " ...." << endl; return 2; } // CG : Explicitly redirect stdout to dumpbin.out. string dumpbin = "dumpbin /SYMBOLS /OUT:dumpbin.out"; int i = 3; for(;i fct def_file << " " << (s+1) << endl; else if(strchr(s,'?')!=0 && strncmp(s,"??_G",4)!=0 && strncmp(s,"??_E",4)!=0) { def_file << " " << s << endl; } } } } // CG : Close dumpbin.out and delete it. fclose(dump); remove("dumpbin.out"); cout << dumpbin.c_str() << endl; } ================================================ FILE: k3dsdk/CMakeLists.txt ================================================ PROJECT(k3dsdk) FILE(GLOB HEADERS *.h) FILE(GLOB SOURCES *.cpp) LIST(SORT HEADERS) LIST(SORT SOURCES) IF(WIN32 AND K3D_COMPILER_GCC) # For some reason, serialization_xml.cpp takes *forever* to build with optimizations enabled SET_SOURCE_FILES_PROPERTIES(serialization_xml.cpp PROPERTIES COMPILE_FLAGS -O0) ENDIF(WIN32 AND K3D_COMPILER_GCC) CONFIGURE_FILE(${k3dsdk_SOURCE_DIR}/k3d-i18n-config.h.in ${k3dsdk_BINARY_DIR}/k3d-i18n-config.h) CONFIGURE_FILE(${k3dsdk_SOURCE_DIR}/k3d-ngui-config.h.in ${k3dsdk_BINARY_DIR}/k3d-ngui-config.h) CONFIGURE_FILE(${k3dsdk_SOURCE_DIR}/k3d-parallel-config.h.in ${k3dsdk_BINARY_DIR}/k3d-parallel-config.h) CONFIGURE_FILE(${k3dsdk_SOURCE_DIR}/k3d-platform-config.h.in ${k3dsdk_BINARY_DIR}/k3d-platform-config.h) CONFIGURE_FILE(${k3dsdk_SOURCE_DIR}/k3d-version-config.h.in ${k3dsdk_BINARY_DIR}/k3d-version-config.h) INCLUDE_DIRECTORIES( ${k3d_SOURCE_DIR} ${k3dsdk_BINARY_DIR} ${Boost_INCLUDE_DIRS} ${k3dsdk_SOURCE_DIR}/gil ${K3D_GLIBMM_INCLUDE_DIRS} ${K3D_SIGC_INCLUDE_DIRS} ${K3D_OPENGL_INCLUDE_DIR} ) IF(K3D_ENABLE_PARALLEL) INCLUDE_DIRECTORIES(${K3D_TBB_INCLUDE_DIR}) ENDIF(K3D_ENABLE_PARALLEL) IF(K3D_ENABLE_PROFILING) INCLUDE_DIRECTORIES(${K3D_GPERFTOOLS_INCLUDE_DIR}) ENDIF(K3D_ENABLE_PROFILING) INCLUDE_DIRECTORIES(${K3D_XML_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${K3D_ZLIB_INCLUDE_DIRS}) LINK_DIRECTORIES(${K3D_GLIBMM_LIB_DIRS}) LINK_DIRECTORIES(${K3D_SIGC_LIB_DIRS}) LINK_DIRECTORIES(${K3D_ZLIB_LIB_DIRS}) K3D_ADD_LIBRARY(k3dsdk SHARED ${HEADERS} ${SOURCES}) K3D_GENERATE_DEF_FILE(k3dsdk) TARGET_LINK_LIBRARIES(k3dsdk ${K3D_GLIBMM_LIBS} ${K3D_SIGC_LIBS} ${K3D_XML_LIB} ${K3D_ZLIB_LIBS} ${K3D_OPENGL_LIBRARIES} k3dsdk-half k3dsdk-sgi-tesselator k3dsdk-parallel ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_DL_LIBS} # for gold linker ) IF(K3D_ENABLE_NLS) INCLUDE_DIRECTORIES(${K3D_INTL_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(k3dsdk ${K3D_INTL_LIBS}) ENDIF(K3D_ENABLE_NLS) IF(K3D_ENABLE_PROFILING) TARGET_LINK_LIBRARIES(k3dsdk ${K3D_PROFILER_LIBRARY}) ENDIF(K3D_ENABLE_PROFILING) IF(WIN32) TARGET_LINK_LIBRARIES(k3dsdk ole32) TARGET_LINK_LIBRARIES(k3dsdk ws2_32) ENDIF(WIN32) ADD_SUBDIRECTORY(Half) ADD_SUBDIRECTORY(expression) ADD_SUBDIRECTORY(gl) ADD_SUBDIRECTORY(parallel) ADD_SUBDIRECTORY(resource) ADD_SUBDIRECTORY(sgi_tesselator) ADD_SUBDIRECTORY(subdivision_surface) K3D_ADD_SUBDIRECTORY(ngui REQUIRES K3D_BUILD_NGUI_MODULE) K3D_ADD_SUBDIRECTORY(qtui REQUIRES K3D_BUILD_QTUI_MODULE) K3D_ADD_SUBDIRECTORY(python REQUIRES K3D_ENABLE_PYTHON) INSTALL(TARGETS k3dsdk RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(FILES ${HEADERS} DESTINATION include/k3d/k3dsdk) INSTALL(FILES ${k3dsdk_BINARY_DIR}/k3d-i18n-config.h DESTINATION ${K3D_LIBDIR}/k3d/include) INSTALL(FILES ${k3dsdk_BINARY_DIR}/k3d-ngui-config.h DESTINATION ${K3D_LIBDIR}/k3d/include) INSTALL(FILES ${k3dsdk_BINARY_DIR}/k3d-parallel-config.h DESTINATION ${K3D_LIBDIR}/k3d/include) INSTALL(FILES ${k3dsdk_BINARY_DIR}/k3d-platform-config.h DESTINATION ${K3D_LIBDIR}/k3d/include) INSTALL(FILES ${k3dsdk_BINARY_DIR}/k3d-version-config.h DESTINATION ${K3D_LIBDIR}/k3d/include) ================================================ FILE: k3dsdk/Half/AUTHORS ================================================ Developers: ----------- Florian Kainz Rod Bogart Drew Hess Paul Schneider Bill Anderson Contributors: ------------- Simon Green Rito Trevino Josh Pines Christian Rouet Rodrigo Damazio Wojciech Jarosz Greg Ward Joseph Goldstone Win32 port contributors: ------------------------ Dustin Graves Jukka Liimatta Baumann Konstantin Daniel Koch Luc-Eric Rousseau E. Scott Larsen stephan mantler Andreas Kahler Frank Jargstorff Lutz Latta ================================================ FILE: k3dsdk/Half/CMakeLists.txt ================================================ PROJECT(k3dsdk-half) ADD_EXECUTABLE(eLut eLut.cpp) GET_TARGET_PROPERTY(eLut_EXE eLut LOCATION) ADD_EXECUTABLE(toFloat toFloat.cpp) GET_TARGET_PROPERTY(toFloat_EXE toFloat LOCATION) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/eLut.h DEPENDS eLut COMMAND ${eLut_EXE} > ${CMAKE_CURRENT_BINARY_DIR}/eLut.h ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h DEPENDS toFloat COMMAND ${toFloat_EXE} > ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h ) SET(SOURCES ${CMAKE_CURRENT_BINARY_DIR}/eLut.h ${CMAKE_CURRENT_BINARY_DIR}/toFloat.h half.cpp half.h halfFunction.h halfLimits.h ) INCLUDE_DIRECTORIES(${k3dsdk-half_SOURCE_DIR}) INCLUDE_DIRECTORIES(${k3dsdk-half_BINARY_DIR}) K3D_ADD_LIBRARY(k3dsdk-half SHARED ${SOURCES}) K3D_GENERATE_DEF_FILE(k3dsdk-half) INSTALL(TARGETS k3dsdk-half RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR} ) ================================================ FILE: k3dsdk/Half/COPYING ================================================ Copyright (c) 2002, Industrial Light & Magic, a division of Lucas Digital Ltd. LLC All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Industrial Light & Magic nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: k3dsdk/Half/LICENSE ================================================ Copyright (c) 2002, Industrial Light & Magic, a division of Lucas Digital Ltd. LLC All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Industrial Light & Magic nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: k3dsdk/Half/README ================================================ ABOUT THE OPENEXR LIBRARIES ---------------------------- Half is a class that encapsulates our 16-bit floating-point format. IlmImf is our "EXR" file format for storing 16-bit FP images. Imath is a math library. IlmImf only uses a subset of it, but we're releasing the full library because it's easier for us to maintain, and we think it'll be useful to others. Iex is an exception-handling library. Documentation on all of these libraries is incomplete. See the .h files for API details. Most of the interfaces are well-documented from a programmer's perspective. See the IlmImfExamples directory for some code that demonstrates how to use the IlmImf library to read and write OpenEXR files. The doc directory contains some high-level documentation and history about the OpenEXR format. If you have questions about using the OpenEXR libraries, you may want to join our developer mailing list. See http://www.openexr.com for details. LICENSE ------- The OpenEXR distribution is covered by a modified BSD license; see the file named COPYING (included in this distribution) for details. WHAT'S INCLUDED --------------- The release includes exrdisplay, an image viewer for OpenEXR images; and exrheader, a utility for dumping header information from OpenEXR files. exrdisplay requires FLTK 1.1 or greater and OpenGL. exrdisplay now supports fragment shaders if you have the Nvidia Cg SDK and a graphics card capable of running fp30 profile fragment shaders. See exrdisplay/README for details. We have also released an OpenEXR display driver for Renderman and a plugin for Adobe Photoshop (on both Windows and MacOS). These are packaged separately. Go to our GNU Savannah web page to download them: http://savannah.nongnu.org/files/?group=openexr BUILDING OPENEXR ---------------- To build OpenEXR on GNU/Linux or other UNIX-like systems, do: ./configure make make install If you have the Nvidia Cg SDK and you want to build support for fragment shaders into exrdisplay, specify the path to the SDK using the "--with-nvsdk-prefix" flag. See README.OSX for details on building OpenEXR in MacOS X. Do 'make check' to run confidence tests. See the INSTALL file for more details or try "./configure --help". Other UNIX variants haven't been tested, but should be easy to build. Let us know if you're having problems porting OpenEXR to a particular platform. See below for platform-specific notes. All include files needed to use the OpenEXR libraries are installed in the OpenEXR subdirectory of the install prefix, e.g. /usr/local/include/OpenEXR. To build OpenEXR on Windows NT or greater, you have a few choices: * Use Cygwin and the 'configure' script, see above. * Use Visual C++ 6.0 with Intel's C++ compiler. * Use Visual Studio .NET 2003 with Microsoft's C++ compiler. See README.win32 for details. ================================================ FILE: k3dsdk/Half/eLut.cpp ================================================ /////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Industrial Light & Magic nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// #include #include using namespace std; //----------------------------------------------------- // Compute a lookup table for float-to-half conversion. // // When indexed with the combined sign and exponent of // a float, the table either returns the combined sign // and exponent of the corresponding half, or zero if // the corresponding half may not be normalized (zero, // denormalized, overflow). //----------------------------------------------------- void initELut (unsigned short eLut[]) { for (int i = 0; i < 0x100; i++) { int e = (i & 0x0ff) - (127 - 15); if (e <= 0 || e >= 30) { // // Special case // eLut[i] = 0; eLut[i | 0x100] = 0; } else { // // Common case - normalized half, no exponent overflow possible // eLut[i] = (e << 10); eLut[i | 0x100] = ((e << 10) | 0x8000); } } } //------------------------------------------------------------ // Main - prints the sign-and-exponent conversion lookup table //------------------------------------------------------------ int main () { const int tableSize = 1 << 9; unsigned short eLut[tableSize]; initELut (eLut); cout << "//\n" "// This is an automatically generated file.\n" "// Do not edit.\n" "//\n\n"; cout << "{\n "; for (int i = 0; i < tableSize; i++) { cout << setw (5) << eLut[i] << ", "; if (i % 8 == 7) { cout << "\n"; if (i < tableSize - 1) cout << " "; } } cout << "};\n"; return 0; } ================================================ FILE: k3dsdk/Half/half.cpp ================================================ /////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Industrial Light & Magic nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// // Primary authors: // Florian Kainz // Rod Bogart //--------------------------------------------------------------------------- // // class half -- // implementation of non-inline members // //--------------------------------------------------------------------------- #include #include using namespace std; //------------------------------------------------------------- // Lookup tables for half-to-float and float-to-half conversion //------------------------------------------------------------- const half::uif half::_toFloat[1 << 16] = #include const unsigned short half::_eLut[1 << 9] = #include //-------------------------------------- // Dummy flag, initialized by selftest() //-------------------------------------- const bool half::_itWorks = selftest(); //----------------------------------------------- // Overflow handler for float-to-half conversion; // generates a hardware floating-point overflow, // which may be trapped by the operating system. //----------------------------------------------- float half::overflow () { volatile float f = 1e10; for (int i = 0; i < 10; i++) f *= f; // this will overflow before // the forloop terminates return f; } //----------------------------------------------------- // Float-to-half conversion -- general case, including // zeroes, denormalized numbers and exponent overflows. //----------------------------------------------------- short half::convert (int i) { // // Our floating point number, f, is represented by the bit // pattern in integer i. Disassemble that bit pattern into // the sign, s, the exponent, e, and the significand, m. // Shift s into the position where it will go in in the // resulting half number. // Adjust e, accounting for the different exponent bias // of float and half (127 versus 15). // register int s = (i >> 16) & 0x00008000; register int e = ((i >> 23) & 0x000000ff) - (127 - 15); register int m = i & 0x007fffff; // // Now reassemble s, e and m into a half: // if (e <= 0) { if (e < -10) { // // E is less than -10. The absolute value of f is // less than HALF_MIN (f may be a small normalized // float, a denormalized float or a zero). // // We convert f to a half zero. // return 0; } // // E is between -10 and 0. F is a normalized float, // whose magnitude is less than HALF_NRM_MIN. // // We convert f to a denormalized half. // m = (m | 0x00800000) >> (1 - e); // // Round to nearest, round "0.5" up. // // Rounding may cause the significand to overflow and make // our number normalized. Because of the way a half's bits // are laid out, we don't have to treat this case separately; // the code below will handle it correctly. // if (m & 0x00001000) m += 0x00002000; // // Assemble the half from s, e (zero) and m. // return s | (m >> 13); } else if (e == 0xff - (127 - 15)) { if (m == 0) { // // F is an infinity; convert f to a half // infinity with the same sign as f. // return s | 0x7c00; } else { // // F is a NAN; produce a half NAN that preserves // the sign bit and the 10 leftmost bits of the // significand of f. // return s | 0x7c00 | (m >> 13); } } else { // // E is greater than zero. F is a normalized float. // We try to convert f to a normalized half. // // // Round to nearest, round "0.5" up // if (m & 0x00001000) { m += 0x00002000; if (m & 0x00800000) { m = 0; // overflow in significand, e += 1; // adjust exponent } } // // Handle exponent overflow // if (e > 30) { overflow (); // Cause a hardware floating point overflow; return s | 0x7c00; // if this returns, the half becomes an } // infinity with the same sign as f. // // Assemble the half from s, e and m. // return s | (e << 10) | (m >> 13); } } //-------------------------------------- // Simple selftest, triggered by static // initialization of half::_itWorks flag //-------------------------------------- namespace { void testNormalized (float f) { half h (f); float e (1 - h / f); if (e < 0) e = -e; if (e > HALF_EPSILON * 0.5) { cerr << "Internal error: float/half conversion does not work."; assert (false); } } void testDenormalized (float f) { half h (f); float e (h - f); if (e < 0) e = -e; if (e > HALF_MIN * 0.5) { cerr << "Internal error: float/half conversion does not work."; assert (false); } } } bool half::selftest () { testNormalized ((float) HALF_MAX); testNormalized ((float) -HALF_MAX); testNormalized ( 0.1f); testNormalized (-0.1f); testNormalized ( 0.5f); testNormalized (-0.5f); testNormalized ( 1.0f); testNormalized (-1.0f); testNormalized ( 2.0f); testNormalized (-2.0f); testNormalized ( 3.0f); testNormalized (-3.0f); testNormalized ( 17.0f); testNormalized (-17.0f); testNormalized ((float) HALF_NRM_MIN); testNormalized ((float) -HALF_NRM_MIN); testDenormalized ((float) HALF_MIN); testDenormalized ((float) -HALF_MIN); testDenormalized ( 0.0f); testDenormalized (-0.0f); return true; } //--------------------- // Stream I/O operators //--------------------- ostream & operator << (ostream &os, half h) { os << float (h); return os; } istream & operator >> (istream &is, half &h) { float f; is >> f; h = half (f); return is; } //--------------------------------------- // Functions to print the bit-layout of // floats and halfs, mostly for debugging //--------------------------------------- void printBits (ostream &os, half h) { unsigned short b = h.bits(); for (int i = 15; i >= 0; i--) { os << (((b >> i) & 1)? '1': '0'); if (i == 15 || i == 10) os << ' '; } } void printBits (ostream &os, float f) { half::uif x; x.f = f; for (int i = 31; i >= 0; i--) { os << (((x.i >> i) & 1)? '1': '0'); if (i == 31 || i == 23) os << ' '; } } void printBits (char c[19], half h) { unsigned short b = h.bits(); for (int i = 15, j = 0; i >= 0; i--, j++) { c[j] = (((b >> i) & 1)? '1': '0'); if (i == 15 || i == 10) c[++j] = ' '; } c[18] = 0; } void printBits (char c[35], float f) { half::uif x; x.f = f; for (int i = 31, j = 0; i >= 0; i--, j++) { c[j] = (((x.i >> i) & 1)? '1': '0'); if (i == 31 || i == 23) c[++j] = ' '; } c[34] = 0; } ================================================ FILE: k3dsdk/Half/half.h ================================================ /////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Industrial Light & Magic nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// // Primary authors: // Florian Kainz // Rod Bogart //--------------------------------------------------------------------------- // // half -- a 16-bit floating point number class: // // Type half can represent positive and negative numbers, whose // magnitude is between roughly 6.1e-5 and 6.5e+4, with a relative // error of 9.8e-4; numbers smaller than 6.1e-5 can be represented // with an absolute error of 6.0e-8. All integers from -2048 to // +2048 can be represented exactly. // // Type half behaves (almost) like the built-in C++ floating point // types. In arithmetic expressions, half, float and double can be // mixed freely. Here are a few examples: // // half a (3.5); // float b (a + sqrt (a)); // a += b; // b += a; // b = a + 7; // // Conversions from half to float are lossless; all half numbers // are exactly representable as floats. // // Conversions from float to half may not preserve the float's // value exactly. If a float is not representable as a half, the // float value is rounded to the nearest representable half. If // a float value is exactly in the middle between the two closest // representable half values, then the float value is rounded to // the half with the greater magnitude. // // Overflows during float-to-half conversions cause arithmetic // exceptions. An overflow occurs when the float value to be // converted is too large to be represented as a half, or if the // float value is an infinity or a NAN. // // The implementation of type half makes the following assumptions // about the implementation of the built-in C++ types: // // float is an IEEE 754 single-precision number // sizeof (float) == 4 // sizeof (unsigned int) == sizeof (float) // alignof (unsigned int) == alignof (float) // sizeof (unsigned short) == 2 // //--------------------------------------------------------------------------- #ifndef _HALF_H_ #define _HALF_H_ #include #include #ifdef K3D_COMPILER_MSVC #ifdef k3dsdk_half_EXPORTS #define K3D_HALF_EXPORT // No dllexport needed, since it's handled by gendef #else #define K3D_HALF_EXPORT __declspec(dllimport) #endif #else // K3D_COMPILER_MSVC #define K3D_HALF_EXPORT #endif // !K3D_COMPILER_MSVC class half { public: //------------- // Constructors //------------- half (); // no initialization half (const half &h); half (float f); //-------------------- // Conversion to float //-------------------- operator float () const; //------------ // Unary minus //------------ half operator - () const; //----------- // Assignment //----------- half operator = (half h); half operator = (float f); half operator += (half h); half operator += (float f); half operator -= (half h); half operator -= (float f); half operator *= (half h); half operator *= (float f); half operator /= (half h); half operator /= (float f); //--------------------------------------------------------- // Round to n-bit precision (n should be between 0 and 10). // After rounding, the significand's 10-n least significant // bits will be zero. //--------------------------------------------------------- half round (unsigned int n) const; //-------------------------------------------------------------------- // Classification: // // h.isFinite() returns true if h is a normalized number, // a denormalized number or zero // // h.isNormalized() returns true if h is a normalized number // // h.isDenormalized() returns true if h is a denormalized number // // h.isZero() returns true if h is zero // // h.isNan() returns true if h is a NAN // // h.isInfinity() returns true if h is a positive // or a negative infinity // // h.isNegative() returns true if the sign bit of h // is set (negative) //-------------------------------------------------------------------- bool isFinite () const; bool isNormalized () const; bool isDenormalized () const; bool isZero () const; bool isNan () const; bool isInfinity () const; bool isNegative () const; //-------------------------------------------- // Special values // // posInf() returns +infinity // // negInf() returns +infinity // // qNan() returns a NAN with the bit // pattern 0111111111111111 // // sNan() returns a NAN with the bit // pattern 0111110111111111 //-------------------------------------------- static half posInf (); static half negInf (); static half qNan (); static half sNan (); //-------------------------------------- // Access to the internal representation //-------------------------------------- unsigned short bits () const; void setBits (unsigned short bits); public: union uif { unsigned int i; float f; }; private: static short convert (int i); static float overflow (); static bool selftest (); unsigned short _h; K3D_HALF_EXPORT static const uif _toFloat[1 << 16]; K3D_HALF_EXPORT static const unsigned short _eLut[1 << 9]; K3D_HALF_EXPORT static const bool _itWorks; }; //----------- // Stream I/O //----------- std::ostream & operator << (std::ostream &os, half h); std::istream & operator >> (std::istream &is, half &h); //---------- // Debugging //---------- void printBits (std::ostream &os, half h); void printBits (std::ostream &os, float f); void printBits (char c[19], half h); void printBits (char c[35], float f); //------- // Limits //------- #define HALF_MIN 5.96046448e-08 // Smallest positive half #define HALF_NRM_MIN 6.10351562e-05 // Smallest positive normalized half #define HALF_MAX 65504.0 // Largest positive half #define HALF_EPSILON 0.00097656 // Smallest positive e for which // half (1.0 + e) != half (1.0) #define HALF_MANT_DIG 11 // Number of digits in mantissa // (significand + hidden leading 1) #define HALF_DIG 2 // Number of base 10 digits that // can be represented without change #define HALF_RADIX 2 // Base of the exponent #define HALF_MIN_EXP -13 // Minimum negative integer such that // HALF_RADIX raised to the power of // one less than that integer is a // normalized half #define HALF_MAX_EXP 16 // Maximum positive integer such that // HALF_RADIX raised to the power of // one less than that integer is a // normalized half #define HALF_MIN_10_EXP -4 // Minimum positive integer such // that 10 raised to that power is // a normalized half #define HALF_MAX_10_EXP 4 // Maximum positive integer such // that 10 raised to that power is // a normalized half //--------------------------------------------------------------------------- // // Implementation -- // // Representation of a float: // // We assume that a float, f, is an IEEE 754 single-precision // floating point number, whose bits are arranged as follows: // // 31 (msb) // | // | 30 23 // | | | // | | | 22 0 (lsb) // | | | | | // X XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX // // s e m // // S is the sign-bit, e is the exponent and m is the significand. // // If e is between 1 and 254, f is a normalized number: // // s e-127 // f = (-1) * 2 * 1.m // // If e is 0, and m is not zero, f is a denormalized number: // // s -126 // f = (-1) * 2 * 0.m // // If e and m are both zero, f is zero: // // f = 0.0 // // If e is 255, f is an "infinity" or "not a number" (NAN), // depending on whether m is zero or not. // // Examples: // // 0 00000000 00000000000000000000000 = 0.0 // 0 01111110 00000000000000000000000 = 0.5 // 0 01111111 00000000000000000000000 = 1.0 // 0 10000000 00000000000000000000000 = 2.0 // 0 10000000 10000000000000000000000 = 3.0 // 1 10000101 11110000010000000000000 = -124.0625 // 0 11111111 00000000000000000000000 = +infinity // 1 11111111 00000000000000000000000 = -infinity // 0 11111111 10000000000000000000000 = NAN // 1 11111111 11111111111111111111111 = NAN // // Representation of a half: // // Here is the bit-layout for a half number, h: // // 15 (msb) // | // | 14 10 // | | | // | | | 9 0 (lsb) // | | | | | // X XXXXX XXXXXXXXXX // // s e m // // S is the sign-bit, e is the exponent and m is the significand. // // If e is between 1 and 30, h is a normalized number: // // s e-15 // h = (-1) * 2 * 1.m // // If e is 0, and m is not zero, h is a denormalized number: // // S -14 // h = (-1) * 2 * 0.m // // If e and m are both zero, h is zero: // // h = 0.0 // // If e is 31, h is an "infinity" or "not a number" (NAN), // depending on whether m is zero or not. // // Examples: // // 0 00000 0000000000 = 0.0 // 0 01110 0000000000 = 0.5 // 0 01111 0000000000 = 1.0 // 0 10000 0000000000 = 2.0 // 0 10000 1000000000 = 3.0 // 1 10101 1111000001 = -124.0625 // 0 11111 0000000000 = +infinity // 1 11111 0000000000 = -infinity // 0 11111 1000000000 = NAN // 1 11111 1111111111 = NAN // // Conversion: // // Converting from a float to a half requires some non-trivial bit // manipulations. In some cases, this makes conversion relatively // slow, but the most common case is accelerated via table lookups. // // Converting back from a half to a float is easier because we don't // have to do any rounding. In addition, there are only 65536 // different half numbers; we can convert each of those numbers once // and store the results in a table. Later, all conversions can be // done using only simple table lookups. // //--------------------------------------------------------------------------- //-------------------- // Simple constructors //-------------------- inline half::half () { // no initialization } inline half::half (const half &h) { _h = h._h; } //---------------------------- // Half-from-float constructor //---------------------------- inline half::half (float f) { if (f == 0) { // // Common special case - zero. // For speed, we don't preserve the zero's sign. // _h = 0; } else { // // We extract the combined sign and exponent, e, from our // floating-point number, f. Then we convert e to the sign // and exponent of the half number via a table lookup. // // For the most common case, where a normalized half is produced, // the table lookup returns a non-zero value; in this case, all // we have to do, is round f's significand to 10 bits and combine // the result with e. // // For all other cases (overflow, zeroes, denormalized numbers // resulting from underflow, infinities and NANs), the table // lookup returns zero, and we call a longer, non-inline function // to do the float-to-half conversion. // uif x; x.f = f; register int e = (x.i >> 23) & 0x000001ff; e = _eLut[e]; if (e) { // // Simple case - round the significand and // combine it with the sign and exponent. // _h = e + (((x.i & 0x007fffff) + 0x00001000) >> 13); } else { // // Difficult case - call a function. // _h = convert (x.i); } } } //------------------------------------------ // Half-to-float conversion via table lookup //------------------------------------------ inline half::operator float () const { return _toFloat[_h].f; } //------------------------- // Round to n-bit precision //------------------------- inline half half::round (unsigned int n) const { // // Parameter check. // if (n >= 10) return *this; // // Disassemble h into the sign, s, // and the combined exponent and significand, e. // unsigned short s = _h & 0x8000; unsigned short e = _h & 0x7fff; // // Round the exponent and significand to the nearest value // where ones occur only in the (10-n) most significant bits. // Note that the exponent adjusts automatically if rounding // up causes the significand to overflow. // e >>= 9 - n; e += e & 1; e <<= 9 - n; // // Check for exponent overflow. // if (e >= 0x7c00) { // // Overflow occurred -- truncate instead of rounding. // e = _h; e >>= 10 - n; e <<= 10 - n; } // // Put the original sign bit back. // half h; h._h = s | e; return h; } //----------------------- // Other inline functions //----------------------- inline half half::operator - () const { half h; h._h = _h ^ 0x8000; return h; } inline half half::operator = (half h) { _h = h._h; return *this; } inline half half::operator = (float f) { *this = half (f); return *this; } inline half half::operator += (half h) { *this = half (float (*this) + float (h)); return *this; } inline half half::operator += (float f) { *this = half (float (*this) + f); return *this; } inline half half::operator -= (half h) { *this = half (float (*this) - float (h)); return *this; } inline half half::operator -= (float f) { *this = half (float (*this) - f); return *this; } inline half half::operator *= (half h) { *this = half (float (*this) * float (h)); return *this; } inline half half::operator *= (float f) { *this = half (float (*this) * f); return *this; } inline half half::operator /= (half h) { *this = half (float (*this) / float (h)); return *this; } inline half half::operator /= (float f) { *this = half (float (*this) / f); return *this; } inline bool half::isFinite () const { unsigned short e = (_h >> 10) & 0x001f; return e < 31; } inline bool half::isNormalized () const { unsigned short e = (_h >> 10) & 0x001f; return e > 0 && e < 31; } inline bool half::isDenormalized () const { unsigned short e = (_h >> 10) & 0x001f; unsigned short m = _h & 0x3ff; return e == 0 && m != 0; } inline bool half::isZero () const { return (_h & 0x7fff) == 0; } inline bool half::isNan () const { unsigned short e = (_h >> 10) & 0x001f; unsigned short m = _h & 0x3ff; return e == 31 && m != 0; } inline bool half::isInfinity () const { unsigned short e = (_h >> 10) & 0x001f; unsigned short m = _h & 0x3ff; return e == 31 && m == 0; } inline bool half::isNegative () const { return (_h & 0x8000) != 0; } inline half half::posInf () { half h; h._h = 0x7c00; return h; } inline half half::negInf () { half h; h._h = 0xfc00; return h; } inline half half::qNan () { half h; h._h = 0x7fff; return h; } inline half half::sNan () { half h; h._h = 0x7dff; return h; } inline unsigned short half::bits () const { return _h; } inline void half::setBits (unsigned short bits) { _h = bits; } #endif ================================================ FILE: k3dsdk/Half/halfFunction.h ================================================ /////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Industrial Light & Magic nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// // Primary authors: // Florian Kainz // Rod Bogart //--------------------------------------------------------------------------- // // halfFunction -- a class for fast evaluation // of half --> T functions // // The constructor for a halfFunction object, // // halfFunction (function, // domainMin, domainMax, // defaultValue, // posInfValue, negInfValue, // nanValue); // // evaluates the function for all finite half values in the interval // [domainMin, domainMax], and stores the results in a lookup table. // For finite half values that are not in [domainMin, domainMax], the // constructor stores defaultValue in the table. For positive infinity, // negative infinity and NANs, posInfValue, negInfValue and nanValue // are stored in the table. // // The tabulated function can then be evaluated quickly for arbitrary // half values by calling the the halfFunction object's operator() // method. // // Example: // // #include // #include // // halfFunction hsin (sin); // // halfFunction hsqrt (sqrt, // function // 0, HALF_MAX, // domain // half::qNan(), // sqrt(x) for x < 0 // half::posInf(), // sqrt(+inf) // half::qNan(), // sqrt(-inf) // half::qNan()); // sqrt(nan) // // half x = hsin (1); // half y = hsqrt (3.5); // //--------------------------------------------------------------------------- #ifndef _HALF_FUNCTION_H_ #define _HALF_FUNCTION_H_ #include #include template class halfFunction { public: //------------ // Constructor //------------ template halfFunction (Function f, half domainMin = -HALF_MAX, half domainMax = HALF_MAX, T defaultValue = 0, T posInfValue = 0, T negInfValue = 0, T nanValue = 0); //----------- // Evaluation //----------- T operator () (half x) const; private: T _lut[1 << 16]; }; //--------------- // Implementation //--------------- template template halfFunction::halfFunction (Function f, half domainMin, half domainMax, T defaultValue, T posInfValue, T negInfValue, T nanValue) { for (int i = 0; i < (1 << 16); i++) { half x; x.setBits (i); if (x.isNan()) _lut[i] = nanValue; else if (x.isInfinity()) _lut[i] = x.isNegative()? negInfValue: posInfValue; else if (x < domainMin || x > domainMax) _lut[i] = defaultValue; else _lut[i] = f (x); } } template inline T halfFunction::operator () (half x) const { return _lut[x.bits()]; } #endif ================================================ FILE: k3dsdk/Half/halfLimits.h ================================================ /////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Industrial Light & Magic nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// // Primary authors: // Florian Kainz // Rod Bogart #ifndef INCLUDED_HALF_LIMITS_H #define INCLUDED_HALF_LIMITS_H //------------------------------------------------------------------------ // // C++ standard library-style numeric_limits for class half // //------------------------------------------------------------------------ #ifdef HAVE_STL_LIMITS #include #include namespace std { template <> class numeric_limits { public: static const bool is_specialized = true; static half min () throw () {return HALF_NRM_MIN;} static half max () throw () {return HALF_MAX;} static const int digits = HALF_MANT_DIG; static const int digits10 = HALF_DIG; static const bool is_signed = true; static const bool is_integer = false; static const bool is_exact = false; static const int radix = HALF_RADIX; static half epsilon () throw () {return HALF_EPSILON;} static half round_error () throw () {return HALF_EPSILON / 2;} static const int min_exponent = HALF_MIN_EXP; static const int min_exponent10 = HALF_MIN_10_EXP; static const int max_exponent = HALF_MAX_EXP; static const int max_exponent10 = HALF_MAX_10_EXP; static const bool has_infinity = true; static const bool has_quiet_NaN = true; static const bool has_signaling_NaN = true; static const float_denorm_style has_denorm = denorm_present; static const bool has_denorm_loss = false; static half infinity () throw () {return half::posInf();} static half quiet_NaN () throw () {return half::qNan();} static half signaling_NaN () throw () {return half::sNan();} static half denorm_min () throw () {return HALF_MIN;} static const bool is_iec559 = false; static const bool is_bounded = false; static const bool is_modulo = false; static const bool traps = true; static const bool tinyness_before = false; static const float_round_style round_style = round_to_nearest; }; } // namespace std #endif #endif ================================================ FILE: k3dsdk/Half/toFloat.cpp ================================================ /////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas // Digital Ltd. LLC // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Industrial Light & Magic nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////// //--------------------------------------------------------------------------- // // toFloat // // A program to generate the lookup table for half-to-float // conversion needed by class half. // The program loops over all 65536 possible half numbers, // converts each of them to a float, and prints the result. // //--------------------------------------------------------------------------- #include #include using namespace std; //--------------------------------------------------- // Interpret an unsigned short bit pattern as a half, // and convert that half to the corresponding float's // bit pattern. //--------------------------------------------------- unsigned int halfToFloat (unsigned short y) { int s = (y >> 15) & 0x00000001; int e = (y >> 10) & 0x0000001f; int m = y & 0x000003ff; if (e == 0) { if (m == 0) { // // Plus or minus zero // return s << 31; } else { // // Denormalized number -- renormalize it // while (!(m & 0x00000400)) { m <<= 1; e -= 1; } e += 1; m &= ~0x00000400; } } else if (e == 31) { if (m == 0) { // // Positive or negative infinity // return (s << 31) | 0x7f800000; } else { // // Nan -- preserve sign and significand bits // return (s << 31) | 0x7f800000 | (m << 13); } } // // Normalized number // e = e + (127 - 15); m = m << 13; // // Assemble s, e and m. // return (s << 31) | (e << 23) | m; } //--------------------------------------------- // Main - prints the half-to-float lookup table //--------------------------------------------- int main () { cout.precision (9); #ifndef HAVE_IOS_BASE cout.setf (ios::hex, ios::basefield); #else cout.setf (ios_base::hex, ios_base::basefield); #endif cout << "//\n" "// This is an automatically generated file.\n" "// Do not edit.\n" "//\n\n"; cout << "{\n "; const int iMax = (1 << 16); for (int i = 0; i < iMax; i++) { cout << "{0x" << setfill ('0') << setw (8) << halfToFloat (i) << "}, "; if (i % 4 == 3) { cout << "\n"; if (i < iMax - 1) cout << " "; } } cout << "};\n"; return 0; } ================================================ FILE: k3dsdk/algebra.h ================================================ #ifndef K3DSDK_ALGEBRA_H #define K3DSDK_ALGEBRA_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Algebra classes \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include /**************************************************************** * * C++ Vector and Matrix Algebra routines * Author: Jean-Francois DOUE * Version 3.1 --- October 1993 * ****************************************************************/ // // From "Graphics Gems IV / Edited by Paul S. Heckbert // Academic Press, 1994, ISBN 0-12-336156-9 // "You are free to use and modify this code in any way // you like." (p. xv) // // Modified by J. Nagle, March 1997 // - All functions are inline. // - All functions are const-correct. // - All checking is via the standard "assert" macro. // // Modified by Tim Shead for use with K-3D, January 1998 namespace k3d { class matrix4; class quaternion; class angle_axis; class euler_angles; ///////////////////////////////////////////////////////////////////////////// // point3 /// Matrix multiplication point3 operator*(const matrix4& a, const point3& v); /// Matrix multiplication point3 operator*(const point3& v, const matrix4& a); ///////////////////////////////////////////////////////////////////////////// // point4 /// Matrix multiplication point4 operator*(const matrix4& a, const point4& v); /// Matrix multiplication point4 operator*(const point4& v, const matrix4& a); /// Linear transformation point3 operator*(const matrix4& a, const point3& v); /// Matrix multiplication matrix4 operator*(const matrix4& a, const matrix4& b); ///////////////////////////////////////////////////////////////////////////// // matrix4 /// A 4x4 matrix class matrix4 { public: /// Stores the matrix elements vector4 v[4]; // Constructors matrix4(); matrix4(const vector4& v0, const vector4& v1, const vector4& v2, const vector4& v3); matrix4(const double d); matrix4(euler_angles Angles); /// Creates a new matrix4 from values in row-major order template static matrix4 row_major(IteratorT Begin, IteratorT End) { matrix4 result; std::copy(Begin, End, &result.v[0][0]); return result; } /// Copy constructor matrix4(const matrix4& m); /// Assignment of an matrix4 matrix4& operator=(const matrix4& m); /* /// Assignment of a C/C++ array matrix4& operator=(const double d[4][4]); */ /// Assignment of a C/C++ array matrix4& operator=(const double d[16]); /// Addition matrix4& operator+=(const matrix4& m); /// Subtraction matrix4& operator-=(const matrix4& m); /// Multiplication by a constant matrix4& operator*=(const double d); /// Division by a constant matrix4& operator/=(const double d); /// Returns a vector by index vector4& operator[](int i); /// Returns a vector by index const vector4& operator[](int i) const; /// Copies the matrix contents into a C/C++ style array void CopyArray(float m[16]) const; /// Copies the matrix contents into a C/C++ style array void CopyArray(double m[16]) const; /// Casts the matrix to a C/C++ style array operator double*() { return &v[0][0]; } }; /// Negation matrix4 operator-(const matrix4& a); /// Addition matrix4 operator+(const matrix4& a, const matrix4& b); /// Subtraction matrix4 operator-(const matrix4& a, const matrix4& b); /// Matrix multiplication matrix4 operator*(const matrix4& a, const matrix4& b); /// Multiplication by a constant matrix4 operator*(const matrix4& a, const double d); /// Multiplication by a constant matrix4 operator*(const double d, const matrix4& a); /// Division by a constant matrix4 operator/(const matrix4& a, const double d); /// Equality bool operator==(const matrix4& a, const matrix4& b); /// Non-equality bool operator!=(const matrix4& a, const matrix4& b); /// Linear transformation point4 operator*(const matrix4& a, const point4& v); /// Linear transformation point3 operator*(const matrix4& a, const point3& v); /// Returns a three-dimensional identity matrix inline matrix4 identity3() { return matrix4( vector4(1, 0, 0, 0), vector4(0, 1, 0, 0), vector4(0, 0, 1, 0), vector4(0, 0, 0, 1)); } /// Returns the transposition of a matrix inline matrix4 transpose(const matrix4& v) { return matrix4( vector4(v[0][0], v[1][0], v[2][0], v[3][0]), vector4(v[0][1], v[1][1], v[2][1], v[3][1]), vector4(v[0][2], v[1][2], v[2][2], v[3][2]), vector4(v[0][3], v[1][3], v[2][3], v[3][3])); } /// Returns the inverse of a matrix inline matrix4 inverse(const matrix4& v) { matrix4 a(v), // As a evolves from original mat into identity b(identity3()); // b evolves from identity into inverse(a) // Loop over cols of a from left to right, eliminating above and below diag for(int j=0; j<4; ++j) { // Find largest pivot in column j among rows j..3 int i1 = j; // Row with largest pivot candidate for(int i=j+1; i<4; ++i) { if (fabs(a.v[i].n[j]) > fabs(a.v[i1].n[j])) i1 = i; } // Swap rows i1 and j in a and b to put pivot on diagonal std::swap(a.v[i1], a.v[j]); std::swap(b.v[i1], b.v[j]); // Scale row j to have a unit diagonal if(!a.v[j].n[j]) { // Singular matrix - can't invert log() << error << "Can't invert singular matrix!" << std::endl; return b; } b.v[j] /= a.v[j].n[j]; a.v[j] /= a.v[j].n[j]; // Eliminate off-diagonal elems in col j of a, doing identical ops to b for(int i=0; i<4; ++i) { if(i!=j) { b.v[i] -= a.v[i].n[j]*b.v[j]; a.v[i] -= a.v[i].n[j]*a.v[j]; } } } return b; } /// Returns true if a matrix contains negative scale factors that will flip an object "inside-out" inline bool inside_out(const matrix4& m) { const vector3 a(m[0][0], m[0][1], m[0][2]); const vector3 b(m[1][0], m[1][1], m[1][2]); const vector3 c(m[2][0], m[2][1], m[2][2]); return ((a ^ b) * c) < 0 ? true : false; } /// Linear transformation inline const vector3 operator*(const matrix4& a, const vector3& v) { const vector4 temp((a * point4(v[0], v[1], v[2], 1)) - (a * point4(0, 0, 0, 1))); return vector3(temp.n[0], temp.n[1], temp.n[2]); } /// Linear transformation inline const vector3 operator*(const vector3& v, const matrix4& a) { return transpose(a) * v; } /// Linear transformation inline const normal3 operator*(const matrix4& a, const normal3& v) { const vector4 temp((a * point4(v[0], v[1], v[2], 1)) - (a * point4(0, 0, 0, 1))); return normal3(temp.n[0], temp.n[1], temp.n[2]); } /// Linear transformation inline const normal3 operator*(const normal3& v, const matrix4& a) { return transpose(a) * v; } /// Output inserter std::ostream& operator<<(std::ostream& Stream, const matrix4& Arg); /// Input extractor std::istream& operator>>(std::istream& Stream, matrix4& Arg); ///////////////////////////////////////////////////////////////////////////// // quaternion /// Encapsulates a quaternion class quaternion { public: // The scalar+vector representation is used double w; vector3 v; // Constructors quaternion(); quaternion(const double u, const point3& t); quaternion(const double u, const vector3& t); quaternion(const double u, const double x, const double y, const double z); quaternion(const angle_axis& AngleAxis); quaternion(euler_angles Angles); /// Assignment of a quaternion quaternion& operator=(const quaternion& q); /// Assignment of an axis/angle quaternion& operator=(const angle_axis& AngleAxis); /// Multiplication by a constant quaternion& operator*=(const double d); /// Division by a constant quaternion& operator/=(const double d); /// Addition quaternion& operator+=(const quaternion& q); /// Substraction quaternion& operator-=(const quaternion& q); /// Multiplication quaternion& operator*=(const quaternion& q); /// Division quaternion& operator/=(const quaternion& q); /// Magnitude double Magnitude() const; /// Normalization quaternion& Normalize(); /// Conjugate quaternion& Conjugate(); /// Inversion in place quaternion& Inverse(); /// Squares the quaternion in place quaternion& Square(); /// Axis rotation quaternion& AxisRotation(const double phi); }; /// Negation quaternion operator-(quaternion& q); /// Addition quaternion operator+(const quaternion& q, const quaternion& r); /// Substraction quaternion operator-(const quaternion& q, const quaternion& r); /// Multiplication by a quaternion quaternion operator*(const quaternion& q, const quaternion& r); /// Multiplication by a constant quaternion operator*(const quaternion& q, const double d); /// Multiplication by a constant quaternion operator*(double d, const quaternion& q); /// Division by a quaternion quaternion operator/(const quaternion& q, const quaternion& r); /// Division by a constant quaternion operator/(const quaternion& q, const double d); /// Equality test bool operator==(const quaternion& q, const quaternion& r); /// Non-equality test bool operator!=(const quaternion& q, const quaternion& r); /// Output inserter std::ostream& operator<<(std::ostream& Stream, const quaternion& Arg); /// Input extractor std::istream& operator>>(std::istream& Stream, quaternion& Arg); ///////////////////////////////////////////////////////////////////////////// // angle_axis /// Encapsulates an angle/axis representation of an object's orientation class angle_axis { public: double angle; vector3 axis; // Constructors ... angle_axis(); angle_axis(const double Angle, const point3& Axis); angle_axis(const double Angle, const vector3& Axis); angle_axis(const double Angle, const double X, const double Y, const double Z); angle_axis(const double AngleAxis[4]); angle_axis(const quaternion& Quaternion); /// Copy constructor angle_axis(const angle_axis& AngleAxis); /// Assignment of an angle_axis angle_axis& operator=(const angle_axis& AngleAxis); /// Assignment of a quaternion angle_axis& operator=(const quaternion& Quaternion); /// Assignment of a C/C++ style array angle_axis& operator=(const double AngleAxis[4]); /// Casting to a C/C++ style array pointer operator double*() { return ∠ } /// Copies the vector into a C/C++ style array void CopyArray(float AngleAxis[4]) const; /// Copies the vector into a C/C++ style array void CopyArray(double AngleAxis[4]) const; }; /// Equality test bool operator==(const angle_axis& a, const angle_axis& b); /// Non-equality test bool operator!=(const angle_axis& a, const angle_axis& b); /// Output inserter std::ostream& operator<<(std::ostream& Stream, const angle_axis& Arg); /// Input extractor std::istream& operator>>(std::istream& Stream, angle_axis& Arg); #define SDPEULERANGLEORDER(initialaxis, parity, repetition, frame) ((((((initialaxis << 1) + parity) << 1) + repetition) << 1) + frame) /// Encapsulates a set of Euler angles, including the order in which they should be applied class euler_angles { public: /// Enumerates what gets rotated - the axes themselves, or the frame they represent typedef enum { StaticFrame = 0, RotatingFrame = 1, } OrderFrame; /// Enumerates whether the last axis will be the same as the first typedef enum { NoRepetition = 0, Repeats = 1, } OrderRepetition; /// Enumerates which axes will become the second axis typedef enum { EvenParity = 0, OddParity = 1, } OrderParity; /// Enumerates all possible axis order permutations typedef enum { XYZstatic = SDPEULERANGLEORDER(0, EvenParity, NoRepetition, StaticFrame), XYXstatic = SDPEULERANGLEORDER(0, EvenParity, Repeats, StaticFrame), XZYstatic = SDPEULERANGLEORDER(0, OddParity, NoRepetition, StaticFrame), XZXstatic = SDPEULERANGLEORDER(0, OddParity, Repeats, StaticFrame), YZXstatic = SDPEULERANGLEORDER(1, EvenParity, NoRepetition, StaticFrame), YZYstatic = SDPEULERANGLEORDER(1, EvenParity, Repeats, StaticFrame), YXZstatic = SDPEULERANGLEORDER(1, OddParity, NoRepetition, StaticFrame), YXYstatic = SDPEULERANGLEORDER(1, OddParity, Repeats, StaticFrame), ZXYstatic = SDPEULERANGLEORDER(2, EvenParity, NoRepetition, StaticFrame), ZXZstatic = SDPEULERANGLEORDER(2, EvenParity, Repeats, StaticFrame), ZYXstatic = SDPEULERANGLEORDER(2, OddParity, NoRepetition, StaticFrame), ZYZstatic = SDPEULERANGLEORDER(2, OddParity, Repeats, StaticFrame), ZYXrotating = SDPEULERANGLEORDER(0, EvenParity, NoRepetition, RotatingFrame), XYXrotating = SDPEULERANGLEORDER(0, EvenParity, Repeats, RotatingFrame), YZXrotating = SDPEULERANGLEORDER(0, OddParity, NoRepetition, RotatingFrame), XZXrotating = SDPEULERANGLEORDER(0, OddParity, Repeats, RotatingFrame), XZYrotating = SDPEULERANGLEORDER(1, EvenParity, NoRepetition, RotatingFrame), YZYrotating = SDPEULERANGLEORDER(1, EvenParity, Repeats, RotatingFrame), ZXYrotating = SDPEULERANGLEORDER(1, OddParity, NoRepetition, RotatingFrame), YXYrotating = SDPEULERANGLEORDER(1, OddParity, Repeats, RotatingFrame), YXZrotating = SDPEULERANGLEORDER(2, EvenParity, NoRepetition, RotatingFrame), ZXZrotating = SDPEULERANGLEORDER(2, EvenParity, Repeats, RotatingFrame), XYZrotating = SDPEULERANGLEORDER(2, OddParity, NoRepetition, RotatingFrame), ZYZrotating = SDPEULERANGLEORDER(2, OddParity, Repeats, RotatingFrame), } AngleOrder; /// Stores the three axis angles double n[3]; /// Stores the axis order in packed format AngleOrder order; euler_angles(); euler_angles(point3 Angles, AngleOrder Order); euler_angles(double X, double Y, double Z, AngleOrder Order); /// Conversion from a quaternion euler_angles(const quaternion& Quaternion, AngleOrder Order); /// Conversion from a 4x4 matrix euler_angles(const matrix4& Matrix, AngleOrder Order); /// Returns the frame type from a packed order representation static OrderFrame Frame(AngleOrder& Order) { return OrderFrame(Order & 1); } /// Returns the repetition type from a packed order representation static OrderRepetition Repetition(AngleOrder& Order) { return OrderRepetition((Order >> 1) & 1); } /// Returns the parity type from a packed order representation static OrderParity Parity(AngleOrder& Order) { return OrderParity((Order >> 2) & 1); } /// Returns the axes in order, from a packed order representation static void Axes(AngleOrder& Order, int& i, int& j, int& k); /// Returns the frame type of this instance OrderFrame Frame() { return Frame(order); } /// Returns the repetition type of this instance OrderRepetition Repetition() { return Repetition(order); } /// Returns the parity type of this instance OrderParity Parity() { return Parity(order); } /// Returns the axes in order, for this instance void Axes(int& i, int& j, int& k) { Axes(order, i, j, k); } /// Returns the given angle by reference double& operator[](int i); /// Returns the given angle by value double operator[](int i) const; }; /// Output inserter std::ostream& operator<<(std::ostream& Stream, const euler_angles& Arg); /// Input extractor std::istream& operator>>(std::istream& Stream, euler_angles& Arg); /// Returns a three-dimensional translation matrix inline const matrix4 translate3(const vector3& v) { return matrix4( vector4(1, 0, 0, v[0]), vector4(0, 1, 0, v[1]), vector4(0, 0, 1, v[2]), vector4(0, 0, 0, 1)); } /// Returns a three-dimensional translation matrix inline const matrix4 translate3(const double_t X, const double_t Y, const double_t Z) { return matrix4( vector4(1, 0, 0, X), vector4(0, 1, 0, Y), vector4(0, 0, 1, Z), vector4(0, 0, 0, 1)); } /// Returns a three-dimensional rotation matrix about an arbitrary axis inline const matrix4 rotate3(const double Angle, vector3 Axis) { const double c = cos(Angle), s = sin(Angle), t = 1.0 - c; Axis = normalize(Axis); return matrix4( vector4(t * Axis[0] * Axis[0] + c, t * Axis[0] * Axis[1] - s * Axis[2], t * Axis[0] * Axis[2] + s * Axis[1], 0), vector4(t * Axis[0] * Axis[1] + s * Axis[2], t * Axis[1] * Axis[1] + c, t * Axis[1] * Axis[2] - s * Axis[0], 0), vector4(t * Axis[0] * Axis[2] - s * Axis[1], t * Axis[1] * Axis[2] + s * Axis[0], t * Axis[2] * Axis[2] + c, 0), vector4(0, 0, 0, 1)); } /// Returns a three-dimensional rotation matrix about an arbitrary axis inline const matrix4 rotate3(const angle_axis& AngleAxis) { return rotate3(AngleAxis.angle, AngleAxis.axis); } /// Returns a three-dimensional rotation matrix based on a set of Euler angles inline const matrix4 rotate3(const point3& EulerAngles) { matrix4 matrix = identity3(); matrix = matrix * rotate3(EulerAngles[1], vector3(0, 1, 0)); matrix = matrix * rotate3(EulerAngles[0], vector3(1, 0, 0)); matrix = matrix * rotate3(EulerAngles[2], vector3(0, 0, 1)); return matrix; } /// Returns a three-dimensional rotation matrix based on a quaternion inline const matrix4 rotate3(const quaternion& Quaternion) { return rotate3(angle_axis(Quaternion)); } /// Returns a quaternion based on a three-dimensional rotation matrix inline const quaternion rotate3(const matrix4& m) { double d0 = m[0][0]; double d1 = m[1][1]; double d2 = m[2][2]; double trace = d0 + d1 + d2 + 1; if(trace > 0.0) { double s = 0.5 / std::sqrt(trace); return quaternion(0.25 / s, s * point3(m[2][1] - m[1][2], m[0][2] - m[2][0], m[1][0] - m[0][1])); } // Identify the major diagonal element with greatest value if(d0 >= d1 && d0 >= d2) { double s = std::sqrt(1.0 + d0 - d1 - d2) * 2.0; return quaternion(m[1][2] - m[2][1], point3(0.5, m[0][1] - m[1][0], m[0][2] - m[2][0])) / s; } else if(d1 >= d0 && d1 >= d2) { double s = std::sqrt(1.0 + d1 - d0 - d2) * 2.0; return quaternion(m[0][2] - m[2][0], point3(m[0][1] - m[1][0], 0.5, m[1][2] - m[2][1])) / s; } else { double s = std::sqrt(1.0 + d2 - d0 - d1) * 2.0; return quaternion(m[0][1] - m[1][0], point3(m[0][2] - m[2][0], m[1][2] - m[2][1], 0.5)) / s; } } /// Returns a three-dimensional scaling matrix that scales uniformly along each dimension. inline const matrix4 scale3(const double_t S) { return matrix4( vector4(S, 0, 0, 0), vector4(0, S, 0, 0), vector4(0, 0, S, 0), vector4(0, 0, 0, 1)); } /// Returns a three-dimensional scaling matrix that can scale non-uniformly along each dimension. inline const matrix4 scale3(const double_t X, const double_t Y, const double_t Z) { return matrix4( vector4(X, 0, 0, 0), vector4(0, Y, 0, 0), vector4(0, 0, Z, 0), vector4(0, 0, 0, 1)); } /// Returns a three-dimensional perspective matrix. inline const matrix4 perspective3(const double d) { return matrix4( vector4(1, 0, 0, 0), vector4(0, 1, 0, 0), vector4(0, 0, 1, 0), vector4(0, 0, 1/d, 0)); } /// Returns a three-dimensional shearing matrix. inline const matrix4 shear3(const double XY, const double XZ, const double YX, const double YZ, const double ZX, const double ZY) { return matrix4( vector4(1, XY, XZ, 0), vector4(YX, 1, YZ, 0), vector4(ZX, ZY, 1, 0), vector4(0, 0, 0, 1)); } /// Extract a "look" vector from a view matrix inline const vector3 look_vector(const matrix4& Matrix) { return normalize(Matrix * vector3(0, 0, 1)); } /// Extract an "up" vector from a view matrix inline const vector3 up_vector(const matrix4& Matrix) { return normalize(Matrix * vector3(0, 1, 0)); } /// Extract a "right" vector from a view matrix inline const vector3 right_vector(const matrix4& Matrix) { return normalize(Matrix * vector3(1, 0, 0)); } /// Extract position from a view matrix inline const point3 position(const matrix4& Matrix) { return point3(Matrix[0][3], Matrix[1][3], Matrix[2][3]); } /// Construct a view matrix from look, up, right, and position data inline const matrix4 view_matrix(const vector3& Look, const vector3& Up, const point3& Position) { const vector3 look = normalize(Look); const vector3 right = normalize(Up ^ look); const vector3 up = normalize(look ^ right); return matrix4( vector4(right[0], up[0], look[0], Position[0]), vector4(right[1], up[1], look[1], Position[1]), vector4(right[2], up[2], look[2], Position[2]), vector4(0, 0, 0, 1)); } // Matrix utilities for affine matrices. // // The input matrix must be affine, but need not be orthogonal. // In other words, it may contain scaling, rotation, and translation, // but not perspective projection. // Ref. Foley and Van Dam, 2nd ed, p. 217. // /// Extracts translation from a three-dimensional matrix inline const vector3 extract_translation(const matrix4& m) { return(vector3(m[0][3], m[1][3], m[2][3])); } /// Extracts scaling from a matrix inline const matrix4 extract_scaling(const matrix4& m) { return matrix4( vector4(sqrt(m[0][0] * m[0][0] + m[1][0] * m[1][0] + m[2][0] * m[2][0]), 0, 0, 0), vector4(0, sqrt(m[0][1] * m[0][1] + m[1][1] * m[1][1] + m[2][1] * m[2][1]), 0, 0), vector4(0, 0, sqrt(m[0][2] * m[0][2] + m[1][2] * m[1][2] + m[2][2] * m[2][2]), 0), vector4(0, 0, 0, 1)); } /// Extracts rotation from a matrix inline const matrix4 extract_rotation(const matrix4& m) { // Get scaling ... const double scale_x = sqrt(m[0][0] * m[0][0] + m[1][0] * m[1][0] + m[2][0] * m[2][0]); const double scale_y = sqrt(m[0][1] * m[0][1] + m[1][1] * m[1][1] + m[2][1] * m[2][1]); const double scale_z = sqrt(m[0][2] * m[0][2] + m[1][2] * m[1][2] + m[2][2] * m[2][2]); return_val_if_fail(scale_x && scale_y && scale_z, identity3()); // Apply inverse of scaling as a transformation, to get unit scale ... matrix4 unscaled(m * scale3(1.0 / scale_x, 1.0 / scale_y, 1.0 / scale_z)); return matrix4( vector4(unscaled[0][0], unscaled[0][1], unscaled[0][2], 0), vector4(unscaled[1][0], unscaled[1][1], unscaled[1][2], 0), vector4(unscaled[2][0], unscaled[2][1], unscaled[2][2], 0), vector4(0, 0, 0, 1)); } ///////////////////////////////////////////////////////////////////////////// // point3 implementation inline point3 operator*(const matrix4& a, const point3& v) { const point4 result = a * point4(v[0], v[1], v[2], 1); return point3(result[0] / result[3], result[1] / result[3], result[2] / result[3]); } inline point3 operator*(const point3& v, const matrix4& a) { return transpose(a) * v; } ///////////////////////////////////////////////////////////////////////////// // point4 implementation inline point4 operator*(const matrix4& a, const point4& v) { #define ROWCOL(i) a.v[i].n[0]*v.n[0] + a.v[i].n[1]*v.n[1] + a.v[i].n[2]*v.n[2] + a.v[i].n[3]*v.n[3] return point4(ROWCOL(0), ROWCOL(1), ROWCOL(2), ROWCOL(3)); #undef ROWCOL // (i) } inline point4 operator*(const point4& v, const matrix4& a) { return transpose(a) * v; } ///////////////////////////////////////////////////////////////////////////// // matrix4 implementation inline matrix4::matrix4() {} inline matrix4::matrix4(const vector4& v0, const vector4& v1, const vector4& v2, const vector4& v3) { v[0] = v0; v[1] = v1; v[2] = v2; v[3] = v3; } inline matrix4::matrix4(const double d) { v[0] = v[1] = v[2] = v[3] = vector4(d, d, d, d); } inline matrix4::matrix4(const matrix4& m) { v[0] = m.v[0]; v[1] = m.v[1]; v[2] = m.v[2]; v[3] = m.v[3]; } inline matrix4::matrix4(euler_angles Angles) { const euler_angles::OrderFrame frame = Angles.Frame(); const euler_angles::OrderParity parity = Angles.Parity(); const euler_angles::OrderRepetition repetition = Angles.Repetition(); int i, j, k; Angles.Axes(i, j, k); if(frame == euler_angles::RotatingFrame) std::swap(Angles.n[0], Angles.n[2]); if(parity == euler_angles::OddParity) { Angles.n[0] = -Angles.n[0]; Angles.n[1] = -Angles.n[1]; Angles.n[2] = -Angles.n[2]; } const double ti = Angles.n[0], tj = Angles.n[1], th = Angles.n[2]; const double ci = cos(ti), cj = cos(tj), ch = cos(th); const double si = sin(ti), sj = sin(tj), sh = sin(th); const double cc = ci*ch, cs = ci*sh; const double sc = si*ch, ss = si*sh; matrix4 m = identity3(); if(repetition == euler_angles::Repeats) { m[i][i] = cj; m[i][j] = sj*si; m[i][k] = sj*ci; m[j][i] = sj*sh; m[j][j] = -cj*ss+cc; m[j][k] = -cj*cs-sc; m[k][i] = -sj*ch; m[k][j] = cj*sc+cs; m[k][k] = cj*cc-ss; } else { m[i][i] = cj*ch; m[i][j] = sj*sc-cs; m[i][k] = sj*cc+ss; m[j][i] = cj*sh; m[j][j] = sj*ss+cc; m[j][k] = sj*cs-sc; m[k][i] = -sj; m[k][j] = cj*si; m[k][k] = cj*ci; } *this = m; } inline matrix4& matrix4::operator=(const matrix4& m) { v[0] = m.v[0]; v[1] = m.v[1]; v[2] = m.v[2]; v[3] = m.v[3]; return *this; } /* inline matrix4& matrix4::operator=(const double d[4][4]) { v[0] = d[0]; v[1] = d[1]; v[2] = d[2]; v[3] = d[3]; return *this; } */ inline matrix4& matrix4::operator=(const double d[16]) { memcpy(&v[0][0], &d[0], 16 * sizeof(double)); return *this; } inline matrix4& matrix4::operator+=(const matrix4& m) { v[0] += m.v[0]; v[1] += m.v[1]; v[2] += m.v[2]; v[3] += m.v[3]; return *this; } inline matrix4& matrix4::operator-=(const matrix4& m) { v[0] -= m.v[0]; v[1] -= m.v[1]; v[2] -= m.v[2]; v[3] -= m.v[3]; return *this; } inline matrix4& matrix4::operator*=(const double d) { v[0] *= d; v[1] *= d; v[2] *= d; v[3] *= d; return *this; } inline matrix4& matrix4::operator/=(const double d) { return_val_if_fail(d, *this); const double inv = 1./d; v[0] *= inv; v[1] *= inv; v[2] *= inv; v[3] *= inv; return *this; } inline vector4& matrix4::operator[](int i) { return v[i]; } inline const vector4& matrix4::operator[](int i) const { return v[i]; } inline void matrix4::CopyArray(float m[16]) const { unsigned long index = 0; for(unsigned long i = 0; i < 4; ++i) for(unsigned long j = 0; j < 4; ++j) m[index++] = float(v[i][j]); } inline void matrix4::CopyArray(double m[16]) const { unsigned long index = 0; for(unsigned long i = 0; i < 4; ++i) for(unsigned long j = 0; j < 4; ++j) m[index++] = v[i][j]; } inline matrix4 operator-(const matrix4& a) { return matrix4(-a.v[0], -a.v[1], -a.v[2], -a.v[3]); } inline matrix4 operator+(const matrix4& a, const matrix4& b) { return matrix4(a.v[0] + b.v[0], a.v[1] + b.v[1], a.v[2] + b.v[2], a.v[3] + b.v[3]); } inline matrix4 operator-(const matrix4& a, const matrix4& b) { return matrix4(a.v[0] - b.v[0], a.v[1] - b.v[1], a.v[2] - b.v[2], a.v[3] - b.v[3]); } inline matrix4 operator*(const matrix4& a, const matrix4& b) { #define ROWCOL(i, j) a.v[i].n[0]*b.v[0][j] + a.v[i].n[1]*b.v[1][j] + a.v[i].n[2]*b.v[2][j] + a.v[i].n[3]*b.v[3][j] return matrix4( vector4(ROWCOL(0,0), ROWCOL(0,1), ROWCOL(0,2), ROWCOL(0,3)), vector4(ROWCOL(1,0), ROWCOL(1,1), ROWCOL(1,2), ROWCOL(1,3)), vector4(ROWCOL(2,0), ROWCOL(2,1), ROWCOL(2,2), ROWCOL(2,3)), vector4(ROWCOL(3,0), ROWCOL(3,1), ROWCOL(3,2), ROWCOL(3,3))); } inline matrix4 operator*(const matrix4& a, const double d) { return matrix4(a.v[0] * d, a.v[1] * d, a.v[2] * d, a.v[3] * d); } inline matrix4 operator*(const double d, const matrix4& a) { return a*d; } inline matrix4 operator/(const matrix4& a, const double d) { return_val_if_fail(d, matrix4()); const double inv = 1./d; return matrix4(a.v[0] * inv, a.v[1] * inv, a.v[2] * inv, a.v[3] * inv); } inline bool operator==(const matrix4& a, const matrix4& b) { return ((a.v[0] == b.v[0]) && (a.v[1] == b.v[1]) && (a.v[2] == b.v[2]) && (a.v[3] == b.v[3])); } inline bool operator!=(const matrix4& a, const matrix4& b) { return !(a == b); } inline std::ostream& operator<<(std::ostream& Stream, const matrix4& Arg) { Stream << Arg[0] << " " << Arg[1] << " " << Arg[2] << " " << Arg[3]; return Stream; } inline std::istream& operator>>(std::istream& Stream, matrix4& Arg) { Stream >> Arg[0] >> Arg[1] >> Arg[2] >> Arg[3]; return Stream; } ///////////////////////////////////////////////////////////////////////////// // quaternion implementation inline quaternion::quaternion() { w = 1.0; v = vector3(0, 0, 0); } inline quaternion::quaternion(const double u, const point3& t) { w = u; v = to_vector(t); } inline quaternion::quaternion(const double u, const vector3& t) { w = u; v = t; } inline quaternion::quaternion(const double u, const double x, const double y, const double z) { w = u; v = vector3(x, y, z); } inline quaternion::quaternion(const angle_axis& AngleAxis) { w = cos(AngleAxis.angle * 0.5); vector3 axis = k3d::normalize(AngleAxis.axis); v = sin(AngleAxis.angle * 0.5) * axis; } inline quaternion::quaternion(euler_angles Angles) { const euler_angles::OrderFrame frame = Angles.Frame(); const euler_angles::OrderParity parity = Angles.Parity(); const euler_angles::OrderRepetition repetition = Angles.Repetition(); int i, j, k; Angles.Axes(i, j, k); if(frame == euler_angles::RotatingFrame) std::swap(Angles.n[0], Angles.n[2]); if(parity == euler_angles::OddParity) Angles.n[1] = -Angles.n[1]; const double ti = Angles.n[0]*0.5, tj = Angles.n[1]*0.5, th = Angles.n[2]*0.5; const double ci = cos(ti), cj = cos(tj), ch = cos(th); const double si = sin(ti), sj = sin(tj), sh = sin(th); const double cc = ci*ch, cs = ci*sh; const double sc = si*ch, ss = si*sh; if(repetition == euler_angles::Repeats) { v[i] = cj*(cs + sc); v[j] = sj*(cc + ss); v[k] = sj*(cs - sc); w = cj*(cc - ss); } else { v[i] = cj*sc - sj*cs; v[j] = cj*ss + sj*cc; v[k] = cj*cs - sj*sc; w = cj*cc + sj*ss; } if(parity == euler_angles::OddParity) v[j] = -v[j]; } inline quaternion& quaternion::operator=(const quaternion& q) { w = q.w; v = q.v; return *this; } inline quaternion& quaternion::operator=(const angle_axis& AngleAxis) { w = cos(AngleAxis.angle * 0.5); vector3 axis = k3d::normalize(AngleAxis.axis); v = sin(AngleAxis.angle * 0.5) * axis; return *this; } inline quaternion& quaternion::operator*=(const double d) { w *= d; v *= d; return *this; } inline quaternion& quaternion::operator/=(const double d) { return_val_if_fail(d, *this); const double inv = 1./d; w *= inv; v *= inv; return *this; } inline quaternion& quaternion::operator+=(const quaternion& q) { w += q.w; v += q.v; return *this; } inline quaternion& quaternion::operator-=(const quaternion& q) { w -= q.w; v -= q.v; return *this; } inline quaternion& quaternion::operator*=(const quaternion& q) { w = w*q.w - (v*q.v); v = q.w*v + w*q.v + (v^q.v); return *this; } inline quaternion& quaternion::operator/=(const quaternion& q) { quaternion t = q; (*this) *= t.Inverse(); return *this; } inline double quaternion::Magnitude() const { return std::sqrt(w*w + v.length2()); } inline quaternion& quaternion::Normalize() { if(const double magnitude = Magnitude()) *this /= magnitude; return *this; } inline quaternion& quaternion::Conjugate() { v = -v; return *this; } inline quaternion& quaternion::Inverse() { if(Magnitude() != 0.0) { const double i = 1.0 / Magnitude(); w *= i; v *= -i; } return *this; } inline quaternion& quaternion::Square() { const double t = 2*w; w = w*w - v.length2(); v *= t; return *this; } inline quaternion& quaternion::AxisRotation(const double phi) { v = k3d::normalize(v); v *= sin(phi/2.0); w = cos(phi/2); return *this; } inline quaternion operator-(const quaternion& q) { return quaternion(-q.w,-q.v); } inline quaternion operator+(const quaternion& q, const quaternion& r) { return quaternion(q.w + r.w, q.v + r.v); } inline quaternion operator-(const quaternion& q, const quaternion& r) { return quaternion(q.w - r.w, q.v - r.v); } inline quaternion operator*(const quaternion& q, const quaternion& r) { return quaternion(q.w*r.w - (q.v*r.v), q.w*r.v + r.w*q.v + (q.v^r.v)); } inline quaternion operator*(const quaternion& q, const double d) { return quaternion(q.w*d, q.v*d); } inline quaternion operator*(const double d, const quaternion& q) { return quaternion(q.w*d, q.v*d); } inline quaternion operator/(const quaternion& q, const quaternion& r) { quaternion t = r; return q*t.Inverse(); } inline quaternion operator/(const quaternion& q, const double d) { return_val_if_fail(d, quaternion()); const double inv = 1./d; return quaternion(q.w * inv, q.v * inv); } inline bool operator==(const quaternion& q, const quaternion& r) { return ((q.w == r.w) && (q.v == r.v)); } inline bool operator!=(const quaternion& q, const quaternion& r) { return !(q == r); } inline std::ostream& operator<<(std::ostream& Stream, const quaternion& Arg) { Stream << Arg.w << " " << Arg.v[0] << " " << Arg.v[1] << " " << Arg.v[2]; return Stream; } inline std::istream& operator>>(std::istream& Stream, quaternion& Arg) { Stream >> Arg.w >> Arg.v[0] >> Arg.v[1] >> Arg.v[2]; return Stream; } ///////////////////////////////////////////////////////////////////////////// // angle_axis implementation ... inline angle_axis::angle_axis() { angle = 0.0; axis = vector3(0, 0, 1); } inline angle_axis::angle_axis(const double Angle, const point3& Axis) { angle = Angle; axis = normalize(to_vector(Axis)); } inline angle_axis::angle_axis(const double Angle, const vector3& Axis) { angle = Angle; axis = normalize(Axis); } inline angle_axis::angle_axis(const double Angle, const double X, const double Y, const double Z) { angle = Angle; axis[0] = X; axis[1] = Y; axis[2] = Z; axis = normalize(axis); } inline angle_axis::angle_axis(const double AngleAxis[4]) { angle = AngleAxis[0]; axis[0] = AngleAxis[1]; axis[1] = AngleAxis[2]; axis[2] = AngleAxis[3]; axis = normalize(axis); } inline angle_axis::angle_axis(const quaternion& Quaternion) { quaternion q = Quaternion; q.Normalize(); const double halftheta = acos(q.w); const double sinhalftheta = sin(halftheta); angle = 2.0 * halftheta; if(sinhalftheta != 0.0) axis = q.v / sinhalftheta; else axis = vector3(0, 0, 1); } inline angle_axis::angle_axis(const angle_axis& AngleAxis) { angle = AngleAxis.angle; axis = AngleAxis.axis; } inline angle_axis& angle_axis::operator=(const angle_axis& AngleAxis) { angle = AngleAxis.angle; axis = AngleAxis.axis; return *this; } inline angle_axis& angle_axis::operator=(const quaternion& Quaternion) { const double halftheta = acos(Quaternion.w); const double sinhalftheta = sin(halftheta); angle = 2.0 * halftheta; if(sinhalftheta != 0.0) axis = Quaternion.v / sinhalftheta; else axis = vector3(0, 0, 1); return *this; } inline angle_axis& angle_axis::operator=(const double AngleAxis[4]) { angle = AngleAxis[0]; axis[0] = AngleAxis[1]; axis[1] = AngleAxis[2]; axis[2] = AngleAxis[3]; return *this; } inline void angle_axis::CopyArray(float AngleAxis[4]) const { AngleAxis[0] = float(angle); AngleAxis[1] = float(axis[0]); AngleAxis[2] = float(axis[1]); AngleAxis[3] = float(axis[2]); } inline void angle_axis::CopyArray(double AngleAxis[4]) const { AngleAxis[0] = angle; AngleAxis[1] = axis[0]; AngleAxis[2] = axis[1]; AngleAxis[3] = axis[2]; } inline bool operator==(const angle_axis& a, const angle_axis& b) { return ((a.angle == b.angle) && (a.axis == b.axis)); } inline bool operator!=(const angle_axis& a, const angle_axis& b) { return !(a == b); } inline std::ostream& operator<<(std::ostream& Stream, const angle_axis& Arg) { Stream << Arg.angle << " " << Arg.axis[0] << " " << Arg.axis[1] << " " << Arg.axis[2]; return Stream; } inline std::istream& operator>>(std::istream& Stream, angle_axis& Arg) { Stream >> Arg.angle >> Arg.axis[0] >> Arg.axis[1] >> Arg.axis[2]; return Stream; } // Unit quaternion utilities. // // Those special functions deal with rotations, thus require unit quaternions. // // Euler/Matrix/Quaternion conversion functions are based on Ken Shoemake code, // from Graphic Gems IV /// Returns the spherical linear interpolation between two quaternions inline quaternion Slerp(const quaternion& q1, const quaternion& q2, double t) { // Calculate the angle between the two quaternions ... double cosangle = q1.w * q2.w + q1.v * q2.v; if(cosangle < -1.0) cosangle = -1.0; if(cosangle > 1.0) cosangle = 1.0; // If the angle is reasonably large, do the spherical interpolation if(1.0 - cosangle > 16 * FLT_EPSILON) { const double angle = acos(cosangle); return (sin((1.0 - t)*angle)*q1 + sin(t*angle)*q2) / sin(angle); } // The angle is too close to zero - do a linear interpolation return mix(q1, q2, t); } ///////////////////////////////////////////////////////////////////////////// // euler_angles implementation inline euler_angles::euler_angles() { n[0] = n[1] = n[2] = 0.0; order = YXZstatic; } inline euler_angles::euler_angles(point3 Angles, AngleOrder Order) { n[0] = Angles[0]; n[1] = Angles[1]; n[2] = Angles[2]; order = Order; } inline euler_angles::euler_angles(double X, double Y, double Z, AngleOrder Order) { n[0] = X; n[1] = Y; n[2] = Z; order = Order; } inline euler_angles::euler_angles(const quaternion& Quaternion, AngleOrder Order) { const double NQuaternion = Quaternion.Magnitude(); const double s = (NQuaternion > 0.0) ? (2.0 / NQuaternion) : 0.0; const double xs = Quaternion.v[0]*s, ys = Quaternion.v[1]*s, zs = Quaternion.v[2]*s; const double wx = Quaternion.w*xs, wy = Quaternion.w*ys, wz = Quaternion.w*zs; const double xx = Quaternion.v[0]*xs, xy = Quaternion.v[0]*ys, xz = Quaternion.v[0]*zs; const double yy = Quaternion.v[1]*ys, yz = Quaternion.v[1]*zs, zz = Quaternion.v[2]*zs; matrix4 matrix = identity3(); matrix[0][0] = 1.0 - (yy + zz); matrix[0][1] = xy - wz; matrix[0][2] = xz + wy; matrix[1][0] = xy + wz; matrix[1][1] = 1.0 - (xx + zz); matrix[1][2] = yz - wx; matrix[2][0] = xz - wy; matrix[2][1] = yz + wx; matrix[2][2] = 1.0 - (xx + yy); *this = euler_angles(matrix, Order); } inline euler_angles::euler_angles(const matrix4& Matrix, AngleOrder Order) { OrderRepetition repetition = Repetition(Order); OrderParity parity = Parity(Order); OrderFrame frame = Frame(Order); int i, j, k; Axes(Order, i, j, k); if(repetition == euler_angles::Repeats) { const double sy = sqrt(Matrix[i][j]*Matrix[i][j] + Matrix[i][k]*Matrix[i][k]); if(sy > 16*FLT_EPSILON) { n[0] = atan2(Matrix[i][j], Matrix[i][k]); n[1] = atan2(sy, Matrix[i][i]); n[2] = atan2(Matrix[j][i], -Matrix[k][i]); } else { n[0] = atan2(-Matrix[j][k], Matrix[j][j]); n[1] = atan2(sy, Matrix[i][i]); n[2] = 0; } } else { const double cy = sqrt(Matrix[i][i]*Matrix[i][i] + Matrix[j][i]*Matrix[j][i]); if(cy > 16*FLT_EPSILON) { n[0] = atan2(Matrix[k][j], Matrix[k][k]); n[1] = atan2(-Matrix[k][i], cy); n[2] = atan2(Matrix[j][i], Matrix[i][i]); } else { n[0] = atan2(-Matrix[j][k], Matrix[j][j]); n[1] = atan2(-Matrix[k][i], cy); n[2] = 0; } } if(parity == euler_angles::OddParity) { n[0] = -n[0]; n[1] = -n[1]; n[2] = -n[2]; } if(frame == euler_angles::RotatingFrame) std::swap(n[0], n[2]); order = Order; } inline void euler_angles::Axes(AngleOrder& Order, int& i, int& j, int& k) { const int safe[4] = {0, 1, 2, 0}; const int next[4] = {1, 2, 0, 1}; i = safe[(Order >> 3) & 3]; j = next[i + Parity(Order)]; k = next[i + 1 - Parity(Order)]; } inline double& euler_angles::operator[](int i) { return_val_if_fail((i >= 0 && i <= 2), n[0]); return n[i]; } inline double euler_angles::operator[](int i) const { return_val_if_fail((i >= 0 && i <= 2), n[0]); return n[i]; } inline std::ostream& operator<<(std::ostream& Stream, const euler_angles& Arg) { Stream << Arg.n[0] << " " << Arg.n[1] << " " << Arg.n[2] << " " << int(Arg.order); return Stream; } inline std::istream& operator>>(std::istream& Stream, euler_angles& Arg) { int order; Stream >> Arg.n[0] >> Arg.n[1] >> Arg.n[2] >> order; Arg.order = euler_angles::AngleOrder(order); return Stream; } namespace difference { /// Specialization of difference::test for matrix4 inline void test(const matrix4& A, const matrix4& B, accumulator& Result) { range_test(A.v, A.v + 4, B.v, B.v + 4, Result); } } // namespace difference } // namespace k3d #endif // !K3DSDK_ALGEBRA_H ================================================ FILE: k3dsdk/application.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Provides singleton access to the global K-3D object \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace { k3d::iapplication* g_application = 0; } // namespace namespace k3d { void register_application(k3d::iapplication& Application) { assert(!g_application); g_application = &Application; } iapplication& application() { assert(g_application); return *g_application; } } // namespace k3d ================================================ FILE: k3dsdk/application.h ================================================ #ifndef K3DSDK_APPLICATION_H #define K3DSDK_APPLICATION_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { class iapplication; /// Returns the global singleton K-3D application object iapplication& application(); } // namespace k3d #endif // !K3DSDK_APPLICATION_H ================================================ FILE: k3dsdk/application_detail.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef interface #undef interface #endif // interface namespace k3d { ///////////////////////////////////////////////////////////////////////////// // application_implementation::implementation /// Encapsulates the running K-3D server application class application_implementation::implementation : public k3d::iapplication { public: implementation() { } ~implementation() { // Notify observers that we're going away ... m_close_signal.emit(); // Delete any remaining documents ... for(document_collection_t::iterator document = m_documents.begin(); document != m_documents.end(); document = m_documents.begin()) close_document(**document); } bool exit() { return m_exit_signal.emit(); } k3d::idocument* create_document() { // Create the new document ... k3d::idocument* const document = k3d::create_document(); return_val_if_fail(document, 0); m_documents.push_back(document); // Create any auto-start plugins ... const plugin::factory::collection_t factories = plugin::factory::lookup(); for(plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { iplugin_factory::metadata_t metadata = (**factory).metadata(); if(!metadata.count("k3d:document-start")) continue; log() << info << "Creating plugin [" << (**factory).name() << "] via k3d:document-start" << std::endl; iunknown* const plugin = plugin::create(**factory); if(!plugin) { log() << error << "Error creating plugin [" << (**factory).name() << "] via k3d:document-start" << std::endl; continue; } m_auto_start_plugins.insert(std::make_pair(document, plugin)); if(iscripted_action* const scripted_action = dynamic_cast(plugin)) { iscript_engine::context context; context["command"] = string_t("startup"); context["document"] = document; scripted_action->execute(context); } } return document; } void close_document(k3d::idocument& Document) { // Notify observers that the document will be closed m_close_document_signal.emit(Document); // Shut-down any auto-start plugins associated with this document ... const auto_start_plugins_t::iterator plugin_begin = m_auto_start_plugins.lower_bound(&Document); const auto_start_plugins_t::iterator plugin_end = m_auto_start_plugins.upper_bound(&Document); for(auto_start_plugins_t::iterator plugin = plugin_begin; plugin != plugin_end; ++plugin) { if(k3d::iscripted_action* const scripted_action = dynamic_cast(plugin->second)) { k3d::iscript_engine::context context; context["command"] = k3d::string_t("shutdown"); context["document"] = &Document; scripted_action->execute(context); } } for(auto_start_plugins_t::iterator plugin = plugin_begin; plugin != plugin_end; ++plugin) delete plugin->second; m_auto_start_plugins.erase(&Document); // Remove it from the document list ... m_documents.erase(std::remove(m_documents.begin(), m_documents.end(), &Document), m_documents.end()); // Delete the document ... k3d::close_document(Document); } const k3d::iapplication::document_collection_t documents() { return m_documents; } k3d::iapplication::startup_message_signal_t& startup_message_signal() { return m_startup_message_signal; } sigc::connection connect_close_signal(const sigc::slot& Slot) { return m_close_signal.connect(Slot); } sigc::connection connect_close_document_signal(const sigc::slot& Slot) { return m_close_document_signal.connect(Slot); } /// Stores the collection of open documents document_collection_t m_documents; /// Stores any per-document auto-start plugins typedef std::multimap auto_start_plugins_t; /// Stores any per-document auto-start plugins auto_start_plugins_t m_auto_start_plugins; /// Signal emitted to display progress during application startup startup_message_signal_t m_startup_message_signal; /// Signal emitted when the application is closing sigc::signal m_close_signal; /// Signal emitted when an open document is closed sigc::signal m_close_document_signal; /// Signal emitted to request application close sigc::signal0 m_exit_signal; }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// // application_implementation application_implementation::application_implementation() : m_implementation(new implementation()) { } application_implementation::~application_implementation() { delete m_implementation; } iapplication& application_implementation::interface() { return *m_implementation; } sigc::connection application_implementation::connect_exit_signal(const sigc::slot& Slot) { return m_implementation->m_exit_signal.connect(Slot); } } // namespace k3d ================================================ FILE: k3dsdk/application_detail.h ================================================ #ifndef K3DSDK_APPLICATION_DETAIL_H #define K3DSDK_APPLICATION_DETAIL_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class iapplication; /// Provides an implementation of k3d::iapplication for use by embedders class application_implementation { public: application_implementation(); ~application_implementation(); /// Returns the underlying k3d::iapplication implementation iapplication& interface(); /// Connects a slot that will be called to request application exit - observers may return false to indicate that this isn't possible (e.g. because we're embedded in a scripting engine) sigc::connection connect_exit_signal(const sigc::slot& Slot); private: class implementation; implementation* const m_implementation; }; } // namespace k3d #endif // !K3DSDK_APPLICATION_DETAIL_H ================================================ FILE: k3dsdk/application_plugin_factory.h ================================================ #ifndef K3DSDK_APPLICATION_PLUGIN_FACTORY_H #define K3DSDK_APPLICATION_PLUGIN_FACTORY_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // application_plugin_factory template class application_plugin_factory : public plugin_factory, public iapplication_plugin_factory { public: application_plugin_factory(const uuid& FactoryID, const std::string& Name, const std::string& ShortDescription, const std::string& Categories, const quality_t Quality = STABLE, const metadata_t& Metadata = metadata_t()) : plugin_factory(FactoryID, Name, ShortDescription, Categories, Quality, Metadata) { } iunknown* create_plugin() { return new plugin_t(); } bool implements(const std::type_info& InterfaceType) { return implements_interface()(InterfaceType); } const interfaces_t interfaces() { interfaces_t results; get_interfaces()(results); return results; } }; } // namespace k3d #endif // !K3DSDK_APPLICATION_PLUGIN_FACTORY_H ================================================ FILE: k3dsdk/array.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // array array::array() { } array::array(const metadata_t& Metadata) : metadata(Metadata) { } array::~array() { } void array::set_metadata_value(const string_t& Name, const string_t& Value) { metadata[Name] = Value; } void array::set_metadata(const metadata_t& Values) { // Note ... we don't use insert() here because we want to overwrite any existing values for(metadata_t::const_iterator pair = Values.begin(); pair != Values.end(); ++pair) metadata[pair->first] = pair->second; } array::metadata_t array::get_metadata() const { return metadata; } const string_t array::get_metadata_value(const string_t& Name) const { metadata_t::const_iterator pair = metadata.find(Name); return pair != metadata.end() ? pair->second : string_t(); } void array::erase_metadata_value(const string_t& Name) { metadata.erase(Name); } ///////////////////////////////////////////////////////////////////////////// // operator<< std::ostream& operator<<(std::ostream& Stream, const array& RHS) { const array::metadata_t metadata = RHS.get_metadata(); for(array::metadata_t::const_iterator pair = metadata.begin(); pair != metadata.end(); ++pair) Stream << standard_indent << "metadata: " << pair->first << " = " << pair->second << "\n"; RHS.print(Stream); return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/array.h ================================================ #ifndef K3DSDK_ARRAY_H #define K3DSDK_ARRAY_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { /// Abstract interface that can be used to store heterogeneous collections of arrays. /// Methods are provided for cloning arrays (virtual ctor pattern), plus type-agnostic /// methods similar to std::vector, and storage for arbitrary metadata (name-value pairs). class array { public: /// Storage for array metadata typedef std::map metadata_t; array(); array(const metadata_t& Metadata); virtual ~array(); /// Returns the string representation for the type stored by this array. virtual const string_t type_string() const = 0; /// Prints the array contents to a stream. virtual void print(std::ostream& Stream) const = 0; /// Returns an empty array with the same concrete type as this array (a variation on virtual ctor) virtual array* clone_type() const = 0; /// Returns a copy of this array (virtual ctor) virtual array* clone() const = 0; /// Returns a copy of a half-open range of this array (a variation on virtual ctor) virtual array* clone(const uint_t Begin, const uint_t End) const = 0; /// Sets the size of this array. virtual void resize(const uint_t NewSize) = 0; /// Returns the size of this array virtual uint_t size() const = 0; /// Returns true iff this array is empty virtual bool_t empty() const = 0; /// Returns the difference between this array and another, using the imprecise semantics of difference::test() /// \note: Returns false if given an array with a different concrete type. virtual void difference(const array& Other, difference::accumulator& Result) const = 0; /// Sets a new name-value pair, overwriting the value if the name already exists void set_metadata_value(const string_t& Name, const string_t& Value); /// Sets a collection of name-value pairs, overwriting any existing values void set_metadata(const metadata_t& Values); /// Returns the set of all name-value pairs metadata_t get_metadata() const; /// Returns a value by name, or empty-string if the name doesn't exist const string_t get_metadata_value(const string_t& Name) const; /// Erases an existing name-value pair void erase_metadata_value(const string_t& Name); protected: /// Storage for array metadata metadata_t metadata; }; /// Serialization std::ostream& operator<<(std::ostream& Stream, const array& RHS); /// Specialization of difference::test for k3d::array namespace difference { inline void test(const array& A, const array& B, accumulator& Result) { A.difference(B, Result); } } // namespace difference /// Specialization of pipeline_data_traits for use with k3d::array template<> class pipeline_data_traits { public: static array* clone(const array& Other) { return Other.clone(); } }; } // namespace k3d #endif // !K3DSDK_ARRAY_H ================================================ FILE: k3dsdk/aspect_ratios.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { const aspect_ratios_t& aspect_ratios() { static aspect_ratios_t results; if(results.empty()) { try { const filesystem::path path = share_path() / filesystem::generic_path("aspect_ratios.k3d"); k3d::filesystem::ifstream stream(path); xml::element xml("k3dml"); stream >> xml; xml::element& xml_aspect_ratios = xml.safe_element("application").safe_element("aspectratios"); for(xml::element::elements_t::iterator xml_aspect_ratio = xml_aspect_ratios.children.begin(); xml_aspect_ratio != xml_aspect_ratios.children.end(); ++xml_aspect_ratio) { if(xml_aspect_ratio->name != "aspectratio") continue; const std::string name = xml::attribute_text(*xml_aspect_ratio, "name"); const std::string description = xml::attribute_text(*xml_aspect_ratio, "description"); const double value = xml::attribute_value(*xml_aspect_ratio, "value", 1.0); results.push_back(aspect_ratio(name, description, value)); } } catch(std::exception& e) { log() << error << k3d_file_reference << ": " << e.what() << std::endl; } catch(...) { log() << error << k3d_file_reference << ": Unknown exception" << std::endl; } } return results; } const ienumeration_property::enumeration_values_t& aspect_ratio_values() { static ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(ienumeration_property::enumeration_value_t("", "", "Custom aspect ratio")); const aspect_ratios_t ratios = aspect_ratios(); for(aspect_ratios_t::const_iterator ratio = ratios.begin(); ratio != ratios.end(); ++ratio) { const std::string label = string_cast(boost::format("%1% (%2%:1)") % ratio->name % ratio->value); const std::string value = ratio->name; const std::string description = ratio->description; values.push_back(ienumeration_property::enumeration_value_t(label, value, description)); } } return values; } } // namespace k3d ================================================ FILE: k3dsdk/aspect_ratios.h ================================================ #ifndef K3DSDK_ASPECT_RATIOS_H #define K3DSDK_ASPECT_RATIOS_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Encapsulates a named aspect ratio struct aspect_ratio { aspect_ratio(const std::string& Name, const std::string& Description, const double Value) : name(Name), description(Description), value(Value) { } std::string name; std::string description; double value; }; /// Defines a collection of named aspect ratios typedef std::vector aspect_ratios_t; /// Returns a list of useful aspect ratios const aspect_ratios_t& aspect_ratios(); /// Returns descriptions of the available aspect ratios for use with enumeration properties const ienumeration_property::enumeration_values_t& aspect_ratio_values(); } // namespace k3d #endif // !K3DSDK_ASPECT_RATIOS_H ================================================ FILE: k3dsdk/axis.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { const ienumeration_property::enumeration_values_t& axis_values() { static ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(ienumeration_property::enumeration_value_t("X Axis", "x", "X Axis")); values.push_back(ienumeration_property::enumeration_value_t("Y Axis", "y", "Y Axis")); values.push_back(ienumeration_property::enumeration_value_t("Z Axis", "z", "Z Axis")); } return values; } const ienumeration_property::enumeration_values_t& signed_axis_values() { static ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(ienumeration_property::enumeration_value_t("-X Axis", "-x", "-X Axis")); values.push_back(ienumeration_property::enumeration_value_t("+X Axis", "+x", "+X Axis")); values.push_back(ienumeration_property::enumeration_value_t("-Y Axis", "-y", "-Y Axis")); values.push_back(ienumeration_property::enumeration_value_t("+Y Axis", "+y", "+Y Axis")); values.push_back(ienumeration_property::enumeration_value_t("-Z Axis", "-z", "-Z Axis")); values.push_back(ienumeration_property::enumeration_value_t("+Z Axis", "+z", "+Z Axis")); } return values; } std::ostream& operator << (std::ostream& Stream, const axis& Value) { switch(Value) { case X: Stream << "x"; break; case Y: Stream << "y"; break; case Z: Stream << "z"; break; } return Stream; } std::istream& operator >> (std::istream& Stream, axis& Value) { char c; Stream >> c; if('x' == c) Value = X; else if('y' == c) Value = Y; else if('z' == c) Value = Z; else log() << error << k3d_file_reference << ": could not extract value [" << c << "]" << std::endl; return Stream; } std::ostream& operator << (std::ostream& Stream, const signed_axis& Value) { switch(Value) { case NX: Stream << "-x"; break; case PX: Stream << "+x"; break; case NY: Stream << "-y"; break; case PY: Stream << "+y"; break; case NZ: Stream << "-z"; break; case PZ: Stream << "+z"; break; } return Stream; } std::istream& operator >> (std::istream& Stream, signed_axis& Value) { std::string c; Stream >> c; if("-x" == c) Value = NX; else if("+x" == c) Value = PX; else if("-y" == c) Value = NY; else if("+y" == c) Value = PY; else if("-z" == c) Value = NZ; else if("+z" == c) Value = PZ; else log() << error << error << k3d_file_reference << ": could not extract value [" << c << "]" << std::endl; return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/axis.h ================================================ #ifndef K3DSDK_AXIS_H #define K3DSDK_AXIS_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Provides an enumerated type for representing axes (useful in a lot of objects) \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Enumerates standard axes typedef enum { X, Y, Z } axis; /// Enumerates signed axes typedef enum { NX, PX, NY, PY, NZ, PZ } signed_axis; /// Returns descriptions of the allowed axis values, for use with enumeration properties const ienumeration_property::enumeration_values_t& axis_values(); /// Returns descriptions of the allowed signed axis values, for use with enumeration properties const ienumeration_property::enumeration_values_t& signed_axis_values(); /// Serialization std::ostream& operator<<(std::ostream& Stream, const axis& Value); /// Serialization std::istream& operator>>(std::istream& Stream, axis& Value); /// Serialization std::ostream& operator<<(std::ostream& Stream, const signed_axis& Value); /// Serialization std::istream& operator>>(std::istream& Stream, signed_axis& Value); } // namespace k3d #endif // !K3DSDK_AXIS_H ================================================ FILE: k3dsdk/base64.cpp ================================================ /*********************************************************************\ MODULE NAME: b64.c AUTHOR: Bob Trower 08/04/01 PROJECT: Crypt Data Packaging COPYRIGHT: Copyright (c) Trantor Standard Systems Inc., 2001 NOTES: This source code may be used as you wish, subject to the MIT license. See the LICENCE section below. Canonical source should be at: http://base64.sourceforge.net DESCRIPTION: This little utility implements the Base64 Content-Transfer-Encoding standard described in RFC1113 (http://www.faqs.org/rfcs/rfc1113.html). This is the coding scheme used by MIME to allow binary data to be transferred by SMTP mail. Groups of 3 bytes from a binary stream are coded as groups of 4 bytes in a text stream. The input stream is 'padded' with zeros to create an input that is an even multiple of 3. A special character ('=') is used to denote padding so that the stream can be decoded back to its exact size. Encoded output is formatted in lines which should be a maximum of 72 characters to conform to the specification. This program defaults to 72 characters, but will allow more or less through the use of a switch. The program enforces a minimum line size of 4 characters. Example encoding: The stream 'ABCD' is 32 bits long. It is mapped as follows: ABCD A (65) B (66) C (67) D (68) (None) (None) 01000001 01000010 01000011 01000100 16 (Q) 20 (U) 9 (J) 3 (D) 17 (R) 0 (A) NA (=) NA (=) 010000 010100 001001 000011 010001 000000 000000 000000 QUJDRA== Decoding is the process in reverse. A 'decode' lookup table has been created to avoid string scans. DESIGN GOALS: Specifically: Code is a stand-alone utility to perform base64 encoding/decoding. It should be genuinely useful when the need arises and it meets a need that is likely to occur for some users. Code acts as sample code to show the author's design and coding style. Generally: This program is designed to survive: Everything you need is in a single source file. It compiles cleanly using a vanilla ANSI C compiler. It does its job correctly with a minimum of fuss. The code is not overly clever, not overly simplistic and not overly verbose. Access is 'cut and paste' from a web page. Terms of use are reasonable. VALIDATION: Non-trivial code is never without errors. This file likely has some problems, since it has only been tested by the author. It is expected with most source code that there is a period of 'burn-in' when problems are identified and corrected. That being said, it is possible to have 'reasonably correct' code by following a regime of unit test that covers the most likely cases and regression testing prior to release. This has been done with this code and it has a good probability of performing as expected. Unit Test Cases: case 0:empty file: CASE0.DAT -> -> (Zero length target file created on both encode and decode.) case 1:One input character: CASE1.DAT A -> QQ== -> A case 2:Two input characters: CASE2.DAT AB -> QUI= -> AB case 3:Three input characters: CASE3.DAT ABC -> QUJD -> ABC case 4:Four input characters: case4.dat ABCD -> QUJDRA== -> ABCD case 5:All chars from 0 to ff, linesize set to 50: AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIj JCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZH SElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWpr bG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6P kJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKz tLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX 2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7 /P3+/w== case 6:Mime Block from e-mail: (Data same as test case 5) case 7: Large files: Tested 28 MB file in/out. case 8: Random Binary Integrity: This binary program (b64.exe) was encoded to base64, back to binary and then executed. case 9 Stress: All files in a working directory encoded/decoded and compared with file comparison utility to ensure that multiple runs do not cause problems such as exhausting file handles, tmp storage, etc. ------------- Syntax, operation and failure: All options/switches tested. Performs as expected. case 10: No Args -- Shows Usage Screen Return Code 1 (Invalid Syntax) case 11: One Arg (invalid) -- Shows Usage Screen Return Code 1 (Invalid Syntax) case 12: One Arg Help (-?) -- Shows detailed Usage Screen. Return Code 0 (Success -- help request is valid). case 13: One Arg Help (-h) -- Shows detailed Usage Screen. Return Code 0 (Success -- help request is valid). case 14: One Arg (valid) -- Uses stdin/stdout (filter) Return Code 0 (Sucess) case 15: Two Args (invalid file) -- shows system error. Return Code 2 (File Error) case 16: Encode non-existent file -- shows system error. Return Code 2 (File Error) case 17: Out of disk space -- shows system error. Return Code 3 (File I/O Error) case 18: Too many args -- shows system error. Return Code 1 (Invalid Syntax) ------------- Compile/Regression test: gcc compiled binary under Cygwin Microsoft Visual Studio under Windows 2000 Microsoft Version 6.0 C under Windows 2000 DEPENDENCIES: None LICENCE: Copyright (c) 2001 Bob Trower, Trantor Standard Systems Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. VERSION HISTORY: Bob Trower 08/04/01 -- Create Version 0.00.00B Bob Trower 08/17/01 -- Correct documentation, messages. -- Correct help for linesize syntax. -- Force error on too many arguments. Bob Trower 08/19/01 -- Add sourceforge.net reference to help screen prior to release. Tim Shead 09/02/05 -- Repackage for use with iostreams, doxygen, K-3D \******************************************************************* */ #include #include #include namespace k3d { namespace base64 { /// Translation Table as described in RFC1113 static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// Translation Table to decode (created by author) static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; /// encode 3 8-bit binary bytes as 4 '6-bit' characters void encodeblock( unsigned char in[3], unsigned char out[4], int len ) { out[0] = cb64[ in[0] >> 2 ]; out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ]; out[2] = (unsigned char) (len > 1 ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '='); out[3] = (unsigned char) (len > 2 ? cb64[ in[2] & 0x3f ] : '='); } void encode(std::istream& Input, std::ostream& Output, const unsigned long LineWidth) { unsigned char in[3], out[4]; int i, len, blocksout = 0; while(Input) { len = 0; for( i = 0; i < 3; i++ ) { in[i] = Input.get(); if(Input) { len++; } else { in[i] = 0; } } if( len ) { encodeblock( in, out, len ); for( i = 0; i < 4; i++ ) { Output.put(out[i]); } blocksout++; } if( blocksout >= (LineWidth/4) || !Input ) { if( blocksout ) { Output << "\n"; } blocksout = 0; } } } /// decode 4 '6-bit' characters into 3 8-bit binary bytes void decodeblock( unsigned char in[4], unsigned char out[3] ) { out[ 0 ] = (unsigned char ) (in[0] << 2 | in[1] >> 4); out[ 1 ] = (unsigned char ) (in[1] << 4 | in[2] >> 2); out[ 2 ] = (unsigned char ) (((in[2] << 6) & 0xc0) | in[3]); } void decode(std::istream& Input, std::ostream& Output) { unsigned char in[4], out[3], v; int i, len; while(Input) { for( len = 0, i = 0; i < 4 && Input; i++ ) { v = 0; while(Input && v == 0 ) { v = Input.get(); v = (unsigned char) ((v < 43 || v > 122) ? 0 : cd64[ v - 43 ]); if( v ) { v = (unsigned char) ((v == '$') ? 0 : v - 61); } } if(Input) { len++; if( v ) { in[ i ] = (unsigned char) (v - 1); } } else { in[i] = 0; } } if( len ) { decodeblock( in, out ); for( i = 0; i < len - 1; i++ ) { Output.put(out[i]); } } } } } // namespace base64 } // namespace k3d ================================================ FILE: k3dsdk/base64.h ================================================ #ifndef K3DSDK_BASE64_H #define K3DSDK_BASE64_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { namespace base64 { /// Encodes the input stream into base64, sending the results to the output stream void encode(std::istream& Input, std::ostream& Output, const unsigned long LineWidth = 72); /// Decodes the input stream from base64, sending the results to the output stream void decode(std::istream& Input, std::ostream& Output); } // namespace base64 } // namespace k3d #endif // !K3DSDK_BASE64_H ================================================ FILE: k3dsdk/basic_math.h ================================================ #ifndef K3DSDK_BASIC_MATH_H #define K3DSDK_BASIC_MATH_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Pi inline double_t pi() { return 3.1415926535897932384626433832795; } /// Pi divided-by two inline double_t pi_over_2() { return pi() * 0.5; } /// Pi times two inline double_t pi_times_2() { return pi() * 2.0; } /// Converts degrees to radians inline double_t radians(const double_t degrees) { return degrees * 0.01745329252; } /// Converts radians to degrees inline double_t degrees(const double_t radians) { return radians * 57.2957795131; } /// Computes N! inline double_t factorial(double_t N) { double_t result = 1; for(double_t i = 2; i <= N; ++i) result *= i; return result; } /// Computes an integer power of a base via successive squaring template Type fast_pow(Type base, int exponent) { bool invert = exponent < 0; if (invert) exponent = -exponent; // loop invariant: prod * base^exponent Type prod = Type(1); while (exponent > 0) { if (exponent % 2 == 0) { base *= base; exponent /= 2; } else { prod *= base; --exponent; } } if (invert) prod = Type(1) / prod; return prod; } /// Returns the sign of an argument: -1 if negative, 0 if zero, +1 if positive template double_t sign(const type& Arg) { if(Arg > 0.0) return 1.0; if(Arg < 0.0) return -1.0; return 0.0; } /// Rounds a value to the closest integer inline double_t round(const double_t Value) { return (Value - std::floor(Value)) < 0.5 ? std::floor(Value) : std::ceil(Value); } /// Clamps a value within the specified range (conforms to SL usage) template type clamp(const type& x, const type& minval, const type& maxval) { return std::min(std::max(x, minval), maxval); } /// Returns the linear interpolation of two values template type mix(const type& x, const type& y, const double_t alpha) { return x * (1 - alpha) + y * (alpha); } /// Returns the ratio of two values (handles type-casting to a floating-point value) template double_t ratio(const type& x, const type& y) { return static_cast(x) / static_cast(y); } } // namespace k3d #endif // !K3DSDK_BASIC_MATH_H ================================================ FILE: k3dsdk/batch_mode.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace detail { /// Stores the global batch (no user intervention) mode state bool_t g_batch_mode = false; } // namespace detail void set_batch_mode(const bool Mode) { detail::g_batch_mode = Mode; } bool_t batch_mode() { return detail::g_batch_mode; } } // namespace k3d ================================================ FILE: k3dsdk/batch_mode.h ================================================ #ifndef K3DSDK_BATCH_MODE_H #define K3DSDK_BATCH_MODE_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// Returns the current batch (no user intervention) mode state bool_t batch_mode(); } // namespace k3d #endif // !K3DSDK_BATCH_MODE_H ================================================ FILE: k3dsdk/batch_mode_init.h ================================================ #ifndef K3DSDK_BATCH_MODE_INIT_H #define K3DSDK_BATCH_MODE_INIT_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { /// Sets the global batch (no user intervention) mode state (call once at startup) void set_batch_mode(const bool Mode); } // namespace k3d #endif // !K3DSDK_BATCH_MODE_INIT_H ================================================ FILE: k3dsdk/bezier.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { double BernsteinBasis(const unsigned long Order, const unsigned long ControlPoint, const double Parameter) { // Sanity checks ... assert(Order > 1); assert(ControlPoint <= Order); const int n = Order - 1; const int i = ControlPoint; const double t = Parameter; const double ni = factorial(n) / (factorial(i) * factorial(n - i)); return ni * pow(t, i) * pow((1 - t), (n - i)); } } // namespace k3d ================================================ FILE: k3dsdk/bezier.h ================================================ #ifndef K3DSDK_BEZIER_H #define K3DSDK_BEZIER_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements basic Bezier functions \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { /// Computes a Bezier curve value with given degree, control points, and parameter value template value_t bezier(const iterator_t First, const iterator_t Last, const double t) { // Sanity checks ... assert(std::distance(First, Last) == n+1); return detail::bezier_implementation().value(t, Last-1); } /// Treats a Bezier curve as a two-dimensional function, returning the curve value Y for a specific X (instead of using the curve parameter t, which is nonlinear) template double bezier_function(const iterator_t First, const iterator_t Last, const double X, const double Hint, const double MaxError, const unsigned long MaxIterations, double& Error, unsigned long& Iterations) { assert(MaxIterations); double t = Hint; value_t result; for(Iterations = 1; Iterations <= MaxIterations; ++Iterations) { result = bezier(First, Last, t); Error = X - result[0]; if(std::abs(Error) < MaxError) return result[1]; t += 0.4 * Error; } return result[1]; } /// Returns a Bezier / Bernstein basis for the given order, control point number, and parameter value double BernsteinBasis(const unsigned long Order, const unsigned long ControlPoint, const double Parameter); /// Computes a Bezier curve value with given order, control points, and parameter value template Type Bezier(const std::vector& ControlPoints, const double Parameter) { // Sanity checks ... assert(ControlPoints.size() > 1); Type result = BernsteinBasis(ControlPoints.size(), 0, Parameter) * ControlPoints[0]; for(unsigned long i = 1; i < ControlPoints.size(); i++) result += to_vector(BernsteinBasis(ControlPoints.size(), i, Parameter) * ControlPoints[i]); return result; } } // namespace k3d #endif // !K3DSDK_BEZIER_H ================================================ FILE: k3dsdk/bezier_private.h ================================================ #ifndef K3DSDK_BEZIER_PRIVATE_H #define K3DSDK_BEZIER_PRIVATE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements internal Bezier computation functions \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace detail { /// Compile-time computation of an integer factorial template struct factorial { enum { result = n * factorial::result }; }; template<> struct factorial<0> { enum { result = 1 }; }; template double bernstein_basis(const double t) { return (static_cast(factorial::result) / static_cast(factorial::result * factorial::result)) * std::pow(t, i) * std::pow(1-t, n-i); } template struct bezier_implementation { value_t value(double t, iterator_t B) { value_t a(bernstein_basis(t) * (*B)); value_t b(bezier_implementation().value(t, --B)); return a + b; } }; template struct bezier_implementation { value_t value(double t, iterator_t B) { return bernstein_basis(t) * (*B); } }; } // namespace detail } // namespace k3d #endif // !K3DSDK_BEZIER_PRIVATE_H ================================================ FILE: k3dsdk/bezier_triangle_patch.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Ashish Myles (marcianx@gmail.com) */ #include #include #include #include #include #include namespace k3d { namespace bezier_triangle_patch { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::indices_t& PatchFirstPoints, const mesh::orders_t& PatchOrders, const mesh::selection_t& PatchSelections, const mesh::materials_t& PatchMaterials, const mesh::indices_t& PatchPoints, const mesh::weights_t& PatchPointWeights, const mesh::table_t& ConstantAttributes, const mesh::table_t& PatchAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ) : patch_first_points(PatchFirstPoints), patch_orders(PatchOrders), patch_selections(PatchSelections), patch_materials(PatchMaterials), patch_points(PatchPoints), patch_point_weights(PatchPointWeights), constant_attributes(ConstantAttributes), patch_attributes(PatchAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::indices_t& PatchFirstPoints, mesh::orders_t& PatchOrders, mesh::selection_t& PatchSelections, mesh::materials_t& PatchMaterials, mesh::indices_t& PatchPoints, mesh::weights_t& PatchPointWeights, mesh::table_t& ConstantAttributes, mesh::table_t& PatchAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ) : patch_first_points(PatchFirstPoints), patch_orders(PatchOrders), patch_selections(PatchSelections), patch_materials(PatchMaterials), patch_points(PatchPoints), patch_point_weights(PatchPointWeights), constant_attributes(ConstantAttributes), patch_attributes(PatchAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("bezier_triangle_patch"); primitive* const result = new primitive( generic_primitive.structure["patch"].create("patch_first_points"), generic_primitive.structure["patch"].create("patch_orders"), generic_primitive.structure["patch"].create("patch_selections"), generic_primitive.structure["patch"].create("patch_materials"), generic_primitive.structure["vertex"].create("patch_points"), generic_primitive.structure["vertex"].create("patch_point_weights"), generic_primitive.attributes["constant"], generic_primitive.attributes["patch"], generic_primitive.attributes["parameter"], generic_primitive.attributes["vertex"] ); result->patch_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->patch_points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "bezier_triangle_patch") return 0; try { require_valid_primitive(Mesh, Primitive); const table& patch_structure = require_structure(Primitive, "patch"); const table& vertex_structure = require_structure(Primitive, "vertex"); const table& constant_attributes = require_attributes(Primitive, "constant"); const table& patch_attributes = require_attributes(Primitive, "patch"); const table& parameter_attributes = require_attributes(Primitive, "parameter"); const table& vertex_attributes = require_attributes(Primitive, "vertex"); const mesh::indices_t& patch_first_points = require_array(Primitive, patch_structure, "patch_first_points"); const mesh::orders_t& patch_orders = require_array(Primitive, patch_structure, "patch_orders"); const mesh::selection_t& patch_selections = require_array(Primitive, patch_structure, "patch_selections"); const mesh::materials_t& patch_materials = require_array(Primitive, patch_structure, "patch_materials"); const mesh::indices_t& patch_points = require_array(Primitive, vertex_structure, "patch_points"); const mesh::weights_t& patch_point_weights = require_array(Primitive, vertex_structure, "patch_point_weights"); require_metadata(Primitive, patch_selections, "patch_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, patch_points, "patch_points", metadata::key::domain(), metadata::value::point_indices_domain()); k3d::uint_t num_control_points = 0; const k3d::uint_t num_patches = patch_selections.size(); for(k3d::uint_t patch = 0; patch != num_patches; ++patch) { const k3d::uint_t patch_size = (patch_orders[patch] * (patch_orders[patch] + 1)) / 2; num_control_points += patch_size; if (patch < num_patches-1 && patch_first_points[patch] + patch_size != patch_first_points[patch+1]) { std::ostringstream buffer; buffer << "[" << Primitive.type << "] primitive [patch_first_points[" << (patch+1) << "]] incorrect value [" << patch_first_points[patch+1] << "], expected [" << (patch_first_points[patch] + patch_size) << "]"; throw std::runtime_error(buffer.str()); } } require_table_row_count(Primitive, vertex_structure, "vertex", num_control_points); require_table_row_count(Primitive, parameter_attributes, "parameter", patch_structure.row_count() * 3); return new const_primitive(patch_first_points, patch_orders, patch_selections, patch_materials, patch_points, patch_point_weights, constant_attributes, patch_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "bezier_triangle_patch") return 0; try { require_valid_primitive(Mesh, Primitive); table& patch_structure = require_structure(Primitive, "patch"); table& vertex_structure = require_structure(Primitive, "vertex"); table& constant_attributes = require_attributes(Primitive, "constant"); table& patch_attributes = require_attributes(Primitive, "patch"); table& parameter_attributes = require_attributes(Primitive, "parameter"); table& vertex_attributes = require_attributes(Primitive, "vertex"); mesh::indices_t& patch_first_points = require_array(Primitive, patch_structure, "patch_first_points"); mesh::orders_t& patch_orders = require_array(Primitive, patch_structure, "patch_orders"); mesh::selection_t& patch_selections = require_array(Primitive, patch_structure, "patch_selections"); mesh::materials_t& patch_materials = require_array(Primitive, patch_structure, "patch_materials"); mesh::indices_t& patch_points = require_array(Primitive, vertex_structure, "patch_points"); mesh::weights_t& patch_point_weights = require_array(Primitive, vertex_structure, "patch_point_weights"); require_metadata(Primitive, patch_selections, "patch_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, patch_points, "patch_points", metadata::key::domain(), metadata::value::point_indices_domain()); k3d::uint_t num_control_points = 0; const k3d::uint_t num_patches = patch_selections.size(); for(k3d::uint_t patch = 0; patch != num_patches; ++patch) { const k3d::uint_t patch_size = (patch_orders[patch] * (patch_orders[patch] + 1)) / 2; num_control_points += patch_size; if (patch < num_patches-1 && patch_first_points[patch] + patch_size != patch_first_points[patch+1]) { std::ostringstream buffer; buffer << "[" << Primitive.type << "] primitive [patch_first_points[" << (patch+1) << "]] incorrect value [" << patch_first_points[patch+1] << "], expected [" << (patch_first_points[patch] + patch_size) << "]"; throw std::runtime_error(buffer.str()); } } require_table_row_count(Primitive, vertex_structure, "vertex", num_control_points); require_table_row_count(Primitive, parameter_attributes, "parameter", patch_structure.row_count() * 3); return new primitive(patch_first_points, patch_orders, patch_selections, patch_materials, patch_points, patch_point_weights, constant_attributes, patch_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "bezier_triangle_patch") return 0; return validate(Mesh, Primitive.writable()); } } // namespace bezier_triangle_patch } // namespace k3d ================================================ FILE: k3dsdk/bezier_triangle_patch.h ================================================ #ifndef K3DSDK_BEZIER_TRIANGLE_PATCH_H #define K3DSDK_BEZIER_TRIANGLE_PATCH_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Ashish Myles (marcianx@gmail.com) */ #include namespace k3d { namespace bezier_triangle_patch { /// Gathers the member arrays of a bezier_triangle_patch primitive into a convenient package class const_primitive { public: const_primitive( const mesh::indices_t& PatchFirstPoints, const mesh::orders_t& PatchOrders, const mesh::selection_t& PatchSelections, const mesh::materials_t& PatchMaterials, const mesh::indices_t& PatchPoints, const mesh::weights_t& PatchPointWeights, const mesh::table_t& ConstantAttributes, const mesh::table_t& PatchAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ); const mesh::indices_t& patch_first_points; const mesh::orders_t& patch_orders; const mesh::selection_t& patch_selections; const mesh::materials_t& patch_materials; const mesh::indices_t& patch_points; const mesh::weights_t& patch_point_weights; const mesh::table_t& constant_attributes; const mesh::table_t& patch_attributes; const mesh::table_t& parameter_attributes; const mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a bezier_triangle_patch primitive into a convenient package class primitive { public: primitive( mesh::indices_t& PatchFirstPoints, mesh::orders_t& PatchOrders, mesh::selection_t& PatchSelections, mesh::materials_t& PatchMaterials, mesh::indices_t& PatchPoints, mesh::weights_t& PatchPointWeights, mesh::table_t& ConstantAttributes, mesh::table_t& PatchAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ); mesh::indices_t& patch_first_points; mesh::orders_t& patch_orders; mesh::selection_t& patch_selections; mesh::materials_t& patch_materials; mesh::indices_t& patch_points; mesh::weights_t& patch_point_weights; mesh::table_t& constant_attributes; mesh::table_t& patch_attributes; mesh::table_t& parameter_attributes; mesh::table_t& vertex_attributes; }; /// Creates a new bezier_triangle_patch mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid bezier_triangle_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid bezier_triangle_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid bezier_triangle_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace bezier_triangle_patch } // namespace k3d #endif // !K3DSDK_BEZIER_TRIANGLE_PATCH_H ================================================ FILE: k3dsdk/bicubic_patch.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include namespace k3d { namespace bicubic_patch { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::selection_t& PatchSelections, const mesh::materials_t& PatchMaterials, const mesh::indices_t& PatchPoints, const mesh::table_t& ConstantAttributes, const mesh::table_t& PatchAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ) : patch_selections(PatchSelections), patch_materials(PatchMaterials), patch_points(PatchPoints), constant_attributes(ConstantAttributes), patch_attributes(PatchAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::selection_t& PatchSelections, mesh::materials_t& PatchMaterials, mesh::indices_t& PatchPoints, mesh::table_t& ConstantAttributes, mesh::table_t& PatchAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ) : patch_selections(PatchSelections), patch_materials(PatchMaterials), patch_points(PatchPoints), constant_attributes(ConstantAttributes), patch_attributes(PatchAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("bicubic_patch"); primitive* const result = new primitive( generic_primitive.structure["patch"].create("patch_selections"), generic_primitive.structure["patch"].create("patch_materials"), generic_primitive.structure["vertex"].create("patch_points"), generic_primitive.attributes["constant"], generic_primitive.attributes["patch"], generic_primitive.attributes["parameter"], generic_primitive.attributes["vertex"] ); result->patch_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->patch_points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "bicubic_patch") return 0; try { require_valid_primitive(Mesh, Primitive); const table& patch_structure = require_structure(Primitive, "patch"); const table& vertex_structure = require_structure(Primitive, "vertex"); const table& constant_attributes = require_attributes(Primitive, "constant"); const table& patch_attributes = require_attributes(Primitive, "patch"); const table& parameter_attributes = require_attributes(Primitive, "parameter"); const table& vertex_attributes = require_attributes(Primitive, "vertex"); const mesh::selection_t& patch_selections = require_array(Primitive, patch_structure, "patch_selections"); const mesh::materials_t& patch_materials = require_array(Primitive, patch_structure, "patch_materials"); const mesh::indices_t& patch_points = require_array(Primitive, vertex_structure, "patch_points"); require_metadata(Primitive, patch_selections, "patch_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, patch_points, "patch_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", patch_structure.row_count() * 16); require_table_row_count(Primitive, parameter_attributes, "parameter", patch_structure.row_count() * 4); return new const_primitive(patch_selections, patch_materials, patch_points, constant_attributes, patch_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "bicubic_patch") return 0; try { require_valid_primitive(Mesh, Primitive); table& patch_structure = require_structure(Primitive, "patch"); table& vertex_structure = require_structure(Primitive, "vertex"); table& constant_attributes = require_attributes(Primitive, "constant"); table& patch_attributes = require_attributes(Primitive, "patch"); table& parameter_attributes = require_attributes(Primitive, "parameter"); table& vertex_attributes = require_attributes(Primitive, "vertex"); mesh::selection_t& patch_selections = require_array(Primitive, patch_structure, "patch_selections"); mesh::materials_t& patch_materials = require_array(Primitive, patch_structure, "patch_materials"); mesh::indices_t& patch_points = require_array(Primitive, vertex_structure, "patch_points"); require_metadata(Primitive, patch_selections, "patch_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, patch_points, "patch_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", patch_structure.row_count() * 16); require_table_row_count(Primitive, parameter_attributes, "parameter", patch_structure.row_count() * 4); return new primitive(patch_selections, patch_materials, patch_points, constant_attributes, patch_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "bicubic_patch") return 0; return validate(Mesh, Primitive.writable()); } } // namespace bicubic_patch } // namespace k3d ================================================ FILE: k3dsdk/bicubic_patch.h ================================================ #ifndef K3DSDK_BICUBIC_PATCH_H #define K3DSDK_BICUBIC_PATCH_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace bicubic_patch { /// Gathers the member arrays of a bicubic_patch primitive into a convenient package class const_primitive { public: const_primitive( const mesh::selection_t& PatchSelections, const mesh::materials_t& PatchMaterials, const mesh::indices_t& PatchPoints, const mesh::table_t& ConstantAttributes, const mesh::table_t& PatchAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ); const mesh::selection_t& patch_selections; const mesh::materials_t& patch_materials; const mesh::indices_t& patch_points; const mesh::table_t& constant_attributes; const mesh::table_t& patch_attributes; const mesh::table_t& parameter_attributes; const mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a bicubic_patch primitive into a convenient package class primitive { public: primitive( mesh::selection_t& PatchSelections, mesh::materials_t& PatchMaterials, mesh::indices_t& PatchPoints, mesh::table_t& ConstantAttributes, mesh::table_t& PatchAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ); mesh::selection_t& patch_selections; mesh::materials_t& patch_materials; mesh::indices_t& patch_points; mesh::table_t& constant_attributes; mesh::table_t& patch_attributes; mesh::table_t& parameter_attributes; mesh::table_t& vertex_attributes; }; /// Creates a new bicubic_patch mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid bicubic_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid bicubic_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid bicubic_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace bicubic_patch } // namespace k3d #endif // !K3DSDK_BICUBIC_PATCH_H ================================================ FILE: k3dsdk/bilinear_patch.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include namespace k3d { namespace bilinear_patch { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::selection_t& PatchSelections, const mesh::materials_t& PatchMaterials, const mesh::indices_t& PatchPoints, const mesh::table_t& ConstantAttributes, const mesh::table_t& PatchAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ) : patch_selections(PatchSelections), patch_materials(PatchMaterials), patch_points(PatchPoints), constant_attributes(ConstantAttributes), patch_attributes(PatchAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::selection_t& PatchSelections, mesh::materials_t& PatchMaterials, mesh::indices_t& PatchPoints, mesh::table_t& ConstantAttributes, mesh::table_t& PatchAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ) : patch_selections(PatchSelections), patch_materials(PatchMaterials), patch_points(PatchPoints), constant_attributes(ConstantAttributes), patch_attributes(PatchAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("bilinear_patch"); primitive* const result = new primitive( generic_primitive.structure["patch"].create("patch_selections"), generic_primitive.structure["patch"].create("patch_materials"), generic_primitive.structure["vertex"].create("patch_points"), generic_primitive.attributes["constant"], generic_primitive.attributes["patch"], generic_primitive.attributes["parameter"], generic_primitive.attributes["vertex"] ); result->patch_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->patch_points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "bilinear_patch") return 0; try { require_valid_primitive(Mesh, Primitive); const table& patch_structure = require_structure(Primitive, "patch"); const table& vertex_structure = require_structure(Primitive, "vertex"); const mesh::selection_t& patch_selections = require_array(Primitive, patch_structure, "patch_selections"); const mesh::materials_t& patch_materials = require_array(Primitive, patch_structure, "patch_materials"); const mesh::indices_t& patch_points = require_array(Primitive, vertex_structure, "patch_points"); const table& constant_attributes = require_attributes(Primitive, "constant"); const table& patch_attributes = require_attributes(Primitive, "patch"); const table& parameter_attributes = require_attributes(Primitive, "parameter"); const table& vertex_attributes = require_attributes(Primitive, "vertex"); require_metadata(Primitive, patch_selections, "patch_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, patch_points, "patch_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", patch_structure.row_count() * 4); require_table_row_count(Primitive, parameter_attributes, "parameter", patch_structure.row_count() * 4); return new const_primitive(patch_selections, patch_materials, patch_points, constant_attributes, patch_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "bilinear_patch") return 0; try { require_valid_primitive(Mesh, Primitive); table& patch_structure = require_structure(Primitive, "patch"); table& vertex_structure = require_structure(Primitive, "vertex"); mesh::selection_t& patch_selections = require_array(Primitive, patch_structure, "patch_selections"); mesh::materials_t& patch_materials = require_array(Primitive, patch_structure, "patch_materials"); mesh::indices_t& patch_points = require_array(Primitive, vertex_structure, "patch_points"); table& constant_attributes = require_attributes(Primitive, "constant"); table& patch_attributes = require_attributes(Primitive, "patch"); table& parameter_attributes = require_attributes(Primitive, "parameter"); table& vertex_attributes = require_attributes(Primitive, "vertex"); require_metadata(Primitive, patch_selections, "patch_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, patch_points, "patch_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", patch_structure.row_count() * 4); require_table_row_count(Primitive, parameter_attributes, "parameter", patch_structure.row_count() * 4); return new primitive(patch_selections, patch_materials, patch_points, constant_attributes, patch_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "bilinear_patch") return 0; return validate(Mesh, Primitive.writable()); } } // namespace bilinear_patch } // namespace k3d ================================================ FILE: k3dsdk/bilinear_patch.h ================================================ #ifndef K3DSDK_BILINEAR_PATCH_H #define K3DSDK_BILINEAR_PATCH_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace bilinear_patch { /// Gathers the member arrays of a bilinear_patch primitive into a convenient package class const_primitive { public: const_primitive( const mesh::selection_t& PatchSelections, const mesh::materials_t& PatchMaterials, const mesh::indices_t& PatchPoints, const mesh::table_t& ConstantAttributes, const mesh::table_t& PatchAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ); const mesh::selection_t& patch_selections; const mesh::materials_t& patch_materials; const mesh::indices_t& patch_points; const mesh::table_t& constant_attributes; const mesh::table_t& patch_attributes; const mesh::table_t& parameter_attributes; const mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a bilinear_patch primitive into a convenient package class primitive { public: primitive( mesh::selection_t& PatchSelections, mesh::materials_t& PatchMaterials, mesh::indices_t& PatchPoints, mesh::table_t& ConstantAttributes, mesh::table_t& PatchAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ); mesh::selection_t& patch_selections; mesh::materials_t& patch_materials; mesh::indices_t& patch_points; mesh::table_t& constant_attributes; mesh::table_t& patch_attributes; mesh::table_t& parameter_attributes; mesh::table_t& vertex_attributes; }; /// Creates a new bilinear_patch mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid bilinear_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid bilinear_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid bilinear_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace bilinear_patch } // namespace k3d #endif // !K3DSDK_BILINEAR_PATCH_H ================================================ FILE: k3dsdk/bitmap.h ================================================ #ifndef K3DSDK_BITMAP_H #define K3DSDK_BITMAP_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #if BOOST_VERSION < 106900 #include #else #include #endif namespace boost { namespace gil { typedef boost::uint8_t bits8; typedef float32_t bits32f; template<> struct channel_traits { typedef half value_type; typedef half& reference; typedef half* pointer; typedef const half& const_reference; typedef const half* const_pointer; BOOST_STATIC_CONSTANT(bool, is_mutable=true); static value_type min_value() { return half(0.0f); } static value_type max_value() { return half(1.0f); } }; template <> struct channel_converter_unsigned : public std::unary_function { half operator()(bits32f x) const { return half(static_cast(x)); } }; } // namespace gil } // namespace boost namespace k3d { /// Defines a standard pixel as half-precision floating-point RGBA typedef boost::gil::pixel pixel; /// Defines a standard bitmap as half-precision floating-point RGBA typedef boost::gil::image bitmap; /// Define storage for a pixel coordinate typedef bitmap::coord_t pixel_size_t; /// Fills a bitmap with a checkerboard pattern with given check dimensions and colors template void checkerboard_fill(bitmap_t& Bitmap, const pixel_size_t CheckWidth, const pixel_size_t CheckHeight, const even_color_t EvenColor, const odd_color_t OddColor) { typename bitmap_t::iterator target = Bitmap.begin(); for(pixel_size_t y = 0; y < Bitmap.height(); ++y) { const bool even_row = (y / CheckHeight) % 2; for(pixel_size_t x = 0; x < Bitmap.width(); ++x) { const bool even_column = (x / CheckWidth) % 2; if((even_row + even_column) % 2) *target = EvenColor; else *target = OddColor; ++target; } } } } // namespace k3d #endif // !K3DSDK_BITMAP_H ================================================ FILE: k3dsdk/bitmap_modifier.h ================================================ #ifndef K3DSDK_BITMAP_MODIFIER_H #define K3DSDK_BITMAP_MODIFIER_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include namespace k3d { template class bitmap_modifier : public ibitmap_source, public ibitmap_sink { public: iproperty& bitmap_source_output() { return m_output_bitmap; } iproperty& bitmap_sink_input() { return m_input_bitmap; } sigc::slot make_update_bitmap_slot() { return m_output_bitmap.make_slot(); } protected: bitmap_modifier() : m_input_bitmap( init_owner(owner()) + init_name("input_bitmap") + init_label(_("Input Bitmap")) + init_description(_("Input bitmap")) + init_value(0)), m_output_bitmap( init_owner(owner()) + init_name("output_bitmap") + init_label(_("Output Bitmap")) + init_description(_("Output bitmap"))) { m_output_bitmap.set_update_slot(sigc::mem_fun(*this, &bitmap_modifier::execute)); m_input_bitmap.changed_signal().connect(hint::converter< hint::convert > > >(m_output_bitmap.make_slot())); } k3d_data(bitmap*, immutable_name, change_signal, no_undo, local_storage, no_constraint, read_only_property, no_serialization) m_input_bitmap; k3d_data(bitmap*, immutable_name, change_signal, no_undo, pointer_demand_storage, no_constraint, read_only_property, no_serialization) m_output_bitmap; private: inline derived_t& owner() { return *static_cast(this); } void execute(const std::vector& Hints, bitmap& Bitmap) { if(const bitmap* const input = m_input_bitmap.pipeline_value()) { bool resize_bitmap = false; bool assign_pixels = false; for(int i = 0; i != Hints.size(); ++i) { // Input pixels changed, so all we have to do is reassign ours ... if(dynamic_cast(Hints[i])) { assign_pixels = true; } // In every other case (bitmap_dimensions_changed, unknown hint, or no hint), // we must assume the worst and recreate everything from scratch ... else { resize_bitmap = true; assign_pixels = true; break; } } if(resize_bitmap) { owner().document().pipeline_profiler().start_execution(owner(), "Resize Bitmap"); on_resize_bitmap(*input, Bitmap); owner().document().pipeline_profiler().finish_execution(owner(), "Resize Bitmap"); } if(assign_pixels) { owner().document().pipeline_profiler().start_execution(owner(), "Assign Pixels"); on_assign_pixels(*input, Bitmap); owner().document().pipeline_profiler().finish_execution(owner(), "Assign Pixels"); } } } virtual void on_resize_bitmap(const bitmap& Input, bitmap& Output) = 0; virtual void on_assign_pixels(const bitmap& Input, bitmap& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_BITMAP_MODIFIER_H ================================================ FILE: k3dsdk/bitmap_sink.h ================================================ #ifndef K3DSDK_BITMAP_SINK_H #define K3DSDK_BITMAP_SINK_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { template class bitmap_sink : public ibitmap_sink { public: iproperty& bitmap_sink_input() { return m_input_bitmap; } sigc::slot make_input_changed_slot() { return sigc::mem_fun(*this, &bitmap_sink::input_changed); } protected: bitmap_sink() : m_input_bitmap( init_owner(*static_cast(this)) + init_name("input_bitmap") + init_label(_("Input Bitmap")) + init_description(_("Input bitmap")) + init_value(0)) { m_input_bitmap.changed_signal().connect(make_input_changed_slot()); } k3d_data(bitmap*, data::immutable_name, data::change_signal, data::no_undo, data::local_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_input_bitmap; private: void input_changed(k3d::ihint* Hint) { on_input_changed(Hint); } virtual void on_input_changed(k3d::ihint*) = 0; }; } // namespace k3d #endif // !K3DSDK_BITMAP_SINK_H ================================================ FILE: k3dsdk/bitmap_source.h ================================================ #ifndef K3DSDK_BITMAP_SOURCE_H #define K3DSDK_BITMAP_SOURCE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include namespace k3d { /// Boilerplate CRTP class for bitmap source objects that produce a k3d::bitmap* as output. template class bitmap_source : public ibitmap_source { public: iproperty& bitmap_source_output() { return m_output_bitmap; } /// Returns a slot that should be connected to input properties to signal that the output has changed. sigc::slot make_update_bitmap_slot() { return m_output_bitmap.make_slot(); } protected: bitmap_source() : m_output_bitmap( init_owner(owner()) + init_name("output_bitmap") + init_label(_("Output Bitmap")) + init_description(_("Output bitmap"))) { m_output_bitmap.set_update_slot(sigc::mem_fun(*this, &bitmap_source::execute)); } /// Stores the output bitmap, which is created on-demand. k3d_data(bitmap*, immutable_name, change_signal, no_undo, pointer_demand_storage, no_constraint, read_only_property, no_serialization) m_output_bitmap; private: inline derived_t& owner() { return *static_cast(this); } /// Called whenever the output has been modified and needs to be updated. void execute(const std::vector& Hints, bitmap& Bitmap) { bool_t resize_bitmap = false; bool_t assign_pixels = false; for(uint_t i = 0; i != Hints.size(); ++i) { // Input pixels changed, so all we have to do is reassign ours ... if(dynamic_cast(Hints[i])) { assign_pixels = true; } // In every other case (bitmap_dimensions_changed, unknown hint, or no hint), // we must assume the worst and recreate everything from scratch ... else { resize_bitmap = true; assign_pixels = true; break; } } if(resize_bitmap) { owner().document().pipeline_profiler().start_execution(owner(), "Resize Bitmap"); on_resize_bitmap(Bitmap); owner().document().pipeline_profiler().finish_execution(owner(), "Resize Bitmap"); } if(assign_pixels) { owner().document().pipeline_profiler().start_execution(owner(), "Assign Pixels"); on_assign_pixels(Bitmap); owner().document().pipeline_profiler().finish_execution(owner(), "Assign Pixels"); } } /// Implement this in derived classes to set the size of the output bitmap. virtual void on_resize_bitmap(bitmap& Output) = 0; /// Implement this in derived classes to assign values to each output pixel. virtual void on_assign_pixels(bitmap& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_BITMAP_SOURCE_H ================================================ FILE: k3dsdk/blobby.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { namespace blobby { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::indices_t& FirstPrimitives, const mesh::counts_t& PrimitiveCounts, const mesh::indices_t& FirstOperators, const mesh::counts_t& OperatorCounts, const mesh::materials_t& Materials, const typed_array& Primitives, const mesh::indices_t& PrimitiveFirstFloats, const mesh::counts_t& PrimitiveFloatCounts, const typed_array& Operators, const mesh::indices_t& OperatorFirstOperands, const mesh::counts_t& OperatorOperandCounts, const mesh::doubles_t& Floats, const mesh::indices_t& Operands, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ) : first_primitives(FirstPrimitives), primitive_counts(PrimitiveCounts), first_operators(FirstOperators), operator_counts(OperatorCounts), materials(Materials), primitives(Primitives), primitive_first_floats(PrimitiveFirstFloats), primitive_float_counts(PrimitiveFloatCounts), operators(Operators), operator_first_operands(OperatorFirstOperands), operator_operand_counts(OperatorOperandCounts), floats(Floats), operands(Operands), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::indices_t& FirstPrimitives, mesh::counts_t& PrimitiveCounts, mesh::indices_t& FirstOperators, mesh::counts_t& OperatorCounts, mesh::materials_t& Materials, typed_array& Primitives, mesh::indices_t& PrimitiveFirstFloats, mesh::counts_t& PrimitiveFloatCounts, typed_array& Operators, mesh::indices_t& OperatorFirstOperands, mesh::counts_t& OperatorOperandCounts, mesh::doubles_t& Floats, mesh::indices_t& Operands, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ) : first_primitives(FirstPrimitives), primitive_counts(PrimitiveCounts), first_operators(FirstOperators), operator_counts(OperatorCounts), materials(Materials), primitives(Primitives), primitive_first_floats(PrimitiveFirstFloats), primitive_float_counts(PrimitiveFloatCounts), operators(Operators), operator_first_operands(OperatorFirstOperands), operator_operand_counts(OperatorOperandCounts), floats(Floats), operands(Operands), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("blobby"); primitive* const result = new primitive( generic_primitive.structure["surface"].create("first_primitives"), generic_primitive.structure["surface"].create("primitive_counts"), generic_primitive.structure["surface"].create("first_operators"), generic_primitive.structure["surface"].create("operator_counts"), generic_primitive.structure["surface"].create("materials"), generic_primitive.structure["vertex"].create >("primitives"), generic_primitive.structure["vertex"].create("primitive_first_floats"), generic_primitive.structure["vertex"].create("primitive_float_counts"), generic_primitive.structure["operator"].create >("operators"), generic_primitive.structure["operator"].create("operator_first_operands"), generic_primitive.structure["operator"].create("operator_operand_counts"), generic_primitive.structure["float"].create("floats"), generic_primitive.structure["operand"].create("operands"), generic_primitive.attributes["constant"], generic_primitive.attributes["surface"], generic_primitive.attributes["parameter"], generic_primitive.attributes["vertex"] ); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "blobby") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& surface_structure = require_structure(Primitive, "surface"); const mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); const mesh::table_t& operator_structure = require_structure(Primitive, "operator"); const mesh::table_t& float_structure = require_structure(Primitive, "float"); const mesh::table_t& operand_structure = require_structure(Primitive, "operand"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); const mesh::indices_t& first_primitives = require_array(Primitive, surface_structure, "first_primitives"); const mesh::counts_t& primitive_counts = require_array(Primitive, surface_structure, "primitive_counts"); const mesh::indices_t& first_operators = require_array(Primitive, surface_structure, "first_operators"); const mesh::counts_t& operator_counts = require_array(Primitive, surface_structure, "operator_counts"); const mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); const typed_array& primitives = require_array >(Primitive, vertex_structure, "primitives"); const mesh::indices_t& primitive_first_floats = require_array(Primitive, vertex_structure, "primitive_first_floats"); const mesh::counts_t& primitive_float_counts = require_array(Primitive, vertex_structure, "primitive_float_counts"); const typed_array& operators = require_array >(Primitive, operator_structure, "operators"); const mesh::indices_t& operator_first_operands = require_array(Primitive, operator_structure, "operator_first_operands"); const mesh::counts_t& operator_operand_counts = require_array(Primitive, operator_structure, "operator_operand_counts"); const mesh::doubles_t& floats = require_array(Primitive, float_structure, "floats"); const mesh::indices_t& operands = require_array(Primitive, operand_structure, "operands"); /** \todo Validate table lengths here */ return new const_primitive(first_primitives, primitive_counts, first_operators, operator_counts, materials, primitives, primitive_first_floats, primitive_float_counts, operators, operator_first_operands, operator_operand_counts, floats, operands, constant_attributes, surface_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "blobby") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& surface_structure = require_structure(Primitive, "surface"); mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); mesh::table_t& operator_structure = require_structure(Primitive, "operator"); mesh::table_t& float_structure = require_structure(Primitive, "float"); mesh::table_t& operand_structure = require_structure(Primitive, "operand"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); mesh::indices_t& first_primitives = require_array(Primitive, surface_structure, "first_primitives"); mesh::counts_t& primitive_counts = require_array(Primitive, surface_structure, "primitive_counts"); mesh::indices_t& first_operators = require_array(Primitive, surface_structure, "first_operators"); mesh::counts_t& operator_counts = require_array(Primitive, surface_structure, "operator_counts"); mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); typed_array& primitives = require_array >(Primitive, vertex_structure, "primitives"); mesh::indices_t& primitive_first_floats = require_array(Primitive, vertex_structure, "primitive_first_floats"); mesh::counts_t& primitive_float_counts = require_array(Primitive, vertex_structure, "primitive_float_counts"); typed_array& operators = require_array >(Primitive, operator_structure, "operators"); mesh::indices_t& operator_first_operands = require_array(Primitive, operator_structure, "operator_first_operands"); mesh::counts_t& operator_operand_counts = require_array(Primitive, operator_structure, "operator_operand_counts"); mesh::doubles_t& floats = require_array(Primitive, float_structure, "floats"); mesh::indices_t& operands = require_array(Primitive, operand_structure, "operands"); /** \todo Validate table lengths here */ return new primitive(first_primitives, primitive_counts, first_operators, operator_counts, materials, primitives, primitive_first_floats, primitive_float_counts, operators, operator_first_operands, operator_operand_counts, floats, operands, constant_attributes, surface_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "blobby") return 0; return validate(Mesh, Primitive.writable()); } } // namespace blobby } // namespace k3d ================================================ FILE: k3dsdk/blobby.h ================================================ #ifndef K3DSDK_BLOBBY_H #define K3DSDK_BLOBBY_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace blobby { /// Predefined primitive types from the RenderMan Specification enum primitive_type { CONSTANT = 1000, ELLIPSOID = 1001, SEGMENT = 1002, }; /// Predefined operator types from the RenderMan Specification enum operator_type { ADD = 0, MULTIPLY = 1, MAXIMUM = 2, MINIMUM = 3, SUBTRACT = 4, DIVIDE = 5, NEGATE = 6, IDENTITY = 7, }; /// Gathers the member arrays of a blobby primitive into a convenient package class const_primitive { public: const_primitive( const mesh::indices_t& FirstPrimitives, const mesh::counts_t& PrimitiveCounts, const mesh::indices_t& FirstOperators, const mesh::counts_t& OperatorCounts, const mesh::materials_t& Materials, const typed_array& Primitives, const mesh::indices_t& PrimitiveFirstFloats, const mesh::counts_t& PrimitiveFloatCounts, const typed_array& Operators, const mesh::indices_t& OperatorFirstOperands, const mesh::counts_t& OperatorOperandCounts, const mesh::doubles_t& Floats, const mesh::indices_t& Operands, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ); const mesh::indices_t& first_primitives; const mesh::counts_t& primitive_counts; const mesh::indices_t& first_operators; const mesh::counts_t& operator_counts; const mesh::materials_t& materials; const typed_array& primitives; const mesh::indices_t& primitive_first_floats; const mesh::counts_t& primitive_float_counts; const typed_array& operators; const mesh::indices_t& operator_first_operands; const mesh::counts_t& operator_operand_counts; const mesh::doubles_t& floats; const mesh::indices_t& operands; const mesh::table_t& constant_attributes; const mesh::table_t& surface_attributes; const mesh::table_t& parameter_attributes; const mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a blobby primitive into a convenient package class primitive { public: primitive( mesh::indices_t& FirstPrimitives, mesh::counts_t& PrimitiveCounts, mesh::indices_t& FirstOperators, mesh::counts_t& OperatorCounts, mesh::materials_t& Materials, typed_array& Primitives, mesh::indices_t& PrimitiveFirstFloats, mesh::counts_t& PrimitiveFloatCounts, typed_array& Operators, mesh::indices_t& OperatorFirstOperands, mesh::counts_t& OperatorOperandCounts, mesh::doubles_t& Floats, mesh::indices_t& Operands, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ); mesh::indices_t& first_primitives; mesh::counts_t& primitive_counts; mesh::indices_t& first_operators; mesh::counts_t& operator_counts; mesh::materials_t& materials; typed_array& primitives; mesh::indices_t& primitive_first_floats; mesh::counts_t& primitive_float_counts; typed_array& operators; mesh::indices_t& operator_first_operands; mesh::counts_t& operator_operand_counts; mesh::doubles_t& floats; mesh::indices_t& operands; mesh::table_t& constant_attributes; mesh::table_t& surface_attributes; mesh::table_t& parameter_attributes; mesh::table_t& vertex_attributes; }; /// Creates a new blobby mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid blobby primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid blobby primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid blobby primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace blobby } // namespace k3d #endif // !K3DSDK_BLOBBY_H ================================================ FILE: k3dsdk/boost_throw_exception.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace boost { /// Override the boost exception handler to make debugging easier void throw_exception(std::exception const & e) { k3d::log() << critical << "Boost exception: " << e.what() << std::endl; assert(0); } } // namespace boost ================================================ FILE: k3dsdk/bounding_box3.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include namespace k3d { bounding_box3& bounding_box3::operator*=(const matrix4 Transformation) { bounding_box3 transformed; transformed.insert(Transformation * point3(px, py, pz)); transformed.insert(Transformation * point3(nx, py, pz)); transformed.insert(Transformation * point3(nx, py, nz)); transformed.insert(Transformation * point3(px, py, nz)); transformed.insert(Transformation * point3(px, ny, pz)); transformed.insert(Transformation * point3(nx, ny, pz)); transformed.insert(Transformation * point3(nx, ny, nz)); transformed.insert(Transformation * point3(px, ny, nz)); *this = transformed; return *this; } bounding_box3 operator*(const bounding_box3& BBox, const matrix4& Transformation) { bounding_box3 new_box = BBox; new_box *= Transformation; return new_box; } bounding_box3 operator*(const matrix4& Transformation, const bounding_box3& BBox) { bounding_box3 new_box = BBox; new_box *= Transformation; return new_box; } bool operator==(const bounding_box3& LHS, const bounding_box3& RHS) { return LHS.nx == RHS.nx && LHS.px == RHS.px && LHS.ny == RHS.ny && LHS.py == RHS.py && LHS.nz == RHS.nz && LHS.pz == RHS.pz; } bool operator!=(const bounding_box3& LHS, const bounding_box3& RHS) { return !(LHS == RHS); } std::ostream& operator<<(std::ostream& Stream, const bounding_box3& RHS) { Stream << RHS.nx << " " << RHS.px << " " << RHS.ny << " " << RHS.py << " " << RHS.nz << " " << RHS.pz; return Stream; } std::istream& operator>>(std::istream& Stream, bounding_box3& RHS) { Stream >> RHS.nx >> RHS.px >> RHS.ny >> RHS.py >> RHS.nz >> RHS.pz; return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/bounding_box3.h ================================================ #ifndef K3DSDK_BOUNDING_BOX3_H #define K3DSDK_BOUNDING_BOX3_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Anders Dahnielson (anders@dahnielson.com) */ #include #include #include #include #include #include namespace k3d { class matrix4; /// Stores an axis-aligned bounding-box in three space class bounding_box3 { public: /// Initializes an "empty" bounding box (note: "empty" means "undefined" - it's not the same as having all values zero) explicit bounding_box3() : px(-std::numeric_limits::max()), nx(std::numeric_limits::max()), py(-std::numeric_limits::max()), ny(std::numeric_limits::max()), pz(-std::numeric_limits::max()), nz(std::numeric_limits::max()) { } bounding_box3(double PX, double NX, double PY, double NY, double PZ, double NZ) : px(std::max(PX, NX)), nx(std::min(PX, NX)), py(std::max(PY, NY)), ny(std::min(PY, NY)), pz(std::max(PZ, NZ)), nz(std::min(PZ, NZ)) { } /// Grows the bounding box as needed to contain the given point void insert(const point3& Point) { px = std::max(px, Point[0]); nx = std::min(nx, Point[0]); py = std::max(py, Point[1]); ny = std::min(ny, Point[1]); pz = std::max(pz, Point[2]); nz = std::min(nz, Point[2]); } /// Grows the bounding box as needed to contain the given bounding box void insert(const bounding_box3& Box) { px = std::max(px, Box.px); nx = std::min(nx, Box.nx); py = std::max(py, Box.py); ny = std::min(ny, Box.ny); pz = std::max(pz, Box.pz); nz = std::min(nz, Box.nz); } /// Returns true iff the bounding box contains the given point bool contains(const point3& Point) const { return nx <= Point[0] && Point[0] <= px && ny <= Point[1] && Point[1] <= py && nz <= Point[2] && Point[2] <= pz; } /// Returns true iff the box is empty (undefined) bool empty() const { return px < nx || py < ny || pz < nz; } /// Returns the width of the bounding box, or zero if the box is empty double width() const { return empty() ? 0.0 : px-nx; } /// Returns the height of the bounding box, or zero if the box is empty double height() const { return empty() ? 0.0 : py-ny; } /// Returns the depth of the bounding box, or zero if the box is empty double depth() const { return empty() ? 0.0 : pz-nz; } /// Returns the center of the bounding box, asserts if the box is empty const point3 center() const { assert(!empty()); return point3((px + nx) / 2, (py + ny) / 2, (pz + nz) / 2); } bounding_box3& operator*=(const matrix4 Transformation); /// Stores the maximum x value (not necessarily positive) double px; /// Stores the minimum x value (not necessarily negative) double nx; /// Stores the maximum y value (not necessarily positive) double py; /// Stores the minimum y value (not necessarily negative) double ny; /// Stores the maximum z value (not necessarily positive) double pz; /// Stores the minimum z value (not necessarily negative) double nz; }; bounding_box3 operator*(const bounding_box3& BBox, const matrix4& Transformation); bounding_box3 operator*(const matrix4& Transformation, const bounding_box3& BBox); bool operator==(const bounding_box3& LHS, const bounding_box3& RHS); bool operator!=(const bounding_box3& LHS, const bounding_box3& RHS); std::ostream& operator<<(std::ostream& Stream, const bounding_box3& RHS); std::istream& operator>>(std::istream& Stream, bounding_box3& RHS); } // namespace k3d #endif // !K3DSDK_BOUNDING_BOX3_H ================================================ FILE: k3dsdk/classes.h ================================================ #ifndef K3DSDK_CLASSES_H #define K3DSDK_CLASSES_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Provides public definitions of a subset of commonly-used class IDs \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iunknown; namespace classes { ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// //// //// DO NOT ADD TO THIS LIST!!! //// //// You DO NOT have to add your objects' class IDs to this list to get them recognized //// by K-3D! This list only defines the class IDs for a subset of commonly-used objects //// that need to be explicitly instantiated by other objects (like import plugins). //// //// In general, you should never care about an object's class ID - only its capabilities, //// as advertised by its interfaces! //// //// Never, never change the values of the class IDs in this list - they get serialized in //// documents, and are used to thaw out the correct object types! //// //// Now go call your mother! //// ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// /** \name Active class IDs */ //@{ inline const uuid Axes() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000001); } inline const uuid FileBitmap() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000003); } inline const uuid RenderManLight() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x0000001d); } inline const uuid RenderManMaterial() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000024); } inline const uuid Cone() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000064); } inline const uuid Cylinder() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000065); } inline const uuid Disk() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000066); } inline const uuid Hyperboloid() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000067); } inline const uuid Paraboloid() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000068); } inline const uuid Sphere() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000069); } inline const uuid Torus() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x0000006a); } inline const uuid PerlEngine() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000075); } inline const uuid PythonEngine() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000076); } inline const uuid ScalarBezierChannel() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x0000007c); } inline const uuid ColorBezierChannel() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x0000007d); } inline const uuid TIFFBitmapExporter() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000085); } inline const uuid FrozenMesh() { return uuid(0x305ceb88, 0x7cf34870, 0x8b5e673c, 0x636beab9); } inline const uuid MeshInstance() { return uuid(0x2c1d60a6, 0x863541a1, 0xbd649bd1, 0x1ea8ae24); } inline const uuid TimeSource() { return uuid(0x1978f1f7, 0x4a864c99, 0x8caf7cfc, 0xd2591baf); } inline const uuid OpenGLEngine() { return uuid(0x0059ba47, 0x7bf740f3, 0x93fb523d, 0x5899f22c); } inline const uuid RenderManEngine() { return uuid(0x0dc5e733, 0xfa684e05, 0x86a3865f, 0x42f7a99d); } inline const uuid RenderManDisplacementShader() { return uuid(0x62827bb7, 0x4cb64427, 0xa9eadbc8, 0x62e1a3f2); } inline const uuid RenderManImagerShader() { return uuid(0x91659033, 0xbd124ba0, 0x81eabb0a, 0xc5ecd094); } inline const uuid RenderManLightShader() { return uuid(0x830e867b, 0x7bc94c6c, 0x8d5087ee, 0x8aa35db2); } inline const uuid RenderManSurfaceShader() { return uuid(0xb553a3bd, 0xd1044c6e, 0xb3f21e07, 0x87132c31); } inline const uuid RenderManVolumeShader() { return uuid(0xfd07a255, 0x9bb84841, 0x87632abe, 0x3ceb9fc7); } inline const uuid Position() { return uuid(0xe2edd795, 0x08f9416a, 0x84139876, 0x9c25a60a); } inline const uuid Orientation() { return uuid(0xcf562348, 0x02624035, 0xae649a84, 0xf42e0b69); } inline const uuid Scale() { return uuid(0x542de0d6, 0xe1e94e4a, 0x883eb23c, 0x3612fb8a); } inline const uuid FrozenMatrix() { return uuid(0x6ea85710, 0x90da4d35, 0xacec30ee, 0xa6aacb9d); } inline const uuid Camera() { return uuid(0x45ce1872, 0xaf184b6d, 0xb391e136, 0x0dcfe8b5); } inline const uuid DocumentExporter() { return uuid(0x0cbc9131, 0x172541b2, 0xb424afab, 0x25143d55); } inline const uuid DocumentImporter() { return uuid(0xf02e8dac, 0xa57d4d76, 0xa6170c3a, 0x9bf09d3b); } inline const uuid AqsisDisplacementShaderLayer() { return uuid(0x1802dce3, 0x71004329, 0x80cbdf0e, 0xbc7f142c); } inline const uuid AqsisSurfaceShaderLayer() { return uuid(0x261e244e, 0xd82947ba, 0x9e56a9af, 0x03d4cc0f); } inline const uuid MultiMaterial() { return uuid(0x00000001, 0x00000002, 0x00000003, 0x00000004); } //@} /** \name Inactive class IDs for plugins that have been removed */ //@{ inline const uuid JavaScriptEngine() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000048); } inline const uuid Transform() { return uuid(0x00000001, 0x00000000, 0x00000000, 0x00000081); } //@} } // namespace classes } // namespace k3d #endif // !K3DSDK_CLASSES_H ================================================ FILE: k3dsdk/color.h ================================================ #ifndef K3DSDK_COLOR_H #define K3DSDK_COLOR_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { template class basic_alpha; template class basic_luma; template class basic_luma_alpha; template class basic_rgb; template class basic_rgba; ///////////////////////////////////////////////////////////////////////////// // color_traits /// Describes traits of a type used as a sample within a color specification template class color_traits { public: typedef SampleType sample_type; /// Returns the maximum value of a sample static sample_type minimum(); /// Returns the minimum value of a sample static sample_type maximum(); /// Returns the sample value corresponding to transparent alpha static sample_type transparent() { return minimum(); } /// Returns the sample value corresponding to opaque alpha static sample_type opaque() { return maximum(); } /// Inverts the value of a sample static sample_type invert(const sample_type& Sample); }; ///////////////////////////////////////////////////////////////////////////// // color_traits /// Specialization of color_traits for 8 bit samples template<> class color_traits { public: /// Defines the sample type for this specialization typedef boost::uint8_t sample_type; /// Returns the minimum value of a sample static inline sample_type minimum() { return 0; } /// Returns the maximum value of a sample static inline sample_type maximum() { return 255; } /// Returns the sample value corresponding to transparent alpha static inline sample_type transparent() { return minimum(); } /// Returns the sample value corresponding to opaque alpha static inline sample_type opaque() { return maximum(); } /// Inverts the value of a sample static inline sample_type invert(const sample_type& Sample) { return maximum() - Sample; } /// Converts a sample from a uint8_t static inline sample_type convert(const sample_type Sample) { return Sample; } /// Converts a sample from a half static inline sample_type convert(const half Sample) { return static_cast(clamp(Sample, half(0), half(1)) * maximum()); } /// Converts a sample from a float static inline sample_type convert(const float Sample) { return static_cast(clamp(Sample, float(0), float(1)) * maximum()); } /// Converts a sample from a double static inline sample_type convert(const double_t Sample) { return static_cast(clamp(Sample, double_t(0), double_t(1)) * maximum()); } }; ///////////////////////////////////////////////////////////////////////////// // color_traits /// Specialization of color_traits for 16 bit samples template<> class color_traits { public: /// Defines the sample type for this specialization typedef boost::uint16_t sample_type; /// Returns the minimum value of a sample static inline sample_type minimum() { return 0; } /// Returns the maximum value of a sample static inline sample_type maximum() { return 65535; } /// Returns the sample value corresponding to transparent alpha static inline sample_type transparent() { return minimum(); } /// Returns the sample value corresponding to opaque alpha static inline sample_type opaque() { return maximum(); } /// Inverts the value of a sample static inline sample_type invert(const sample_type& Sample) { return maximum() - Sample; } /// Converts a sample from a uint16_t static inline sample_type convert(const sample_type Sample) { return Sample; } /// Converts a sample from a half static inline sample_type convert(const half Sample) { return static_cast(clamp(Sample, half(0), half(1)) * maximum()); } /// Converts a sample from a float static inline sample_type convert(const float Sample) { return static_cast(clamp(Sample, float(0), float(1)) * maximum()); } /// Converts a sample from a double static inline sample_type convert(const double_t Sample) { return static_cast(clamp(Sample, double_t(0), double_t(1)) * maximum()); } }; ///////////////////////////////////////////////////////////////////////////// // color_traits /// Specialization of color_traits for half samples template<> class color_traits { public: /// Defines the sample type for this specialization typedef half sample_type; /// Returns the minimum value of a sample static inline sample_type minimum() { return 0; } /// Returns the maximum value of a sample static inline sample_type maximum() { return 1; } /// Returns the sample value corresponding to transparent alpha static inline sample_type transparent() { return minimum(); } /// Returns the sample value corresponding to opaque alpha static inline sample_type opaque() { return maximum(); } /// Inverts the value of a sample static inline sample_type invert(const sample_type& Sample) { return maximum() - Sample; } /// Converts a sample from a uint8_t static inline sample_type convert(const boost::uint8_t Sample) { return static_cast(Sample) / 255.0f; } /// Converts a sample from a uint16_t static inline sample_type convert(const boost::uint16_t Sample) { return static_cast(Sample) / 65535.0f; } /// Converts a sample from a half static inline sample_type convert(const sample_type Sample) { return Sample; } /// Converts a sample from a float static inline sample_type convert(const float Sample) { return static_cast(Sample); } /// Converts a sample from a double static inline sample_type convert(const double_t Sample) { return static_cast(static_cast(Sample)); } }; ///////////////////////////////////////////////////////////////////////////// // color_traits /// Specialization of color_traits for float samples template<> class color_traits { public: /// Defines the sample type for this specialization typedef float sample_type; /// Returns the minimum value of a sample static inline sample_type minimum() { return 0; } /// Returns the maximum value of a sample static inline sample_type maximum() { return 1; } /// Returns the sample value corresponding to transparent alpha static inline sample_type transparent() { return minimum(); } /// Returns the sample value corresponding to opaque alpha static inline sample_type opaque() { return maximum(); } /// Inverts the value of a sample static inline sample_type invert(const sample_type& Sample) { return maximum() - Sample; } /// Converts a sample from a uint8_t static inline sample_type convert(const boost::uint8_t Sample) { return static_cast(Sample) / 255.0f; } /// Converts a sample from a half static inline sample_type convert(const half Sample) { return Sample; } /// Converts a sample from a float static inline sample_type convert(const sample_type Sample) { return static_cast(Sample); } /// Converts a sample from a double static inline sample_type convert(const double_t Sample) { return static_cast(Sample); } }; ///////////////////////////////////////////////////////////////////////////// // color_traits /// Specialization of color_traits for double samples template<> class color_traits { public: /// Defines the sample type for this specialization typedef double_t sample_type; /// Returns the minimum value of a sample static inline sample_type minimum() { return 0; } /// Returns the maximum value of a sample static inline sample_type maximum() { return 1; } /// Returns the sample value corresponding to transparent alpha static inline sample_type transparent() { return minimum(); } /// Returns the sample value corresponding to opaque alpha static inline sample_type opaque() { return maximum(); } /// Inverts the value of a sample static inline sample_type invert(const sample_type& Sample) { return maximum() - Sample; } /// Converts a sample from a uint8_t static inline sample_type convert(const boost::uint8_t Sample) { return static_cast(Sample) / 255.0; } /// Converts a sample from a half static inline sample_type convert(const half Sample) { return Sample; } /// Converts a sample from a float static inline sample_type convert(const float Sample) { return Sample; } /// Converts a sample from a double static inline sample_type convert(const sample_type Sample) { return Sample; } }; ///////////////////////////////////////////////////////////////////////////// // basic_hsv /// Encapsulates storage for an HSV color sample class basic_hsv { public: typedef double_t sample_type; typedef color_traits sample_traits; typedef basic_hsv this_type; /// Default constructor sets all samples to zero basic_hsv() : hue(sample_traits::minimum()), saturation(sample_traits::minimum()), value(sample_traits::minimum()) { } /// Constructor that takes hue, saturation, and value samples basic_hsv(const sample_type Hue, const sample_type Saturation, const sample_type Value) : hue(Hue), saturation(Saturation), value(Value) { } template basic_hsv(const basic_luma& RHS) : hue(sample_traits::minimum()), saturation(sample_traits::minimum()), value(sample_traits::convert(RHS.luma)) { } template basic_hsv(const ForeignType& RHS) { const sample_type red = sample_traits::convert(RHS.red); const sample_type green = sample_traits::convert(RHS.green); const sample_type blue = sample_traits::convert(RHS.blue); const sample_type maxcomponent = std::max(std::max(red, green), blue); const sample_type mincomponent = std::min(std::min(red, green), blue); const sample_type difference = maxcomponent - mincomponent; value = maxcomponent; saturation = maxcomponent ? difference / maxcomponent : sample_traits::minimum(); if(saturation != sample_traits::minimum()) { const sample_type reddistance = (maxcomponent - red) / difference; const sample_type greendistance = (maxcomponent - green) / difference; const sample_type bluedistance = (maxcomponent - blue) / difference; if(red == maxcomponent) { hue = bluedistance - greendistance; } else if(green == maxcomponent) { hue = 2 + reddistance - bluedistance; } else { hue = 4 + greendistance - reddistance; } hue *= 60; while(hue < 0) hue += 360; while(hue >= 360) hue -= 360; } else { hue = sample_traits::minimum(); } } /// Serialization friend std::ostream& operator<<(std::ostream& Stream, const basic_hsv& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.hue << " " << RHS.saturation << " " << RHS.value; return Stream; } /// Deserialization friend std::istream& operator>>(std::istream& Stream, basic_hsv& RHS) { Stream >> RHS.hue >> RHS.saturation >> RHS.value; return Stream; } sample_type hue; sample_type saturation; sample_type value; }; ///////////////////////////////////////////////////////////////////////////// // basic_alpha /// Encapsulates storage for an alpha color sample template > class basic_alpha { public: typedef SampleType sample_type; typedef SampleTraits sample_traits; typedef basic_alpha this_type; /// Default constructor sets all samples to zero basic_alpha() : alpha(sample_traits::transparent()) { } /// Straightforward constructor that initializes samples basic_alpha(const sample_type Alpha) : alpha(Alpha) { } template basic_alpha(const basic_alpha& RHS) : alpha(sample_traits::convert(RHS.Alpha)) { } template basic_alpha(const basic_rgb& RHS) : alpha(sample_traits::opaque()) { } template basic_alpha(const basic_rgba& RHS) : alpha(sample_traits::convert(RHS.alpha)) { } basic_alpha(const basic_hsv& RHS) : alpha(sample_traits::opaque()) { } /// Serialization friend std::ostream& operator<<(std::ostream& Stream, const basic_alpha& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.alpha; return Stream; } /// Deserialization friend std::istream& operator>>(std::istream& Stream, basic_alpha& RHS) { Stream >> RHS.alpha; return Stream; } sample_type alpha; }; ///////////////////////////////////////////////////////////////////////////// // basic_luma /// Encapsulates storage for a luma color sample template > class basic_luma { public: typedef SampleType sample_type; typedef SampleTraits sample_traits; typedef basic_luma this_type; /// Default constructor sets all samples to zero basic_luma() : luma(sample_traits::minimum()) { } /// Straightforward constructor that initializes samples basic_luma(const sample_type Luma) : luma(Luma) { } template basic_luma(const basic_luma& RHS) : luma(sample_traits::convert(RHS.luma)) { } template basic_luma(const basic_rgb& RHS) : luma(sample_traits::convert(std::max(RHS.red, std::max(RHS.green, RHS.blue)))) { } template basic_luma(const basic_rgba& RHS) : luma(sample_traits::convert(std::max(RHS.red, std::max(RHS.green, RHS.blue)))) { } basic_luma(const basic_hsv& RHS) : luma(sample_traits::convert(RHS.value)) { } /// Serialization friend std::ostream& operator<<(std::ostream& Stream, const basic_luma& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.luma; return Stream; } /// Deserialization friend std::istream& operator>>(std::istream& Stream, basic_luma& RHS) { Stream >> RHS.luma; return Stream; } sample_type luma; }; ///////////////////////////////////////////////////////////////////////////// // basic_luma_alpha /// Encapsulates storage for a luma color sample with alpha template > class basic_luma_alpha { public: typedef SampleType sample_type; typedef SampleTraits sample_traits; typedef basic_luma_alpha this_type; /// Default constructor sets all samples to zero basic_luma_alpha() : luma(sample_traits::minimum()), alpha(sample_traits::opaque()) { } /// Straightforward constructor that initializes samples basic_luma_alpha(const sample_type Luma) : luma(Luma), alpha(sample_traits::opaque()) { } basic_luma_alpha(const sample_type Luma, const sample_type Alpha) : luma(Luma), alpha(Alpha) { } template basic_luma_alpha(const basic_luma_alpha& RHS) : luma(sample_traits::convert(RHS.luma)), alpha(sample_traits::convert(RHS.alpha)) { } template basic_luma_alpha(const basic_rgb& RHS) : luma(sample_traits::convert(std::max(RHS.red, std::max(RHS.green, RHS.blue)))), alpha(sample_traits::opaque()) { } template basic_luma_alpha(const basic_rgba& RHS) : luma(sample_traits::convert(std::max(RHS.red, std::max(RHS.green, RHS.blue)))), alpha(sample_traits::convert(RHS.alpha)) { } basic_luma_alpha(const basic_hsv& RHS) : luma(sample_traits::convert(RHS.value)), alpha(sample_traits::opaque()) { } /// Serialization friend std::ostream& operator<<(std::ostream& Stream, const basic_luma_alpha& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.luma << RHS.alpha; return Stream; } /// Deserialization friend std::istream& operator>>(std::istream& Stream, basic_luma_alpha& RHS) { Stream >> RHS.luma >> RHS.alpha; return Stream; } sample_type luma; sample_type alpha; }; ///////////////////////////////////////////////////////////////////////////// // basic_rgb /// Encapsulates storage for an RGB color sample template > class basic_rgb { public: typedef SampleType sample_type; typedef SampleTraits sample_traits; typedef basic_rgb this_type; /// Default constructor sets all samples to zero basic_rgb() : red(sample_traits::minimum()), green(sample_traits::minimum()), blue(sample_traits::minimum()) { } /// Constructor that takes red, green, and blue samples basic_rgb(const sample_type Red, const sample_type Green, const sample_type Blue) : red(Red), green(Green), blue(Blue) { } template basic_rgb(const basic_alpha& RHS) : red(sample_traits::convert(RHS.alpha)), green(sample_traits::convert(RHS.alpha)), blue(sample_traits::convert(RHS.alpha)) { } template basic_rgb(const basic_luma& RHS) : red(sample_traits::convert(RHS.luma)), green(sample_traits::convert(RHS.luma)), blue(sample_traits::convert(RHS.luma)) { } template basic_rgb(const basic_rgb& RHS) : red(sample_traits::convert(RHS.red)), green(sample_traits::convert(RHS.green)), blue(sample_traits::convert(RHS.blue)) { } template basic_rgb(const basic_rgba& RHS) : red(sample_traits::convert(RHS.red)), green(sample_traits::convert(RHS.green)), blue(sample_traits::convert(RHS.blue)) { } basic_rgb(const basic_hsv& RHS) { // Easiest case - saturation is zero if(0 == RHS.saturation) { red = green = blue = sample_traits::convert(RHS.value); return; } const double_t h = RHS.hue / 60; const double_t i = floor(h); const double_t f = h - i; const double_t p = RHS.value * (1 - RHS.saturation); const double_t q = RHS.value * (1 - (RHS.saturation * f)); const double_t t = RHS.value * (1 - (RHS.saturation * (1 - f))); if(0.0 == i) { red = sample_traits::convert(RHS.value); green = sample_traits::convert(t); blue = sample_traits::convert(p); } else if(1.0 == i) { red = sample_traits::convert(q); green = sample_traits::convert(RHS.value); blue = sample_traits::convert(p); } else if(2.0 == i) { red = sample_traits::convert(p); green = sample_traits::convert(RHS.value); blue = sample_traits::convert(t); } else if(3.0 == i) { red = sample_traits::convert(p); green = sample_traits::convert(q); blue = sample_traits::convert(RHS.value); } else if(4.0 == i) { red = sample_traits::convert(t); green = sample_traits::convert(p); blue = sample_traits::convert(RHS.value); } else if(5.0 == i) { red = sample_traits::convert(RHS.value); green = sample_traits::convert(p); blue = sample_traits::convert(q); } } const double_t* data() const { return &red; } friend bool operator==(const this_type& LHS, const this_type& RHS) { return LHS.red == RHS.red && LHS.green == RHS.green && LHS.blue == RHS.blue; } friend bool operator!=(const this_type& LHS, const this_type& RHS) { return !(LHS == RHS); } friend const this_type operator+(const this_type& LHS, const this_type& RHS) { return this_type(LHS.red + RHS.red, LHS.green + RHS.green, LHS.blue + RHS.blue); } friend const this_type operator-(const this_type& LHS, const this_type& RHS) { return this_type(LHS.red - RHS.red, LHS.green - RHS.green, LHS.blue - RHS.blue); } friend const this_type operator*(const this_type& LHS, const double_t RHS) { return this_type(LHS.red * RHS, LHS.green * RHS, LHS.blue * RHS); } friend const this_type operator*(const double_t LHS, const this_type& RHS) { return RHS * LHS; } friend std::ostream& operator<<(std::ostream& Stream, const basic_rgb& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.red << " " << RHS.green << " " << RHS.blue; return Stream; } friend std::istream& operator>>(std::istream& Stream, basic_rgb& RHS) { Stream >> RHS.red >> RHS.green >> RHS.blue; return Stream; } sample_type red; sample_type green; sample_type blue; }; ///////////////////////////////////////////////////////////////////////////// // basic_rgba /// Encapsulates storage for an RGBA color sample template > class basic_rgba { public: typedef SampleType sample_type; typedef SampleTraits sample_traits; typedef basic_rgba this_type; /// Default constructor sets all samples to zero basic_rgba() : red(sample_traits::minimum()), green(sample_traits::minimum()), blue(sample_traits::minimum()), alpha(sample_traits::opaque()) { } /// Constructor that takes red, green, and blue samples, and sets alpha opaque basic_rgba(const sample_type Red, const sample_type Green, const sample_type Blue) : red(Red), green(Green), blue(Blue), alpha(sample_traits::opaque()) { } /// Constructor that takes red, green, blue, and alpha samples basic_rgba(const sample_type Red, const sample_type Green, const sample_type Blue, const sample_type Alpha) : red(Red), green(Green), blue(Blue), alpha(Alpha) { } template basic_rgba(const basic_luma& RHS) : red(sample_traits::convert(RHS.luma)), green(sample_traits::convert(RHS.luma)), blue(sample_traits::convert(RHS.luma)), alpha(sample_traits::opaque()) { } template basic_rgba(const basic_luma_alpha& RHS) : red(sample_traits::convert(RHS.luma)), green(sample_traits::convert(RHS.luma)), blue(sample_traits::convert(RHS.luma)), alpha(sample_traits::convert(RHS.alpha)) { } template basic_rgba(const basic_rgb& RHS) : red(sample_traits::convert(RHS.red)), green(sample_traits::convert(RHS.green)), blue(sample_traits::convert(RHS.blue)), alpha(sample_traits::opaque()) { } template basic_rgba(const basic_rgba& RHS) : red(sample_traits::convert(RHS.red)), green(sample_traits::convert(RHS.green)), blue(sample_traits::convert(RHS.blue)), alpha(sample_traits::convert(RHS.alpha)) { } /// Serialization friend std::ostream& operator<<(std::ostream& Stream, const basic_rgba& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.red << " " << RHS.green << " " << RHS.blue << " " << RHS.alpha; return Stream; } /// Deserialization friend std::istream& operator>>(std::istream& Stream, basic_rgba& RHS) { Stream >> RHS.red >> RHS.green >> RHS.blue >> RHS.alpha; return Stream; } sample_type red; sample_type green; sample_type blue; sample_type alpha; }; /// Convenience typedef for our "standard" color type typedef basic_rgb color; /// Specialization of difference::test for color namespace difference { inline void test(const color& A, const color& B, accumulator& Result) { test(A.red, B.red, Result); test(A.green, B.green, Result); test(A.blue, B.blue, Result); } } // namespace difference } // namespace k3d #endif // !K3DSDK_COLOR_H ================================================ FILE: k3dsdk/color_source.h ================================================ #ifndef K3DSDK_COLOR_SOURCE_H #define K3DSDK_COLOR_SOURCE_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { template class color_source : public icolor_source { public: iproperty& color_source_output() { return m_output_color; } /// Returns a slot that should be connected to input properties to signal that the output has changed sigc::slot make_update_color_slot() { return m_output_color.make_slot(); } protected: color_source() : m_output_color( init_owner(*static_cast(this)) + init_name("output_color") + init_label(_("Output Color")) + init_description(_("Output color")) + init_value(k3d::color(1, 1, 1))) { m_output_color.set_update_slot(sigc::mem_fun(*this, &color_source::execute)); } private: k3d_data(color, data::immutable_name, data::change_signal, data::no_undo, data::value_demand_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_output_color; /// Called whenever the output has been modified and needs to be updated. void execute(const std::vector& Hints, color& Output) { // We can safely ignore any hints ... on_update_color(Output); } virtual void on_update_color(color& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_COLOR_SOURCE_H ================================================ FILE: k3dsdk/component.cpp ================================================ // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { const ilist_property::values_t& component_values() { static ilist_property::values_t values; if(values.empty()) { values.push_back("constant"); values.push_back("curve"); values.push_back("edge"); values.push_back("face"); values.push_back("parameter"); values.push_back("patch"); values.push_back("surface"); values.push_back("vertex"); } return values; } const uint_t component_size(const mesh::primitive& Primitive, const string_t Component) { static const std::set two_sided_curves = boost::assign::list_of("linear_curve")("cubic_curve")("nurbs_curve"); static const std::set three_sided_patches = boost::assign::list_of("bezier_triangle_patch"); static const std::set four_sided_patches = boost::assign::list_of("bilinear_patch")("bicubic_patch")("nurbs_patch"); static const std::set four_sided_surfaces = boost::assign::list_of("cone")("cylinder")("disk")("hyperboloid")("paraboloid")("sphere")("torus"); if(Primitive.structure.count(Component)) { return Primitive.structure.find(Component)->second.row_count(); } else if(Component == "constant") { return 1; } else if(Component == "parameter" && two_sided_curves.count(Primitive.type)) { return Primitive.structure.find("curve")->second.row_count() * 2; } else if(Component == "parameter" && three_sided_patches.count(Primitive.type)) { return Primitive.structure.find("patch")->second.row_count() * 3; } else if(Component == "parameter" && four_sided_patches.count(Primitive.type)) { return Primitive.structure.find("patch")->second.row_count() * 4; } else if(Component == "parameter" && four_sided_surfaces.count(Primitive.type)) { return Primitive.structure.find("surface")->second.row_count() * 4; } k3d::log() << error << "Cannot determine count for unknown attribute [" << Component << "] in [" << Primitive.type << "] primitive" << std::endl; return 0; } } // namespace k3d ================================================ FILE: k3dsdk/component.h ================================================ #ifndef K3DSDK_COMPONENT_H #define K3DSDK_COMPONENT_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Returns a list of common component names, for use with list properties. const ilist_property::values_t& component_values(); /// Returns the correct size for the given component, or zero if no size can be determined. const uint_t component_size(const mesh::primitive& Primitive, const string_t Component); } // namespace k3d #endif // !K3DSDK_COMPONENT_H ================================================ FILE: k3dsdk/cone.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { namespace cone { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::doubles_t& Heights, const mesh::doubles_t& Radii, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), heights(Heights), radii(Radii), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::doubles_t& Heights, mesh::doubles_t& Radii, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), heights(Heights), radii(Radii), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("cone"); primitive* const result = new primitive( generic_primitive.structure["surface"].create("matrices"), generic_primitive.structure["surface"].create("materials"), generic_primitive.structure["surface"].create("heights"), generic_primitive.structure["surface"].create("radii"), generic_primitive.structure["surface"].create("sweep_angles"), generic_primitive.structure["surface"].create("selections"), generic_primitive.attributes["constant"], generic_primitive.attributes["surface"], generic_primitive.attributes["parameter"] ); result->selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "cone") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& surface_structure = require_structure(Primitive, "surface"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); const mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); const mesh::doubles_t& heights = require_array(Primitive, surface_structure, "heights"); const mesh::doubles_t& radii = require_array(Primitive, surface_structure, "radii"); const mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); const mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new const_primitive(matrices, materials, heights, radii, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "cone") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& surface_structure = require_structure(Primitive, "surface"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); mesh::doubles_t& heights = require_array(Primitive, surface_structure, "heights"); mesh::doubles_t& radii = require_array(Primitive, surface_structure, "radii"); mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new primitive(matrices, materials, heights, radii, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "cone") return 0; return validate(Mesh, Primitive.writable()); } } // namespace cone } // namespace k3d ================================================ FILE: k3dsdk/cone.h ================================================ #ifndef K3DSDK_CONE_H #define K3DSDK_CONE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace cone { /// Gathers the member arrays of a cone primitive into a convenient package class const_primitive { public: const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::doubles_t& Heights, const mesh::doubles_t& Radii, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes); const mesh::matrices_t& matrices; const mesh::materials_t& materials; const mesh::doubles_t& heights; const mesh::doubles_t& radii; const mesh::doubles_t& sweep_angles; const mesh::selection_t& selections; const mesh::table_t& constant_attributes; const mesh::table_t& surface_attributes; const mesh::table_t& parameter_attributes; }; /// Gathers the member arrays of a cone primitive into a convenient package class primitive { public: primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::doubles_t& Heights, mesh::doubles_t& Radii, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes); mesh::matrices_t& matrices; mesh::materials_t& materials; mesh::doubles_t& heights; mesh::doubles_t& radii; mesh::doubles_t& sweep_angles; mesh::selection_t& selections; mesh::table_t& constant_attributes; mesh::table_t& surface_attributes; mesh::table_t& parameter_attributes; }; /// Creates a new cone mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid cone primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid cone primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid cone primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace cone } // namespace k3d #endif // !K3DSDK_CONE_H ================================================ FILE: k3dsdk/contributors.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { contributor::contributor(const string_t& Category) : category(Category) { } contributor::contributor(const ustring& Name, const string_t& Description) : name(Name), description(Description) { } const contributors_t& contributors() { static contributors_t storage; if(storage.empty()) { storage.push_back(contributor("Founders")); storage.push_back(contributor(ustring::from_utf8("Timothy M. Shead"), "K-3D Founder")); storage.push_back(contributor(ustring::from_utf8("Romain Behar"), "K-3D Co-Founder")); storage.push_back(contributor(ustring::from_utf8("Bart Janssens"), "K-3D Co-Founder")); storage.push_back(contributor("Contributors")); storage.push_back(contributor(ustring::from_utf8("Alexander Curtis"), "Integrated material manager")); storage.push_back(contributor(ustring::from_utf8("Anders Dahnielson"), "Documentation, script engines, web design")); storage.push_back(contributor(ustring::from_utf8("Anders Stenberg"), "UV mapping, MSVC build")); storage.push_back(contributor(ustring::from_utf8("Ashish Myles"), "Bezier Triangles")); storage.push_back(contributor(ustring::from_utf8("Carlos Andres Dominguez Caballero"), "File import / export plugins")); storage.push_back(contributor(ustring::from_utf8("Carsten Thomas Haubold"), "NURBS modeling tools")); storage.push_back(contributor(ustring::from_utf8("Daniel S. \"Scalable Vector\" Matthews"), "Win32 build, icons, documentation, samples")); storage.push_back(contributor(ustring::from_utf8("Evan Lezar"), "GPU-based processing")); storage.push_back(contributor(ustring::from_utf8("Joaqu\303\255n Duo"), "User interface enhancements, documentation, web design")); storage.push_back(contributor(ustring::from_utf8("Joe \"Incredibly-Super-Critical!\" Crawford"), "User interface design")); storage.push_back(contributor(ustring::from_utf8("Jotham Ritorze"), "Logo design")); storage.push_back(contributor(ustring::from_utf8("Rene Jensen"), "Icon design")); storage.push_back(contributor("Past Contributors")); storage.push_back(contributor(ustring::from_utf8("Adam Hupp"), "Python script engine enhancements")); storage.push_back(contributor(ustring::from_utf8("Adam Sakareassen"), ".X file format writer")); storage.push_back(contributor(ustring::from_utf8("Alexander Leidinger"), "BSD build")); storage.push_back(contributor(ustring::from_utf8("Alper Ersoy"), "Web design")); storage.push_back(contributor(ustring::from_utf8("Andreas Haferburg"), "Win32 build")); storage.push_back(contributor(ustring::from_utf8("Andy Gill"), "Too many plugins and tools to count")); storage.push_back(contributor(ustring::from_utf8("Anonymous"), "Bugfixes")); storage.push_back(contributor(ustring::from_utf8("Anonymous"), "Mandrake 9 RPMs")); storage.push_back(contributor(ustring::from_utf8("Ben Campbell"), "3DS file format reader")); storage.push_back(contributor(ustring::from_utf8("Brett W. McCoy"), "Configuration, ImageMagick plugins")); storage.push_back(contributor(ustring::from_utf8("Chris Funke"), "Suse 8.0 build")); storage.push_back(contributor(ustring::from_utf8("Damien Pollet"), "MacOSX build")); storage.push_back(contributor(ustring::from_utf8("Dan Erikson"), "User interface enhancements")); storage.push_back(contributor(ustring::from_utf8("Daniel MacDonald"), "PPC build")); storage.push_back(contributor(ustring::from_utf8("Dave Crane"), "Configuration and JavaScript enhancements")); storage.push_back(contributor(ustring::from_utf8("Dave Wallace"), "GCC 3.0 fixes")); storage.push_back(contributor(ustring::from_utf8("David Mart\303\255nez Moreno"), "Debian build, portability enhancements")); storage.push_back(contributor(ustring::from_utf8("Denis Leroy"), "GCC 4.1, Python 2.5 fixes")); storage.push_back(contributor(ustring::from_utf8("Diego Petteno"), "NLS fixes, enhancements")); storage.push_back(contributor(ustring::from_utf8("Ed Millard"), "User interface fixes, prototype pipeline viewer")); storage.push_back(contributor(ustring::from_utf8("Francisco Andrades Grassi"), "Startup script improvements")); storage.push_back(contributor(ustring::from_utf8("Fred Labrosse"), "RedHat RPM packages")); storage.push_back(contributor(ustring::from_utf8("Gerhard Reitmayr"), "Reentrant Python scripting")); storage.push_back(contributor(ustring::from_utf8("German Gomez Garcia"), "Shader cache enhancements")); storage.push_back(contributor(ustring::from_utf8("Gilles J. Seguin"), "Bugfixes")); storage.push_back(contributor(ustring::from_utf8("Giuseppe Zompatori"), "RenderMan enhancements")); storage.push_back(contributor(ustring::from_utf8("Gregory Junker"), "Shader compilation fixes")); storage.push_back(contributor(ustring::from_utf8("Ian South-Dickinson"), "PGP Remesh plugins")); storage.push_back(contributor(ustring::from_utf8("Ilya Volynets"), "SGI IRIX build, GCC 3.1 fixes")); storage.push_back(contributor(ustring::from_utf8("Joal Heagney"), "Gallery contributions")); storage.push_back(contributor(ustring::from_utf8("Joshua Moline"), "Configuration and portability enhancements")); storage.push_back(contributor(ustring::from_utf8("Kevin McBride"), "Configure/install fixes")); storage.push_back(contributor(ustring::from_utf8("Kirstyn Amanda \"GeekGirl\" Fox"), "Win32 installer")); storage.push_back(contributor(ustring::from_utf8("Louis-Dominique Dubeau"), "Bugfixes and enhancements")); storage.push_back(contributor(ustring::from_utf8("Lukas Schroeder"), "Configuration")); storage.push_back(contributor(ustring::from_utf8("Manuel Bastioni"), "Authored the first K-3D fan page")); storage.push_back(contributor(ustring::from_utf8("Marco Amato from Udine"), "Tutorial localization")); storage.push_back(contributor(ustring::from_utf8("Patrick Mauritz"), "Plugin build enhancements")); storage.push_back(contributor(ustring::from_utf8("Peter Balon"), "GCC 3.3 fixes")); storage.push_back(contributor(ustring::from_utf8("Paul Gregory"), "Win32 build, subdivision surfaces, bug fixes")); storage.push_back(contributor(ustring::from_utf8("Steve Sorensen"), "Documentation")); storage.push_back(contributor(ustring::from_utf8("Tom Browder"), "GNU Triangulated Surface support")); storage.push_back(contributor(ustring::from_utf8("Wladyslaw Strugala"), "Win32 build and support")); } return storage; } } // namespace k3d ================================================ FILE: k3dsdk/contributors.h ================================================ #ifndef K3DSDK_CONTRIBUTORS_H #define K3DSDK_CONTRIBUTORS_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { struct contributor { contributor(const string_t& Category); contributor(const ustring& Name, const string_t& Description = ""); string_t category; ustring name; string_t description; }; typedef std::vector contributors_t; const contributors_t& contributors(); } // namespace k3d #endif // !K3DSDK_CONTRIBUTORS_H ================================================ FILE: k3dsdk/convert.h ================================================ #ifndef K3DSDK_CONVERT_H #define K3DSDK_CONVERT_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { /// Perform an explicit conversion between two types. This template is designed to be specialized on an as-needed /// basis so we have a consistent syntax for performing explicit conversions (for example: from k3d::ustring to QString). template Target convert(const Source& From) { // This will be triggered if this template is ever instantiated BOOST_STATIC_ASSERT(sizeof(Target) == 0); }; } // namespace k3d #endif // !K3DSDK_CONVERT_H ================================================ FILE: k3dsdk/cubic_curve.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include namespace k3d { namespace cubic_curve { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::bools_t& Periodic, const mesh::materials_t& Material, const mesh::indices_t& CurveFirstPoints, const mesh::counts_t& CurvePointCounts, const mesh::selection_t& CurveSelections, const mesh::indices_t& CurvePoints, const mesh::table_t& ConstantAttributes, const mesh::table_t& CurveAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ) : periodic(Periodic), material(Material), curve_first_points(CurveFirstPoints), curve_point_counts(CurvePointCounts), curve_selections(CurveSelections), curve_points(CurvePoints), constant_attributes(ConstantAttributes), curve_attributes(CurveAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::bools_t& Periodic, mesh::materials_t& Material, mesh::indices_t& CurveFirstPoints, mesh::counts_t& CurvePointCounts, mesh::selection_t& CurveSelections, mesh::indices_t& CurvePoints, mesh::table_t& ConstantAttributes, mesh::table_t& CurveAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ) : periodic(Periodic), material(Material), curve_first_points(CurveFirstPoints), curve_point_counts(CurvePointCounts), curve_selections(CurveSelections), curve_points(CurvePoints), constant_attributes(ConstantAttributes), curve_attributes(CurveAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("cubic_curve"); primitive* const result = new primitive( generic_primitive.structure["constant"].create("periodic"), generic_primitive.structure["constant"].create("material"), generic_primitive.structure["curve"].create("curve_first_points"), generic_primitive.structure["curve"].create("curve_point_counts"), generic_primitive.structure["curve"].create("curve_selections"), generic_primitive.structure["vertex"].create("curve_points"), generic_primitive.attributes["constant"], generic_primitive.attributes["curve"], generic_primitive.attributes["parameter"], generic_primitive.attributes["vertex"] ); result->curve_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->curve_points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "cubic_curve") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& constant_structure = require_structure(Primitive, "constant"); const mesh::table_t& curve_structure = require_structure(Primitive, "curve"); const mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& curve_attributes = require_attributes(Primitive, "curve"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); const mesh::bools_t& periodic = require_array(Primitive, constant_structure, "periodic"); const mesh::materials_t& material = require_array(Primitive, constant_structure, "material"); const mesh::indices_t& curve_first_points = require_array(Primitive, curve_structure, "curve_first_points"); const mesh::counts_t& curve_point_counts = require_array(Primitive, curve_structure, "curve_point_counts"); const mesh::selection_t& curve_selections = require_array(Primitive, curve_structure, "curve_selections"); const mesh::indices_t& curve_points = require_array(Primitive, vertex_structure, "curve_points"); require_metadata(Primitive, curve_selections, "curve_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, curve_points, "curve_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", std::accumulate(curve_point_counts.begin(), curve_point_counts.end(), 0)); require_table_row_count(Primitive, parameter_attributes, "parameter", curve_structure.row_count() * 2); return new const_primitive(periodic, material, curve_first_points, curve_point_counts, curve_selections, curve_points, constant_attributes, curve_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "cubic_curve") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& constant_structure = require_structure(Primitive, "constant"); mesh::table_t& curve_structure = require_structure(Primitive, "curve"); mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& curve_attributes = require_attributes(Primitive, "curve"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); mesh::bools_t& periodic = require_array(Primitive, constant_structure, "periodic"); mesh::materials_t& material = require_array(Primitive, constant_structure, "material"); mesh::indices_t& curve_first_points = require_array(Primitive, curve_structure, "curve_first_points"); mesh::counts_t& curve_point_counts = require_array(Primitive, curve_structure, "curve_point_counts"); mesh::selection_t& curve_selections = require_array(Primitive, curve_structure, "curve_selections"); mesh::indices_t& curve_points = require_array(Primitive, vertex_structure, "curve_points"); require_metadata(Primitive, curve_selections, "curve_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, curve_points, "curve_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", std::accumulate(curve_point_counts.begin(), curve_point_counts.end(), 0)); require_table_row_count(Primitive, parameter_attributes, "parameter", curve_structure.row_count() * 2); return new primitive(periodic, material, curve_first_points, curve_point_counts, curve_selections, curve_points, constant_attributes, curve_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "cubic_curve") return 0; return validate(Mesh, Primitive.writable()); } } // namespace cubic_curve } // namespace k3d ================================================ FILE: k3dsdk/cubic_curve.h ================================================ #ifndef K3DSDK_CUBIC_CURVE_H #define K3DSDK_CUBIC_CURVE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace cubic_curve { /// Gathers the member arrays of a cubic_curve primitive into a convenient package class const_primitive { public: const_primitive( const mesh::bools_t& Periodic, const mesh::materials_t& Material, const mesh::indices_t& CurveFirstPoints, const mesh::counts_t& CurvePointCounts, const mesh::selection_t& CurveSelections, const mesh::indices_t& CurvePoints, const mesh::table_t& ConstantAttributes, const mesh::table_t& CurveAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ); const mesh::bools_t& periodic; const mesh::materials_t& material; const mesh::indices_t& curve_first_points; const mesh::counts_t& curve_point_counts; const mesh::selection_t& curve_selections; const mesh::indices_t& curve_points; const mesh::table_t& constant_attributes; const mesh::table_t& curve_attributes; const mesh::table_t& parameter_attributes; const mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a cubic_curve primitive into a convenient package class primitive { public: primitive( mesh::bools_t& Periodic, mesh::materials_t& Material, mesh::indices_t& CurveFirstPoints, mesh::counts_t& CurvePointCounts, mesh::selection_t& CurveSelections, mesh::indices_t& CurvePoints, mesh::table_t& ConstantAttributes, mesh::table_t& CurveAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ); mesh::bools_t& periodic; mesh::materials_t& material; mesh::indices_t& curve_first_points; mesh::counts_t& curve_point_counts; mesh::selection_t& curve_selections; mesh::indices_t& curve_points; mesh::table_t& constant_attributes; mesh::table_t& curve_attributes; mesh::table_t& parameter_attributes; mesh::table_t& vertex_attributes; }; /// Creates a new cubic_curve mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid cubic_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid cubic_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid cubic_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace cubic_curve } // namespace k3d #endif // !K3DSDK_CUBIC_CURVE_H ================================================ FILE: k3dsdk/cylinder.cpp ================================================ // K-3D // Copyright (c) 1995-200 7, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { namespace cylinder { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::doubles_t& Radii, const mesh::doubles_t& ZMin, const mesh::doubles_t& ZMax, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), radii(Radii), z_min(ZMin), z_max(ZMax), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::doubles_t& Radii, mesh::doubles_t& ZMin, mesh::doubles_t& ZMax, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), radii(Radii), z_min(ZMin), z_max(ZMax), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("cylinder"); primitive* const result = new primitive( generic_primitive.structure["surface"].create("matrices"), generic_primitive.structure["surface"].create("materials"), generic_primitive.structure["surface"].create("radii"), generic_primitive.structure["surface"].create("z_min"), generic_primitive.structure["surface"].create("z_max"), generic_primitive.structure["surface"].create("sweep_angles"), generic_primitive.structure["surface"].create("selections"), generic_primitive.attributes["constant"], generic_primitive.attributes["surface"], generic_primitive.attributes["parameter"] ); result->selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "cylinder") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& surface_structure = require_structure(Primitive, "surface"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); const mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); const mesh::doubles_t& radii = require_array(Primitive, surface_structure, "radii"); const mesh::doubles_t& z_min = require_array(Primitive, surface_structure, "z_min"); const mesh::doubles_t& z_max = require_array(Primitive, surface_structure, "z_max"); const mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); const mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new const_primitive(matrices, materials, radii, z_min, z_max, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "cylinder") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& surface_structure = require_structure(Primitive, "surface"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); mesh::doubles_t& radii = require_array(Primitive, surface_structure, "radii"); mesh::doubles_t& z_min = require_array(Primitive, surface_structure, "z_min"); mesh::doubles_t& z_max = require_array(Primitive, surface_structure, "z_max"); mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new primitive(matrices, materials, radii, z_min, z_max, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "cylinder") return 0; return validate(Mesh, Primitive.writable()); } } // namespace cylinder } // namespace k3d ================================================ FILE: k3dsdk/cylinder.h ================================================ #ifndef K3DSDK_CYLINDER_H #define K3DSDK_CYLINDER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace cylinder { /// Gathers the member arrays of a cylinder primitive into a convenient package class const_primitive { public: const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::doubles_t& Radii, const mesh::doubles_t& ZMin, const mesh::doubles_t& ZMax, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes); const mesh::matrices_t& matrices; const mesh::materials_t& materials; const mesh::doubles_t& radii; const mesh::doubles_t& z_min; const mesh::doubles_t& z_max; const mesh::doubles_t& sweep_angles; const mesh::selection_t& selections; const mesh::table_t& constant_attributes; const mesh::table_t& surface_attributes; const mesh::table_t& parameter_attributes; }; /// Gathers the member arrays of a cylinder primitive into a convenient package class primitive { public: primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::doubles_t& Radii, mesh::doubles_t& ZMin, mesh::doubles_t& ZMax, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes); mesh::matrices_t& matrices; mesh::materials_t& materials; mesh::doubles_t& radii; mesh::doubles_t& z_min; mesh::doubles_t& z_max; mesh::doubles_t& sweep_angles; mesh::selection_t& selections; mesh::table_t& constant_attributes; mesh::table_t& surface_attributes; mesh::table_t& parameter_attributes; }; /// Creates a new cylinder mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid cylinder primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid cylinder primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid cylinder primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace cylinder } // namespace k3d #endif // !K3DSDK_CYLINDER_H ================================================ FILE: k3dsdk/data.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include namespace k3d { std::ostream& operator<<(std::ostream& Stream, const ipath_property::reference_t& RHS) { switch(RHS) { case ipath_property::ABSOLUTE_REFERENCE: Stream << "absolute"; break; case ipath_property::RELATIVE_REFERENCE: Stream << "relative"; break; case ipath_property::INLINE_REFERENCE: Stream << "inline"; break; } return Stream; } std::istream& operator>>(std::istream& Stream, ipath_property::reference_t& RHS) { std::string temp; Stream >> temp; if(temp == "absolute") RHS = ipath_property::ABSOLUTE_REFERENCE; else if(temp == "relative") RHS = ipath_property::RELATIVE_REFERENCE; else if(temp == "inline") RHS = ipath_property::INLINE_REFERENCE; else { log() << error << "unknown enumeration" << std::endl; RHS = ipath_property::RELATIVE_REFERENCE; } return Stream; } namespace data { iproperty* property_lookup(iproperty* const Source) { iproperty* result = Source; // We lookup property dependencies using two pointers so we can detect cycles ... iproperty* slow = Source ? Source->property_dependency() : 0; iproperty* fast = slow ? slow->property_dependency() : 0; while(slow) { if(slow == fast) return Source; result = slow; slow = slow->property_dependency(); fast = fast ? fast->property_dependency() : 0; fast = fast ? fast->property_dependency() : 0; } return result; } xml::element& save_external_resource(xml::element& Element, const ipersistent::save_context& Context, const std::string& Name, const ipath_property::reference_t Reference, const filesystem::path& Value) { xml::element& xml_storage = Element.append( xml::element("property", xml::attribute("name", Name))); // Construct absolute and relative paths for later reference const filesystem::path absolute_path = filesystem::path(Value.is_complete() ? Value : Context.root_path / Value); // Under certain circumstances, we override the user's choice of reference ... // As a special-case, if the value doesn't have the same root name as the reference // (i.e. different drive letters on Win32), force an absolute path ... ipath_property::reference_t reference = Reference; if(reference == ipath_property::RELATIVE_REFERENCE) { if(Value.is_complete() && Value.root_name() != Context.root_path.root_name()) reference = ipath_property::ABSOLUTE_REFERENCE; } // As a special-case, an absolute path that points into the share directory // becomes a relative path ... if(reference == ipath_property::ABSOLUTE_REFERENCE) { if(0 == absolute_path.generic_utf8_string().find(share_path().generic_utf8_string())) reference = ipath_property::RELATIVE_REFERENCE; } // Actually store the data ... switch(reference) { case ipath_property::ABSOLUTE_REFERENCE: { xml_storage.append(xml::attribute("reference", string_cast(ipath_property::ABSOLUTE_REFERENCE))); xml_storage.append(xml::attribute("absolute_path", absolute_path.generic_utf8_string().raw())); break; } case ipath_property::RELATIVE_REFERENCE: { // As a special-case, a path that points into the share directory // will be stored relative to share, instead of relative to the document if(0 == absolute_path.generic_utf8_string().find(share_path().generic_utf8_string())) { const filesystem::path relative_path = filesystem::make_relative_path(absolute_path, share_path()); xml_storage.append(xml::attribute("reference", string_cast(ipath_property::RELATIVE_REFERENCE))); xml_storage.append(xml::attribute("relative_path", relative_path.generic_utf8_string().raw())); xml_storage.append(xml::element("root", "$K3D_SHARE_PATH")); } else { const filesystem::path relative_path = filesystem::make_relative_path(absolute_path, Context.root_path); xml_storage.append(xml::attribute("reference", string_cast(ipath_property::RELATIVE_REFERENCE))); xml_storage.append(xml::attribute("relative_path", relative_path.generic_utf8_string().raw())); } break; } case ipath_property::INLINE_REFERENCE: { xml_storage.append(xml::attribute("reference", string_cast(ipath_property::INLINE_REFERENCE))); xml_storage.append(xml::attribute("filename", absolute_path.leaf().raw())); xml_storage.append(xml::attribute("encoding", "base64")); filesystem::ifstream file(absolute_path); std::stringstream buffer; base64::encode(file, buffer); xml_storage.text = "\n" + buffer.str(); break; } } return xml_storage; } void load_external_resource(xml::element& Element, const ipersistent::load_context& Context, ipath_property::reference_t& Reference, filesystem::path& Value) { Reference = xml::attribute_value(Element, "reference", ipath_property::RELATIVE_REFERENCE); switch(Reference) { case ipath_property::ABSOLUTE_REFERENCE: { try { /** \todo Change this to use generic_path after version 0.8 */ Value = filesystem::native_path(ustring::from_utf8(xml::attribute_text(Element, "absolute_path"))); log() << info << "Resolved absolute path " << Value.native_console_string() << std::endl; } catch(std::exception& e) { log() << error << e.what() << std::endl; } break; } case ipath_property::RELATIVE_REFERENCE: { try { filesystem::path root_path = Context.root_path; if(xml::element* const xml_root = xml::find_element(Element, "root")) { if(xml_root->text == "$K3D_SHARE_PATH") root_path = share_path(); else root_path = filesystem::generic_path(xml_root->text); } Value = root_path / filesystem::generic_path(xml::attribute_text(Element, "relative_path")); log() << info << "Resolved relative path as " << Value.native_console_string() << std::endl; } catch(std::exception& e) { log() << error << e.what() << std::endl; } break; } case ipath_property::INLINE_REFERENCE: { try { Value = system::get_temp_directory() / filesystem::generic_path(xml::attribute_text(Element, "filename")); filesystem::ofstream file(Value); std::stringstream buffer(Element.text); base64::decode(buffer, file); log() << info << "Extracted inline document to " << Value.native_console_string() << std::endl; } catch(std::exception& e) { log() << error << e.what() << std::endl; } break; } } } } // namespace data } // namespace k3d ================================================ FILE: k3dsdk/data.h ================================================ #ifndef K3DSDK_DATA_H #define K3DSDK_DATA_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace data { ///////////////////////////////////////////////////////////////////////////// // container /// Host class for storing data using serialization, property, name, constraint, undo, storage, and signal policies template class container : public serialization_policy_t { public: template container(const init_t& Init) : serialization_policy_t(Init) { } }; ///////////////////////////////////////////////////////////////////////////// // no_serialization /// Serialization policy for data containers that do not need to be serialized template class no_serialization : public property_policy_t { protected: template no_serialization(const init_t& Init) : property_policy_t(Init) { } }; ///////////////////////////////////////////////////////////////////////////// // with_serialization /// Serialization policy for data containers that can be serialized as XML template class with_serialization : public property_policy_t, public ipersistent { // This policy only works for data stored by-value BOOST_STATIC_ASSERT((!boost::is_pointer::value)); public: void save(xml::element& Element, const ipersistent::save_context&) { Element.append(xml::element("property", string_cast(property_policy_t::internal_value()), xml::attribute("name", property_policy_t::name()))); } void load(xml::element& Element, const ipersistent::load_context&) { std::string value = Element.text; property_policy_t::set_value(from_string(value, property_policy_t::internal_value())); } protected: template with_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } }; ///////////////////////////////////////////////////////////////////////////// // path_serialization xml::element& save_external_resource(xml::element& Element, const ipersistent::save_context& Context, const std::string& Name, const ipath_property::reference_t Reference, const filesystem::path& Value); void load_external_resource(xml::element& Element, const ipersistent::load_context& Context, ipath_property::reference_t& Reference, filesystem::path& Value); /// Serialization policy for filesystem path data that handles external filesystem resources template class path_serialization : public property_policy_t, public ipersistent { // This policy only works for data stored by-value BOOST_STATIC_ASSERT((!boost::is_pointer::value)); public: void save(xml::element& Element, const ipersistent::save_context& Context) { save_external_resource(Element, Context, property_policy_t::name(), property_policy_t::property_path_reference(), property_policy_t::internal_value()); } void load(xml::element& Element, const ipersistent::load_context& Context) { ipath_property::reference_t reference; filesystem::path value; load_external_resource(Element, Context, reference, value); property_policy_t::set_property_path_reference(reference); property_policy_t::set_value(value); } protected: template path_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } }; ///////////////////////////////////////////////////////////////////////////// // node_serialization /// Serialization policy for data containers that store a document node and can be serialized as XML template class node_serialization : public property_policy_t, public ipersistent { // If this assertion fires, it means that you're trying to use node_serialization with a non-node data type BOOST_STATIC_ASSERT((boost::is_base_and_derived::type>::value)); public: void save(xml::element& Element, const ipersistent::save_context& Context) { if(property_policy_t::internal_node()) Element.append(xml::element("property", string_cast(Context.lookup.lookup_id(property_policy_t::internal_node())), xml::attribute("name", property_policy_t::name()))); else Element.append(xml::element("property", "0", xml::attribute("name", property_policy_t::name()))); } void load(xml::element& Element, const ipersistent::load_context& Context) { std::string value = Element.text; property_policy_t::set_value(dynamic_cast(Context.lookup.lookup_object(from_string(value, static_cast(0))))); } protected: template node_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } private: ipersistent_lookup::id_type m_node_id; }; ///////////////////////////////////////////////////////////////////////////// // node_collection_serialization /// Serialization policy for data containers that can be serialized as XML template class node_collection_serialization : public property_policy_t, public ipersistent { public: void save(xml::element& Element, const ipersistent::save_context& Context) { std::stringstream buffer; const inode_collection_property::nodes_t& nodes = property_policy_t::internal_value(); for(inode_collection_property::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { if(*node) buffer << " " << string_cast(Context.lookup.lookup_id(*node)); else buffer << " 0"; } Element.append(xml::element("property", buffer.str(), xml::attribute("name", property_policy_t::name()))); } void load(xml::element& Element, const ipersistent::load_context& Context) { inode_collection_property::nodes_t nodes; std::stringstream buffer(Element.text); std::string node; while(buffer >> node) nodes.push_back(dynamic_cast(Context.lookup.lookup_object(from_string(node, static_cast(0))))); nodes.erase(std::remove(nodes.begin(), nodes.end(), static_cast(0)), nodes.end()); property_policy_t::set_value(nodes); } protected: template node_collection_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } }; ///////////////////////////////////////////////////////////////////////////// // property_lookup /** \brief Encapsulates the lookup process for connected properties \note In the case of circular dependencies, returns the same value as the input property */ iproperty* property_lookup(iproperty* const Source); ///////////////////////////////////////////////////////////////////////////// // no_property /// Property policy for data containers that do not expose their values using the K-3D property mechanism template class no_property : public name_policy_t { public: protected: template no_property(const init_t& Init) : name_policy_t(Init) { } }; ///////////////////////////////////////////////////////////////////////////// // read_only_property /// Property policy that exposes a data container as a read-only K-3D property template class read_only_property : public name_policy_t, public iproperty { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return name_policy_t::constrain_value(boost::any_cast(source->property_internal_value())); return name_policy_t::internal_value(); } const std::string property_name() { return name_policy_t::name(); } const std::string property_label() { return m_label; } const std::string property_description() { return m_description; } const std::type_info& property_type() { return typeid(value_t); } const boost::any property_internal_value() { return name_policy_t::internal_value(); } const boost::any property_pipeline_value() { return pipeline_value(); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } protected: template read_only_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_dependency(0) { Init.property_collection().register_property(*this); } ~read_only_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // writable_property /// Property policy that exposes a data container as a writable K-3D property template class writable_property : public name_policy_t, public iproperty, public iwritable_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return name_policy_t::constrain_value(boost::any_cast(source->property_internal_value())); return name_policy_t::internal_value(); } const std::string property_name() { return name_policy_t::name(); } const std::string property_label() { return m_label; } const std::string property_description() { return m_description; } const std::type_info& property_type() { return typeid(value_t); } const boost::any property_internal_value() { return name_policy_t::internal_value(); } const boost::any property_pipeline_value() { return pipeline_value(); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } bool property_set_value(const boost::any Value, ihint* const Hint) { const value_t* const new_value = boost::any_cast(&Value); if(!new_value) return false; name_policy_t::set_value(*new_value, Hint); return true; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } protected: template writable_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_dependency(0) { Init.property_collection().register_property(*this); } ~writable_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // string_property /// Property policy that exposes a data container as a writable string property template class string_property : public name_policy_t, public iproperty, public iwritable_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return name_policy_t::constrain_value(boost::any_cast(source->property_internal_value())); return name_policy_t::internal_value(); } const std::string property_name() { return name_policy_t::name(); } const std::string property_label() { return m_label; } const std::string property_description() { return m_description; } const std::type_info& property_type() { return typeid(std::string); } const boost::any property_internal_value() { try { return boost::any(boost::lexical_cast(name_policy_t::internal_value())); } catch(...) { } return boost::any(); } const boost::any property_pipeline_value() { return pipeline_value(); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { const std::string* const new_value = boost::any_cast(&Value); if(!new_value) return false; try { set_value(boost::lexical_cast(*new_value), Hint); return true; } catch(...) { } return false; } protected: template string_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_dependency(0) { Init.property_collection().register_property(*this); } ~string_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // path_property /// Property policy that exposes a data container as a writable K-3D path property template class path_property : public name_policy_t, public iproperty, public iwritable_property, public ipath_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return name_policy_t::constrain_value(boost::any_cast(source->property_internal_value())); return name_policy_t::internal_value(); } const std::string property_name() { return name_policy_t::name(); } const std::string property_label() { return m_label; } const std::string property_description() { return m_description; } const std::type_info& property_type() { return typeid(value_t); } const boost::any property_internal_value() { return name_policy_t::internal_value(); } const boost::any property_pipeline_value() { return pipeline_value(); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { const value_t* const new_value = boost::any_cast(&Value); if(!new_value) return false; name_policy_t::set_value(*new_value, Hint); return true; } ipath_property::mode_t property_path_mode() { return m_mode; } const std::string property_path_type() { return m_type; } ipath_property::reference_t property_path_reference() { return m_reference; } void set_property_path_reference(const ipath_property::reference_t Reference) { if(Reference != m_reference) { m_reference = Reference; m_reference_changed_signal.emit(); } } ipath_property::path_reference_changed_signal_t& property_path_reference_changed_signal() { return m_reference_changed_signal; } const ipath_property::pattern_filters_t pattern_filters() { return m_pattern_filters; } void add_pattern_filter(const ipath_property::pattern_filter& PatternFilter) { m_pattern_filters.push_back(PatternFilter); } protected: template path_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_mode(Init.path_mode()), m_type(Init.path_type()), m_reference(RELATIVE_REFERENCE), m_dependency(0) { Init.property_collection().register_property(*this); } ~path_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; deleted_signal_t m_deleted_signal; const ipath_property::mode_t m_mode; const std::string m_type; ipath_property::reference_t m_reference; ipath_property::path_reference_changed_signal_t m_reference_changed_signal; ipath_property::pattern_filters_t m_pattern_filters; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // script_property /// Property policy that exposes a data container as a writable K-3D script property template class script_property : public name_policy_t, public iproperty, public iwritable_property, public iscript_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return name_policy_t::constrain_value(boost::any_cast(source->property_internal_value())); return name_policy_t::internal_value(); } const std::string property_name() { return name_policy_t::name(); } const std::string property_label() { return m_label; } const std::string property_description() { return m_description; } const std::type_info& property_type() { return typeid(std::string); } const boost::any property_internal_value() { try { return boost::any(boost::lexical_cast(name_policy_t::internal_value())); } catch(...) { } return boost::any(); } const boost::any property_pipeline_value() { return pipeline_value(); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { const std::string* const new_value = boost::any_cast(&Value); if(!new_value) return false; try { name_policy_t::set_value(boost::lexical_cast(*new_value), Hint); return true; } catch(...) { } return false; } protected: template script_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_dependency(0) { Init.property_collection().register_property(*this); } ~script_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // enumeration_property /// Property policy that exposes a data container as a K-3D enumeration property template class enumeration_property : public name_policy_t, public iproperty, public iwritable_property, public ienumeration_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) { try { // Because enumeration properties all have type "string", we have to convert the source property into our internal type (which // could fail) before applying any constraints. return name_policy_t::constrain_value(boost::lexical_cast(boost::any_cast(source->property_internal_value()))); } catch(...) { return name_policy_t::internal_value(); } } return name_policy_t::internal_value(); } const string_t property_name() { return name_policy_t::name(); } const string_t property_label() { return m_label; } const string_t property_description() { return m_description; } const std::type_info& property_type() { return typeid(string_t); } const boost::any property_internal_value() { try { return boost::any(boost::lexical_cast(name_policy_t::internal_value())); } catch(...) { } return boost::any(); } const boost::any property_pipeline_value() { try { return boost::any(boost::lexical_cast(pipeline_value())); } catch(...) { } return boost::any(); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { const string_t* const new_value = boost::any_cast(&Value); if(!new_value) return false; try { name_policy_t::set_value(boost::lexical_cast(*new_value), Hint); return true; } catch(...) { } return false; } enumeration_values_t enumeration_values() { return m_values; } sigc::connection connect_enumeration_values_changed(const sigc::slot& Slot) { return m_values_changed_signal.connect(Slot); } void notify_enumeration_values_changed() { m_values_changed_signal.emit(); } protected: template enumeration_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_values(Init.values()), m_dependency(0) { Init.property_collection().register_property(*this); } ~enumeration_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; const ienumeration_property::enumeration_values_t& m_values; sigc::signal m_values_changed_signal; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // list_property /// Property policy that exposes a data container as a K-3D list property template class list_property : public name_policy_t, public iproperty, public iwritable_property, public ilist_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return name_policy_t::constrain_value(boost::any_cast(source->property_internal_value())); return name_policy_t::internal_value(); } const std::string property_name() { return name_policy_t::name(); } const std::string property_label() { return m_label; } const std::string property_description() { return m_description; } const std::type_info& property_type() { return typeid(value_t); } const boost::any property_internal_value() { return boost::any(name_policy_t::internal_value()); } const boost::any property_pipeline_value() { return pipeline_value(); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { const value_t* const new_value = boost::any_cast(&Value); if(!new_value) return false; name_policy_t::set_value(*new_value, Hint); return true; } typename ilist_property::values_t property_values() { return m_values; } protected: template list_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_values(Init.values()), m_dependency(0) { Init.property_collection().register_property(*this); } ~list_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; const typename ilist_property::values_t& m_values; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // node_property /// Property policy that exposes a data container as a K-3D node property template class node_property : public name_policy_t, public iproperty, public iwritable_property, public inode_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return name_policy_t::constrain_value(dynamic_cast(boost::any_cast(source->property_internal_value()))); return name_policy_t::internal_value(); } const std::string property_name() { return name_policy_t::name(); } const std::string property_label() { return m_label; } const std::string property_description() { return m_description; } const std::type_info& property_type() { return typeid(inode*); } const boost::any property_internal_value() { return boost::any(name_policy_t::internal_node()); } const boost::any property_pipeline_value() { return dynamic_cast(pipeline_value()); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { inode* const * new_value = boost::any_cast(&Value); if(!new_value) return false; name_policy_t::set_value(dynamic_cast(*new_value), Hint); return true; } bool property_allow_none() { return name_policy_t::allow_none(); } bool property_allow(iplugin_factory& Factory) { return name_policy_t::allow(Factory); } bool property_allow(inode& Object) { return name_policy_t::allow(Object); } protected: template node_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_dependency(0) { Init.property_collection().register_property(*this); } ~node_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // measurement_property /// Property policy that exposes a data container as a K-3D measurement property template class measurement_property : public name_policy_t, public iproperty, public iwritable_property, public imeasurement_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return name_policy_t::constrain_value(boost::any_cast(source->property_internal_value())); return name_policy_t::internal_value(); } const std::string property_name() { return name_policy_t::name(); } const std::string property_label() { return m_label; } const std::string property_description() { return m_description; } const std::type_info& property_type() { return typeid(value_t); } const boost::any property_internal_value() { return boost::any(name_policy_t::internal_value()); } const boost::any property_pipeline_value() { return pipeline_value(); } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { const value_t* const new_value = boost::any_cast(&Value); if(!new_value) return false; name_policy_t::set_value(*new_value, Hint); return true; } double property_step_increment() { return m_step_increment; } const std::type_info& property_units() { return m_units; } protected: template measurement_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_step_increment(Init.step_increment()), m_units(Init.units()), m_dependency(0) { Init.property_collection().register_property(*this); } ~measurement_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; const double m_step_increment; const std::type_info& m_units; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // no_name /// Name policy for unnamed data containers template class no_name : public constraint_policy_t { protected: template no_name(const init_t& Init) : constraint_policy_t(Init) { } }; ///////////////////////////////////////////////////////////////////////////// // immutable_name /// Name policy for data containers whose name cannot be changed template class immutable_name : public constraint_policy_t { public: /// Returns the container name const std::string name() const { return m_name; } protected: template immutable_name(const init_t& Init) : constraint_policy_t(Init), m_name(Init.name()) { } private: /// Storage for the container name const char* const m_name; }; ///////////////////////////////////////////////////////////////////////////// // no_constraint /// Constraint policy for data containers whose values are unconstrained template class no_constraint : public undo_policy_t { public: void set_value(const value_t& Value, ihint* const Hint = 0) { if(Value != undo_policy_t::internal_value()) undo_policy_t::set_value(Value, Hint); } const value_t constrain_value(const value_t Value) { return Value; } protected: template no_constraint(const init_t& Init) : undo_policy_t(Init) { } }; ///////////////////////////////////////////////////////////////////////////// // iconstraint /// Abstract interface for a chain-of-responsibility constraint node template class iconstraint { public: virtual ~iconstraint() {} void constrain(value_t& Value) { on_constrain(Value); if(m_next_constraint.get()) m_next_constraint->constrain(Value); } protected: explicit iconstraint(iconstraint* NextConstraint) : m_next_constraint(NextConstraint) { } private: /// Implement this method in a derived class to modify / constrain the input Value virtual void on_constrain(value_t& Value) = 0; /// Storage for the (optional) next constraint to apply in the chain const std::unique_ptr > m_next_constraint; }; namespace constraint { ///////////////////////////////////////////////////////////////////////////// // minimum_t /// Constraint node that enforces a minimum value (using the std::max concept) template class minimum_t : public iconstraint { // We require that the minimum constraint be applied only to signed types, to prevent // overflow problems associated with unsigned types (for example, if you had a minimum // constraint of 0 applied to an unsigned long with current value 0, and subtract 1, the // result will 0xffffffff, which compares as larger than 0) BOOST_STATIC_ASSERT((std::numeric_limits::is_signed)); public: minimum_t(const value_t MinimumValue, iconstraint* NextConstraint = 0) : iconstraint(NextConstraint), m_minimum_value(MinimumValue) { } private: void on_constrain(value_t& Value) { Value = std::max(Value, m_minimum_value); } const value_t m_minimum_value; }; ///////////////////////////////////////////////////////////////////////////// // minimum /// Convenience factory function for creating minimum_t constraint nodes template iconstraint* minimum(const value_t MinimumValue, iconstraint* NextConstraint = 0) { return new minimum_t(MinimumValue, NextConstraint); } ///////////////////////////////////////////////////////////////////////////// // maximum_t /// Constraint node that enforces a maximum value (using the std::min concept) template class maximum_t : public iconstraint { public: maximum_t(const value_t MaximumValue, iconstraint* NextConstraint = 0) : iconstraint(NextConstraint), m_maximum_value(MaximumValue) { } private: void on_constrain(value_t& Value) { Value = std::min(Value, m_maximum_value); } const value_t m_maximum_value; }; ///////////////////////////////////////////////////////////////////////////// // maximum /// Convenience factory function for creating maximum_t constraint nodes template iconstraint* maximum(const value_t MaximumValue, iconstraint* NextConstraint = 0) { return new maximum_t(MaximumValue, NextConstraint); } } // namespace constraint ///////////////////////////////////////////////////////////////////////////// // with_constraint /// Policy for data nodes whose values are constrained by a chain of one-to-many iconstraint nodes template class with_constraint : public undo_policy_t { public: void set_value(value_t Value, ihint* const Hint = 0) { m_constraint->constrain(Value); if(Value != undo_policy_t::internal_value()) undo_policy_t::set_value(Value, Hint); } const value_t constrain_value(value_t Value) { m_constraint->constrain(Value); return Value; } protected: template with_constraint(const init_t& Init) : undo_policy_t(Init), m_constraint(Init.constraint()) { assert(m_constraint.get()); } private: /// Stores the (mandatory) chain of constraint nodes to apply to incoming values const std::unique_ptr > m_constraint; }; ///////////////////////////////////////////////////////////////////////////// // no_undo /// Undo policy for data containers that do not store state changes for undo/redo template class no_undo : public storage_policy_t { protected: template no_undo(const init_t& Init) : storage_policy_t(Init) { } /// This little bit of magic makes it possible for base classes (such as node_storage) to update their own values while observing the correct undo policy void internal_set_value(const value_t& Value, ihint* const Hint) { storage_policy_t::set_value(Value, Hint); } }; ///////////////////////////////////////////////////////////////////////////// // with_undo /// Undo policy for data containers that stores state changes for undo/redo template class with_undo : public storage_policy_t, public virtual sigc::trackable { public: /// Returns true iff the next write to the underlying storage will generate undo/redo data (useful if you need to perform additional undo/redo related operations, such as creating a signal connection) bool ready_to_record() { return !m_changes && m_state_recorder.current_change_set(); } /// Returns the state recorder for storing undo/redo data istate_recorder& state_recorder() { return m_state_recorder; } protected: template with_undo(const init_t& Init) : storage_policy_t(Init), m_state_recorder(Init.document().state_recorder()), m_changes(false) { } typedef with_undo this_t; /// This little bit of magic makes it possible for base classes (such as node_storage) to update their own values while observing the correct undo policy void internal_set_value(const value_t& Value, ihint* const Hint) { set_value(Value, Hint); } void set_value(const value_t& Value, ihint* const Hint = 0) { if(ready_to_record()) { m_changes = true; /// Note ... we don't save the connection here because connections are automatically disconnected when the signal is emitted m_state_recorder.connect_recording_done_signal(sigc::mem_fun(*this, &this_t::on_recording_done)); storage_policy_t::start_recording(m_state_recorder); } storage_policy_t::set_value(Value, Hint); } private: /// Called by the signal system once undo/redo recording is complete, so we can record our final value for redo purposes void on_recording_done() { // Sanity check ... assert(m_changes); assert(m_state_recorder.current_change_set()); m_changes = false; storage_policy_t::finish_recording(m_state_recorder); } /// Central location where undo/redo data is stored istate_recorder& m_state_recorder; /// Set to true iff the underlying data has changed during undo/redo recording bool m_changes; }; ///////////////////////////////////////////////////////////////////////////// // local_storage /// Storage policy for data containers that store their state by value template class local_storage : public signal_policy_t { public: /// Writable access to the underlying data - this is handy for working with STL containers, but be careful - writing data in this way will bypass signal and undo policies value_t& internal_value() { return m_value; } /// Read-only access to the underlying data const value_t& internal_value() const { return m_value; } protected: template local_storage(const init_t& Init) : signal_policy_t(Init), m_value(Init.value()) { } /// Optionally called to store the original state of the data prior to modification void start_recording(istate_recorder& StateRecorder) { signal_policy_t::start_recording(StateRecorder); StateRecorder.current_change_set()->record_old_state(new value_container(m_value)); } /// Sets a new value for the data void set_value(const value_t& Value, ihint* const Hint = 0) { m_value = Value; signal_policy_t::set_value(Hint); } /// Optionally called to store the new state of the data after one-or-more modifications void finish_recording(istate_recorder& StateRecorder) { StateRecorder.current_change_set()->record_new_state(new value_container(m_value)); signal_policy_t::finish_recording(StateRecorder); } private: /// Local storage for the data stored by this policy value_t m_value; /// Provides an implementation of istate_container for storing nodes by value (ValueType must have a copy constructor and assignment operator) class value_container : public istate_container { public: value_container(value_t& Instance) : m_instance(Instance), m_value(Instance) { } void restore_state() { m_instance = m_value; } private: value_t& m_instance; const value_t m_value; }; }; ///////////////////////////////////////////////////////////////////////////// // node_storage /// Storage policy for data containers that store a pointer to a document node that could be deleted by the user at any time - note that value_t should be the interface type used to access the node template class node_storage : public signal_policy_t, public virtual sigc::trackable { public: /// Returns an interface pointer to the node (could be NULL) value_t internal_value() { return dynamic_cast(m_node); } /// Returns the underlying node (could be NULL) inode* internal_node() { return m_node; } /// Returns true iff the value is allowed to be NULL bool allow_none() { return true; } /// Returns true iff the given factory creates an node that could be stored by this container bool allow(iplugin_factory& Factory) { return Factory.implements(typeid(typename boost::remove_pointer::type)); } /// Returns true iff the given node coult be stored by this container bool allow(inode& Object) { return dynamic_cast(&Object) ? true : false; } protected: template node_storage(const init_t& Init) : signal_policy_t(Init), m_node(dynamic_cast(Init.value())) { if(m_node) { m_node_deleted_connection = m_node->deleted_signal().connect(sigc::mem_fun(*this, &node_storage::on_node_deleted)); if(inode_change_signal* const node_change_signal = dynamic_cast(m_node)) m_node_changed_connection = node_change_signal->connect_node_changed_signal(signal_policy_t::changed_signal().make_slot()); } } virtual ~node_storage() { } void on_node_deleted() { internal_set_value(0, 0); } /// Optionally called to store the original state of the data prior to modification void start_recording(istate_recorder& StateRecorder) { signal_policy_t::start_recording(StateRecorder); StateRecorder.current_change_set()->record_old_state(new value_container(m_node)); } /// Sets a new value for the data void set_value(value_t Value, ihint* const Hint) { if(m_node) { m_node_deleted_connection.disconnect(); m_node_changed_connection.disconnect(); } m_node = dynamic_cast(Value); if(m_node) { m_node_deleted_connection = m_node->deleted_signal().connect(sigc::mem_fun(*this, &node_storage::on_node_deleted)); if(inode_change_signal* const node_change_signal = dynamic_cast(m_node)) m_node_changed_connection = node_change_signal->connect_node_changed_signal(signal_policy_t::changed_signal().make_slot()); } signal_policy_t::set_value(Hint); } /// Optionally called to store the new state of the data after one-or-more modifications void finish_recording(istate_recorder& StateRecorder) { StateRecorder.current_change_set()->record_new_state(new value_container(m_node)); signal_policy_t::finish_recording(StateRecorder); } private: /// This little bit of magic allows us to "call" the derived undo policy when our state is modified internally, e.g. if the node is deleted virtual void internal_set_value(const value_t&, ihint* const) { } /// Local storage for the node stored by this policy inode* m_node; sigc::connection m_node_deleted_connection; sigc::connection m_node_changed_connection; /// Provides an implementation of istate_container for storing nodes by value (ValueType must have a copy constructor and assignment operator) class value_container : public istate_container { public: value_container(inode*& Instance) : m_instance(Instance), m_value(Instance) { } void restore_state() { m_instance = m_value; } private: inode*& m_instance; inode* m_value; }; }; ///////////////////////////////////////////////////////////////////////////// // pointer_storage /// Read-only storage policy that stores a value by pointer, created on-demand /** \deprecated Use pointer_demand_storage instead */ template class pointer_storage : public signal_policy_t { // This policy only works for data stored by-pointer BOOST_STATIC_ASSERT((boost::is_pointer::value)); public: typedef typename boost::remove_pointer::type non_pointer_t; typedef pointer_storage this_t; /// Set a slot that will be called to initialize the value when first created void set_initialize_slot(const sigc::slot& Slot) { m_initialize_slot = Slot; reset(); } /// Set the slot that will be called to update the value whenever it changes void set_update_slot(const sigc::slot& Slot) { m_update_slot = Slot; update(); } /// Returns a slot that will invoke the reset() method sigc::slot make_reset_slot() { return sigc::bind<0>(sigc::mem_fun(*this, &this_t::reset), static_cast(0)); } /// Returns a slot that will invoke the update() method sigc::slot make_update_slot() { return sigc::mem_fun(*this, &this_t::update); } /// Store an object as the new value, taking control of its lifetime void reset(pointer_t NewValue = 0, ihint* const Hint = 0) { // Ensure that our value doesn't go out-of-scope while it's being modified if(m_executing) return; m_value.reset(NewValue); signal_policy_t::set_value(Hint); } /// Schedule an update for the value the next time it's read void update(ihint* const Hint = 0) { // Ensure that our value doesn't go out-of-scope while it's being modified if(m_executing) return; m_update = true; signal_policy_t::set_value(Hint); } /// Accesses the underlying value, creating it if it doesn't already exist pointer_t internal_value() { if(!m_value.get()) { m_executing = true; // We can cancel pending updates since we're creating the value from scratch m_update = false; // Note: we create the value and update its state in two steps // because m_data_slot() may cause this method to be executed in a loop m_value.reset(new non_pointer_t()); m_initialize_slot(*m_value); m_executing = false; } if(m_update) { m_executing = true; m_update = false; m_update_slot(*m_value); m_executing = false; } return m_value.get(); } protected: template pointer_storage(const init_t& Init) : signal_policy_t(Init), m_update(false), m_executing(false) { } private: /// Storage for this policy's value std::unique_ptr m_value; /// Set to true if this policy's value is stale and needs to be updated bool m_update; /// Stores a slot that will be executed to initialize this policy's value sigc::slot m_initialize_slot; /// Stores a slot that will be executed to update this policy's value sigc::slot m_update_slot; /// Set to true during initialization / update of the policy value, to prevent problems with recursion bool m_executing; }; ///////////////////////////////////////////////////////////////////////////// // no_signal /// Signal policy for data containers that do not notify observers when their value changes template class no_signal { protected: template no_signal(const init_t&) { } void start_recording(istate_recorder&) { } void set_value(ihint* const) { } void finish_recording(istate_recorder&) { } }; ///////////////////////////////////////////////////////////////////////////// // change_signal /// Signal policy for data containers that notify observers when their value changes, including through undo/redo. template class change_signal { public: /// Defines a signal emitted when the underlying data changes. The signal includes an optional "hint" that describes the nature of the change. typedef sigc::signal changed_signal_t; /// Returns a reference to the signal that is emitted whenever the underlying data changes changed_signal_t& changed_signal() { return m_changed_signal; } protected: template change_signal(const init_t&) { } void start_recording(istate_recorder&) { } void set_value(ihint* const Hint) { m_changed_signal.emit(Hint); } void finish_recording(istate_recorder& StateRecorder) { StateRecorder.current_change_set()->connect_undo_signal(sigc::bind(m_changed_signal.make_slot(), static_cast(0))); StateRecorder.current_change_set()->connect_redo_signal(sigc::bind(m_changed_signal.make_slot(), static_cast(0))); } private: changed_signal_t m_changed_signal; }; /// Signal policy for data containers that notify observers when their value changes. Observers can choose whether to be notified every time the value changes (including undo/redo), or only when the value is changed explicitly by a caller. template class explicit_change_signal { public: /// Defines a signal emitted when the underlying data changes. The signal includes an optional "hint" that describes the nature of the change. typedef sigc::signal changed_signal_t; /// Returns a reference to the signal that is emitted whenever the underlying data changes. changed_signal_t& changed_signal() { return m_changed_signal; } /// Connects a slot to a signal that is emitted whenever the underlying data is modified explicitly through set_value, never by undo/redo const sigc::connection connect_explicit_change_signal(const sigc::slot& Slot) { return m_explicit_change_signal.connect(Slot); } protected: template explicit_change_signal(const init_t&) { } void start_recording(k3d::istate_recorder&) { } void set_value(k3d::ihint* const Hint) { m_changed_signal.emit(Hint); m_explicit_change_signal.emit(Hint); } void finish_recording(k3d::istate_recorder& StateRecorder) { StateRecorder.current_change_set()->connect_undo_signal(sigc::bind(m_changed_signal.make_slot(), static_cast(0))); StateRecorder.current_change_set()->connect_redo_signal(sigc::bind(m_changed_signal.make_slot(), static_cast(0))); } private: changed_signal_t m_changed_signal; changed_signal_t m_explicit_change_signal; }; /// Convenience macro for declaring k3d::data::container nodes #define k3d_data(value_type, name_policy, signal_policy, undo_policy, storage_policy, constraint_policy, property_policy, serialization_policy) \ k3d::data::container > > > > > > > /// Allows an arbitrary set of initializers to be consolidated into a single node template class initializer_t : public init_t { public: explicit initializer_t(const init_t& Init) : init_t(Init) { }; }; /// Helper class used to consolidate two initializers into a single node template class composition_t : public lhs_t, public rhs_t { public: explicit composition_t(const lhs_t& LHS, const rhs_t& RHS) : lhs_t(LHS), rhs_t(RHS) { } }; /// Consolidates two initializers into a single node, which can be consolidated in-turn template inline const initializer_t > operator+(const initializer_t& LHS, const initializer_t& RHS) { return initializer_t >(composition_t(LHS, RHS)); } /// Helper class used to set a data container's initial value template class value_initializer_t { public: explicit value_initializer_t(const value_t& Value) : m_value(Value) { } const value_t& value() const { return m_value; } private: const value_t m_value; }; template inline const initializer_t > init_value(const value_t& Value) { return initializer_t >(value_initializer_t(Value)); } /// Helper class used to set a data container's name class name_t { public: explicit name_t(const char* const Name) : m_name(Name) { } const char* name() const { return m_name; } private: const char* const m_name; }; inline const initializer_t init_name(const char* const Name) { return initializer_t(name_t(Name)); } /// Helper class used to initialize a data container's label class label_t { public: explicit label_t(const char* const Label) : m_label(Label) { } const char* label() const { return m_label; } private: const char* const m_label; }; inline const initializer_t init_label(const char* const Label) { return initializer_t(label_t(Label)); } /// Helper class used to initialize a data container's description class description_t { public: explicit description_t(const char* const Description) : m_description(Description) { } const char* description() const { return m_description; } private: const char* const m_description; }; inline const initializer_t init_description(const char* const Description) { return initializer_t(description_t(Description)); } /// Helper class used to initialize a data container's constraints template class constraint_t { public: explicit constraint_t(iconstraint* Constraint) : m_constraint(Constraint) { } iconstraint* constraint() const { return m_constraint; } private: iconstraint* const m_constraint; }; template inline const initializer_t > init_constraint(iconstraint* Constraint) { return initializer_t >(constraint_t(Constraint)); } /// Helper class used to initialize the mode for path property nodes class path_mode_t { public: explicit path_mode_t(const ipath_property::mode_t Mode) : m_mode(Mode) { } ipath_property::mode_t path_mode() const { return m_mode; } private: ipath_property::mode_t m_mode; }; inline const initializer_t init_path_mode(const ipath_property::mode_t Mode) { return initializer_t(path_mode_t(Mode)); } /// Helper class used to initialize the type for path property nodes class path_type_t { public: explicit path_type_t(const std::string& Type) : m_type(Type) { } const std::string& path_type() const { return m_type; } private: const std::string m_type; }; inline const initializer_t init_path_type(const std::string& Type) { return initializer_t(path_type_t(Type)); } /// Helper class used to initialize enumeration property types class enumeration_t { public: explicit enumeration_t(const ienumeration_property::enumeration_values_t& Values) : m_values(Values) { } const ienumeration_property::enumeration_values_t& values() const { return m_values; } private: const ienumeration_property::enumeration_values_t& m_values; }; inline const initializer_t init_enumeration(const ienumeration_property::enumeration_values_t& Values) { return initializer_t(enumeration_t(Values)); } /// Helper class used to initialize list properties template class values_t { public: explicit values_t(const data_t& Values) : m_values(Values) { } const data_t& values() const { return m_values; } private: const data_t& m_values; }; template inline const initializer_t > init_values(const data_t& Values) { return initializer_t >(values_t(Values)); } /// Helper class used to initialize measurement properties class step_increment_t { public: explicit step_increment_t(const double StepIncrement) : m_step_increment(StepIncrement) { } double step_increment() const { return m_step_increment; } private: const double m_step_increment; }; inline const initializer_t init_step_increment(const double StepIncrement) { return initializer_t(step_increment_t(StepIncrement)); } /// Helper class used to initialize measurement properties class units_t { public: explicit units_t(const std::type_info& Units) : m_units(Units) { } const std::type_info& units() const { return m_units; } private: const std::type_info& m_units; }; inline const initializer_t init_units(const std::type_info& Units) { return initializer_t(units_t(Units)); } /// Helper class used to initialize data containers template class owner_initializer_t { public: explicit owner_initializer_t(owner_t& Owner) : m_owner(Owner) { } owner_t& owner() const { return m_owner; } idocument& document() const { return m_owner.document(); } iproperty_collection& property_collection() const { return m_owner; } ipersistent_collection& persistent_collection() const { return m_owner; } inode* node() const { return dynamic_cast(&m_owner); } private: owner_t& m_owner; }; template inline const initializer_t > init_owner(owner_t& Owner) { return initializer_t >(owner_initializer_t(Owner)); } /// Helper class used to initialize data containers class external_owner_initializer_t { public: explicit external_owner_initializer_t(idocument& Document, iproperty_collection& PropertyCollection, ipersistent_collection& PersistentCollection, inode* const Node) : m_document(Document), m_property_collection(PropertyCollection), m_persistent_collection(PersistentCollection), m_node(Node) { } idocument& document() const { return m_document; } iproperty_collection& property_collection() const { return m_property_collection; } ipersistent_collection& persistent_collection() const { return m_persistent_collection; } inode* node() const { return m_node; } private: idocument& m_document; iproperty_collection& m_property_collection; ipersistent_collection& m_persistent_collection; inode* const m_node; }; inline const initializer_t init_owner(idocument& Document, iproperty_collection& PropertyCollection, ipersistent_collection& PersistentCollection, inode* const Object) { return initializer_t(external_owner_initializer_t(Document, PropertyCollection, PersistentCollection, Object)); } /// Helper class used to initialize slots template class slot_initializer_t { public: explicit slot_initializer_t(const slot_t& Slot) : m_slot(Slot) { } const slot_t& slot() const { return m_slot; } private: const slot_t& m_slot; }; template inline const initializer_t > init_slot(const slot_t& Slot) { return initializer_t >(slot_initializer_t(Slot)); } } // namespace data namespace detail { template class instance_container : public istate_container, public sigc::trackable { public: instance_container(instance_t* const Instance, const bool Owned) : m_instance(Instance), m_owned(Owned) { } virtual ~instance_container() { if(m_owned) delete m_instance; } void restore_state() { } void on_owned(bool Owned) { m_owned = Owned; } private: instance_t* const m_instance; bool m_owned; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // undoable_new /// To make creation of an object undoable / redoable, pass it to this function after calling operator new template void undoable_new(object_t* const Object, idocument& Document) { // If we aren't recording undos, we're done... state_change_set* const changeset = Document.state_recorder().current_change_set(); if(!changeset) return; // Create an instance container that only deletes the object if it has been undone typedef detail::instance_container container_t; container_t* const container = new container_t(Object, false); changeset->connect_undo_signal(sigc::bind(sigc::mem_fun(*container, &container_t::on_owned), true)); changeset->connect_redo_signal(sigc::bind(sigc::mem_fun(*container, &container_t::on_owned), false)); changeset->record_old_state(container); } ///////////////////////////////////////////////////////////////////////////// // undoable_delete /// To make deletion of an object undoable / redoable, pass it to this function instead of calling operator delete template void undoable_delete(object_t* const Object, idocument& Document) { // If we aren't recording undos, delete it the old-fashioned way ... state_change_set* const changeset = Document.state_recorder().current_change_set(); if(!changeset) { delete Object; return; } // Create an instance container that only deletes the object if it hasn't been undone typedef detail::instance_container container_t; container_t* const container = new container_t(Object, true); changeset->connect_undo_signal(sigc::bind(sigc::mem_fun(*container, &container_t::on_owned), false)); changeset->connect_redo_signal(sigc::bind(sigc::mem_fun(*container, &container_t::on_owned), true)); changeset->record_old_state(container); } } // namespace k3d using namespace k3d::data; #endif // !K3DSDK_DATA_H ================================================ FILE: k3dsdk/dependencies.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements the k3d::dependencies class, which provides an implementation of k3d::idependencies \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { void dependencies::register_object_dependency(inode& Object, const bool CopyByReference) { // Add this object to the list ... m_objects.insert(std::make_pair(&Object, CopyByReference)); } const dependencies::objects_t& dependencies::objects() const { return m_objects; } } // namespace k3d ================================================ FILE: k3dsdk/dependencies.h ================================================ #ifndef K3DSDK_DEPENDENCIES_H #define K3DSDK_DEPENDENCIES_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares the k3d::dependencies class, which provides an implementation of k3d::idependencies \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // dependencies class dependencies : public idependencies { public: void register_object_dependency(inode& Object, const bool CopyByReference); typedef std::map objects_t; const objects_t& objects() const; private: // The set of dependent objects ... objects_t m_objects; }; } // namespace k3d #endif // !K3DSDK_DEPENDENCIES_H ================================================ FILE: k3dsdk/difference.h ================================================ #ifndef K3DSDK_DIFFERENCE_H #define K3DSDK_DIFFERENCE_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace difference { /// Stores the results of the difference::test() function. class accumulator { public: /// Stores statistics for comparisons of exact (string and integer) types, including the number of tests, and the min and max test values. boost::accumulators::accumulator_set > exact; /// Stores statistics for comparisons of inexact (floating-point) types using Units in the Last Place (ULPS), including the number of tests, min, max, mean, median, and variance. boost::accumulators::accumulator_set > ulps; }; /// Function that tests the difference between two objects, returning separate results for exact (integer and string) and inexact (floating-point) types. /// See "Comparing floating point numbers" by Bruce Dawson at http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm template const accumulator test(const T& A, const T& B) { accumulator result; test(A, B, result); return result; }; /// Function that tests the difference between two objects, returning separate results for exact (integer and string) and inexact (floating-point) types. /// See "Comparing floating point numbers" by Bruce Dawson at http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm template void test(const T& A, const T& B, accumulator& Result) { // This will be triggered if this template is ever instantiated BOOST_STATIC_ASSERT(sizeof(T) == 0); }; /// Specialization of test() that tests bool_t inline void test(const bool_t& A, const bool_t& B, accumulator& Result) { Result.exact(A == B); }; #ifdef _LIBCPP_VERSION // For libc++ inline void test(const std::vector::reference& A, const std::vector::reference& B, accumulator& Result) { Result.exact(A == B); }; inline void test(const std::vector::const_reference& A, const std::vector::const_reference& B, accumulator& Result) { Result.exact(A == B); }; #endif /// Specialization of test that tests int8_t inline void test(const int8_t& A, const int8_t& B, accumulator& Result) { Result.exact(A == B); }; /// Specialization of test that tests int16_t inline void test(const int16_t& A, const int16_t& B, accumulator& Result) { Result.exact(A == B); }; /// Specialization of test that tests int32_t inline void test(const int32_t& A, const int32_t& B, accumulator& Result) { Result.exact(A == B); }; /// Specialization of test that tests int64_t inline void test(const int64_t& A, const int64_t& B, accumulator& Result) { Result.exact(A == B); }; /// Specialization of test that tests uint8_t inline void test(const uint8_t& A, const uint8_t& B, accumulator& Result) { Result.exact(A == B); }; /// Specialization of test that tests uint16_t inline void test(const uint16_t& A, const uint16_t& B, accumulator& Result) { Result.exact(A == B); }; /// Specialization of test that tests uint32_t inline void test(const uint32_t& A, const uint32_t& B, accumulator& Result) { Result.exact(A == B); }; /// Specialization of test that tests uint64_t inline void test(const uint64_t& A, const uint64_t& B, accumulator& Result) { Result.exact(A == B); }; /// Specialization of test that tests double_t inline void test(const double_t& A, const double_t& B, accumulator& Result) { Result.ulps(std::fabs(boost::math::float_distance(A, B))); }; /// Specialization of test that tests string_t inline void test(const string_t& A, const string_t& B, accumulator& Result) { Result.exact(A == B); }; #ifdef K3D_API_DARWIN /// Specialization of test for use with unsigned long (required on OSX) /// \deprecated New code must use the sized K-3D types instead of unsigned long inline void test(const unsigned long& A, const unsigned long& B, accumulator& Result) { Result.exact(A == B); }; #endif // K3D_API_DARWIN /// Given iterators designating two sequences, calls the test() function for each pair of values, /// and confirms that both sequences are the same length. template void range_test(IteratorT A, IteratorT LastA, IteratorT B, IteratorT LastB, accumulator& Result) { for(; A != LastA && B != LastB; ++A, ++B) test(*A, *B, Result); Result.exact(A == LastA && B == LastB); }; } // namespace difference } // namespace k3d #endif // !K3DSDK_DIFFERENCE_H ================================================ FILE: k3dsdk/disk.cpp ================================================ // K-3D // Copyright (c) 1995-200 7, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { namespace disk { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::doubles_t& Heights, const mesh::doubles_t& Radii, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), heights(Heights), radii(Radii), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::doubles_t& Heights, mesh::doubles_t& Radii, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), heights(Heights), radii(Radii), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("disk"); primitive* const result = new primitive( generic_primitive.structure["surface"].create("matrices"), generic_primitive.structure["surface"].create("materials"), generic_primitive.structure["surface"].create("heights"), generic_primitive.structure["surface"].create("radii"), generic_primitive.structure["surface"].create("sweep_angles"), generic_primitive.structure["surface"].create("selections"), generic_primitive.attributes["constant"], generic_primitive.attributes["surface"], generic_primitive.attributes["parameter"] ); result->selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "disk") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& surface_structure = require_structure(Primitive, "surface"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); const mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); const mesh::doubles_t& heights = require_array(Primitive, surface_structure, "heights"); const mesh::doubles_t& radii = require_array(Primitive, surface_structure, "radii"); const mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); const mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new const_primitive(matrices, materials, heights, radii, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "disk") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& surface_structure = require_structure(Primitive, "surface"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); mesh::doubles_t& heights = require_array(Primitive, surface_structure, "heights"); mesh::doubles_t& radii = require_array(Primitive, surface_structure, "radii"); mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new primitive(matrices, materials, heights, radii, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "disk") return 0; return validate(Mesh, Primitive.writable()); } } // namespace disk } // namespace k3d ================================================ FILE: k3dsdk/disk.h ================================================ #ifndef K3DSDK_DISK_H #define K3DSDK_DISK_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace disk { /// Gathers the member arrays of a disk primitive into a convenient package class const_primitive { public: const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::doubles_t& Heights, const mesh::doubles_t& Radii, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes); const mesh::matrices_t& matrices; const mesh::materials_t& materials; const mesh::doubles_t& heights; const mesh::doubles_t& radii; const mesh::doubles_t& sweep_angles; const mesh::selection_t& selections; const mesh::table_t& constant_attributes; const mesh::table_t& surface_attributes; const mesh::table_t& parameter_attributes; }; /// Gathers the member arrays of a disk primitive into a convenient package class primitive { public: primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::doubles_t& Heights, mesh::doubles_t& Radii, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes); mesh::matrices_t& matrices; mesh::materials_t& materials; mesh::doubles_t& heights; mesh::doubles_t& radii; mesh::doubles_t& sweep_angles; mesh::selection_t& selections; mesh::table_t& constant_attributes; mesh::table_t& surface_attributes; mesh::table_t& parameter_attributes; }; /// Creates a new disk mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid disk primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid disk primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid disk primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace disk } // namespace k3d #endif // !K3DSDK_DISK_H ================================================ FILE: k3dsdk/document.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Provides a concrete implementation of idocument, which encapsulates an open K-3D document \author Tim Shead (tshead@k-3d.com) \author Dan Erikson (derikson@montana.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace k3d::xml; #include #include #include #include #include namespace k3d { namespace detail { ///////////////////////////////////////////////////////////////////////////// // state_recorder_implementation /// Provides a concrete implementation of istate_recorder class state_recorder_implementation : public istate_recorder { public: state_recorder_implementation() : m_current_node(0), m_newest_node(0), m_last_saved_node(0) { } ~state_recorder_implementation() { // Delete all nodes ... for(nodes_t::iterator node = m_root_nodes.begin(); node != m_root_nodes.end(); ++node) delete_node(*node); if(m_current_recording.get()) log() << warning << "Still recording undo/redo data at shutdown, this indicates an undo/redo leak" << std::endl; } void delete_node(node* const Node) { if(!Node) return; for(nodes_t::iterator node = Node->children.begin(); node != Node->children.end(); ++node) delete_node(*node); delete Node; } void start_recording(std::unique_ptr ChangeSet, const char* const Context) { if(!ChangeSet.get()) { log() << error << "start_recording() attempt with NULL changeset. Context: " << Context << std::endl; return; } if(m_current_recording.get()) { log() << warning << "Forcing termination of unfinished changeset. Context: " << m_current_context << std::endl; std::unique_ptr changeset = stop_recording(Context); commit_change_set(std::move(changeset), "Unfinished changeset", Context); } m_current_recording = std::move(ChangeSet); m_current_context = Context; } state_change_set* current_change_set() { return m_current_recording.get(); } std::unique_ptr stop_recording(const char* const Context) { if(!m_current_recording.get()) { log() << error << "stop_recording() attempt with NULL changeset. Context: " << Context << std::endl; return std::move(m_current_recording); } // Let the world know that recording is finished ... m_recording_done_signal.emit(); // Now that recording is complete, get rid of leftover connections ... sigc::signal::slot_list_type slots = m_recording_done_signal.slots(); slots.erase(slots.begin(), slots.end()); return std::move(m_current_recording); } void commit_change_set(std::unique_ptr ChangeSet, const std::string& Label, const char* const Context) { if(!ChangeSet.get()) { log() << error << "commit_change_set() attempt with NULL changeset. Context: " << Context << std::endl; return; } if(!ChangeSet->undo_count() && !ChangeSet->redo_count()) { log() << error << "discarding empty changeset [" << Label << "]. Context: " << Context << std::endl; return; } std::string label = Label; if(label.empty()) { log() << warning << "committing anonymous changeset. Context: " << Context << std::endl; label = "Unnamed changeset"; } // Create a new node in the hierarchy, branching it from the current node if necessary ... m_newest_node = new node(label, ChangeSet.release(), m_current_node); if(m_current_node) m_current_node->children.push_back(m_newest_node); else m_root_nodes.push_back(m_newest_node); m_current_node = m_newest_node; m_node_added_signal.emit(m_newest_node); m_current_node_changed_signal.emit(); } const nodes_t& root_nodes() { return m_root_nodes; } const node* current_node() { return m_current_node; } const node* newest_node() { return m_newest_node; } const node* last_saved_node() { return m_last_saved_node; } void mark_saved() { m_last_saved_node = m_current_node; m_last_saved_node_changed_signal.emit(); } void set_current_node(const node* const Node) { m_current_node = const_cast(Node); m_current_node_changed_signal.emit(); } sigc::connection connect_recording_done_signal(const sigc::slot& Slot) { return m_recording_done_signal.connect(Slot); } sigc::connection connect_node_added_signal(const sigc::slot& Slot) { return m_node_added_signal.connect(Slot); } sigc::connection connect_current_node_changed_signal(const sigc::slot& Slot) { return m_current_node_changed_signal.connect(Slot); } sigc::connection connect_last_saved_node_changed_signal(const sigc::slot& Slot) { return m_last_saved_node_changed_signal.connect(Slot); } private: /// Stores the current change set std::unique_ptr m_current_recording; /// Stores the context for the current change set const char* m_current_context; /// Stores the root node(s) (if any) nodes_t m_root_nodes; /// Stores a reference to the current node (if any) node* m_current_node; /// Stores a reference to the most-recently-added node (if any) node* m_newest_node; /// Stores a reference to the most-recently-saved node (if any) node* m_last_saved_node; sigc::signal m_recording_done_signal; sigc::signal m_node_added_signal; sigc::signal m_current_node_changed_signal; sigc::signal m_last_saved_node_changed_signal; }; ///////////////////////////////////////////////////////////////////////////// // node_collection_implementation class node_collection_implementation : public inode_collection { public: node_collection_implementation(istate_recorder& StateRecorder) : m_state_recorder(StateRecorder) { } ~node_collection_implementation() { } void add_nodes(const nodes_t& Nodes) { // Ensure no NULLs creep in ... nodes_t nodes(Nodes); nodes.erase(std::remove(nodes.begin(), nodes.end(), static_cast(0)), nodes.end()); if(nodes.size() != Nodes.size()) log() << warning << "NULL node cannot be inserted into node collection and will be ignored" << std::endl; // We want to emit a signal whenever an node's name changes ... for(nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) (*node)->name_changed_signal().connect(sigc::bind(m_rename_node_signal.make_slot(), *node)); // If we're recording undo/redo data, record the new state ... if(m_state_recorder.current_change_set()) { m_state_recorder.current_change_set()->record_old_state(new remove_nodes_container(*this, nodes)); m_state_recorder.current_change_set()->record_new_state(new add_nodes_container(*this, nodes)); } // Make the change and notify observers ... m_nodes.insert(m_nodes.end(), nodes.begin(), nodes.end()); m_add_nodes_signal.emit(nodes); } const inode_collection::nodes_t& collection() { return m_nodes; } void remove_nodes(const nodes_t& Nodes) { // Ensure no NULLs creep in ... nodes_t nodes(Nodes); nodes.erase(std::remove(nodes.begin(), nodes.end(), static_cast(0)), nodes.end()); if(nodes.size() != Nodes.size()) log() << warning << "NULL node will be ignored" << std::endl; // If we're recording undo/redo data, record the new state ... if(m_state_recorder.current_change_set()) { m_state_recorder.current_change_set()->record_old_state(new add_nodes_container(*this, nodes)); m_state_recorder.current_change_set()->record_new_state(new remove_nodes_container(*this, nodes)); } // Make the change and notify observers ... for(nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { (*node)->deleted_signal().emit(); m_nodes.erase(std::remove(m_nodes.begin(), m_nodes.end(), *node), m_nodes.end()); } m_remove_nodes_signal.emit(nodes); } add_nodes_signal_t& add_nodes_signal() { return m_add_nodes_signal; } remove_nodes_signal_t& remove_nodes_signal() { return m_remove_nodes_signal; } rename_node_signal_t& rename_node_signal() { return m_rename_node_signal; } void on_close_document() { // Give nodes a chance to shut down ... for(inode_collection::nodes_t::iterator node = m_nodes.begin(); node != m_nodes.end(); ++node) { (*node)->deleted_signal().emit(); } // Zap nodes ... for(inode_collection::nodes_t::iterator node = m_nodes.begin(); node != m_nodes.end(); ++node) delete *node; } private: class add_nodes_container : public istate_container { public: add_nodes_container(inode_collection& Collection, const inode_collection::nodes_t& Nodes) : m_collection(Collection), m_nodes(Nodes) { } ~add_nodes_container() { } void restore_state() { m_collection.add_nodes(m_nodes); } private: inode_collection& m_collection; const inode_collection::nodes_t m_nodes; }; class remove_nodes_container : public istate_container { public: remove_nodes_container(inode_collection& Collection, const inode_collection::nodes_t& Nodes) : m_collection(Collection), m_nodes(Nodes) { } ~remove_nodes_container() { } void restore_state() { m_collection.remove_nodes(m_nodes); } private: inode_collection& m_collection; const inode_collection::nodes_t m_nodes; }; /// Provides storage for undo/redo information istate_recorder& m_state_recorder; /// Provides undo-able storage for a collection of nodes inode_collection::nodes_t m_nodes; /// Signal for notifying observers when nodes are added to the collection add_nodes_signal_t m_add_nodes_signal; /// Signal for notifying observers when nodes are removed from the collection remove_nodes_signal_t m_remove_nodes_signal; /// Signal for notifying observers when an node's name is changed rename_node_signal_t m_rename_node_signal; }; ///////////////////////////////////////////////////////////////////////////// // public_document_implementation /// Encapsulates an open K-3D document class public_document_implementation : public idocument, public property_collection, public sigc::trackable { public: public_document_implementation(istate_recorder& StateRecorder, inode_collection& Nodes, ipipeline& Pipeline) : m_state_recorder(StateRecorder), m_nodes(Nodes), m_pipeline(Pipeline), m_path(init_owner(*this) + init_name("path") + init_label(_("Document Path")) + init_description(_("Document Path")) + init_value(filesystem::path())), m_title(init_owner(*this) + init_name("title") + init_label(_("Document Title")) + init_description(_("Document Title")) + init_value(k3d::ustring())) { // Automatically add nodes to the unique node name collection m_nodes.add_nodes_signal().connect(sigc::mem_fun(m_unique_node_names, &node_name_map::add_nodes)); } ~public_document_implementation() { // Note: our close signal gets called by our owner - yes, it's a hack } idocument& document() { return *this; } inode_collection& nodes() { return m_nodes; } ipipeline& pipeline() { return m_pipeline; } ipipeline_profiler& pipeline_profiler() { return m_pipeline_profiler; } istate_recorder& state_recorder() { return m_state_recorder; } inode_name_map& unique_node_names() { return m_unique_node_names; } iproperty& path() { return m_path; } iproperty& title() { return m_title; } idocument::close_signal_t& close_signal() { return m_close_signal; } private: /// Notifies observers that the document is being closed close_signal_t m_close_signal; /// Records changes made by the user for Undo / Redo purposes istate_recorder& m_state_recorder; /// Stores document nodes ... inode_collection& m_nodes; /// Stores a reference to an implementation of ipipeline ipipeline& m_pipeline; /// Stores a pipeline profiler object k3d::pipeline_profiler m_pipeline_profiler; /// Stores unique node names node_name_map m_unique_node_names; /// Stores the full document filepath (if any) k3d_data(filesystem::path, immutable_name, change_signal, no_undo, local_storage, no_constraint, writable_property, no_serialization) m_path; /// Stores the document title (if any) k3d_data(ustring, immutable_name, change_signal, no_undo, local_storage, no_constraint, writable_property, no_serialization) m_title; }; /// This is a real abortion, but it solves our interdependency problems among state recorder, pipeline, and property collection implementations class document_implementation { public: document_implementation() : m_state_recorder(new state_recorder_implementation()), m_nodes(new node_collection_implementation(*m_state_recorder)), m_pipeline(new pipeline(m_state_recorder)), m_document(new public_document_implementation(*m_state_recorder, *m_nodes, *m_pipeline)) { } ~document_implementation() { m_document->close_signal().emit(); // Completely remove all pipeline connections so we don't waste time updating individual properties m_pipeline->clear(); m_nodes->on_close_document(); delete m_document; delete m_pipeline; delete m_nodes; delete m_state_recorder; } state_recorder_implementation* const m_state_recorder; node_collection_implementation* const m_nodes; pipeline* const m_pipeline; public_document_implementation* const m_document; private: document_implementation(const document_implementation&); document_implementation& operator=(const document_implementation&); }; typedef std::vector documents_t; documents_t& documents() { static documents_t g_documents; return g_documents; } } // namespace detail idocument* create_document() { std::unique_ptr document(new detail::document_implementation()); detail::documents().push_back(document.get()); return document.release()->m_document; } void close_document(idocument& Document) { for(detail::documents_t::iterator document = detail::documents().begin(); document != detail::documents().end(); ++document) { if((*document)->m_document == &Document) { delete *document; detail::documents().erase(document); return; } } log() << error << "close_document(): could not find document to destroy" << std::endl; } } // namespace k3d ================================================ FILE: k3dsdk/document.h ================================================ #ifndef K3DSDK_DOCUMENT_H #define K3DSDK_DOCUMENT_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares the CDocument class, which encapsulates an open K-3D document \author Tim Shead (tshead@k-3d.com) */ namespace k3d { // Forward declarations class idocument; /// Factory function that creates a new document with (optional) template (could return NULL) idocument* create_document(); /// Destroys a document, freeing all resources void close_document(idocument& Document); } // namespace k3d #endif // !K3DSDK_DOCUMENT_H ================================================ FILE: k3dsdk/document_plugin_factory.h ================================================ #ifndef K3DSDK_DOCUMENT_PLUGIN_FACTORY_H #define K3DSDK_DOCUMENT_PLUGIN_FACTORY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // document_plugin_factory template class document_plugin_factory : public plugin_factory, public idocument_plugin_factory { public: document_plugin_factory(const uuid& FactoryID, const std::string& Name, const std::string& ShortDescription, const std::string& Categories, const quality_t Quality = STABLE, const metadata_t& Metadata = metadata_t()) : plugin_factory(FactoryID, Name, ShortDescription, Categories, Quality, Metadata) { } inode* create_plugin(iplugin_factory& Factory, idocument& Document) { return new plugin_t(Factory, Document); } bool implements(const std::type_info& InterfaceType) { return implements_interface()(InterfaceType); } const interfaces_t interfaces() { interfaces_t results; get_interfaces()(results); return results; } }; } // namespace k3d #endif // !K3DSDK_DOCUMENT_PLUGIN_FACTORY_H ================================================ FILE: k3dsdk/double_source.h ================================================ #ifndef K3DSDK_DOUBLE_SOURCE_H #define K3DSDK_DOUBLE_SOURCE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { template class double_source : public idouble_source { public: iproperty& double_source_output() { return m_output_double; } sigc::slot make_update_double_slot() { return m_output_double.make_slot(); } protected: double_source() : m_output_double( init_owner(*static_cast(this)) + init_name("output_double") + init_label(_("Output Double")) + init_description("Output double") + init_value(0.0)) { m_output_double.set_update_slot(sigc::mem_fun(*this, &double_source::execute)); } private: k3d_data(double_t, data::immutable_name, data::change_signal, data::no_undo, data::value_demand_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_output_double; /// Called whenever the output has been modified and needs to be updated. void execute(const std::vector& Hints, double_t& Output) { // We can safely ignore any hints ... on_update_double(Output); } virtual void on_update_double(double_t& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_DOUBLE_SOURCE_H ================================================ FILE: k3dsdk/euler_operations.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { namespace euler { namespace detail { template void cumulative_sum(const ArrayT& InputArray, ArrayT& OutputArray) { return_if_fail(InputArray.size() == OutputArray.size()); if(InputArray.empty()) return; const uint_t array_begin = 0; const uint_t array_end = InputArray.size(); OutputArray[0] = InputArray[0]; for(uint_t i = array_begin + 1; i != array_end; ++i) OutputArray[i] = OutputArray[i-1] + InputArray[i]; } /// Sets the loop number associated with each edge in the loop to Loop void set_edge_loop(const uint_t Loop, const uint_t FirstEdge, const mesh::indices_t& ClockwiseEdges, mesh::indices_t& EdgeLoops) { for(uint_t edge = FirstEdge; ;) { EdgeLoops[edge] = Loop; edge = ClockwiseEdges[edge]; if(edge == FirstEdge) break; } } /// True if the given loop is really a polyline of adjacent edges bool_t is_polyline(const uint_t FirstEdge, const mesh::indices_t& ClockwiseEdges, const mesh::indices_t& EdgeLoops, const mesh::indices_t& AdjacentEdges) { for(uint_t edge = FirstEdge; ;) { if(AdjacentEdges[edge] == edge || EdgeLoops[AdjacentEdges[edge]] != EdgeLoops[edge]) return false; edge = ClockwiseEdges[edge]; if(edge == FirstEdge) break; } return true; } /// Deletes the given loop void delete_loop(const uint_t Loop, const mesh::indices_t& LoopFaces, const mesh::indices_t& FaceFirstLoops, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& ClockwiseEdges, mesh::indices_t& FacesToDelete, mesh::indices_t& LoopsToDelete, mesh::indices_t& EdgesToDelete, mesh::indices_t& Companions, mesh::indices_t& OutputFaceLoopCounts) { const uint_t face = LoopFaces[Loop]; --OutputFaceLoopCounts[face]; if(Loop == FaceFirstLoops[face]) { FacesToDelete[face] = 1; for(uint_t loop = 0; loop != LoopFaces.size(); ++loop) { if(LoopFaces[loop] == face && !LoopsToDelete[loop]) { LoopsToDelete[loop] = 1; --OutputFaceLoopCounts[face]; const uint_t first_edge2 = LoopFirstEdges[loop]; for(uint_t edge = first_edge2; ;) { //return_if_fail(!EdgesToDelete[edge]); EdgesToDelete[edge] = 1; edge = ClockwiseEdges[edge]; if(edge == first_edge2) break; } } } LoopsToDelete[Loop] = 1; } } /// Deletes the given loop if it consists of two edges, as well as the face if tis was the last loop void delete_loop_if_degenerate(const uint_t Loop, const mesh::indices_t& LoopFaces, const mesh::indices_t& FaceFirstLoops, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& ClockwiseEdges, mesh::indices_t& FacesToDelete, mesh::indices_t& LoopsToDelete, mesh::indices_t& EdgesToDelete, mesh::indices_t& Companions, mesh::indices_t& OutputFaceLoopCounts) { const uint_t first_edge = LoopFirstEdges[Loop]; if(first_edge != ClockwiseEdges[ClockwiseEdges[first_edge]]) // not a degenerate loop return; delete_loop(Loop, LoopFaces, FaceFirstLoops, LoopFirstEdges, ClockwiseEdges, FacesToDelete, LoopsToDelete, EdgesToDelete, Companions, OutputFaceLoopCounts); const uint_t companion1 = Companions[first_edge]; const uint_t companion2 = Companions[ClockwiseEdges[first_edge]]; Companions[companion1] = companion2; Companions[companion2] = companion1; } /// Update output arrays based on geometry that is marked for deletion void remove_deleted_geometry(polyhedron::primitive& Output, const mesh::indices_t& FaceFirstLoops, const mesh::counts_t& FaceLoopCounts, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& EdgePoints, const mesh::indices_t& ClockwiseEdges, const mesh::indices_t& FacesToDelete, const mesh::indices_t& LoopsToDelete, const mesh::indices_t& EdgesToDelete, const mesh::indices_t& LoopFaces, const mesh::selection_t& FaceSelection, const mesh::indices_t& FaceShells) { const uint_t edge_count = EdgePoints.size(); const uint_t face_count = FaceFirstLoops.size(); mesh::counts_t edges_to_delete_sum(edge_count); detail::cumulative_sum(EdgesToDelete, edges_to_delete_sum); mesh::indices_t loop_map(LoopFirstEdges.size()); // mapping between old and new loop numbers mesh::indices_t& output_loop_first_edges = Output.loop_first_edges; output_loop_first_edges.clear(); mesh::indices_t& output_face_first_loops = Output.face_first_loops; output_face_first_loops.clear(); mesh::indices_t& output_face_loop_counts = Output.face_loop_counts; output_face_loop_counts.clear(); mesh::selection_t& output_face_selection = Output.face_selections; output_face_selection.clear(); Output.face_shells.clear(); mesh::indices_t face_map(face_count); const k3d::table input_edge_attributes = Output.edge_attributes; const k3d::table input_vertex_attributes = Output.vertex_attributes; const k3d::table input_face_attributes = Output.face_attributes; Output.edge_attributes = input_edge_attributes.clone_types(); Output.vertex_attributes = input_vertex_attributes.clone_types(); Output.face_attributes = input_face_attributes.clone_types(); k3d::table_copier edge_copier(input_edge_attributes, Output.edge_attributes); k3d::table_copier vertex_copier(input_vertex_attributes, Output.vertex_attributes); k3d::table_copier face_copier(input_face_attributes, Output.face_attributes); for(uint_t loop = 0; loop != LoopFirstEdges.size(); ++loop) { if(!LoopsToDelete[loop] && !FacesToDelete[LoopFaces[loop]]) { const uint_t face = LoopFaces[loop]; //return_if_fail(!FacesToDelete[face]); if(loop == FaceFirstLoops[face]) { face_map[face] = output_face_first_loops.size(); output_face_first_loops.push_back(output_loop_first_edges.size()); output_face_loop_counts.push_back(FaceLoopCounts[face]); output_face_selection.push_back(FaceSelection[face]); face_copier.push_back(face); Output.face_shells.push_back(FaceShells[face]); return_if_fail(!EdgesToDelete[LoopFirstEdges[loop]]); output_loop_first_edges.push_back(LoopFirstEdges[loop] - edges_to_delete_sum[LoopFirstEdges[loop]]); output_loop_first_edges.resize(output_loop_first_edges.size() + FaceLoopCounts[face] - 1); } } } mesh::counts_t added_loops(output_face_first_loops.size(), 1); for(uint_t loop = 0; loop != LoopFirstEdges.size(); ++loop) { if(!LoopsToDelete[loop] && !FacesToDelete[LoopFaces[loop]]) { const uint_t face = LoopFaces[loop]; const uint_t new_face = face_map[face]; if(loop != FaceFirstLoops[face]) { output_loop_first_edges[output_face_first_loops[new_face] + added_loops[new_face]] = LoopFirstEdges[loop] - edges_to_delete_sum[LoopFirstEdges[loop]]; ++added_loops[new_face]; } } } mesh::indices_t& output_edge_points = Output.vertex_points; output_edge_points.clear(); mesh::indices_t& output_clockwise_edges = Output.clockwise_edges; output_clockwise_edges.clear(); for(uint_t edge = 0; edge != edge_count; ++edge) { if(!EdgesToDelete[edge]) { output_edge_points.push_back(EdgePoints[edge]); output_clockwise_edges.push_back(ClockwiseEdges[edge] - edges_to_delete_sum[ClockwiseEdges[edge]]); edge_copier.push_back(edge); vertex_copier.push_back(edge); } } std::set shells_to_erase; const uint_t shell_count = Output.shell_types.size(); for(uint_t shell_idx = 0; shell_idx != shell_count; ++shell_idx) { if(!std::count(Output.face_shells.begin(), Output.face_shells.end(), shell_idx)) { shells_to_erase.insert(shell_idx); } } for(std::set::const_reverse_iterator it = shells_to_erase.rbegin(); it != shells_to_erase.rend(); ++it) { const uint_t faces_end = Output.face_shells.size(); for(uint_t face = 0; face != faces_end; ++face) { if(Output.face_shells[face] > *it) --Output.face_shells[face]; } } for(typed_array::iterator shell = Output.shell_types.begin(); shell != Output.shell_types.end();) { if(shells_to_erase.count(shell - Output.shell_types.begin())) { shell = Output.shell_types.erase(shell); } else { ++shell; } } } /// Creates lookup arrays linking edges to their loops, and loops to their faces void create_edge_loop_face_lookup(const mesh::indices_t& FaceFirstLoops, const mesh::counts_t& FaceLoopCounts, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& ClockwiseEdges, mesh::indices_t& EdgeLoops, mesh::indices_t& LoopFaces) { const uint_t face_count = FaceFirstLoops.size(); EdgeLoops.resize(ClockwiseEdges.size()); LoopFaces.resize(LoopFirstEdges.size()); for(uint_t face = 0; face != face_count; ++face) // fill the above arrays { const uint_t loop_begin = FaceFirstLoops[face]; const uint_t loop_end = loop_begin + FaceLoopCounts[face]; for(uint_t loop = loop_begin; loop != loop_end; ++loop) { LoopFaces[loop] = face; const uint_t first_edge = LoopFirstEdges[loop]; for(uint_t edge = first_edge; ;) { EdgeLoops[edge] = loop; edge = ClockwiseEdges[edge]; if(edge == first_edge) break; } } } } } // namespace detail void kill_edge_make_loop(polyhedron::primitive& Output, const mesh::indices_t& EdgeList, const mesh::bools_t BoundaryEdges, const mesh::indices_t& AdjacentEdges, const mesh::points_t& Points, const mesh::normals_t& FaceNormals) { // Copies, so we can use them as temp storage between the individiual KEML operations const mesh::indices_t face_first_loops = Output.face_first_loops; mesh::counts_t face_loop_counts = Output.face_loop_counts; mesh::indices_t loop_first_edges = Output.loop_first_edges; mesh::indices_t clockwise_edges = Output.clockwise_edges; const mesh::indices_t edge_points = Output.vertex_points; const double_t threshold = 1e-1; // Threshold for normal comparison // Initiate some helper arrays const uint_t face_count = face_first_loops.size(); const uint_t loop_count = loop_first_edges.size(); const uint_t edge_count = clockwise_edges.size(); mesh::selection_t face_selection(face_count, 0.0); mesh::counts_t faces_to_delete(face_count, 0); mesh::counts_t loops_to_delete(loop_count, 0); mesh::counts_t edges_to_delete(edge_count, 0); mesh::indices_t loop_faces(loop_count); // for each loop, the face it belongs to mesh::indices_t edge_loops(edge_count); // for each edge, the loop it belongs to detail::create_edge_loop_face_lookup(face_first_loops, face_loop_counts, loop_first_edges, clockwise_edges, edge_loops, loop_faces); mesh::indices_t counter_clockwise_edges(edge_count); for(uint_t edge = 0; edge != edge_count; ++edge) { counter_clockwise_edges[clockwise_edges[edge]] = edge; } mesh::selection_t marked_edges(edge_count, 0.0); for(uint_t i = 0; i != EdgeList.size(); ++i) marked_edges[EdgeList[i]] = 1.0; for(uint_t edge_list_index = 0; edge_list_index != EdgeList.size(); ++edge_list_index) { const uint_t edge = EdgeList[edge_list_index]; const uint_t companion = AdjacentEdges[edge]; if(!marked_edges[edge] && !marked_edges[companion]) continue; if(BoundaryEdges[edge]) continue; if(edges_to_delete[edge]) continue; return_if_fail(!edges_to_delete[companion]); const uint_t loop = edge_loops[edge]; const uint_t companion_loop = edge_loops[companion]; const uint_t face = loop_faces[loop]; const uint_t companion_face = loop_faces[companion_loop]; // Treat this case when we hit the companion edge if(loop == face_first_loops[face] && companion_loop != face_first_loops[companion_face]) { continue; } return_if_fail(!faces_to_delete[face]); return_if_fail(!faces_to_delete[companion_face]); return_if_fail(!loops_to_delete[loop]); return_if_fail(!loops_to_delete[companion_loop]); return_if_fail(clockwise_edges[counter_clockwise_edges[edge]] == edge); return_if_fail(clockwise_edges[counter_clockwise_edges[companion]] == companion); return_if_fail(counter_clockwise_edges[clockwise_edges[edge]] == edge); return_if_fail(counter_clockwise_edges[clockwise_edges[companion]] == companion); edges_to_delete[edge] = 1; edges_to_delete[companion] = 1; face_selection[face] = 1.0; if(edge == clockwise_edges[clockwise_edges[edge]]) { return_if_fail(loop == companion_loop); return_if_fail(loop != face_first_loops[face]); return_if_fail(counter_clockwise_edges[counter_clockwise_edges[edge]] == edge); loops_to_delete[loop] = 1; --face_loop_counts[face]; continue; } bool_t loop_is_polyline = detail::is_polyline(edge, clockwise_edges, edge_loops, AdjacentEdges); bool_t companion_loop_is_polyline = detail::is_polyline(companion, clockwise_edges, edge_loops, AdjacentEdges); // Reconnect edges clockwise_edges[counter_clockwise_edges[edge]] = clockwise_edges[companion]; clockwise_edges[counter_clockwise_edges[companion]] = clockwise_edges[edge]; counter_clockwise_edges[clockwise_edges[edge]] = counter_clockwise_edges[companion]; counter_clockwise_edges[clockwise_edges[companion]] = counter_clockwise_edges[edge]; if(loop == companion_loop) { return_if_fail(face == companion_face); if(clockwise_edges[edge] == companion) { loop_first_edges[loop] = clockwise_edges[companion]; continue; } if(clockwise_edges[companion] == edge) { loop_first_edges[loop] = clockwise_edges[edge]; continue; } if(!detail::is_polyline(clockwise_edges[companion], clockwise_edges, edge_loops, AdjacentEdges) && std::abs(normalize(polyhedron::normal(edge_points, clockwise_edges, Points, clockwise_edges[companion])) * FaceNormals[face] - 1) < threshold) { loop_first_edges[loop] = clockwise_edges[companion]; const uint_t new_loop = loop_first_edges.size(); loop_first_edges.push_back(clockwise_edges[edge]); detail::set_edge_loop(new_loop, clockwise_edges[edge], clockwise_edges, edge_loops); loop_faces.push_back(face); } else { if(loop == face_first_loops[face]) // first loops should not degenerate to a polyline { return_if_fail(!detail::is_polyline(clockwise_edges[edge], clockwise_edges, edge_loops, AdjacentEdges)); return_if_fail(std::abs(normalize(polyhedron::normal(edge_points, clockwise_edges, Points, clockwise_edges[edge])) * FaceNormals[face] - 1) < threshold); } loop_first_edges[loop] = clockwise_edges[edge]; const uint_t new_loop = loop_first_edges.size(); loop_first_edges.push_back(clockwise_edges[companion]); detail::set_edge_loop(new_loop, clockwise_edges[companion], clockwise_edges, edge_loops); loop_faces.push_back(face); } ++face_loop_counts[face]; loops_to_delete.push_back(0); } else { if(companion_loop == face_first_loops[companion_face]) { loop_first_edges[loop] = counter_clockwise_edges[edge]; detail::set_edge_loop(loop, loop_first_edges[loop], clockwise_edges, edge_loops); loops_to_delete[companion_loop] = 1; --face_loop_counts[companion_face]; faces_to_delete[companion_face] = 1; for(uint_t l = 0; l != loop_faces.size(); ++l) { if(loop_faces[l] == companion_face && !loops_to_delete[l]) { loop_faces[l] = face; ++face_loop_counts[face]; } } } else { assert_not_implemented(); } } } return_if_fail(loops_to_delete.size() == loop_first_edges.size()); return_if_fail(loop_faces.size() == loop_first_edges.size()); mesh::indices_t edges_to_delete_sum(edges_to_delete.size()); detail::cumulative_sum(edges_to_delete, edges_to_delete_sum); // Update the output arrays const k3d::mesh::indices_t face_shells = Output.face_shells; detail::remove_deleted_geometry(Output, face_first_loops, face_loop_counts, loop_first_edges, edge_points, clockwise_edges, faces_to_delete, loops_to_delete, edges_to_delete, loop_faces, face_selection, face_shells); Output.face_materials.assign(Output.face_first_loops.size(), static_cast(0)); Output.edge_selections.assign(Output.vertex_points.size(), 0.0); Output.vertex_selections.assign(Output.vertex_points.size(), 0.0); } void kill_edge_and_vertex(polyhedron::primitive& Output, const mesh::indices_t& EdgeList, const mesh::bools_t BoundaryEdges, const mesh::indices_t& AdjacentEdges, const uint_t PointCount) { const mesh::indices_t face_first_loops = Output.face_first_loops; mesh::counts_t face_loop_counts = Output.face_loop_counts; mesh::indices_t loop_first_edges = Output.loop_first_edges; mesh::indices_t clockwise_edges = Output.clockwise_edges; mesh::indices_t edge_points = Output.vertex_points; // Copy the companions array, since it will change mesh::indices_t companions = AdjacentEdges; // Initiate some helper arrays const uint_t face_count = face_first_loops.size(); const uint_t loop_count = loop_first_edges.size(); const uint_t edge_count = clockwise_edges.size(); mesh::selection_t face_selection(face_count, 0.0); mesh::counts_t faces_to_delete(face_count, 0); mesh::counts_t loops_to_delete(loop_count, 0); mesh::counts_t edges_to_delete(edge_count, 0); mesh::indices_t loop_faces(loop_count); // for each loop, the face it belongs to mesh::indices_t edge_loops(edge_count); // for each edge, the loop it belongs to detail::create_edge_loop_face_lookup(face_first_loops, face_loop_counts, loop_first_edges, clockwise_edges, edge_loops, loop_faces); mesh::indices_t counter_clockwise_edges(edge_count); for(uint_t edge = 0; edge != edge_count; ++edge) { const uint_t clockwise = clockwise_edges[edge]; counter_clockwise_edges[clockwise] = edge; } // maps old point indices to the indices that replace them. mesh::indices_t point_map(PointCount, 0.0); for(uint_t point = 0; point != PointCount; ++point) point_map[point] = point; for(uint_t edge_list_index = 0; edge_list_index != EdgeList.size(); ++edge_list_index) { const uint_t edge = EdgeList[edge_list_index]; //const uint_t edge = affected_edges[i]; const uint_t companion = companions[edge]; const uint_t loop = edge_loops[edge]; const uint_t face = loop_faces[loop]; if(!edges_to_delete[companion]) { const uint_t edge_point = edge_points[edge]; if(edge_point == point_map[edge_point]) point_map[edge_point] = edge_points[clockwise_edges[edge]]; } return_if_fail(clockwise_edges[counter_clockwise_edges[edge]] == edge); // Mark edge to delete edges_to_delete[edge] = 1; // Reconnect edges if(companion == counter_clockwise_edges[edge]) // first antenna case { counter_clockwise_edges[clockwise_edges[edge]] = companions[clockwise_edges[edge]]; loop_first_edges[loop] = companions[clockwise_edges[edge]]; } else if(companion == clockwise_edges[edge]) // second antenna case { clockwise_edges[counter_clockwise_edges[edge]] = companions[counter_clockwise_edges[edge]]; loop_first_edges[loop] = companions[counter_clockwise_edges[edge]]; } else // normal edge { clockwise_edges[counter_clockwise_edges[edge]] = clockwise_edges[edge]; counter_clockwise_edges[clockwise_edges[edge]] = counter_clockwise_edges[edge]; return_if_fail(edge_loops[counter_clockwise_edges[edge]] == edge_loops[clockwise_edges[edge]]); loop_first_edges[loop] = clockwise_edges[edge]; } // Check if we created a loop that has only 2 edges, and if we did, delete it detail::delete_loop_if_degenerate(loop, loop_faces, face_first_loops, loop_first_edges, clockwise_edges, faces_to_delete, loops_to_delete, edges_to_delete, companions, face_loop_counts); } // Set edge points for(uint_t edge = 0; edge != edge_count; ++edge) { if(!edges_to_delete[edge] && edge_points[edge] != edge_points[clockwise_edges[edge]]) { uint_t new_edge_point = edge_points[edge]; // recursively get the new edge point while(new_edge_point != point_map[new_edge_point]) { new_edge_point = point_map[new_edge_point]; // if we get a loop, leave the point unchanged if(new_edge_point != point_map[new_edge_point] && new_edge_point == point_map[point_map[new_edge_point]]) { new_edge_point = edge_points[edge]; break; } } if(edge_points[edge] != new_edge_point) { face_selection[loop_faces[edge_loops[edge]]] = 1.0; } edge_points[edge] = new_edge_point; } } // Remove edges that have the same start and end for(uint_t edge = 0; edge != edge_count; ++edge) { if(edge_points[edge] == edge_points[clockwise_edges[edge]]) { edges_to_delete[edge] = 1; clockwise_edges[counter_clockwise_edges[edge]] = clockwise_edges[edge]; counter_clockwise_edges[clockwise_edges[edge]] = counter_clockwise_edges[edge]; loop_first_edges[edge_loops[edge]] = clockwise_edges[edge]; } } // Update output arrays const k3d::mesh::indices_t face_shells = Output.face_shells; detail::remove_deleted_geometry(Output,face_first_loops, face_loop_counts, loop_first_edges, edge_points, clockwise_edges, faces_to_delete, loops_to_delete, edges_to_delete, loop_faces, face_selection, face_shells); Output.face_materials.assign(Output.face_first_loops.size(), static_cast(0)); Output.edge_selections.assign(Output.clockwise_edges.size(), 0.0); Output.vertex_selections.assign(Output.clockwise_edges.size(), 0.0); } } // namespace euler } // namespace k3d ================================================ FILE: k3dsdk/euler_operations.h ================================================ #ifndef K3DSDK_EULER_OPERATIONS_H #define K3DSDK_EULER_OPERATIONS_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include namespace k3d { namespace euler { /// Apply the Kill Edge Make Loop (KEML) Euler operation to all edges in EdgeList that are not boundary edges /** * This operations removes an edge and its companion, and makes one loop out of the loops that are on either side of the edge. * This effectively merges two faces, if neither loop is a hole. * \param Output The polyhedron containing the input, which will be transformed so it contains the output * \param EdgeList A list of edge indices that the operation will be applied to * \param BoundaryEdges True for all edges that are on the mesh boundary * \param AdjacentEdges The index of the adjacent edge (companion) for each edge * \param Points The coordinates of the points for the mesh * \param FaceNormals The normal for each face */ void kill_edge_make_loop(polyhedron::primitive& Output, const mesh::indices_t& EdgeList, const mesh::bools_t BoundaryEdges, const mesh::indices_t& AdjacentEdges, const mesh::points_t& Points, const mesh::normals_t& FaceNormals); /// Apply the Kill Edge and Vertex (KEV) Euler operation to all selected edges /** * This operation removes an edge and its vertex. If an edge pair is selected, the vertex of the lowest numbered halfedge in * the pair is removed. If only one halfedge of an edge pair is selected, the vertex belonging to that edge is removed. * \param Output The polyhedron containing the input, which will be transformed so it contains the output * \param EdgeList A list of edge indices that the operation will be applied to * \param BoundaryEdges True for all edges that are on the mesh boundary * \param AdjacentEdges The index of the adjacent edge (companion) for each edge * \param PointCount The number of points in the mesh */ void kill_edge_and_vertex(polyhedron::primitive& Output, const mesh::indices_t& EdgeList, const mesh::bools_t BoundaryEdges, const mesh::indices_t& AdjacentEdges, const uint_t PointCount); } // namespace euler } // namespace k3d #endif // !K3DSDK_EULER_OPERATIONS_H ================================================ FILE: k3dsdk/exceptions.h ================================================ #ifndef K3DSDK_EXCEPTIONS_H #define K3DSDK_EXCEPTIONS_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA namespace k3d { /// All code should use this template to throw exceptions (Why? Because We Told You So) template void throw_exception(const E& e) { throw e; } } // namespace k3d #endif // !K3DSDK_EXCEPTIONS_H ================================================ FILE: k3dsdk/explicit_instantiation.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include /* Excerpted from http://mail.python.org/pipermail/c++-sig/2003-July/004906.html: Most of the subtle problems with dynamic linking C++ have to do with symbols C++ generates implicitly: RTTI and EH information virtual tables static data members of class template instantiations static variables in function template instantiations Typically, in the Global model this information (known as "weak symbols" on Linux) is generated in every translation unit where it is used, and resolved away at link time. Of course, that leaves us with a single copy per link unit (executable or shared library), and which copy is used needs to be resolved at load time.** The solutions generally come down to controlling where those symbols are generated and how they are shared across boundaries. Whether the first two things are a problem for your application depends in part on the ABI (application binary interface) of your compiler. The ABI encompasses issues such as function calling convention, class layout, the format of EH tables, the format of RTTI information, and of course, the procedures the compiler uses to manipulate that information. Your problem with boost::any was an interaction with the compiler's implementation of dynamic_cast. Recent GCCs determine dynamic type equivalence by comparing the *addresses* (not the contents) of their RTTI information. Because your two extension modules are not sharing any symbols other than those in the Boost.Python library, each one gets its own copy of the RTTI for the class in the any object, and the template instantiation of the any_cast on each side of the library boundary uses a different copy. The solution is to get that RTTI information generated in a place that both libraries can see. The best way to achieve that is to link both extension modules to a common shared library using the global model, and put the RTTI information there. For the case in question, you might achieve that by explicitly instantiating the any_cast template there. The problem we had earlier with catching exceptions is an interaction with the compiler's implementation of EH and the behavior of glibc under dynamic linking. Recent glibc implementations have an "inconvenient" (charitably speaking) behavior with weak symbols. The result is that if the symbol appears in both extension modules *and* in the Boost.Python shared library, the first extension module loaded will share a copy with the Boost.Python library and each module loaded thereafter will get its own copy. Fortunately, I knew that classes with non-inline virtual functions are different, and usually a *strong* symbol gets generated in the translation unit containing the class' first non-inline virtual function. By adding a virtual destructor in the Boost.Python library we ensured that both extension modules got the same copy of the exception's EH info. >>The Windows crash, FWIW, is a poor-QOI issue "bug" in the Dinkumware >>standard library that ships with vc6. vc7 solves it: This problem is that the vc6 associative containers use a special static data member representing a "NULL" node, used as a sentinel to tell the container implementation where the "edge" is, so it would stop searching there. Because you instantiated the map<> template in two separate extension modules, each one got it's own copy of the "NULL" node, and a map passed across the boundary would contain the wrong sentinel value for the code on the other side. -- Dave Abrahams Boost Consulting www.boost-consulting.com */ template k3d::mesh* boost::any_cast(boost::any&); template k3d::mesh* boost::any_cast(const boost::any&); ================================================ FILE: k3dsdk/explicit_snap_source.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { //////////////////////////////////////////////////////////////////////////////////// // explicit_snap_source explicit_snap_source::explicit_snap_source(const std::string& Label, const k3d::point3& Position) : m_label(Label), m_position(Position) { } explicit_snap_source::explicit_snap_source(const std::string& Label, const k3d::point3& Position, const k3d::vector3& Look, const k3d::vector3& Up) : m_label(Label), m_position(Position), m_look(new k3d::vector3(Look)), m_up(new k3d::vector3(Up)) { } void explicit_snap_source::add_group(const std::string& Group) { return_if_fail(Group.size()); return_if_fail(std::find(m_groups.begin(), m_groups.end(), Group) == m_groups.end()); m_groups.push_back(Group); } const std::string explicit_snap_source::label() { return m_label; } const isnap_source::groups_t explicit_snap_source::groups() { return m_groups; } const point3 explicit_snap_source::source_position() { return m_position; } bool explicit_snap_source::source_orientation(vector3& SourceLook, vector3& SourceUp) { if(m_look.get() && m_up.get()) { SourceLook = *m_look; SourceUp = *m_up; return true; } return false; } } // namespace k3d ================================================ FILE: k3dsdk/explicit_snap_source.h ================================================ #ifndef K3DSDK_EXPLICIT_SNAP_SOURCE_H #define K3DSDK_EXPLICIT_SNAP_SOURCE_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class explicit_snap_source : public isnap_source { public: explicit_snap_source(const std::string& Label, const k3d::point3& Position); explicit_snap_source(const std::string& Label, const k3d::point3& Position, const k3d::vector3& Look, const k3d::vector3& Up); void add_group(const std::string& Group); const std::string label(); const groups_t groups(); const point3 source_position(); bool source_orientation(vector3& SourceLook, vector3& SourceUp); std::string m_label; k3d::point3 m_position; std::unique_ptr m_look; std::unique_ptr m_up; groups_t m_groups; }; } // namespace k3d #endif // !K3DSDK_EXPLICIT_SNAP_SOURCE_H ================================================ FILE: k3dsdk/explicit_snap_target.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { //////////////////////////////////////////////////////////////////////////////////// // explicit_snap_target explicit_snap_target::explicit_snap_target(const std::string& Label, const k3d::point3& Position) : m_label(Label), m_position(Position) { } explicit_snap_target::explicit_snap_target(const std::string& Label, const k3d::point3& Position, const k3d::vector3& Look, const k3d::vector3& Up) : m_label(Label), m_position(Position), m_look(new k3d::vector3(Look)), m_up(new k3d::vector3(Up)) { } void explicit_snap_target::add_group(const std::string& Group) { return_if_fail(Group.size()); return_if_fail(std::find(m_groups.begin(), m_groups.end(), Group) == m_groups.end()); m_groups.push_back(Group); } const std::string explicit_snap_target::label() { return m_label; } const isnap_target::groups_t explicit_snap_target::groups() { return m_groups; } bool explicit_snap_target::target_position(const point3&, point3& TargetPosition) { TargetPosition = m_position; return true; } bool explicit_snap_target::target_orientation(const point3&, vector3& TargetLook, vector3& TargetUp) { if(m_look.get() && m_up.get()) { TargetLook = *m_look; TargetUp = *m_up; return true; } return false; } } // namespace k3d ================================================ FILE: k3dsdk/explicit_snap_target.h ================================================ #ifndef K3DSDK_EXPLICIT_SNAP_TARGET_H #define K3DSDK_EXPLICIT_SNAP_TARGET_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class explicit_snap_target : public isnap_target { public: explicit_snap_target(const std::string& Label, const k3d::point3& Position); explicit_snap_target(const std::string& Label, const k3d::point3& Position, const k3d::vector3& Look, const k3d::vector3& Up); void add_group(const std::string& Group); const std::string label(); const groups_t groups(); bool target_position(const point3& Position, point3& TargetPosition); bool target_orientation(const point3& Position, vector3& TargetLook, vector3& TargetUp); std::string m_label; k3d::point3 m_position; std::unique_ptr m_look; std::unique_ptr m_up; groups_t m_groups; }; } // namespace k3d #endif // !K3DSDK_EXPLICIT_SNAP_TARGET_H ================================================ FILE: k3dsdk/expression/CMakeLists.txt ================================================ PROJECT(k3dsdk-expression) FILE(GLOB HEADERS *.h) FILE(GLOB SOURCES *.cpp) LIST(SORT HEADERS) LIST(SORT SOURCES) INCLUDE_DIRECTORIES(${k3d_SOURCE_DIR}) K3D_ADD_LIBRARY(k3dsdk-expression SHARED ${HEADERS} ${SOURCES}) K3D_GENERATE_DEF_FILE(k3dsdk-expression) TARGET_LINK_LIBRARIES(k3dsdk-expression k3dsdk) INSTALL(TARGETS k3dsdk-expression RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) ================================================ FILE: k3dsdk/expression/basic_parser.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { namespace expression { class basic_parser::implementation { public: FunctionParser basic_parser; }; basic_parser::basic_parser() : m_implementation(new implementation()) { } basic_parser::~basic_parser() { delete m_implementation; } void basic_parser::add_constant(const std::string& Name, double_t Value) { return_if_fail(m_implementation->basic_parser.AddConstant(Name, Value)); } void basic_parser::add_function(const std::string& Name, FunctionPtr Function, uint8_t ParameterCount) { return_if_fail(m_implementation->basic_parser.AddFunction(Name, Function, ParameterCount)); } bool_t basic_parser::parse(const std::string& Function, const std::string& Variables) { return m_implementation->basic_parser.Parse(Function, Variables) <= -1; } const std::string basic_parser::last_parse_error() { return m_implementation->basic_parser.ErrorMsg() ? m_implementation->basic_parser.ErrorMsg() : ""; } void basic_parser::optimize() { m_implementation->basic_parser.Optimize(); } double_t basic_parser::evaluate(const double_t* Variables) { return m_implementation->basic_parser.Eval(Variables); } } // namespace expression } // namespace k3d ================================================ FILE: k3dsdk/expression/basic_parser.h ================================================ #ifndef K3DSDK_EXPRESSION_BASIC_PARSER_H #define K3DSDK_EXPRESSION_BASIC_PARSER_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace expression { /// Provides a parser that can execute functions with C-like syntax, returning a double result /** \note The implementation is provided by http://iki.fi/warp/FunctionParser */ class basic_parser { public: basic_parser(); ~basic_parser(); /// Adds a named constant that can be used in expressions void add_constant(const std::string& Name, double_t Value); typedef double_t (*FunctionPtr)(const double_t*); /// Adds a function that can be used in expressions void add_function(const std::string& Name, FunctionPtr Function, uint8_t ParameterCount); /// Parse an expression, returning true on success, otherwise false. /// If parsing fails, Error will contain a human-readable string describing the reason. bool_t parse(const std::string& Function, const std::string& Variables); /// Returns a human-readable string describing the most recent parse error const std::string last_parse_error(); /// Run an optimizer on the currently parsed expression, for (potentially) faster execution void optimize(); /// Evaluate the expression with the given variable values, returning the result double_t evaluate(const double_t* Variables); private: basic_parser(const basic_parser&); basic_parser& operator=(const basic_parser&); class implementation; implementation* const m_implementation; }; } // namespace expression } // namespace k3d #endif // !K3DSDK_EXPRESSION_BASIC_PARSER_H ================================================ FILE: k3dsdk/expression/fparser.cpp ================================================ //============================== // Function parser v2.8 by Warp //============================== // ============================================================================= // Usage license: // ============================================================================= // // Copyright © 2003-2005 Juha Nieminen, Joel Yliluoma // // This library is distributed under two distinct usage licenses depending // on the software ("Software" below) which uses the Function Parser library // ("Library" below). // The reason for having two distinct usage licenses is to make the library // compatible with the GPL license while still being usable in other non-GPL // (even commercial) software. See fparser_license.txt for more details. #include "fparser.h" #include "fpconfig.h" #include "fptypes.h" using namespace FUNCTIONPARSERTYPES; #include #include #include #include using namespace std; #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 #endif namespace { const unsigned FUNC_AMOUNT = sizeof(Functions)/sizeof(Functions[0]); // BCB4 does not implement the standard lower_bound function. // This is used instead: const FuncDefinition* fp_lower_bound(const FuncDefinition* first, const FuncDefinition* last, const FuncDefinition& value) { while(first < last) { const FuncDefinition* middle = first+(last-first)/2; if(*middle < value) first = middle+1; else last = middle; } return last; } // Returns a pointer to the FuncDefinition instance which 'name' is // the same as the one given by 'F'. If no such function name exists, // returns 0. inline const FuncDefinition* FindFunction(const char* F) { FuncDefinition func = { F, 0, 0, 0 }; while(isalnum(F[func.nameLength])) ++func.nameLength; if(func.nameLength) { const FuncDefinition* found = fp_lower_bound(Functions, Functions+FUNC_AMOUNT, func); if(found == Functions+FUNC_AMOUNT || func < *found) return 0; return found; } return 0; } } //--------------------------------------------------------------------------- // Copy-on-write method //--------------------------------------------------------------------------- void FunctionParser::copyOnWrite() { if(data->referenceCounter > 1) { Data* oldData = data; data = new Data(*oldData); --(oldData->referenceCounter); data->referenceCounter = 1; } } //--------------------------------------------------------------------------- // Constructors and destructors //--------------------------------------------------------------------------- //=========================================================================== FunctionParser::FunctionParser(): parseErrorType(FP_NO_ERROR), evalErrorType(0), data(new Data), evalRecursionLevel(0) { data->referenceCounter = 1; } FunctionParser::~FunctionParser() { if(--(data->referenceCounter) == 0) { delete data; } } FunctionParser::FunctionParser(const FunctionParser& cpy): parseErrorType(cpy.parseErrorType), evalErrorType(cpy.evalErrorType), data(cpy.data), evalRecursionLevel(0) { ++(data->referenceCounter); } FunctionParser& FunctionParser::operator=(const FunctionParser& cpy) { if(data != cpy.data) { if(--(data->referenceCounter) == 0) delete data; parseErrorType = cpy.parseErrorType; evalErrorType = cpy.evalErrorType; data = cpy.data; evalRecursionLevel = cpy.evalRecursionLevel; ++(data->referenceCounter); } return *this; } FunctionParser::Data::Data(): useDegreeConversion(false), ByteCode(0), ByteCodeSize(0), Immed(0), ImmedSize(0), Stack(0), StackSize(0) {} FunctionParser::Data::~Data() { if(ByteCode) { delete[] ByteCode; ByteCode=0; } if(Immed) { delete[] Immed; Immed=0; } if(Stack) { delete[] Stack; Stack=0; } } // Makes a deep-copy of Data: FunctionParser::Data::Data(const Data& cpy): varAmount(cpy.varAmount), useDegreeConversion(cpy.useDegreeConversion), Variables(cpy.Variables), Constants(cpy.Constants), FuncPtrNames(cpy.FuncPtrNames), FuncPtrs(cpy.FuncPtrs), FuncParserNames(cpy.FuncParserNames), FuncParsers(cpy.FuncParsers), ByteCode(0), ByteCodeSize(cpy.ByteCodeSize), Immed(0), ImmedSize(cpy.ImmedSize), Stack(0), StackSize(cpy.StackSize) { if(ByteCodeSize) ByteCode = new unsigned[ByteCodeSize]; if(ImmedSize) Immed = new double[ImmedSize]; if(StackSize) Stack = new double[StackSize]; for(unsigned i=0; i& dest) { unsigned varNumber = VarBegin; unsigned ind1 = 0, ind2; while(ind1 < Vars.size()) { if(!isalpha(Vars[ind1]) && Vars[ind1]!='_') return false; for(ind2=ind1+1; ind2FuncParserNames) != data->FuncParserNames.end() || FindVariable(n, data->FuncPtrNames) != data->FuncPtrNames.end()) return false; copyOnWrite(); data->Constants[name] = value; return true; } return false; } // Function pointers bool FunctionParser::AddFunction(const std::string& name, FunctionPtr func, unsigned paramsAmount) { if(isValidName(name)) { const char* n = name.c_str(); if(FindVariable(n, data->FuncParserNames) != data->FuncParserNames.end() || FindConstant(n) != data->Constants.end()) return false; copyOnWrite(); data->FuncPtrNames[name] = data->FuncPtrs.size(); data->FuncPtrs.push_back(Data::FuncPtrData(func, paramsAmount)); return true; } return false; } bool FunctionParser::checkRecursiveLinking(const FunctionParser* fp) const { if(fp == this) return true; for(unsigned i=0; idata->FuncParsers.size(); ++i) if(checkRecursiveLinking(fp->data->FuncParsers[i])) return true; return false; } bool FunctionParser::AddFunction(const std::string& name, FunctionParser& parser) { if(isValidName(name)) { const char* n = name.c_str(); if(FindVariable(n, data->FuncPtrNames) != data->FuncPtrNames.end() || FindConstant(n) != data->Constants.end()) return false; if(checkRecursiveLinking(&parser)) return false; copyOnWrite(); data->FuncParserNames[name] = data->FuncParsers.size(); data->FuncParsers.push_back(&parser); return true; } return false; } // Main parsing function // --------------------- int FunctionParser::Parse(const std::string& Function, const std::string& Vars, bool useDegrees) { copyOnWrite(); data->Variables.clear(); if(!ParseVars(Vars, data->Variables)) { parseErrorType = INVALID_VARS; return Function.size(); } data->varAmount = data->Variables.size(); // this is for Eval() const char* Func = Function.c_str(); parseErrorType = FP_NO_ERROR; int Result = CheckSyntax(Func); if(Result>=0) return Result; data->useDegreeConversion = useDegrees; if(!Compile(Func)) return Function.size(); data->Variables.clear(); parseErrorType = FP_NO_ERROR; return -1; } namespace { const char* const fpOperators[] = { "+", "-", "*", "/", "%", "^", "=", "!=", "<=", "<", ">=", ">", "&", "|", 0 }; // Is given char an operator? // (Returns 0 if not, else the size of the operator) inline int IsOperator(const char* F) { for(unsigned opInd = 0; fpOperators[opInd]; ++opInd) { const char* op = fpOperators[opInd]; for(unsigned n = 0; F[n] == *op; ++n) { ++op; if(*op == 0) return op-fpOperators[opInd]; } } return 0; } // skip whitespace inline void sws(const char* F, int& Ind) { while(F[Ind] && isspace(F[Ind])) ++Ind; } } // Returns an iterator to the variable with the same name as 'F', or to // Variables.end() if no such variable exists: inline FunctionParser::Data::VarMap_t::const_iterator FunctionParser::FindVariable(const char* F, const Data::VarMap_t& vars) const { if(vars.size()) { unsigned ind = 0; while(isalnum(F[ind]) || F[ind] == '_') ++ind; if(ind) { string name(F, ind); return vars.find(name); } } return vars.end(); } inline FunctionParser::Data::ConstMap_t::const_iterator FunctionParser::FindConstant(const char* F) const { if(data->Constants.size()) { unsigned ind = 0; while(isalnum(F[ind]) || F[ind] == '_') ++ind; if(ind) { string name(F, ind); return data->Constants.find(name); } } return data->Constants.end(); } //--------------------------------------------------------------------------- // Check function string syntax // ---------------------------- int FunctionParser::CheckSyntax(const char* Function) { const Data::VarMap_t& Variables = data->Variables; const Data::ConstMap_t& Constants = data->Constants; const Data::VarMap_t& FuncPtrNames = data->FuncPtrNames; const Data::VarMap_t& FuncParserNames = data->FuncParserNames; vector functionParenthDepth; int Ind=0, ParenthCnt=0, c; char* Ptr; while(true) { sws(Function, Ind); c=Function[Ind]; // Check for valid operand (must appear) // Check for leading - or ! if(c=='-' || c=='!') { sws(Function, ++Ind); c=Function[Ind]; } if(c==0) { parseErrorType=PREMATURE_EOS; return Ind; } // Check for math function bool foundFunc = false; const FuncDefinition* fptr = FindFunction(&Function[Ind]); if(fptr) { Ind += fptr->nameLength; foundFunc = true; } else { // Check for user-defined function Data::VarMap_t::const_iterator fIter = FindVariable(&Function[Ind], FuncPtrNames); if(fIter != FuncPtrNames.end()) { Ind += fIter->first.size(); foundFunc = true; } else { Data::VarMap_t::const_iterator pIter = FindVariable(&Function[Ind], FuncParserNames); if(pIter != FuncParserNames.end()) { Ind += pIter->first.size(); foundFunc = true; } } } if(foundFunc) { sws(Function, Ind); c = Function[Ind]; if(c!='(') { parseErrorType=EXPECT_PARENTH_FUNC; return Ind; } int Ind2 = Ind+1; sws(Function, Ind2); if(Function[Ind2] == ')') { Ind = Ind2+1; sws(Function, Ind); c = Function[Ind]; // Ugly, but other methods would just be uglier... goto CheckOperator; } functionParenthDepth.push_back(ParenthCnt+1); } // Check for opening parenthesis if(c=='(') { ++ParenthCnt; sws(Function, ++Ind); if(Function[Ind]==')') { parseErrorType=EMPTY_PARENTH; return Ind;} continue; } // Check for number if(isdigit(c) || (c=='.' && isdigit(Function[Ind+1]))) { strtod(&Function[Ind], &Ptr); Ind += int(Ptr-&Function[Ind]); sws(Function, Ind); c = Function[Ind]; } else { // Check for variable Data::VarMap_t::const_iterator vIter = FindVariable(&Function[Ind], Variables); if(vIter != Variables.end()) Ind += vIter->first.size(); else { // Check for constant Data::ConstMap_t::const_iterator cIter = FindConstant(&Function[Ind]); if(cIter != Constants.end()) Ind += cIter->first.size(); else { parseErrorType=SYNTAX_ERROR; return Ind; } } sws(Function, Ind); c = Function[Ind]; } // Check for closing parenthesis while(c==')') { if(functionParenthDepth.size() && functionParenthDepth.back() == ParenthCnt) functionParenthDepth.pop_back(); if((--ParenthCnt)<0) { parseErrorType=MISM_PARENTH; return Ind; } sws(Function, ++Ind); c=Function[Ind]; } // If we get here, we have a legal operand and now a legal operator or // end of string must follow CheckOperator: // Check for EOS if(c==0) break; // The only way to end the checking loop without error // Check for operator int opSize = 0; if(c == ',' && !functionParenthDepth.empty() && functionParenthDepth.back() == ParenthCnt) opSize = 1; else opSize = IsOperator(Function+Ind); if(opSize == 0) { parseErrorType=EXPECT_OPERATOR; return Ind; } // If we get here, we have an operand and an operator; the next loop will // check for another operand (must appear) Ind += opSize; } // while // Check that all opened parentheses are also closed if(ParenthCnt>0) { parseErrorType=MISSING_PARENTH; return Ind; } // The string is ok parseErrorType=FP_NO_ERROR; return -1; } // Compile function string to bytecode // ----------------------------------- bool FunctionParser::Compile(const char* Function) { if(data->ByteCode) { delete[] data->ByteCode; data->ByteCode=0; } if(data->Immed) { delete[] data->Immed; data->Immed=0; } if(data->Stack) { delete[] data->Stack; data->Stack=0; } vector byteCode; byteCode.reserve(1024); tempByteCode = &byteCode; vector immed; immed.reserve(1024); tempImmed = &immed; data->StackSize = StackPtr = 0; CompileExpression(Function, 0); if(parseErrorType != FP_NO_ERROR) return false; data->ByteCodeSize = byteCode.size(); data->ImmedSize = immed.size(); if(data->ByteCodeSize) { data->ByteCode = new unsigned[data->ByteCodeSize]; memcpy(data->ByteCode, &byteCode[0], sizeof(unsigned)*data->ByteCodeSize); } if(data->ImmedSize) { data->Immed = new double[data->ImmedSize]; memcpy(data->Immed, &immed[0], sizeof(double)*data->ImmedSize); } if(data->StackSize) data->Stack = new double[data->StackSize]; return true; } inline void FunctionParser::AddCompiledByte(unsigned c) { tempByteCode->push_back(c); } inline void FunctionParser::AddImmediate(double i) { tempImmed->push_back(i); } inline void FunctionParser::AddFunctionOpcode(unsigned opcode) { if(data->useDegreeConversion) switch(opcode) { case cCos: case cCosh: case cCot: case cCsc: case cSec: case cSin: case cSinh: case cTan: case cTanh: AddCompiledByte(cRad); } AddCompiledByte(opcode); if(data->useDegreeConversion) switch(opcode) { case cAcos: #ifndef NO_ASINH case cAcosh: case cAsinh: case cAtanh: #endif case cAsin: case cAtan: case cAtan2: AddCompiledByte(cDeg); } } inline void FunctionParser::incStackPtr() { if(++StackPtr > data->StackSize) ++(data->StackSize); } // Compile if() int FunctionParser::CompileIf(const char* F, int ind) { int ind2 = CompileExpression(F, ind, true); // condition sws(F, ind2); if(F[ind2] != ',') { parseErrorType=ILL_PARAMS_AMOUNT; return ind2; } AddCompiledByte(cIf); unsigned curByteCodeSize = tempByteCode->size(); AddCompiledByte(0); // Jump index; to be set later AddCompiledByte(0); // Immed jump index; to be set later --StackPtr; ind2 = CompileExpression(F, ind2+1, true); // then sws(F, ind2); if(F[ind2] != ',') { parseErrorType=ILL_PARAMS_AMOUNT; return ind2; } AddCompiledByte(cJump); unsigned curByteCodeSize2 = tempByteCode->size(); unsigned curImmedSize2 = tempImmed->size(); AddCompiledByte(0); // Jump index; to be set later AddCompiledByte(0); // Immed jump index; to be set later --StackPtr; ind2 = CompileExpression(F, ind2+1, true); // else sws(F, ind2); if(F[ind2] != ')') { parseErrorType=ILL_PARAMS_AMOUNT; return ind2; } // Set jump indices (*tempByteCode)[curByteCodeSize] = curByteCodeSize2+1; (*tempByteCode)[curByteCodeSize+1] = curImmedSize2; (*tempByteCode)[curByteCodeSize2] = tempByteCode->size()-1; (*tempByteCode)[curByteCodeSize2+1] = tempImmed->size(); return ind2+1; } int FunctionParser::CompileFunctionParams(const char* F, int ind, unsigned requiredParams) { int ind2 = ind; if(requiredParams > 0) { unsigned curStackPtr = StackPtr; ind2 = CompileExpression(F, ind); if(StackPtr != curStackPtr+requiredParams) { parseErrorType=ILL_PARAMS_AMOUNT; return ind; } StackPtr -= requiredParams - 1; } else { incStackPtr(); } sws(F, ind2); return ind2+1; // F[ind2] is ')' } // Compiles element int FunctionParser::CompileElement(const char* F, int ind) { sws(F, ind); char c = F[ind]; if(c == '(') { ind = CompileExpression(F, ind+1); sws(F, ind); return ind+1; // F[ind] is ')' } if(isdigit(c) || c=='.' /*|| c=='-'*/) // Number { const char* startPtr = &F[ind]; char* endPtr; double val = strtod(startPtr, &endPtr); AddImmediate(val); AddCompiledByte(cImmed); incStackPtr(); return ind+(endPtr-startPtr); } if(isalpha(c) || c == '_') // Function, variable or constant { const FuncDefinition* func = FindFunction(F+ind); if(func) // is function { int ind2 = ind + func->nameLength; sws(F, ind2); // F[ind2] is '(' if(strcmp(func->name, "if") == 0) // "if" is a special case { return CompileIf(F, ind2+1); } #ifndef DISABLE_EVAL unsigned requiredParams = strcmp(func->name, "eval") == 0 ? data->Variables.size() : func->params; #else unsigned requiredParams = func->params; #endif ind2 = CompileFunctionParams(F, ind2+1, requiredParams); AddFunctionOpcode(func->opcode); return ind2; // F[ind2-1] is ')' } Data::VarMap_t::const_iterator vIter = FindVariable(F+ind, data->Variables); if(vIter != data->Variables.end()) // is variable { AddCompiledByte(vIter->second); incStackPtr(); return ind + vIter->first.size(); } Data::ConstMap_t::const_iterator cIter = FindConstant(F+ind); if(cIter != data->Constants.end()) // is constant { AddImmediate(cIter->second); AddCompiledByte(cImmed); incStackPtr(); return ind + cIter->first.size(); } Data::VarMap_t::const_iterator fIter = FindVariable(F+ind, data->FuncPtrNames); if(fIter != data->FuncPtrNames.end()) // is user-defined func pointer { unsigned index = fIter->second; int ind2 = ind + fIter->first.length(); sws(F, ind2); // F[ind2] is '(' ind2 = CompileFunctionParams(F, ind2+1, data->FuncPtrs[index].params); AddCompiledByte(cFCall); AddCompiledByte(index); return ind2; } Data::VarMap_t::const_iterator pIter = FindVariable(F+ind, data->FuncParserNames); if(pIter != data->FuncParserNames.end()) // is user-defined func parser { unsigned index = pIter->second; int ind2 = ind + pIter->first.length(); sws(F, ind2); // F[ind2] is '(' ind2 = CompileFunctionParams (F, ind2+1, data->FuncParsers[index]->data->varAmount); AddCompiledByte(cPCall); AddCompiledByte(index); return ind2; } } parseErrorType = UNEXPECTED_ERROR; return ind; } // Compiles '^' int FunctionParser::CompilePow(const char* F, int ind) { int ind2 = CompileElement(F, ind); sws(F, ind2); while(F[ind2] == '^') { ind2 = CompileUnaryMinus(F, ind2+1); sws(F, ind2); AddCompiledByte(cPow); --StackPtr; } return ind2; } // Compiles unary '-' int FunctionParser::CompileUnaryMinus(const char* F, int ind) { sws(F, ind); if(F[ind] == '-' || F[ind] == '!') { int ind2 = ind+1; sws(F, ind2); ind2 = CompilePow(F, ind2); sws(F, ind2); // if we are negating a constant, negate the constant itself: if(F[ind] == '-' && tempByteCode->back() == cImmed) tempImmed->back() = -tempImmed->back(); // if we are negating a negation, we can remove both: else if((F[ind] == '-' && tempByteCode->back() == cNeg)) tempByteCode->pop_back(); else AddCompiledByte(F[ind] == '-' ? cNeg : cNot); return ind2; } int ind2 = CompilePow(F, ind); sws(F, ind2); return ind2; } // Compiles '*', '/' and '%' int FunctionParser::CompileMult(const char* F, int ind) { int ind2 = CompileUnaryMinus(F, ind); sws(F, ind2); char op; while((op = F[ind2]) == '*' || op == '/' || op == '%') { ind2 = CompileUnaryMinus(F, ind2+1); sws(F, ind2); switch(op) { case '*': AddCompiledByte(cMul); break; case '/': AddCompiledByte(cDiv); break; case '%': AddCompiledByte(cMod); break; } --StackPtr; } return ind2; } // Compiles '+' and '-' int FunctionParser::CompileAddition(const char* F, int ind) { int ind2 = CompileMult(F, ind); sws(F, ind2); char op; while((op = F[ind2]) == '+' || op == '-') { ind2 = CompileMult(F, ind2+1); sws(F, ind2); AddCompiledByte(op=='+' ? cAdd : cSub); --StackPtr; } return ind2; } // Compiles '=', '<' and '>' int FunctionParser::CompileComparison(const char* F, int ind) { int ind2 = CompileAddition(F, ind); sws(F, ind2); char op; while((op = F[ind2]) == '=' || op == '<' || op == '>' || op == '!') { int opSize = (F[ind2+1] == '=' ? 2 : 1); ind2 = CompileAddition(F, ind2+opSize); sws(F, ind2); switch(op) { case '=': AddCompiledByte(cEqual); break; case '<': AddCompiledByte(opSize == 1 ? cLess : cLessOrEq); break; case '>': AddCompiledByte(opSize == 1 ? cGreater : cGreaterOrEq); break; case '!': AddCompiledByte(cNEqual); break; } --StackPtr; } return ind2; } // Compiles '&' int FunctionParser::CompileAnd(const char* F, int ind) { int ind2 = CompileComparison(F, ind); sws(F, ind2); while(F[ind2] == '&') { ind2 = CompileComparison(F, ind2+1); sws(F, ind2); AddCompiledByte(cAnd); --StackPtr; } return ind2; } // Compiles '|' int FunctionParser::CompileOr(const char* F, int ind) { int ind2 = CompileAnd(F, ind); sws(F, ind2); while(F[ind2] == '|') { ind2 = CompileAnd(F, ind2+1); sws(F, ind2); AddCompiledByte(cOr); --StackPtr; } return ind2; } // Compiles ',' int FunctionParser::CompileExpression(const char* F, int ind, bool stopAtComma) { int ind2 = CompileOr(F, ind); sws(F, ind2); if(stopAtComma) return ind2; while(F[ind2] == ',') { ind2 = CompileOr(F, ind2+1); sws(F, ind2); } return ind2; } // Return parse error message // -------------------------- const char* FunctionParser::ErrorMsg() const { if(parseErrorType != FP_NO_ERROR) return ParseErrorMessage[parseErrorType]; return 0; } //--------------------------------------------------------------------------- // Function evaluation //--------------------------------------------------------------------------- //=========================================================================== namespace { inline int doubleToInt(double d) { return d<0 ? -int((-d)+.5) : int(d+.5); } inline double Min(double d1, double d2) { return d1d2 ? d1 : d2; } inline double DegreesToRadians(double degrees) { return degrees*(M_PI/180.0); } inline double RadiansToDegrees(double radians) { return radians*(180.0/M_PI); } } double FunctionParser::Eval(const double* Vars) { const unsigned* const ByteCode = data->ByteCode; const double* const Immed = data->Immed; double* const Stack = data->Stack; const unsigned ByteCodeSize = data->ByteCodeSize; unsigned IP, DP=0; int SP=-1; for(IP=0; IP 1) { evalErrorType=4; return 0; } Stack[SP] = acos(Stack[SP]); break; #ifndef NO_ASINH case cAcosh: Stack[SP] = acosh(Stack[SP]); break; #endif case cAsin: if(Stack[SP] < -1 || Stack[SP] > 1) { evalErrorType=4; return 0; } Stack[SP] = asin(Stack[SP]); break; #ifndef NO_ASINH case cAsinh: Stack[SP] = asinh(Stack[SP]); break; #endif case cAtan: Stack[SP] = atan(Stack[SP]); break; case cAtan2: Stack[SP-1] = atan2(Stack[SP-1], Stack[SP]); --SP; break; #ifndef NO_ASINH case cAtanh: Stack[SP] = atanh(Stack[SP]); break; #endif case cCeil: Stack[SP] = ceil(Stack[SP]); break; case cCos: Stack[SP] = cos(Stack[SP]); break; case cCosh: Stack[SP] = cosh(Stack[SP]); break; case cCot: { double t = tan(Stack[SP]); if(t == 0) { evalErrorType=1; return 0; } Stack[SP] = 1/t; break; } case cCsc: { double s = sin(Stack[SP]); if(s == 0) { evalErrorType=1; return 0; } Stack[SP] = 1/s; break; } #ifndef DISABLE_EVAL case cEval: { double retVal = 0; if(evalRecursionLevel == EVAL_MAX_REC_LEVEL) { evalErrorType = 5; } else { data->Stack = new double[data->StackSize]; ++evalRecursionLevel; retVal = Eval(&Stack[SP-data->varAmount+1]); --evalRecursionLevel; delete[] data->Stack; data->Stack = Stack; } SP -= data->varAmount-1; Stack[SP] = retVal; break; } #endif case cExp: Stack[SP] = exp(Stack[SP]); break; case cFloor: Stack[SP] = floor(Stack[SP]); break; case cIf: { unsigned jumpAddr = ByteCode[++IP]; unsigned immedAddr = ByteCode[++IP]; if(doubleToInt(Stack[SP]) == 0) { IP = jumpAddr; DP = immedAddr; } --SP; break; } case cInt: Stack[SP] = floor(Stack[SP]+.5); break; case cLog: if(Stack[SP] <= 0) { evalErrorType=3; return 0; } Stack[SP] = log(Stack[SP]); break; case cLog10: if(Stack[SP] <= 0) { evalErrorType=3; return 0; } Stack[SP] = log10(Stack[SP]); break; case cMax: Stack[SP-1] = Max(Stack[SP-1], Stack[SP]); --SP; break; case cMin: Stack[SP-1] = Min(Stack[SP-1], Stack[SP]); --SP; break; case cSec: { double c = cos(Stack[SP]); if(c == 0) { evalErrorType=1; return 0; } Stack[SP] = 1/c; break; } case cSin: Stack[SP] = sin(Stack[SP]); break; case cSinh: Stack[SP] = sinh(Stack[SP]); break; case cSqrt: if(Stack[SP] < 0) { evalErrorType=2; return 0; } Stack[SP] = sqrt(Stack[SP]); break; case cTan: Stack[SP] = tan(Stack[SP]); break; case cTanh: Stack[SP] = tanh(Stack[SP]); break; // Misc: case cImmed: Stack[++SP] = Immed[DP++]; break; case cJump: DP = ByteCode[IP+2]; IP = ByteCode[IP+1]; break; // Operators: case cNeg: Stack[SP] = -Stack[SP]; break; case cAdd: Stack[SP-1] += Stack[SP]; --SP; break; case cSub: Stack[SP-1] -= Stack[SP]; --SP; break; case cMul: Stack[SP-1] *= Stack[SP]; --SP; break; case cDiv: if(Stack[SP] == 0) { evalErrorType=1; return 0; } Stack[SP-1] /= Stack[SP]; --SP; break; case cMod: if(Stack[SP] == 0) { evalErrorType=1; return 0; } Stack[SP-1] = fmod(Stack[SP-1], Stack[SP]); --SP; break; case cPow: Stack[SP-1] = pow(Stack[SP-1], Stack[SP]); --SP; break; #ifdef FP_EPSILON case cEqual: Stack[SP-1] = (fabs(Stack[SP-1]-Stack[SP]) <= FP_EPSILON); --SP; break; case cNEqual: Stack[SP-1] = (fabs(Stack[SP-1] - Stack[SP]) >= FP_EPSILON); --SP; break; case cLess: Stack[SP-1] = (Stack[SP-1] < Stack[SP]-FP_EPSILON); --SP; break; case cLessOrEq: Stack[SP-1] = (Stack[SP-1] <= Stack[SP]+FP_EPSILON); --SP; break; case cGreater: Stack[SP-1] = (Stack[SP-1]-FP_EPSILON > Stack[SP]); --SP; break; case cGreaterOrEq: Stack[SP-1] = (Stack[SP-1]+FP_EPSILON >= Stack[SP]); --SP; break; #else case cEqual: Stack[SP-1] = (Stack[SP-1] == Stack[SP]); --SP; break; case cNEqual: Stack[SP-1] = (Stack[SP-1] != Stack[SP]); --SP; break; case cLess: Stack[SP-1] = (Stack[SP-1] < Stack[SP]); --SP; break; case cLessOrEq: Stack[SP-1] = (Stack[SP-1] <= Stack[SP]); --SP; break; case cGreater: Stack[SP-1] = (Stack[SP-1] > Stack[SP]); --SP; break; case cGreaterOrEq: Stack[SP-1] = (Stack[SP-1] >= Stack[SP]); --SP; break; #endif case cAnd: Stack[SP-1] = (doubleToInt(Stack[SP-1]) && doubleToInt(Stack[SP])); --SP; break; case cOr: Stack[SP-1] = (doubleToInt(Stack[SP-1]) || doubleToInt(Stack[SP])); --SP; break; case cNot: Stack[SP] = !doubleToInt(Stack[SP]); break; // Degrees-radians conversion: case cDeg: Stack[SP] = RadiansToDegrees(Stack[SP]); break; case cRad: Stack[SP] = DegreesToRadians(Stack[SP]); break; // User-defined function calls: case cFCall: { unsigned index = ByteCode[++IP]; unsigned params = data->FuncPtrs[index].params; double retVal = data->FuncPtrs[index].ptr(&Stack[SP-params+1]); SP -= int(params)-1; Stack[SP] = retVal; break; } case cPCall: { unsigned index = ByteCode[++IP]; unsigned params = data->FuncParsers[index]->data->varAmount; double retVal = data->FuncParsers[index]->Eval(&Stack[SP-params+1]); SP -= int(params)-1; Stack[SP] = retVal; break; } #ifdef SUPPORT_OPTIMIZER case cVar: break; // Paranoia. These should never exist case cDup: Stack[SP+1] = Stack[SP]; ++SP; break; case cInv: if(Stack[SP] == 0.0) { evalErrorType=1; return 0; } Stack[SP] = 1.0/Stack[SP]; break; #endif // Variables: default: Stack[++SP] = Vars[ByteCode[IP]-VarBegin]; } } evalErrorType=0; return Stack[SP]; } #ifdef FUNCTIONPARSER_SUPPORT_DEBUG_OUTPUT namespace { inline void printHex(std::ostream& dest, unsigned n) { dest.width(8); dest.fill('0'); hex(dest); //uppercase(dest); dest << n; } } void FunctionParser::PrintByteCode(std::ostream& dest) const { const unsigned* const ByteCode = data->ByteCode; const double* const Immed = data->Immed; for(unsigned IP=0, DP=0; IPByteCodeSize; ++IP) { printHex(dest, IP); dest << ": "; unsigned opcode = ByteCode[IP]; switch(opcode) { case cIf: dest << "jz\t"; printHex(dest, ByteCode[IP+1]+1); dest << endl; IP += 2; break; case cJump: dest << "jump\t"; printHex(dest, ByteCode[IP+1]+1); dest << endl; IP += 2; break; case cImmed: dest.precision(10); dest << "push\t" << Immed[DP++] << endl; break; case cFCall: { unsigned index = ByteCode[++IP]; Data::VarMap_t::const_iterator iter = data->FuncPtrNames.begin(); while(iter->second != index) ++iter; dest << "fcall\t" << iter->first << " (" << data->FuncPtrs[index].params << ")" << endl; break; } case cPCall: { unsigned index = ByteCode[++IP]; Data::VarMap_t::const_iterator iter = data->FuncParserNames.begin(); while(iter->second != index) ++iter; dest << "pcall\t" << iter->first << " (" << data->FuncParsers[index]->data->varAmount << ")" << endl; break; } default: if(opcode < VarBegin) { string n; unsigned params = 1; switch(opcode) { case cNeg: n = "neg"; break; case cAdd: n = "add"; break; case cSub: n = "sub"; break; case cMul: n = "mul"; break; case cDiv: n = "div"; break; case cMod: n = "mod"; break; case cPow: n = "pow"; break; case cEqual: n = "eq"; break; case cNEqual: n = "neq"; break; case cLess: n = "lt"; break; case cLessOrEq: n = "le"; break; case cGreater: n = "gt"; break; case cGreaterOrEq: n = "ge"; break; case cAnd: n = "and"; break; case cOr: n = "or"; break; case cNot: n = "not"; break; case cDeg: n = "deg"; break; case cRad: n = "rad"; break; #ifndef DISABLE_EVAL case cEval: n = "call\t0"; break; #endif #ifdef SUPPORT_OPTIMIZER case cVar: n = "(var)"; break; case cDup: n = "dup"; break; case cInv: n = "inv"; break; #endif default: n = Functions[opcode-cAbs].name; params = Functions[opcode-cAbs].params; } dest << n; if(params != 1) dest << " (" << params << ")"; dest << endl; } else { dest << "push\tVar" << opcode-VarBegin << endl; } } } } #endif #ifndef SUPPORT_OPTIMIZER void FunctionParser::MakeTree(void *) const {} void FunctionParser::Optimize() { // Do nothing if no optimizations are supported. } #endif ================================================ FILE: k3dsdk/expression/fparser.h ================================================ /***************************************************************************\ |* Function parser v2.8 by Warp *| |* ---------------------------- *| |* Parses and evaluates the given function with the given variable values. *| |* See fparser.txt for details. *| |* *| \***************************************************************************/ // ============================================================================= // Usage license: // ============================================================================= // // Copyright © 2003-2005 Juha Nieminen, Joel Yliluoma // // This library is distributed under two distinct usage licenses depending // on the software ("Software" below) which uses the Function Parser library // ("Library" below). // The reason for having two distinct usage licenses is to make the library // compatible with the GPL license while still being usable in other non-GPL // (even commercial) software. See fparser_license.txt for more details. #ifndef ONCE_FPARSER_H_ #define ONCE_FPARSER_H_ #include #include #include #ifdef FUNCTIONPARSER_SUPPORT_DEBUG_OUTPUT #include #endif class FunctionParser { public: enum ParseErrorType { SYNTAX_ERROR=0, MISM_PARENTH, MISSING_PARENTH, EMPTY_PARENTH, EXPECT_OPERATOR, OUT_OF_MEMORY, UNEXPECTED_ERROR, INVALID_VARS, ILL_PARAMS_AMOUNT, PREMATURE_EOS, EXPECT_PARENTH_FUNC, FP_NO_ERROR }; int Parse(const std::string& Function, const std::string& Vars, bool useDegrees = false); const char* ErrorMsg() const; inline ParseErrorType GetParseErrorType() const { return parseErrorType; } double Eval(const double* Vars); inline int EvalError() const { return evalErrorType; } bool AddConstant(const std::string& name, double value); typedef double (*FunctionPtr)(const double*); bool AddFunction(const std::string& name, FunctionPtr, unsigned paramsAmount); bool AddFunction(const std::string& name, FunctionParser&); void Optimize(); FunctionParser(); ~FunctionParser(); // Copy constructor and assignment operator (implemented using the // copy-on-write technique for efficiency): FunctionParser(const FunctionParser&); FunctionParser& operator=(const FunctionParser&); #ifdef FUNCTIONPARSER_SUPPORT_DEBUG_OUTPUT // For debugging purposes only: void PrintByteCode(std::ostream& dest) const; #endif //======================================================================== private: //======================================================================== // Private data: // ------------ ParseErrorType parseErrorType; int evalErrorType; struct Data { unsigned referenceCounter; int varAmount; bool useDegreeConversion; typedef std::map VarMap_t; VarMap_t Variables; typedef std::map ConstMap_t; ConstMap_t Constants; VarMap_t FuncPtrNames; struct FuncPtrData { FunctionPtr ptr; unsigned params; FuncPtrData(FunctionPtr p, unsigned par): ptr(p), params(par) {} }; std::vector FuncPtrs; VarMap_t FuncParserNames; std::vector FuncParsers; unsigned* ByteCode; unsigned ByteCodeSize; double* Immed; unsigned ImmedSize; double* Stack; unsigned StackSize; Data(); ~Data(); Data(const Data&); Data& operator=(const Data&); // not implemented on purpose }; Data* data; unsigned evalRecursionLevel; // Temp data needed in Compile(): unsigned StackPtr; std::vector* tempByteCode; std::vector* tempImmed; // Private methods: // --------------- void copyOnWrite(); bool checkRecursiveLinking(const FunctionParser*) const; bool isValidName(const std::string&) const; Data::VarMap_t::const_iterator FindVariable(const char*, const Data::VarMap_t&) const; Data::ConstMap_t::const_iterator FindConstant(const char*) const; int CheckSyntax(const char*); bool Compile(const char*); bool IsVariable(int); void AddCompiledByte(unsigned); void AddImmediate(double); void AddFunctionOpcode(unsigned); inline void incStackPtr(); int CompileIf(const char*, int); int CompileFunctionParams(const char*, int, unsigned); int CompileElement(const char*, int); int CompilePow(const char*, int); int CompileUnaryMinus(const char*, int); int CompileMult(const char*, int); int CompileAddition(const char*, int); int CompileComparison(const char*, int); int CompileAnd(const char*, int); int CompileOr(const char*, int); int CompileExpression(const char*, int, bool=false); void MakeTree(void*) const; }; #endif ================================================ FILE: k3dsdk/expression/fparser_license.txt ================================================ Function parser for C++ v2.8 by Warp. ===================================== ============================================================================= Usage license: ============================================================================= Copyright © 2003-2005 Juha Nieminen, Joel Yliluoma This library is distributed under two distinct usage licenses depending on the software ("Software" below) which uses the Function Parser library ("Library" below). The reason for having two distinct usage licenses is to make the library compatible with the GPL license while still being usable in other non-GPL (even commercial) software. A) If the Software using the Library is distributed under the GPL license, then the Library can be used under the GPL license as well. The Library will be under the GPL license only when used with the Software. If the Library is separated from the Software and used in another different software under a different license, then the Library will have the B) license below. Exception to the above: If the Library is modified for the GPL Software, then the Library cannot be used with the B) license without the express permission of the author of the modifications. A modified library will be under the GPL license by default. That is, only the original, unmodified version of the Library can be taken to another software with the B) license below. The author of the Software should provide an URL to the original version of the Library if the one used in the Software has been modified. (http://iki.fi/warp/FunctionParser/) This text file must be distributed in its original intact form along with the sources of the Library. (Documentation about possible modifications to the library should be put in a different text file.) B) If the Software using the Library is not distributed under the GPL license but under any other license, then the following usage license applies to the Library: 1. This library is free for non-commercial usage. You can do whatever you like with it as long as you don't claim you made it yourself. 2. It is possible to use this library in a commercial program, but in this case you MUST contact me first (warp@iki.fi) and ask express permission for this. (Read explanation at the end of the file.) If you are making a free program or a shareware program with just a nominal price (5 US dollars or less), you don't have to ask for permission. In any case, I DON'T WANT MONEY for the usage of this library. It is free, period. 3. You can make any modifications you want to it so that it conforms your needs. If you make modifications to it, you have, of course, credits for the modified parts. 4. If you use this library in your own program, you don't have to provide the source code if you don't want to (ie. the source code of your program or this library). If you DO include the source code for this library, this text file must be included in its original intact form. 5. If you distribute a program which uses this library, and specially if you provide the source code, proper credits MUST be included. Trying to obfuscate the fact that this library is not made by you or that it is free is expressly prohibited. When crediting the usage of this library, it's enough to include my name and email address, that is: "Juha Nieminen (warp@iki.fi)". Also a URL to the library download page would be nice, although not required. The official URL is: http://iki.fi/warp/FunctionParser/ 6. And the necessary "lawyer stuff": The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. --- Explanation of the section 2 of the B) license above: The section 2 tries to define "fair use" of the library in commercial programs. "Fair use" of the library means that the program is not heavily dependent on the library, but the library only provides a minor secondary feature to the program. "Heavily dependent" means that the program depends so much on the library that without it the functionality of the program would be seriously degraded or the program would even become completely non-functional. In other words: If the program does not depend heavily on the library, that is, the library only provides a minor secondary feature which could be removed without the program being degraded in any considerable way, then it's OK to use the library in the commercial program. If, however, the program depends so heavily on the library that removing it would make the program non-functional or degrade its functionality considerably, then it's NOT OK to use the library. The ideology behind this is that it's not fair to use a free library as a base for a commercial program, but it's fair if the library is just a minor, unimportant extra. If you are going to ask me for permission to use the library in a commercial program, please describe the feature which the library will be providing and how important it is to the program. ================================================ FILE: k3dsdk/expression/fpconfig.h ================================================ //============================== // Function parser v2.8 by Warp //============================== // ============================================================================= // Usage license: // ============================================================================= // // Copyright © 2003-2005 Juha Nieminen, Joel Yliluoma // // This library is distributed under two distinct usage licenses depending // on the software ("Software" below) which uses the Function Parser library // ("Library" below). // The reason for having two distinct usage licenses is to make the library // compatible with the GPL license while still being usable in other non-GPL // (even commercial) software. See fparser_license.txt for more details. // Configuration file // ------------------ // NOTE: // This file is for the internal use of the function parser only. // You don't need to include this file in your source files, just // include "fparser.h". /* Comment out the following line if your compiler supports the (non-standard) asinh, acosh and atanh functions and you want them to be supported. If you are not sure, just leave it (those function will then not be supported). */ #define NO_ASINH /* Uncomment the following line to disable the eval() function if it could be too dangerous in the target application. Note that even though the maximum recursion level of eval() is limited, it is still possible to write functions using it which take enormous amounts of time to evaluate even though the maximum recursion is never reached. This may be undesirable in some applications. */ //#define DISABLE_EVAL /* Maximum recursion level for eval() calls: */ #define EVAL_MAX_REC_LEVEL 1000 /* Comment out the following lines out if you are not going to use the optimizer and want a slightly smaller library. The Optimize() method can still be called, but it will not do anything. If you are unsure, just leave it. It won't slow down the other parts of the library. */ #ifndef NO_SUPPORT_OPTIMIZER #define SUPPORT_OPTIMIZER #endif /* Epsilon value used with the comparison operators (must be non-negative): (Comment it out if you don't want to use epsilon in comparisons. Might lead to marginally faster evaluation of the comparison operators, but can introduce inaccuracies in comparisons.) */ #define FP_EPSILON 1e-14 ================================================ FILE: k3dsdk/expression/fpoptimizer.cpp ================================================ //=========================================== // Function parser v2.8 optimizer by Bisqwit //=========================================== // ============================================================================= // Usage license: // ============================================================================= // // Copyright © 2003-2005 Juha Nieminen, Joel Yliluoma // // This library is distributed under two distinct usage licenses depending // on the software ("Software" below) which uses the Function Parser library // ("Library" below). // The reason for having two distinct usage licenses is to make the library // compatible with the GPL license while still being usable in other non-GPL // (even commercial) software. See fparser_license.txt for more details. /* NOTE! ---- Everything that goes into the #ifndef SUPPORT_OPTIMIZER part (ie. when SUPPORT_OPTIMIZER is not defined) should be put in the end of fparser.cc file, not in this file. Everything in this file should be inside the #ifdef SUPPORT_OPTIMIZER block (except the #include "fpconfig.h" line). */ #include "fpconfig.h" #ifdef SUPPORT_OPTIMIZER #include "fparser.h" #include "fptypes.h" using namespace FUNCTIONPARSERTYPES; #include #include #include #include using namespace std; #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 #endif #define CONSTANT_E 2.71828182845904509080 // exp(1) #define CONSTANT_PI M_PI // atan2(0,-1) #define CONSTANT_L10 2.30258509299404590109 // log(10) #define CONSTANT_L10I 0.43429448190325176116 // 1/log(10) #define CONSTANT_L10E CONSTANT_L10I // log10(e) #define CONSTANT_L10EI CONSTANT_L10 // 1/log10(e) #define CONSTANT_DR (180.0 / M_PI) // 180/pi #define CONSTANT_RD (M_PI / 180.0) // pi/180 namespace { inline double Min(double d1, double d2) { return d1d2 ? d1 : d2; } class compres { // states: 0=false, 1=true, 2=unknown public: compres(bool b) : state(b) {} compres(char v) : state(v) {} // is it? operator bool() const { return state != 0; } // is it not? bool operator! () const { return state != 1; } bool operator==(bool b) const { return state != !b; } bool operator!=(bool b) const { return state != b; } private: char state; }; const compres maybe = (char)2; struct CodeTree; class SubTree { CodeTree *tree; bool sign; // Only possible when parent is cAdd or cMul inline void flipsign() { sign = !sign; } public: SubTree(); SubTree(double value); SubTree(const SubTree &b); SubTree(const CodeTree &b); ~SubTree(); const SubTree &operator= (const SubTree &b); const SubTree &operator= (const CodeTree &b); bool getsign() const { return sign; } const CodeTree* operator-> () const { return tree; } const CodeTree& operator* () const { return *tree; } struct CodeTree* operator-> () { return tree; } struct CodeTree& operator* () { return *tree; } bool operator< (const SubTree& b) const; bool operator== (const SubTree& b) const; void Negate(); // Note: Parent must be cAdd void Invert(); // Note: Parent must be cMul void CheckConstNeg(); void CheckConstInv(); }; bool IsNegate(const SubTree &p1, const SubTree &p2); bool IsInverse(const SubTree &p1, const SubTree &p2); typedef list paramlist; struct CodeTreeData { paramlist args; private: unsigned op; // Operation double value; // In case of cImmed unsigned var; // In case of cVar unsigned funcno; // In case of cFCall, cPCall public: CodeTreeData() : op(cAdd) {} ~CodeTreeData() {} void SetOp(unsigned newop) { op=newop; } void SetFuncNo(unsigned newno) { funcno=newno; } unsigned GetFuncNo() const { return funcno; } bool IsFunc() const { return op == cFCall || op == cPCall; } bool IsImmed() const { return op == cImmed; } bool IsVar() const { return op == cVar; } inline unsigned GetOp() const { return op; } inline double GetImmed() const { return value; } inline unsigned GetVar() const { return var; } void AddParam(const SubTree &p) { args.push_back(p); } void SetVar(unsigned v) { args.clear(); op = cVar; var = v; } void SetImmed(double v) { args.clear(); op = cImmed; value = orig = v; inverted = negated = false; } void NegateImmed() { negated = !negated; UpdateValue(); } void InvertImmed() { inverted = !inverted; UpdateValue(); } bool IsOriginal() const { return !(IsInverted() || IsNegated()); } bool IsInverted() const { return inverted; } bool IsNegated() const { return negated; } bool IsInvertedOriginal() const { return IsInverted() && !IsNegated(); } bool IsNegatedOriginal() const { return !IsInverted() && IsNegated(); } private: void UpdateValue() { value = orig; if(IsInverted()) { value = 1.0 / value; // FIXME: potential divide by zero. } if(IsNegated()) value = -value; } double orig; bool inverted; bool negated; protected: // Ensure we don't accidentally copy this void operator=(const CodeTreeData &b); }; class CodeTreeDataPtr { typedef pair p_t; typedef p_t* pp; mutable pp p; void Alloc() const { ++p->second; } void Dealloc() const { if(!--p->second) delete p; p = 0; } void PrepareForWrite() { // We're ready if we're the only owner. if(p->second == 1) return; // Then make a clone. p_t *newtree = new p_t(p->first, 1); // Forget the old Dealloc(); // Keep the new p = newtree; } public: CodeTreeDataPtr() : p(new p_t) { p->second = 1; } CodeTreeDataPtr(const CodeTreeDataPtr &b): p(b.p) { Alloc(); } ~CodeTreeDataPtr() { Dealloc(); } const CodeTreeDataPtr &operator= (const CodeTreeDataPtr &b) { b.Alloc(); Dealloc(); p = b.p; return *this; } const CodeTreeData *operator-> () const { return &p->first; } const CodeTreeData &operator* () const { return p->first; } CodeTreeData *operator-> () { PrepareForWrite(); return &p->first; } CodeTreeData &operator* () { PrepareForWrite(); return p->first; } void Shock(); }; #define CHECKCONSTNEG(item, op) \ ((op)==cMul) \ ? (item).CheckConstInv() \ : (item).CheckConstNeg() struct CodeTree { CodeTreeDataPtr data; private: typedef paramlist::iterator pit; typedef paramlist::const_iterator pcit; /* template inline void chk() const { } */ public: const pcit GetBegin() const { return data->args.begin(); } const pcit GetEnd() const { return data->args.end(); } const pit GetBegin() { return data->args.begin(); } const pit GetEnd() { return data->args.end(); } const SubTree& getp0() const { /*chk<1>();*/pcit tmp=GetBegin(); return *tmp; } const SubTree& getp1() const { /*chk<2>();*/pcit tmp=GetBegin(); ++tmp; return *tmp; } const SubTree& getp2() const { /*chk<3>();*/pcit tmp=GetBegin(); ++tmp; ++tmp; return *tmp; } unsigned GetArgCount() const { return data->args.size(); } void Erase(const pit p) { data->args.erase(p); } SubTree& getp0() { /*chk<1>();*/pit tmp=GetBegin(); return *tmp; } SubTree& getp1() { /*chk<2>();*/pit tmp=GetBegin(); ++tmp; return *tmp; } SubTree& getp2() { /*chk<3>();*/pit tmp=GetBegin(); ++tmp; ++tmp; return *tmp; } // set void SetImmed(double v) { data->SetImmed(v); } void SetOp(unsigned op) { data->SetOp(op); } void SetVar(unsigned v) { data->SetVar(v); } // get double GetImmed() const { return data->GetImmed(); } unsigned GetVar() const { return data->GetVar(); } unsigned GetOp() const { return data->GetOp(); } // test bool IsImmed() const { return data->IsImmed(); } bool IsVar() const { return data->IsVar(); } // act void AddParam(const SubTree &p) { data->AddParam(p); } void NegateImmed() { data->NegateImmed(); } // don't use when op!=cImmed void InvertImmed() { data->InvertImmed(); } // don't use when op!=cImmed compres NonZero() const { if(!IsImmed()) return maybe; return GetImmed() != 0.0; } compres IsPositive() const { if(!IsImmed()) return maybe; return GetImmed() > 0.0; } private: struct ConstList { double voidvalue; list cp; double value; unsigned size() const { return cp.size(); } }; struct ConstList BuildConstList(); void KillConst(const ConstList &cl) { for(list::const_iterator i=cl.cp.begin(); i!=cl.cp.end(); ++i) Erase(*i); } void FinishConst(const ConstList &cl) { if(cl.value != cl.voidvalue && cl.size() > 1) AddParam(cl.value); if(cl.value == cl.voidvalue || cl.size() > 1) KillConst(cl); } public: CodeTree() {} CodeTree(double v) { SetImmed(v); } CodeTree(unsigned op, const SubTree &p) { SetOp(op); AddParam(p); } CodeTree(unsigned op, const SubTree &p1, const SubTree &p2) { SetOp(op); AddParam(p1); AddParam(p2); } bool operator== (const CodeTree& b) const; bool operator< (const CodeTree& b) const; private: bool IsSortable() const { switch(GetOp()) { case cAdd: case cMul: case cEqual: case cAnd: case cOr: case cMax: case cMin: return true; default: return false; } } void SortIfPossible() { if(IsSortable()) { data->args.sort(); } } void ReplaceWithConst(double value) { SetImmed(value); /* REMEMBER TO CALL CheckConstInv / CheckConstNeg * FOR PARENT SubTree, OR MAYHEM HAPPENS */ } void ReplaceWith(const CodeTree &b) { // If b is child of *this, mayhem // happens. So we first make a clone // and then proceed with copy. CodeTreeDataPtr tmp = b.data; tmp.Shock(); data = tmp; } void ReplaceWith(unsigned op, const SubTree &p) { ReplaceWith(CodeTree(op, p)); } void ReplaceWith(unsigned op, const SubTree &p1, const SubTree &p2) { ReplaceWith(CodeTree(op, p1, p2)); } void OptimizeConflict() { // This optimization does this: x-x = 0, x/x = 1, a+b-a = b. if(GetOp() == cAdd || GetOp() == cMul) { Redo: pit a, b; for(a=GetBegin(); a!=GetEnd(); ++a) { for(b=GetBegin(); ++b != GetEnd(); ) { const SubTree &p1 = *a; const SubTree &p2 = *b; if(GetOp() == cMul ? IsInverse(p1,p2) : IsNegate(p1,p2)) { // These parameters complement each others out Erase(b); Erase(a); goto Redo; } } } } OptimizeRedundant(); } void OptimizeRedundant() { // This optimization does this: min()=0, max()=0, add()=0, mul()=1 if(!GetArgCount()) { if(GetOp() == cAdd || GetOp() == cMin || GetOp() == cMax) ReplaceWithConst(0); else if(GetOp() == cMul) ReplaceWithConst(1); return; } // And this: mul(x) = x, min(x) = x, max(x) = x, add(x) = x if(GetArgCount() == 1) { if(GetOp() == cMul || GetOp() == cAdd || GetOp() == cMin || GetOp() == cMax) if(!getp0().getsign()) ReplaceWith(*getp0()); } OptimizeDoubleNegations(); } void OptimizeDoubleNegations() { if(GetOp() == cAdd) { // Eschew double negations // If any of the elements is cMul // and has a numeric constant, negate // the constant and negate sign. for(pit a=GetBegin(); a!=GetEnd(); ++a) { SubTree &pa = *a; if(pa.getsign() && pa->GetOp() == cMul) { CodeTree &p = *pa; for(pit b=p.GetBegin(); b!=p.GetEnd(); ++b) { SubTree &pb = *b; if(pb->IsImmed()) { pb.Negate(); pa.Negate(); break; } } } } } if(GetOp() == cMul) { // If any of the elements is cPow // and has a numeric exponent, negate // the exponent and negate sign. for(pit a=GetBegin(); a!=GetEnd(); ++a) { SubTree &pa = *a; if(pa.getsign() && pa->GetOp() == cPow) { CodeTree &p = *pa; if(p.getp1()->IsImmed()) { // negate ok for pow when op=cImmed p.getp1().Negate(); pa.Negate(); } } } } } void OptimizeConstantMath1() { // This optimization does three things: // - For adding groups: // Constants are added together. // - For multiplying groups: // Constants are multiplied together. // - For function calls: // If all parameters are constants, // the call is replaced with constant value. // First, do this: OptimizeAddMulFlat(); switch(GetOp()) { case cAdd: { ConstList cl = BuildConstList(); FinishConst(cl); break; } case cMul: { ConstList cl = BuildConstList(); if(cl.value == 0.0) ReplaceWithConst(0.0); else FinishConst(cl); break; } #define ConstantUnaryFun(token, fun) \ case token: { const SubTree &p0 = getp0(); \ if(p0->IsImmed()) ReplaceWithConst(fun(p0->GetImmed())); \ break; } #define ConstantBinaryFun(token, fun) \ case token: { const SubTree &p0 = getp0(); \ const SubTree &p1 = getp1(); \ if(p0->IsImmed() && \ p1->IsImmed()) ReplaceWithConst(fun(p0->GetImmed(), p1->GetImmed())); \ break; } // FIXME: potential invalid parameters for functions // can cause exceptions here ConstantUnaryFun(cAbs, fabs); ConstantUnaryFun(cAcos, acos); ConstantUnaryFun(cAsin, asin); ConstantUnaryFun(cAtan, atan); ConstantUnaryFun(cCeil, ceil); ConstantUnaryFun(cCos, cos); ConstantUnaryFun(cCosh, cosh); ConstantUnaryFun(cFloor, floor); ConstantUnaryFun(cLog, log); ConstantUnaryFun(cSin, sin); ConstantUnaryFun(cSinh, sinh); ConstantUnaryFun(cTan, tan); ConstantUnaryFun(cTanh, tanh); ConstantBinaryFun(cAtan2, atan2); ConstantBinaryFun(cMax, Max); ConstantBinaryFun(cMin, Min); ConstantBinaryFun(cMod, fmod); // not a func, but belongs here too ConstantBinaryFun(cPow, pow); case cNeg: case cSub: case cDiv: /* Unreached (nonexistent operator) * TODO: internal error here? */ break; case cCot: case cCsc: case cSec: case cDeg: case cRad: case cLog10: case cSqrt: case cExp: /* Unreached (nonexistent function) * TODO: internal error here? */ break; } OptimizeConflict(); } void OptimizeAddMulFlat() { // This optimization flattens the topography of the tree. // Examples: // x + (y+z) = x+y+z // x * (y/z) = x*y/z // x / (y/z) = x/y*z if(GetOp() == cAdd || GetOp() == cMul) { // If children are same type as parent add them here for(pit b, a=GetBegin(); a!=GetEnd(); a=b) { const SubTree &pa = *a; b=a; ++b; if(pa->GetOp() != GetOp()) continue; // Child is same type for(pcit c=pa->GetBegin(); c!=pa->GetEnd(); ++c) { const SubTree &pb = *c; if(pa.getsign()) { // +a -(+b +c) // means b and c will be negated SubTree tmp = pb; if(GetOp() == cMul) tmp.Invert(); else tmp.Negate(); AddParam(tmp); } else AddParam(pb); } Erase(a); // Note: OptimizeConstantMath1() would be a good thing to call next. } } } void OptimizeLinearCombine() { // This optimization does the following: // // x*x*x*x -> x^4 // x+x+x+x -> x*4 // x*x -> x^2 // x/z/z -> // // Remove conflicts first, so we don't have to worry about signs. OptimizeConflict(); bool didchanges = false; if(GetOp() == cAdd || GetOp() == cMul) { Redo: for(pit a=GetBegin(); a!=GetEnd(); ++a) { const SubTree &pa = *a; list poslist; for(pit b=a; ++b!=GetEnd(); ) { const SubTree &pb = *b; if(*pa == *pb) poslist.push_back(b); } unsigned min = 2; if(poslist.size() >= min) { SubTree arvo = pa; bool negate = arvo.getsign(); double factor = poslist.size() + 1; if(negate) { arvo.Negate(); factor = -factor; } CodeTree tmp(GetOp()==cAdd ? cMul : cPow, arvo, factor); list::const_iterator j; for(j=poslist.begin(); j!=poslist.end(); ++j) Erase(*j); poslist.clear(); *a = tmp; didchanges = true; goto Redo; } } } if(didchanges) { // As a result, there might be need for this: OptimizeAddMulFlat(); // And this: OptimizeRedundant(); } } void OptimizeLogarithm() { /* This is basic logarithm math: pow(X,Y)/log(Y) = X log(X)/log(Y) = logY(X) log(X^Y) = log(X)*Y log(X*Y) = log(X)+log(Y) exp(log(X)*Y) = X^Y This function does these optimizations: pow(const_E, log(x)) = x pow(const_E, log(x)*y) = x^y pow(10, log(x)*const_L10I*y) = x^y pow(z, log(x)/log(z)*y) = x^y And this: log(x^z) = z * log(x) Which automatically causes these too: log(pow(const_E, x)) = x log(pow(y, x)) = x * log(y) log(pow(pow(const_E, y), x)) = x*y And it does this too: log(x) + log(y) + log(z) = log(x * y * z) log(x * exp(y)) = log(x) + y */ // Must be already in exponential form. // Optimize exponents before doing something. OptimizeExponents(); if(GetOp() == cLog) { // We should have one parameter for log() function. // If we don't, we're screwed. const SubTree &p = getp0(); if(p->GetOp() == cPow) { // Found log(x^y) SubTree p0 = p->getp0(); // x SubTree p1 = p->getp1(); // y // Build the new logarithm. CodeTree tmp(GetOp(), p0); // log(x) // Become log(x) * y ReplaceWith(cMul, tmp, p1); } else if(p->GetOp() == cMul) { // Redefine &p nonconst SubTree &p = getp0(); p->OptimizeAddMulFlat(); p->OptimizeExponents(); CHECKCONSTNEG(p, p->GetOp()); list adds; for(pit b, a = p->GetBegin(); a != p->GetEnd(); a=b) { SubTree &pa = *a; b=a; ++b; if(pa->GetOp() == cPow && pa->getp0()->IsImmed() && pa->getp0()->GetImmed() == CONSTANT_E) { adds.push_back(pa->getp1()); p->Erase(a); continue; } } if(adds.size()) { CodeTree tmp(cAdd, *this); list::const_iterator i; for(i=adds.begin(); i!=adds.end(); ++i) tmp.AddParam(*i); ReplaceWith(tmp); } } } if(GetOp() == cAdd) { // Check which ones are logs. list poslist; for(pit a=GetBegin(); a!=GetEnd(); ++a) { const SubTree &pa = *a; if(pa->GetOp() == cLog) poslist.push_back(a); } if(poslist.size() >= 2) { CodeTree tmp(cMul, 1.0); // eek list::const_iterator j; for(j=poslist.begin(); j!=poslist.end(); ++j) { const SubTree &pb = **j; // Take all of its children for(pcit b=pb->GetBegin(); b!=pb->GetEnd(); ++b) { SubTree tmp2 = *b; if(pb.getsign()) tmp2.Negate(); tmp.AddParam(tmp2); } Erase(*j); } poslist.clear(); AddParam(CodeTree(cLog, tmp)); } // Done, hopefully } if(GetOp() == cPow) { const SubTree &p0 = getp0(); SubTree &p1 = getp1(); if(p0->IsImmed() && p0->GetImmed() == CONSTANT_E && p1->GetOp() == cLog) { // pow(const_E, log(x)) = x ReplaceWith(*(p1->getp0())); } else if(p1->GetOp() == cMul) { //bool didsomething = true; pit poslogpos; bool foundposlog = false; pit neglogpos; bool foundneglog = false; ConstList cl = p1->BuildConstList(); for(pit a=p1->GetBegin(); a!=p1->GetEnd(); ++a) { const SubTree &pa = *a; if(pa->GetOp() == cLog) { if(!pa.getsign()) { foundposlog = true; poslogpos = a; } else if(*p0 == *(pa->getp0())) { foundneglog = true; neglogpos = a; } } } if(p0->IsImmed() && p0->GetImmed() == 10.0 && cl.value == CONSTANT_L10I && foundposlog) { SubTree base = (*poslogpos)->getp0(); p1->KillConst(cl); p1->Erase(poslogpos); p1->OptimizeRedundant(); SubTree mul = p1; ReplaceWith(cPow, base, mul); // FIXME: what optimizations should be done now? return; } // Put back the constant FinishConst(cl); if(p0->IsImmed() && p0->GetImmed() == CONSTANT_E && foundposlog) { SubTree base = (*poslogpos)->getp0(); p1->Erase(poslogpos); p1->OptimizeRedundant(); SubTree mul = p1; ReplaceWith(cPow, base, mul); // FIXME: what optimizations should be done now? return; } if(foundposlog && foundneglog && *((*neglogpos)->getp0()) == *p0) { SubTree base = (*poslogpos)->getp0(); p1->Erase(poslogpos); p1->Erase(neglogpos); p1->OptimizeRedundant(); SubTree mul = p1; ReplaceWith(cPow, base, mul); // FIXME: what optimizations should be done now? return; } } } } void OptimizeFunctionCalls() { /* Goals: sin(asin(x)) = x * cos(acos(x)) = x * tan(atan(x)) = x * NOTE: * Do NOT do these: * asin(sin(x)) * acos(cos(x)) * atan(tan(x)) * Because someone might want to wrap the angle. */ // FIXME: TODO } void OptimizePowMulAdd() { // x^3 * x -> x^4 // x*3 + x -> x*4 // FIXME: Do those // x^1 -> x if(GetOp() == cPow) { const SubTree &base = getp0(); const SubTree &exponent = getp1(); if(exponent->IsImmed()) { if(exponent->GetImmed() == 1.0) ReplaceWith(*base); else if(exponent->GetImmed() == 0.0 && base->NonZero()) ReplaceWithConst(1.0); } } } void OptimizeExponents() { /* Goals: * (x^y)^z -> x^(y*z) * x^y * x^z -> x^(y+z) */ // First move to exponential form. OptimizeLinearCombine(); bool didchanges = false; Redo: if(GetOp() == cPow) { // (x^y)^z -> x^(y*z) const SubTree &p0 = getp0(); const SubTree &p1 = getp1(); if(p0->GetOp() == cPow) { CodeTree tmp(cMul, p0->getp1(), p1); tmp.Optimize(); ReplaceWith(cPow, p0->getp0(), tmp); didchanges = true; goto Redo; } } if(GetOp() == cMul) { // x^y * x^z -> x^(y+z) for(pit a=GetBegin(); a!=GetEnd(); ++a) { const SubTree &pa = *a; if(pa->GetOp() != cPow) continue; list poslist; for(pit b=a; ++b != GetEnd(); ) { const SubTree &pb = *b; if(pb->GetOp() == cPow && *(pa->getp0()) == *(pb->getp0())) { poslist.push_back(b); } } if(poslist.size() >= 1) { poslist.push_back(a); CodeTree base = *(pa->getp0()); CodeTree exponent(cAdd, 0.0); //eek // Collect all exponents to cAdd list::const_iterator i; for(i=poslist.begin(); i!=poslist.end(); ++i) { const SubTree &pb = **i; SubTree tmp2 = pb->getp1(); if(pb.getsign()) tmp2.Invert(); exponent.AddParam(tmp2); } exponent.Optimize(); CodeTree result(cPow, base, exponent); for(i=poslist.begin(); i!=poslist.end(); ++i) Erase(*i); poslist.clear(); AddParam(result); // We're cMul, remember didchanges = true; goto Redo; } } } OptimizePowMulAdd(); if(didchanges) { // As a result, there might be need for this: OptimizeConflict(); } } void OptimizeLinearExplode() { // x^2 -> x*x // But only if x is just a simple thing // Won't work on anything else. if(GetOp() != cPow) return; // TODO TODO TODO } void OptimizePascal() { #if 0 // Too big, too specific, etc // Won't work on anything else. if(GetOp() != cAdd) return; // Must be done after OptimizeLinearCombine(); // Don't need pascal triangle // Coefficient for x^a * y^b * z^c = 3! / (a! * b! * c!) // We are greedy and want other than just binomials // FIXME // note: partial ones are also nice // x*x + x*y + y*y // = (x+y)^2 - x*y // // x x * x y * + y y * + // -> x y + dup * x y * - #endif } public: void Optimize(); void Assemble(vector &byteCode, vector &immed) const; void FinalOptimize() { // First optimize each parameter. for(pit a=GetBegin(); a!=GetEnd(); ++a) (*a)->FinalOptimize(); /* These things are to be done: * * x * CONSTANT_DR -> cDeg(x) * x * CONSTANT_RD -> cRad(x) * pow(x, 0.5) -> sqrt(x) * log(x) * CONSTANT_L10I -> log10(x) * pow(CONSTANT_E, x) -> exp(x) * inv(sin(x)) -> csc(x) * inv(cos(x)) -> sec(x) * inv(tan(x)) -> cot(x) */ if(GetOp() == cPow) { const SubTree &p0 = getp0(); const SubTree &p1 = getp1(); if(p0->GetOp() == cImmed && p0->GetImmed() == CONSTANT_E) { ReplaceWith(cExp, p1); } else if(p1->GetOp() == cImmed && p1->GetImmed() == 0.5) { ReplaceWith(cSqrt, p0); } } if(GetOp() == cMul) { if(GetArgCount() == 1 && getp0().getsign()) { /***/if(getp0()->GetOp() == cSin)ReplaceWith(cCsc, getp0()->getp0()); else if(getp0()->GetOp() == cCos)ReplaceWith(cSec, getp0()->getp0()); else if(getp0()->GetOp() == cTan)ReplaceWith(cCot, getp0()->getp0()); } } // Separate "if", because op may have just changed if(GetOp() == cMul) { CodeTree *found_log = 0; ConstList cl = BuildConstList(); for(pit a=GetBegin(); a!=GetEnd(); ++a) { SubTree &pa = *a; if(pa->GetOp() == cLog && !pa.getsign()) found_log = &*pa; } if(cl.value == CONSTANT_L10I && found_log) { // Change the log() to log10() found_log->SetOp(cLog10); // And forget the constant KillConst(cl); } else if(cl.value == CONSTANT_DR) { OptimizeRedundant(); ReplaceWith(cDeg, *this); } else if(cl.value == CONSTANT_RD) { OptimizeRedundant(); ReplaceWith(cRad, *this); } else FinishConst(cl); } SortIfPossible(); } }; void CodeTreeDataPtr::Shock() { /* PrepareForWrite(); paramlist &p2 = (*this)->args; for(paramlist::iterator i=p2.begin(); i!=p2.end(); ++i) { (*i)->data.Shock(); } */ } CodeTree::ConstList CodeTree::BuildConstList() { ConstList result; result.value = result.voidvalue = GetOp()==cMul ? 1.0 : 0.0; list &cp = result.cp; for(pit b, a=GetBegin(); a!=GetEnd(); a=b) { SubTree &pa = *a; b=a; ++b; if(!pa->IsImmed()) continue; double thisvalue = pa->GetImmed(); if(thisvalue == result.voidvalue) { // This value is no good, forget it Erase(a); continue; } if(GetOp() == cMul) result.value *= thisvalue; else result.value += thisvalue; cp.push_back(a); } if(GetOp() == cMul) { /* Jos joku niist� arvoista on -1 eik� se ole ainoa arvo, niin joku muu niist� arvoista negatoidaan. */ for(bool done=false; cp.size() > 1 && !done; ) { done = true; for(list::iterator b,a=cp.begin(); a!=cp.end(); a=b) { b=a; ++b; if((**a)->GetImmed() == -1.0) { Erase(*a); cp.erase(a); // take randomly something (**cp.begin())->data->NegateImmed(); if(cp.size() < 2)break; done = false; } } } } return result; } void CodeTree::Assemble (vector &byteCode, vector &immed) const { #define AddCmd(op) byteCode.push_back((op)) #define AddConst(v) do { \ byteCode.push_back(cImmed); \ immed.push_back((v)); \ } while(0) if(IsVar()) { AddCmd(GetVar()); return; } if(IsImmed()) { AddConst(GetImmed()); return; } switch(GetOp()) { case cAdd: case cMul: { unsigned opcount = 0; for(pcit a=GetBegin(); a!=GetEnd(); ++a) { const SubTree &pa = *a; if(opcount < 2) ++opcount; bool pnega = pa.getsign(); bool done = false; if(pa->IsImmed()) { if(GetOp() == cMul && pa->data->IsInverted() && (pnega || opcount==2) ) { CodeTree tmp = *pa; tmp.data->InvertImmed(); tmp.Assemble(byteCode, immed); pnega = !pnega; done = true; } else if(GetOp() == cAdd && (pa->data->IsNegatedOriginal() // || pa->GetImmed() < 0 ) && (pnega || opcount==2) ) { CodeTree tmp = *pa; tmp.data->NegateImmed(); tmp.Assemble(byteCode, immed); pnega = !pnega; done = true; } } if(!done) pa->Assemble(byteCode, immed); if(opcount == 2) { unsigned tmpop = GetOp(); if(pnega) // negate { tmpop = (tmpop == cMul) ? cDiv : cSub; } AddCmd(tmpop); } else if(pnega) { if(GetOp() == cMul) AddCmd(cInv); else AddCmd(cNeg); } } break; } case cIf: { // If the parameter amount is != 3, we're screwed. getp0()->Assemble(byteCode, immed); unsigned ofs = byteCode.size(); AddCmd(cIf); AddCmd(0); // code index AddCmd(0); // immed index getp1()->Assemble(byteCode, immed); byteCode[ofs+1] = byteCode.size()+2; byteCode[ofs+2] = immed.size(); ofs = byteCode.size(); AddCmd(cJump); AddCmd(0); // code index AddCmd(0); // immed index getp2()->Assemble(byteCode, immed); byteCode[ofs+1] = byteCode.size()-1; byteCode[ofs+2] = immed.size(); break; } case cFCall: { // If the parameter count is invalid, we're screwed. for(pcit a=GetBegin(); a!=GetEnd(); ++a) { const SubTree &pa = *a; pa->Assemble(byteCode, immed); } AddCmd(GetOp()); AddCmd(data->GetFuncNo()); break; } case cPCall: { // If the parameter count is invalid, we're screwed. for(pcit a=GetBegin(); a!=GetEnd(); ++a) { const SubTree &pa = *a; pa->Assemble(byteCode, immed); } AddCmd(GetOp()); AddCmd(data->GetFuncNo()); break; } default: { // If the parameter count is invalid, we're screwed. for(pcit a=GetBegin(); a!=GetEnd(); ++a) { const SubTree &pa = *a; pa->Assemble(byteCode, immed); } AddCmd(GetOp()); break; } } } void CodeTree::Optimize() { // Phase: // Phase 0: Do local optimizations. // Phase 1: Optimize each. // Phase 2: Do local optimizations again. for(unsigned phase=0; phase<=2; ++phase) { if(phase == 1) { // Optimize each parameter. for(pit a=GetBegin(); a!=GetEnd(); ++a) { (*a)->Optimize(); CHECKCONSTNEG(*a, GetOp()); } continue; } if(phase == 0 || phase == 2) { // Do local optimizations. OptimizeConstantMath1(); OptimizeLogarithm(); OptimizeFunctionCalls(); OptimizeExponents(); OptimizeLinearExplode(); OptimizePascal(); /* Optimization paths: doublenegations= redundant= * doublenegations conflict= * redundant addmulflat= constantmath1= addmulflat * conflict linearcombine= conflict * addmulflat� redundant� powmuladd= exponents= linearcombine * powmuladd conflict� logarithm= exponents * functioncalls= IDLE linearexplode= IDLE pascal= IDLE * = actions here � = only if made changes */ } } } bool CodeTree::operator== (const CodeTree& b) const { if(GetOp() != b.GetOp()) return false; if(IsImmed()) if(GetImmed() != b.GetImmed()) return false; if(IsVar()) if(GetVar() != b.GetVar()) return false; if(data->IsFunc()) if(data->GetFuncNo() != b.data->GetFuncNo()) return false; return data->args == b.data->args; } bool CodeTree::operator< (const CodeTree& b) const { if(GetArgCount() != b.GetArgCount()) return GetArgCount() > b.GetArgCount(); if(GetOp() != b.GetOp()) { // sort immeds last if(IsImmed() != b.IsImmed()) return IsImmed() < b.IsImmed(); return GetOp() < b.GetOp(); } if(IsImmed()) { if(GetImmed() != b.GetImmed()) return GetImmed() < b.GetImmed(); } if(IsVar() && GetVar() != b.GetVar()) { return GetVar() < b.GetVar(); } if(data->IsFunc() && data->GetFuncNo() != b.data->GetFuncNo()) { return data->GetFuncNo() < b.data->GetFuncNo(); } pcit i = GetBegin(), j = b.GetBegin(); for(; i != GetEnd(); ++i, ++j) { const SubTree &pa = *i, &pb = *j; if(!(pa == pb)) return pa < pb; } return false; } bool IsNegate(const SubTree &p1, const SubTree &p2) /*const */ { if(p1->IsImmed() && p2->IsImmed()) { return p1->GetImmed() == -p2->GetImmed(); } if(p1.getsign() == p2.getsign()) return false; return *p1 == *p2; } bool IsInverse(const SubTree &p1, const SubTree &p2) /*const*/ { if(p1->IsImmed() && p2->IsImmed()) { // FIXME: potential divide by zero. return p1->GetImmed() == 1.0 / p2->GetImmed(); } if(p1.getsign() == p2.getsign()) return false; return *p1 == *p2; } SubTree::SubTree() : tree(new CodeTree), sign(false) { } SubTree::SubTree(const SubTree &b) : tree(new CodeTree(*b.tree)), sign(b.sign) { } #define SubTreeDecl(p1, p2) \ SubTree::SubTree p1 : tree(new CodeTree p2), sign(false) { } SubTreeDecl( (const CodeTree &b), (b) ) SubTreeDecl( (double value), (value) ) #undef SubTreeDecl SubTree::~SubTree() { delete tree; tree=0; } const SubTree &SubTree::operator= (const SubTree &b) { sign = b.sign; CodeTree *oldtree = tree; tree = new CodeTree(*b.tree); delete oldtree; return *this; } const SubTree &SubTree::operator= (const CodeTree &b) { sign = false; CodeTree *oldtree = tree; tree = new CodeTree(b); delete oldtree; return *this; } bool SubTree::operator< (const SubTree& b) const { if(getsign() != b.getsign()) return getsign() < b.getsign(); return *tree < *b.tree; } bool SubTree::operator== (const SubTree& b) const { return sign == b.sign && *tree == *b.tree; } void SubTree::Negate() // Note: Parent must be cAdd { flipsign(); CheckConstNeg(); } void SubTree::CheckConstNeg() { if(tree->IsImmed() && getsign()) { tree->NegateImmed(); sign = false; } } void SubTree::Invert() // Note: Parent must be cMul { flipsign(); CheckConstInv(); } void SubTree::CheckConstInv() { if(tree->IsImmed() && getsign()) { tree->InvertImmed(); sign = false; } } }//namespace void FunctionParser::MakeTree(void *r) const { // Dirty hack. Should be fixed. CodeTree* result = static_cast(r); vector stack(1); #define GROW(n) do { \ stacktop += n; \ if(stack.size() <= stacktop) stack.resize(stacktop+1); \ } while(0) #define EAT(n, opcode) do { \ unsigned newstacktop = stacktop-n; \ if((n) == 0) GROW(1); \ stack[stacktop].SetOp((opcode)); \ for(unsigned a=0, b=(n); a labels; const unsigned* const ByteCode = data->ByteCode; const unsigned ByteCodeSize = data->ByteCodeSize; const double* const Immed = data->Immed; for(unsigned IP=0, DP=0; ; ++IP) { while(labels.size() > 0 && *labels.begin() == IP) { // The "else" of an "if" ends here EAT(3, cIf); labels.erase(labels.begin()); } if(IP >= ByteCodeSize) { break; } unsigned opcode = ByteCode[IP]; if(opcode == cIf) { IP += 2; } else if(opcode == cJump) { labels.push_front(ByteCode[IP+1]+1); IP += 2; } else if(opcode == cImmed) { ADDCONST(Immed[DP++]); } else if(opcode < VarBegin) { switch(opcode) { // Unary operators case cNeg: { EAT(1, cAdd); // Unary minus is negative adding. stack[stacktop-1].getp0().Negate(); break; } // Binary operators case cSub: { EAT(2, cAdd); // Minus is negative adding stack[stacktop-1].getp1().Negate(); break; } case cDiv: { EAT(2, cMul); // Divide is inverse multiply stack[stacktop-1].getp1().Invert(); break; } // ADD ALL TWO PARAMETER NON-FUNCTIONS HERE case cAdd: case cMul: case cMod: case cPow: case cEqual: case cLess: case cGreater: case cNEqual: case cLessOrEq: case cGreaterOrEq: case cAnd: case cOr: EAT(2, opcode); break; // ADD ALL UNARY NON-FUNCTIONS HERE case cNot: EAT(1, opcode); break; case cFCall: { unsigned index = ByteCode[++IP]; unsigned params = data->FuncPtrs[index].params; EAT(params, opcode); stack[stacktop-1].data->SetFuncNo(index); break; } case cPCall: { unsigned index = ByteCode[++IP]; unsigned params = data->FuncParsers[index]->data->varAmount; EAT(params, opcode); stack[stacktop-1].data->SetFuncNo(index); break; } // Converted to cMul on fly case cDeg: ADDCONST(CONSTANT_DR); EAT(2, cMul); break; // Converted to cMul on fly case cRad: ADDCONST(CONSTANT_RD); EAT(2, cMul); break; // Functions default: { //assert(opcode >= cAbs); unsigned funcno = opcode-cAbs; assert(funcno < sizeof(Functions)/sizeof(Functions[0])); const FuncDefinition& func = Functions[funcno]; //const FuncDefinition& func = Functions[opcode-cAbs]; unsigned paramcount = func.params; #ifndef DISABLE_EVAL if(opcode == cEval) paramcount = data->varAmount; #endif if(opcode == cSqrt) { // Converted on fly: sqrt(x) = x^0.5 opcode = cPow; paramcount = 2; ADDCONST(0.5); } if(opcode == cExp) { // Converted on fly: exp(x) = CONSTANT_E^x opcode = cPow; paramcount = 2; // reverse the parameters... kludgey stack[stacktop] = stack[stacktop-1]; stack[stacktop-1].SetImmed(CONSTANT_E); GROW(1); } bool do_inv = false; if(opcode == cCot) { do_inv = true; opcode = cTan; } if(opcode == cCsc) { do_inv = true; opcode = cSin; } if(opcode == cSec) { do_inv = true; opcode = cCos; } bool do_log10 = false; if(opcode == cLog10) { // Converted on fly: log10(x) = log(x) * CONSTANT_L10I opcode = cLog; do_log10 = true; } EAT(paramcount, opcode); if(do_log10) { ADDCONST(CONSTANT_L10I); EAT(2, cMul); } if(do_inv) { // Unary cMul, inverted. No need for "1.0" EAT(1, cMul); stack[stacktop-1].getp0().Invert(); } break; } } } else { stack[stacktop].SetVar(opcode); GROW(1); } } if(!stacktop) { // ERROR: Stack does not have any values! return; } --stacktop; // Ignore the last element, it is always nop (cAdd). if(stacktop > 0) { // ERROR: Stack has too many values! return; } // Okay, the tree is now stack[0] *result = stack[0]; } void FunctionParser::Optimize() { copyOnWrite(); CodeTree tree; MakeTree(&tree); // Do all sorts of optimizations tree.Optimize(); // Last changes before assembly tree.FinalOptimize(); // Now rebuild from the tree. vector byteCode; vector immed; #if 0 byteCode.resize(Comp.ByteCodeSize); for(unsigned a=0; aByteCode; data->ByteCode = 0; if((data->ByteCodeSize = byteCode.size()) > 0) { data->ByteCode = new unsigned[data->ByteCodeSize]; for(unsigned a=0; aByteCode[a] = byteCode[a]; } delete[] data->Immed; data->Immed = 0; if((data->ImmedSize = immed.size()) > 0) { data->Immed = new double[data->ImmedSize]; for(unsigned a=0; aImmed[a] = immed[a]; } } #endif // #ifdef SUPPORT_OPTIMIZER ================================================ FILE: k3dsdk/expression/fptypes.h ================================================ //============================== // Function parser v2.8 by Warp //============================== // ============================================================================= // Usage license: // ============================================================================= // // Copyright © 2003-2005 Juha Nieminen, Joel Yliluoma // // This library is distributed under two distinct usage licenses depending // on the software ("Software" below) which uses the Function Parser library // ("Library" below). // The reason for having two distinct usage licenses is to make the library // compatible with the GPL license while still being usable in other non-GPL // (even commercial) software. See fparser_license.txt for more details. // NOTE: // This file contains only internal types for the function parser library. // You don't need to include this file in your code. Include "fparser.h" // only. namespace FUNCTIONPARSERTYPES { // The functions must be in alphabetical order: enum OPCODE { cAbs, cAcos, #ifndef NO_ASINH cAcosh, #endif cAsin, #ifndef NO_ASINH cAsinh, #endif cAtan, cAtan2, #ifndef NO_ASINH cAtanh, #endif cCeil, cCos, cCosh, cCot, cCsc, #ifndef DISABLE_EVAL cEval, #endif cExp, cFloor, cIf, cInt, cLog, cLog10, cMax, cMin, cSec, cSin, cSinh, cSqrt, cTan, cTanh, // These do not need any ordering: cImmed, cJump, cNeg, cAdd, cSub, cMul, cDiv, cMod, cPow, cEqual, cNEqual, cLess, cLessOrEq, cGreater, cGreaterOrEq, cNot, cAnd, cOr, cDeg, cRad, cFCall, cPCall, #ifdef SUPPORT_OPTIMIZER cVar, cDup, cInv, #endif VarBegin }; struct FuncDefinition { const char* name; unsigned nameLength; unsigned opcode; unsigned params; // This is basically strcmp(), but taking 'nameLength' as string // length (not ending '\0'): bool operator<(const FuncDefinition& rhs) const { for(unsigned i = 0; i < nameLength; ++i) { if(i == rhs.nameLength) return false; const char c1 = name[i], c2 = rhs.name[i]; if(c1 < c2) return true; if(c2 < c1) return false; } return nameLength < rhs.nameLength; } }; // This list must be in alphabetical order: const FuncDefinition Functions[]= { { "abs", 3, cAbs, 1 }, { "acos", 4, cAcos, 1 }, #ifndef NO_ASINH { "acosh", 5, cAcosh, 1 }, #endif { "asin", 4, cAsin, 1 }, #ifndef NO_ASINH { "asinh", 5, cAsinh, 1 }, #endif { "atan", 4, cAtan, 1 }, { "atan2", 5, cAtan2, 2 }, #ifndef NO_ASINH { "atanh", 5, cAtanh, 1 }, #endif { "ceil", 4, cCeil, 1 }, { "cos", 3, cCos, 1 }, { "cosh", 4, cCosh, 1 }, { "cot", 3, cCot, 1 }, { "csc", 3, cCsc, 1 }, #ifndef DISABLE_EVAL { "eval", 4, cEval, 0 }, #endif { "exp", 3, cExp, 1 }, { "floor", 5, cFloor, 1 }, { "if", 2, cIf, 0 }, { "int", 3, cInt, 1 }, { "log", 3, cLog, 1 }, { "log10", 5, cLog10, 1 }, { "max", 3, cMax, 2 }, { "min", 3, cMin, 2 }, { "sec", 3, cSec, 1 }, { "sin", 3, cSin, 1 }, { "sinh", 4, cSinh, 1 }, { "sqrt", 4, cSqrt, 1 }, { "tan", 3, cTan, 1 }, { "tanh", 4, cTanh, 1 } }; } ================================================ FILE: k3dsdk/expression/parser.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include namespace k3d { namespace expression { parser::parser() : base_t() { add_constant("pi", pi()); } } // namespace expression } // namespace k3d ================================================ FILE: k3dsdk/expression/parser.h ================================================ #ifndef K3DSDK_EXPRESSION_PARSER_H #define K3DSDK_EXPRESSION_PARSER_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace expression { /// Refinement of basic_parser that provides a standard set of functions and constants class parser : public basic_parser { typedef basic_parser base_t; public: parser(); }; } // namespace expression } // namespace k3d #endif // !K3DSDK_EXPRESSION_PARSER_H ================================================ FILE: k3dsdk/expression_grammar.h ================================================ #ifndef K3DSDK_EXPRESSION_GRAMMAR_H #define K3DSDK_EXPRESSION_GRAMMAR_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include using namespace boost::spirit::classic; #include #include #include #include #include #include namespace k3d { namespace expression { /// Defines a stack for holding intermediate values during parsing typedef std::stack stack_t; /// Inserts a parsed numeric value onto the stack class push_number { public: push_number(stack_t& Stack) : m_stack(Stack) { } void operator()(const double Constant) const { m_stack.push(Constant); } private: stack_t& m_stack; }; /// Inserts a constant numeric value onto the stack class push_constant { public: push_constant(const double Constant, stack_t& Stack) : m_constant(Constant), m_stack(Stack) { } template void operator()(iterator_t, iterator_t) const { m_stack.push(m_constant); } private: const double m_constant; stack_t& m_stack; }; /// Applies a unary function to the top of the stack template class unary_operator_t { public: explicit unary_operator_t(operator_t Operator, stack_t& Stack) : m_operator(Operator), m_stack(Stack) { } template void operator()(iterator_t, iterator_t) const { const double rhs = m_stack.top(); m_stack.pop(); m_stack.push(m_operator(rhs)); } private: operator_t m_operator; stack_t& m_stack; }; /// Convenience factory function for instantiating unary_operator_t objects template unary_operator_t unary_operator(operator_t Operator, stack_t& Stack) { return unary_operator_t(Operator, Stack); } /// Applies a binary function to the top two values of the stack template class binary_operator_t { public: explicit binary_operator_t(operator_t Operator, stack_t& Stack) : m_operator(Operator), m_stack(Stack) { } template void operator()(iterator_t, iterator_t) const { const double rhs = m_stack.top(); m_stack.pop(); const double lhs = m_stack.top(); m_stack.pop(); m_stack.push(m_operator(lhs, rhs)); } private: operator_t m_operator; stack_t& m_stack; }; /// Convenience factory function for instantiating binary_operator_t objects template binary_operator_t binary_operator(operator_t Operator, stack_t& Stack) { return binary_operator_t(Operator, Stack); } /// Encapsulates a grammar for evaluating basic mathematics expressions struct expression_grammar : public grammar { expression_grammar(stack_t& Stack) : m_stack(Stack) { } template struct definition { definition(const expression_grammar& self) { number = (real_p)[push_number(self.m_stack)]; pi = (nocase_d[str_p("pi")])[push_constant(3.14159265358979323846, self.m_stack)]; constant = number | pi; primary_expression = constant | (ch_p('(') >> expression >> ch_p(')')) | (ch_p('-') >> expression)[unary_operator(std::negate(), self.m_stack)] | (ch_p('+') >> expression); unary_function_arguments = ch_p('(') >> expression >> ch_p(')'); binary_function_arguments = ch_p('(') >> expression >> ch_p(',') >> expression >> ch_p(')'); builtins = primary_expression | (str_p("abs") >> unary_function_arguments)[unary_operator((double(*)(double))&fabs, self.m_stack)] | (str_p("acos") >> unary_function_arguments)[unary_operator((double(*)(double))&acos, self.m_stack)] | (str_p("asin") >> unary_function_arguments)[unary_operator((double(*)(double))&asin, self.m_stack)] | (str_p("atan") >> unary_function_arguments)[unary_operator((double(*)(double))&atan, self.m_stack)] | (str_p("ceil") >> unary_function_arguments)[unary_operator((double(*)(double))&ceil, self.m_stack)] | (str_p("cos") >> unary_function_arguments)[unary_operator((double(*)(double))&cos, self.m_stack)] | (str_p("cosh") >> unary_function_arguments)[unary_operator((double(*)(double))&cosh, self.m_stack)] | (str_p("exp") >> unary_function_arguments)[unary_operator((double(*)(double))&exp, self.m_stack)] | (str_p("floor") >> unary_function_arguments)[unary_operator((double(*)(double))&floor, self.m_stack)] | (str_p("log") >> unary_function_arguments)[unary_operator((double(*)(double))&::log, self.m_stack)] | (str_p("log10") >> unary_function_arguments)[unary_operator((double(*)(double))&log10, self.m_stack)] | (str_p("pow") >> binary_function_arguments)[binary_operator((double(*)(double, double))&pow, self.m_stack)] | (str_p("sin") >> unary_function_arguments)[unary_operator((double(*)(double))&sin, self.m_stack)] | (str_p("sinh") >> unary_function_arguments)[unary_operator((double(*)(double))&sinh, self.m_stack)] | (str_p("sqrt") >> unary_function_arguments)[unary_operator((double(*)(double))&sqrt, self.m_stack)] | (str_p("tan") >> unary_function_arguments)[unary_operator((double(*)(double))&tan, self.m_stack)] | (str_p("tanh") >> unary_function_arguments)[unary_operator((double(*)(double))&tanh, self.m_stack)]; multiplicative_expression = builtins >> *((ch_p('*') >> builtins)[binary_operator(std::multiplies(), self.m_stack)] | (ch_p('/') >> builtins)[binary_operator(std::divides(), self.m_stack)]); additive_expression = multiplicative_expression >> *((ch_p('+') >> multiplicative_expression)[binary_operator(std::plus(), self.m_stack)] | (ch_p('-') >> multiplicative_expression)[binary_operator(std::minus(), self.m_stack)]); expression = (additive_expression); } rule const& start() const { return expression; } rule number, pi, constant, primary_expression, unary_function_arguments, binary_function_arguments, builtins, multiplicative_expression, additive_expression, expression; }; stack_t& m_stack; }; } //namespace expression } // namespace k3d #endif // !K3DSDK_EXPRESSION_GRAMMAR_H ================================================ FILE: k3dsdk/file_helpers.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace { class endian_test { public: endian_test() { m_union.Long = 1; } bool little_endian() { return 1 == m_union.Char[0]; } private: union { long Long; char Char[sizeof(long)]; } m_union; }; } // namespace namespace k3d { void getline(std::istream& Stream, std::ostream& LineBuffer) { for(char c = Stream.get(); !Stream.eof(); c = Stream.get()) { if('\r' == c) { if('\n' == Stream.peek()) Stream.get(); break; } else if('\n' == c) { break; } LineBuffer << c; } } void getline(std::istream& Stream, std::string& LineBuffer) { std::ostringstream buffer; getline(Stream, buffer); LineBuffer = buffer.str(); } bool big_endian() { static endian_test test; return !test.little_endian(); } bool little_endian() { static endian_test test; return test.little_endian(); } } // namespace k3d ================================================ FILE: k3dsdk/file_helpers.h ================================================ #ifndef K3DSDK_FILE_HELPERS_H #define K3DSDK_FILE_HELPERS_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Extracts a line from a stream; handles Posix/DOS linebreaks void getline(std::istream& Stream, std::ostream& LineBuffer); /// Extracts a line from a stream; handles Posix/DOS linebreaks void getline(std::istream& Stream, std::string& LineBuffer); /// Returns true if the architecture is big endian bool big_endian(); /// Returns true if the architecture is little endian bool little_endian(); } // namespace k3d #endif // !K3DSDK_FILE_HELPERS_H ================================================ FILE: k3dsdk/file_range.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // file_range file_range::file_range() : digits(0), begin(0), end(0) { } size_t file_range::max_file_count() const { return static_cast(std::pow(10.0, static_cast(digits))); } const filesystem::path file_range::file(const size_t N) const { std::ostringstream buffer; buffer << std::setfill('0') << std::setw(digits) << N; return directory / filesystem::generic_path(before + ustring::from_utf8(buffer.str()) + after); } } // namespace k3d ================================================ FILE: k3dsdk/file_range.h ================================================ #ifndef K3DSDK_FILE_RANGE_H #define K3DSDK_FILE_RANGE_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // file_range /// Encapsulates a half-open range of numbered files (useful for working with animation frames) class file_range { public: /// Creates an empty range file_range(); /// Returns the maximum number of files that can be represented by this range size_t max_file_count() const; /// Returns the full path to the Nth file (N does *not* have to be within the valid range) const filesystem::path file(const size_t N) const; /// Stores the directory that contains the range of files filesystem::path directory; /// Stores an optional string that precedes the filename number ustring before; /// Stores the number of digits used to number the filename size_t digits; /// Stores an optional string that follows the filename number (including file extension, etc) ustring after; /// Stores the first filename number in the range size_t begin; /// Stores the one-past-last filename number in the range size_t end; }; } // namespace k3d #endif // !K3DSDK_FILE_RANGE_H ================================================ FILE: k3dsdk/frames.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /////////////////////////////////////////////////////////////////// // frame frame::frame() : begin_time(0), end_time(0) { } frame::frame(const double_t BeginTime, const double_t EndTime) : begin_time(BeginTime), end_time(EndTime) { } frame::frame(const double_t BeginTime, const double_t EndTime, const filesystem::path& Destination) : begin_time(BeginTime), end_time(EndTime), destination(Destination) { } std::ostream& operator<<(std::ostream& Stream, const frame& RHS) { Stream << "frame: " << RHS.begin_time << " " << RHS.end_time << " " << RHS.destination.native_console_string(); return Stream; } /////////////////////////////////////////////////////////////////// // frames std::ostream& operator<<(std::ostream& Stream, const frames& RHS) { std::copy(RHS.begin(), RHS.end(), std::ostream_iterator(Stream, "\n")); return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/frames.h ================================================ #ifndef K3DSDK_FRAMES_H #define K3DSDK_FRAMES_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // frame /// Encapsulates an animation frame (a range of time) to be rendered class frame { public: frame(); frame(const double_t BeginTime, const double_t EndTime); frame(const double_t BeginTime, const double_t EndTime, const filesystem::path& Destination); /// Stores the beginning of the frame double_t begin_time; /// Stores the end of the frame double_t end_time; /// Stores the filesystem location where the rendered frame should be stored filesystem::path destination; }; std::ostream& operator<<(std::ostream& Stream, const frame& RHS); ///////////////////////////////////////////////////////////////////////////// // frames /// Stores a collection of animation frames to be rendered typedef std::vector frames; std::ostream& operator<<(std::ostream& Stream, const frames& RHS); } // namespace k3d #endif // !K3DSDK_FRAMES_H ================================================ FILE: k3dsdk/fstream.h ================================================ #ifndef K3DSDK_FSTREAM_H #define K3DSDK_FSTREAM_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace filesystem { /// Convenience wrapper for standard fstream that opens a k3d::filesystem::path in binary mode template< class charT, class traits = std::char_traits > class basic_ifstream : public std::basic_ifstream { public: basic_ifstream() { } explicit basic_ifstream(const path& file, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary) : std::basic_ifstream(file.native_filesystem_string().c_str(), mode) { } virtual ~basic_ifstream() { } void open(const path& file, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary) { std::basic_ifstream::open(file.native_filesystem_string().c_str(), mode); } }; /// Convenience wrapper for standard fstream that opens a k3d::filesystem::path in binary mode typedef basic_ifstream ifstream; // typedef basic_ifstream wifstream; // Why do you want to use this? It isn't portable, and you should be using UTF-8! /// Convenience wrapper for standard fstream that opens a k3d::filesystem::path in binary mode template < class charT, class traits = std::char_traits > class basic_ofstream : public std::basic_ofstream { public: basic_ofstream() { } explicit basic_ofstream(const path& file, std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary) : std::basic_ofstream(file.native_filesystem_string().c_str(), mode) { } virtual ~basic_ofstream() { } void open(const path& file, std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary) { std::basic_ofstream::open(file.native_filesystem_string().c_str(), mode); } }; /// Convenience wrapper for standard fstream that opens a k3d::filesystem::path in binary mode typedef basic_ofstream ofstream; // typedef basic_ofstream wofstream; // Why do you want to use this? It isn't portable, and you should be using UTF-8! /// Convenience wrapper for standard fstream that opens a k3d::filesystem::path in binary mode template < class charT, class traits = std::char_traits > class basic_fstream : public std::basic_fstream { public: basic_fstream() { } explicit basic_fstream(const path& file, std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out | std::ios_base::binary) : std::basic_fstream(file.native_filesystem_string(), mode) { } virtual ~basic_fstream() { } void open(const path& file, std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out | std::ios_base::binary) { std::basic_fstream::open(file.native_filesystem_string().c_str(), mode); } }; /// Convenience wrapper for standard fstream that opens a k3d::filesystem::path in binary mode typedef basic_fstream fstream; // typedef basic_fstream wfstream; // Why do you want to use this? It isn't portable, and you should be using UTF-8! } // namespace filesystem } // namespace k3d #endif // !K3DSDK_FSTREAM_H ================================================ FILE: k3dsdk/geometric_operations.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief 2D geometry routines implementation \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // intersect bool_t intersect(const plane& Plane, const line3& Line, point3& Intersection) { // Calculate the angle (dot product) between line and plane ... const double_t theta = Plane.normal * Line.direction; // Make sure the line & plane aren't parallel ... if(0.0 == theta) return false; const double_t v0 = -(Plane.normal * to_vector(Line.point) + Plane.distance); const double_t t = v0 / theta; Intersection = Line.point + (t * Line.direction); return true; } ///////////////////////////////////////////////////////////////////////////// // distance double_t distance(const point2& Point, const line2& Line) { const double_t x0 = Point[0]; const double_t y0 = Point[1]; const double_t x1 = Line.point[0]; const double_t y1 = Line.point[1]; const double_t x2 = x1 + Line.direction[0]; const double_t y2 = y1 + Line.direction[1]; const double_t denominator = sqrt((x2-x1) * (x2-x1) + (y2-y1) * (y2-y1)); return_val_if_fail(denominator, 0.0); // Happens if the line direction is undefined const double_t numerator = fabs((x2-x1) * (y1-y0) - (x1-x0) * (y2-y1)); return numerator / denominator; } bool_t intersect_lines(const point3& P1, const vector3& T1, const point3& P2, const vector3& T2, point3& Result) { // Code originally from Aqsis, http://www.aqsis.com vector3 px = T1 ^ to_vector( P1 - T2 ); vector3 v = px ^ T1; double_t t = (P1 - P2) * v; double_t vw = v * T2; if ( ( vw * vw ) < 1.0e-07 ) return false; t /= vw; Result = P2 + (((P1 - P2) * v) / vw) * T2; return true; } } // namespace k3d ================================================ FILE: k3dsdk/geometric_operations.h ================================================ #ifndef K3DSDK_GEOMETRIC_OPERATIONS_H #define K3DSDK_GEOMETRIC_OPERATIONS_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief 2D geometry routines \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class line2; class line3; class plane; class point2; class point3; class vector3; /// Returns the (minimum) distance between a point and a line in two dimensions double_t distance(const point2& Point, const line2& Line); /// Calculates the intersection of a plane with a line, returns false if the line and plane are parallel bool_t intersect(const plane& Plane, const line3& Line, point3& Intersection); /** Find the point at which two infinite lines intersect. The algorithm generates a plane from one of the lines and finds the intersection point between this plane and the other line. \param P1 A point that lies on the first line \param T1 Direction vector for the first line \param P2 A point that lies on the second line \param T2 Direction vector for the second line \param Result Returns the intersection between the two lines \result Returns true iff the lines intersect, false if they are parallel \note Code originally from Aqsis, http://www.aqsis.com */ bool_t intersect_lines(const point3& P1, const vector3& T1, const point3& P2, const vector3& T2, point3& Result); } // namespace k3d #endif // !K3DSDK_GEOMETRIC_OPERATIONS_H ================================================ FILE: k3dsdk/geometry.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include namespace k3d { namespace geometry { namespace point_selection { ////////////////////////////////////////////////////////////////////// // const_storage const_storage::const_storage( const mesh::indices_t& IndexBegin, const mesh::indices_t& IndexEnd, const mesh::selection_t& Weight ) : index_begin(IndexBegin), index_end(IndexEnd), weight(Weight) { } ////////////////////////////////////////////////////////////////////// // storage storage::storage( mesh::indices_t& IndexBegin, mesh::indices_t& IndexEnd, mesh::selection_t& Weight ) : index_begin(IndexBegin), index_end(IndexEnd), weight(Weight) { } ////////////////////////////////////////////////////////////////////// // create storage* create(k3d::selection::set& Set) { k3d::selection::storage& generic_storage = Set.create("point"); storage* const result = new storage( generic_storage.structure.create("index_begin"), generic_storage.structure.create("index_end"), generic_storage.structure.create("weight") ); return result; } storage* create(k3d::selection::set& Set, const double_t Weight) { storage* const result = create(Set); append(*result, Weight); return result; } ////////////////////////////////////////////////////////////////////// // validate const_storage* validate(const k3d::selection::storage& Storage) { if(Storage.type != "point") return 0; try { const mesh::indices_t& index_begin = require_array(Storage, "index_begin"); const mesh::indices_t& index_end = require_array(Storage, "index_end"); const mesh::selection_t& weight = require_array(Storage, "weight"); require_array_size(Storage, index_end, "index_end", index_begin.size()); require_array_size(Storage, weight, "weight", index_begin.size()); return new const_storage(index_begin, index_end, weight); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } ////////////////////////////////////////////////////////////////////// // validate storage* validate(k3d::selection::storage& Storage) { if(Storage.type != "point") return 0; try { mesh::indices_t& index_begin = require_array(Storage, "index_begin"); mesh::indices_t& index_end = require_array(Storage, "index_end"); mesh::selection_t& weight = require_array(Storage, "weight"); require_array_size(Storage, index_end, "index_end", index_begin.size()); require_array_size(Storage, weight, "weight", index_begin.size()); return new storage(index_begin, index_end, weight); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } ////////////////////////////////////////////////////////////////////// // append void append(storage& Storage, const double_t Weight) { Storage.index_begin.push_back(0); Storage.index_end.push_back(uint_t(-1)); Storage.weight.push_back(Weight); } ////////////////////////////////////////////////////////////////////// // append void append(storage& Storage, const uint_t Begin, const uint_t End, const double_t Weight) { Storage.index_begin.push_back(Begin); Storage.index_end.push_back(End); Storage.weight.push_back(Weight); } ////////////////////////////////////////////////////////////////////// // merge void merge(const_storage& Storage, mesh& Mesh) { if(!Mesh.point_selection) return; mesh::selection_t& point_selection = Mesh.point_selection.writable(); const uint_t point_selection_count = point_selection.size(); const uint_t record_count = Storage.index_begin.size(); for(uint_t record = 0; record != record_count; ++record) { const uint_t index_begin = Storage.index_begin[record]; const uint_t index_end = std::max(index_begin, Storage.index_end[record]); const double_t weight = Storage.weight[record]; const mesh::selection_t::iterator begin = point_selection.begin() + std::min(point_selection_count, index_begin); const mesh::selection_t::iterator end = point_selection.begin() + std::min(point_selection_count, index_end); std::fill(begin, end, weight); } } } // namespace point_selection namespace primitive_selection { ////////////////////////////////////////////////////////////////////// // const_storage const_storage::const_storage( const mesh::indices_t& PrimitiveBegin, const mesh::indices_t& PrimitiveEnd, const typed_array& PrimitiveSelectionType, const mesh::indices_t& PrimitiveFirstRange, const mesh::counts_t& PrimitiveRangeCount, const mesh::indices_t& IndexBegin, const mesh::indices_t& IndexEnd, const mesh::selection_t& Weight ) : primitive_begin(PrimitiveBegin), primitive_end(PrimitiveEnd), primitive_selection_type(PrimitiveSelectionType), primitive_first_range(PrimitiveFirstRange), primitive_range_count(PrimitiveRangeCount), index_begin(IndexBegin), index_end(IndexEnd), weight(Weight) { } ////////////////////////////////////////////////////////////////////// // storage storage::storage( mesh::indices_t& PrimitiveBegin, mesh::indices_t& PrimitiveEnd, typed_array& PrimitiveSelectionType, mesh::indices_t& PrimitiveFirstRange, mesh::counts_t& PrimitiveRangeCount, mesh::indices_t& IndexBegin, mesh::indices_t& IndexEnd, mesh::selection_t& Weight ) : primitive_begin(PrimitiveBegin), primitive_end(PrimitiveEnd), primitive_selection_type(PrimitiveSelectionType), primitive_first_range(PrimitiveFirstRange), primitive_range_count(PrimitiveRangeCount), index_begin(IndexBegin), index_end(IndexEnd), weight(Weight) { } ////////////////////////////////////////////////////////////////////// // create storage* create(k3d::selection::set& Set) { k3d::selection::storage& generic_storage = Set.create("primitive"); storage* const result = new storage( generic_storage.structure.create("primitive_begin"), generic_storage.structure.create("primitive_end"), generic_storage.structure.create >("primitive_selection_type"), generic_storage.structure.create("primitive_first_range"), generic_storage.structure.create("primitive_range_count"), generic_storage.structure.create("index_begin"), generic_storage.structure.create("index_end"), generic_storage.structure.create("weight") ); return result; } storage* create(k3d::selection::set& Set, const uint_t PrimitiveBegin, const uint_t PrimitiveEnd, const int32_t SelectionType) { storage* const result = create(Set); result->primitive_begin.push_back(PrimitiveBegin); result->primitive_end.push_back(PrimitiveEnd); result->primitive_selection_type.push_back(SelectionType); result->primitive_first_range.push_back(0); result->primitive_range_count.push_back(0); return result; } storage* create(k3d::selection::set& Set, const int32_t SelectionType) { storage* const result = create(Set); result->primitive_begin.push_back(0); result->primitive_end.push_back(uint_t(-1)); result->primitive_selection_type.push_back(SelectionType); result->primitive_first_range.push_back(0); result->primitive_range_count.push_back(0); return result; } ////////////////////////////////////////////////////////////////////// // validate const_storage* validate(const k3d::selection::storage& Storage) { if(Storage.type != "primitive") return 0; try { const mesh::indices_t& primitive_begin = require_array(Storage, "primitive_begin"); const mesh::indices_t& primitive_end = require_array(Storage, "primitive_end"); const typed_array& primitive_selection_type = require_array >(Storage, "primitive_selection_type"); const mesh::indices_t& primitive_first_range = require_array(Storage, "primitive_first_range"); const mesh::indices_t& primitive_range_count = require_array(Storage, "primitive_range_count"); const mesh::indices_t& index_begin = require_array(Storage, "index_begin"); const mesh::indices_t& index_end = require_array(Storage, "index_end"); const mesh::selection_t& weight = require_array(Storage, "weight"); require_array_size(Storage, primitive_end, "primitive_end", primitive_begin.size()); require_array_size(Storage, primitive_selection_type, "primitive_selection_type", primitive_begin.size()); require_array_size(Storage, primitive_first_range, "primitive_first_range", primitive_begin.size()); require_array_size(Storage, primitive_range_count, "primitive_range_count", primitive_begin.size()); require_array_size(Storage, index_end, "index_end", index_begin.size()); require_array_size(Storage, weight, "weight", index_begin.size()); return new const_storage(primitive_begin, primitive_end, primitive_selection_type, primitive_first_range, primitive_range_count, index_begin, index_end, weight); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } ////////////////////////////////////////////////////////////////////// // validate storage* validate(k3d::selection::storage& Storage) { if(Storage.type != "primitive") return 0; try { mesh::indices_t& primitive_begin = require_array(Storage, "primitive_begin"); mesh::indices_t& primitive_end = require_array(Storage, "primitive_end"); typed_array& primitive_selection_type = require_array >(Storage, "primitive_selection_type"); mesh::indices_t& primitive_first_range = require_array(Storage, "primitive_first_range"); mesh::indices_t& primitive_range_count = require_array(Storage, "primitive_range_count"); mesh::indices_t& index_begin = require_array(Storage, "index_begin"); mesh::indices_t& index_end = require_array(Storage, "index_end"); mesh::selection_t& weight = require_array(Storage, "weight"); require_array_size(Storage, primitive_end, "primitive_end", primitive_begin.size()); require_array_size(Storage, primitive_selection_type, "primitive_selection_type", primitive_begin.size()); require_array_size(Storage, primitive_first_range, "primitive_first_range", primitive_begin.size()); require_array_size(Storage, primitive_range_count, "primitive_range_count", primitive_begin.size()); require_array_size(Storage, index_end, "index_end", index_begin.size()); require_array_size(Storage, weight, "weight", index_begin.size()); return new storage(primitive_begin, primitive_end, primitive_selection_type, primitive_first_range, primitive_range_count, index_begin, index_end, weight); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } ////////////////////////////////////////////////////////////////////// // append void append(storage& Storage, const uint_t PrimitiveBegin, const uint_t PrimitiveEnd, const int32_t SelectionType, const uint_t Begin, const uint_t End, const double_t Weight) { Storage.primitive_begin.push_back(PrimitiveBegin); Storage.primitive_end.push_back(PrimitiveEnd); Storage.primitive_selection_type.push_back(SelectionType); Storage.primitive_first_range.push_back(Storage.index_begin.size()); Storage.primitive_range_count.push_back(1); Storage.index_begin.push_back(Begin); Storage.index_end.push_back(End); Storage.weight.push_back(Weight); } void append(storage& Storage, const int32_t SelectionType, const uint_t Begin, const uint_t End, const double_t Weight) { Storage.primitive_begin.push_back(0); Storage.primitive_end.push_back(uint_t(-1)); Storage.primitive_selection_type.push_back(SelectionType); Storage.primitive_first_range.push_back(Storage.index_begin.size()); Storage.primitive_range_count.push_back(1); Storage.index_begin.push_back(Begin); Storage.index_end.push_back(End); Storage.weight.push_back(Weight); } void append(storage& Storage, const int32_t SelectionType, const double_t Weight) { Storage.primitive_begin.push_back(0); Storage.primitive_end.push_back(uint_t(-1)); Storage.primitive_selection_type.push_back(SelectionType); Storage.primitive_first_range.push_back(Storage.index_begin.size()); Storage.primitive_range_count.push_back(1); Storage.index_begin.push_back(0); Storage.index_end.push_back(uint_t(-1)); Storage.weight.push_back(Weight); } void append(storage& Storage, const uint_t Begin, const uint_t End, const double_t Weight) { return_if_fail(Storage.primitive_begin.size()); Storage.primitive_range_count.back() += 1; Storage.index_begin.push_back(Begin); Storage.index_end.push_back(End); Storage.weight.push_back(Weight); } void append(storage& Storage, const double_t Weight) { return_if_fail(Storage.primitive_begin.size()); Storage.primitive_range_count.back() += 1; Storage.index_begin.push_back(0); Storage.index_end.push_back(uint_t(-1)); Storage.weight.push_back(Weight); } ////////////////////////////////////////////////////////////////////// // merge class merge_primitive_selection { public: merge_primitive_selection(const_storage& Storage, const string_t& PrimitiveSelectionType, const uint_t PrimitiveFirstRange, const uint_t PrimitiveRangeCount) : m_storage(Storage), m_primitive_selection_type(PrimitiveSelectionType), m_primitive_first_range(PrimitiveFirstRange), m_primitive_range_count(PrimitiveRangeCount) { } void operator()(const string_t& StructureName, table& Structure, const string_t& ArrayName, pipeline_data& Array) { if(StructureName != m_primitive_selection_type) return; if(Array->get_metadata_value(metadata::key::role()) != metadata::value::selection_role()) return; mesh::selection_t* const array = dynamic_cast(&Array.writable()); if(!array) { log() << error << "unexpected type for array [" << ArrayName << "] with k3d:selection-component = " << m_primitive_selection_type << std::endl; return; } const uint_t range_begin = m_primitive_first_range; const uint_t range_end = range_begin + m_primitive_range_count; for(uint_t range = range_begin; range != range_end; ++range) { std::fill( array->begin() + std::min(array->size(), m_storage.index_begin[range]), array->begin() + std::min(array->size(), m_storage.index_end[range]), m_storage.weight[range]); } } private: const_storage& m_storage; const string_t& m_primitive_selection_type; const uint_t m_primitive_first_range; const uint_t m_primitive_range_count; }; void merge(const_storage& Storage, mesh& Mesh) { const uint_t mesh_primitive_count = static_cast(Mesh.primitives.size()); const uint_t component_count = Storage.primitive_begin.size(); for(uint_t component = 0; component != component_count; ++component) { const uint_t primitive_begin = std::min(mesh_primitive_count, Storage.primitive_begin[component]); const uint_t primitive_end = std::min(mesh_primitive_count, std::max(primitive_begin, Storage.primitive_end[component])); const string_t primitive_selection_type = string_cast(static_cast(Storage.primitive_selection_type[component])); const uint_t primitive_first_range = Storage.primitive_first_range[component]; const uint_t primitive_range_count = Storage.primitive_range_count[component]; for(uint_t primitive = primitive_begin; primitive != primitive_end; ++primitive) { mesh::visit_arrays(Mesh.primitives[primitive].writable(), merge_primitive_selection(Storage, primitive_selection_type, primitive_first_range, primitive_range_count)); } } } } // namespace primitive_selection namespace selection { k3d::selection::set create(const double_t Weight) { k3d::selection::set result; boost::scoped_ptr point_selection_storage(point_selection::create(result)); point_selection::append(*point_selection_storage, Weight); boost::scoped_ptr primitive_selection_storage(primitive_selection::create(result)); primitive_selection::append(*primitive_selection_storage, k3d::selection::CONSTANT, Weight); primitive_selection::append(*primitive_selection_storage, k3d::selection::CURVE, Weight); primitive_selection::append(*primitive_selection_storage, k3d::selection::EDGE, Weight); primitive_selection::append(*primitive_selection_storage, k3d::selection::FACE, Weight); primitive_selection::append(*primitive_selection_storage, k3d::selection::PARAMETER, Weight); primitive_selection::append(*primitive_selection_storage, k3d::selection::PATCH, Weight); primitive_selection::append(*primitive_selection_storage, k3d::selection::SURFACE, Weight); primitive_selection::append(*primitive_selection_storage, k3d::selection::VERTEX, Weight); return result; } void merge(const k3d::selection::set& Set, mesh& Mesh) { for(k3d::selection::set::const_iterator storage = Set.begin(); storage != Set.end(); ++storage) { boost::scoped_ptr point_selection_storage(point_selection::validate(**storage)); if(point_selection_storage) { point_selection::merge(*point_selection_storage, Mesh); continue; } boost::scoped_ptr primitive_selection_storage(primitive_selection::validate(**storage)); if(primitive_selection_storage) { primitive_selection::merge(*primitive_selection_storage, Mesh); continue; } } } } // namespace selection } // namespace geometry } // namespace k3d ================================================ FILE: k3dsdk/geometry.h ================================================ #ifndef K3DSDK_GEOMETRY_H #define K3DSDK_GEOMETRY_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace selection { class set; } namespace selection { class storage; } namespace geometry { namespace point_selection { /// Gathers the member arrays of a point selection into a convenient package. class const_storage { public: const_storage( const mesh::indices_t& IndexBegin, const mesh::indices_t& IndexEnd, const mesh::selection_t& Weight ); const mesh::indices_t& index_begin; const mesh::indices_t& index_end; const mesh::selection_t& weight; }; /// Gathers the member arrays of a mutable point selection into a convenient package. class storage { public: storage( mesh::indices_t& IndexBegin, mesh::indices_t& IndexEnd, mesh::selection_t& Weight ); mesh::indices_t& index_begin; mesh::indices_t& index_end; mesh::selection_t& weight; }; /// Creates an empty point selection, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. storage* create(k3d::selection::set& Set); /// Creates a point selection that assigns a uniform weight to all points, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. storage* create(k3d::selection::set& Set, const double_t Weight); /// Tests the given storage to see if it is a valid point selection, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_storage* validate(const k3d::selection::storage& GenericStorage); /// Tests the given storage to see if it is a valid point selection, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. storage* validate(k3d::selection::storage& GenericStorage); /// Appends a uniform weight to all points. Useful for "select all" and "deselect all". void append(storage& Storage, const double_t Weight); /// Appends a weight to a range of points. void append(storage& Storage, const uint_t Begin, const uint_t End, const double_t Weight); /// Merges a point selection with the points in a mesh. void merge(const_storage& Storage, mesh& Mesh); } // namespace point_selection namespace primitive_selection { /// Gathers the member arrays of a primitive selection into a convenient package. class const_storage { public: const_storage( const mesh::indices_t& PrimitiveBegin, const mesh::indices_t& PrimitiveEnd, const typed_array& PrimitiveSelectionType, const mesh::indices_t& PrimitiveFirstRange, const mesh::counts_t& PrimitiveRangeCount, const mesh::indices_t& IndexBegin, const mesh::indices_t& IndexEnd, const mesh::selection_t& Weight ); const mesh::indices_t& primitive_begin; const mesh::indices_t& primitive_end; const typed_array& primitive_selection_type; const mesh::indices_t& primitive_first_range; const mesh::counts_t& primitive_range_count; const mesh::indices_t& index_begin; const mesh::indices_t& index_end; const mesh::selection_t& weight; }; /// Gathers the member arrays of a mutable primitive selection into a convenient package. class storage { public: storage( mesh::indices_t& PrimitiveBegin, mesh::indices_t& PrimitiveEnd, typed_array& PrimitiveSelectionType, mesh::indices_t& PrimitiveFirstRange, mesh::counts_t& PrimitiveRangeCount, mesh::indices_t& IndexBegin, mesh::indices_t& IndexEnd, mesh::selection_t& Weight ); mesh::indices_t& primitive_begin; mesh::indices_t& primitive_end; typed_array& primitive_selection_type; mesh::indices_t& primitive_first_range; mesh::counts_t& primitive_range_count; mesh::indices_t& index_begin; mesh::indices_t& index_end; mesh::selection_t& weight; }; /// Creates an empty primitive selection, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. storage* create(k3d::selection::set& Set); /// Creates a primitive selection that will apply to all primitives, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. storage* create(k3d::selection::set& Set, const int32_t SelectionType); /// Creates a primitive selection that will apply to a range of primitives, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. storage* create(k3d::selection::set& Set, const uint_t PrimitiveBegin, const uint_t PrimitiveEnd, const int32_t SelectionType); /// Tests the given storage to see if it is a valid primitive selection, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_storage* validate(const k3d::selection::storage& GenericStorage); /// Tests the given storage to see if it is a valid primitive selection, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. storage* validate(k3d::selection::storage& GenericStorage); /// Appends a selection weight to a range of components within a range of primitives. void append(storage& Storage, const uint_t PrimitiveBegin, const uint_t PrimitiveEnd, const int32_t SelectionType, const uint_t Begin, const uint_t End, const double_t Weight); /// Appends a selection weight to a range of components across all primitives. void append(storage& Storage, const int32_t SelectionType, const uint_t Begin, const uint_t End, const double_t Weight); /// Appends a selection weight to all components across all primitives. void append(storage& Storage, const int32_t SelectionType, const double_t Weight); /// Appends a selection weight to a range of components. void append(storage& Storage, const uint_t Begin, const uint_t End, const double_t Weight); /// Appends a selection weight to all components. void append(storage& Storage, const double_t Weight); /// Merges a primitive selection with the primitives in a mesh. void merge(const_storage& Storage, mesh& Mesh); } // namespace primitive_selection namespace selection { /// Returns a selection set that applies a uniform weight to every component. /// Useful for "select all" and "deselect all". k3d::selection::set create(const double_t Weight); /// Merges a selection set with the selections in a mesh. void merge(const k3d::selection::set& Set, mesh& Mesh); } // namespace selection } // namespace geometry } // namespace k3d #endif // !K3DSDK_GEOMETRY_H ================================================ FILE: k3dsdk/gil/boost/gil/extension/numeric/affine.hpp ================================================ /* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef GIL_AFFINE_HPP #define GIL_AFFINE_HPP #include // point2 //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief support for affine transformations /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n September 21, 2006 /// //////////////////////////////////////////////////////////////////////////////////////// namespace boost { namespace gil { //////////////////////////////////////////////////////////////////////////////////////// /// /// Simple matrix to do 2D affine transformations. It is actually 3x3 but the last column is [0 0 1] /// //////////////////////////////////////////////////////////////////////////////////////// template class matrix3x2 { public: matrix3x2() : a(1), b(0), c(0), d(1), e(0), f(0) {} matrix3x2(T A, T B, T C, T D, T E, T F) : a(A),b(B),c(C),d(D),e(E),f(F) {} matrix3x2(const matrix3x2& mat) : a(mat.a), b(mat.b), c(mat.c), d(mat.d), e(mat.e), f(mat.f) {} matrix3x2& operator=(const matrix3x2& m) { a=m.a; b=m.b; c=m.c; d=m.d; e=m.e; f=m.f; return *this; } matrix3x2& operator*=(const matrix3x2& m) { (*this) = (*this)*m; return *this; } static matrix3x2 get_rotate(T rads) { T c=std::cos(rads); T s=std::sin(rads); return matrix3x2(c,s,-s,c,0,0); } static matrix3x2 get_translate(const point2& t) { return matrix3x2(1 ,0,0,1 ,t.x,t.y); } static matrix3x2 get_translate(T x, T y) { return matrix3x2(1 ,0,0,1 ,x, y ); } static matrix3x2 get_scale (const point2& s) { return matrix3x2(s.x,0,0,s.y,0 ,0 ); } static matrix3x2 get_scale (T x, T y) { return matrix3x2(x, 0,0,y, 0 ,0 ); } static matrix3x2 get_scale (T s) { return matrix3x2(s ,0,0,s ,0 ,0 ); } T a,b,c,d,e,f; }; template BOOST_FORCEINLINE matrix3x2 operator*(const matrix3x2& m1, const matrix3x2& m2) { return matrix3x2( m1.a * m2.a + m1.b * m2.c, m1.a * m2.b + m1.b * m2.d, m1.c * m2.a + m1.d * m2.c, m1.c * m2.b + m1.d * m2.d, m1.e * m2.a + m1.f * m2.c + m2.e, m1.e * m2.b + m1.f * m2.d + m2.f ); } template BOOST_FORCEINLINE point2 operator*(const point2& p, const matrix3x2& m) { return point2(m.a*p.x + m.c*p.y + m.e, m.b*p.x + m.d*p.y + m.f); } //////////////////////////////////////////////////////////////////////////////////////// /// Define affine mapping that transforms the source coordinates by the affine transformation //////////////////////////////////////////////////////////////////////////////////////// /* template concept MappingFunctionConcept { typename mapping_traits::result_type; where PointNDConcept; template { where PointNDConcept } result_type transform(MapFn&, const Domain& src); }; */ template struct mapping_traits; template struct mapping_traits > { typedef point2 result_type; }; template BOOST_FORCEINLINE point2 transform(const matrix3x2& mat, const point2& src) { return src * mat; } } } // namespace boost::gil #endif ================================================ FILE: k3dsdk/gil/boost/gil/extension/numeric/algorithm.hpp ================================================ /* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef GIL_NUMERIC_ALGORITHM_HPP #define GIL_NUMERIC_ALGORITHM_HPP /*! /// \file /// \brief Numeric algorithms /// \author Hailin Jin and Lubomir Bourdev \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on February 6, 2007 */ #include #include #include #include #include #if BOOST_VERSION < 106900 #include #else #include #endif #include #include namespace boost { namespace gil { /// \brief Returns the reference proxy associated with a type that has a \p "reference" member typedef. /// /// The reference proxy is the reference type, but with stripped-out C++ reference. It models PixelConcept template struct pixel_proxy : public remove_reference {}; /// \brief std::for_each for a pair of iterators template BinaryFunction for_each(Iterator1 first1,Iterator1 last1,Iterator2 first2,BinaryFunction f) { while(first1!=last1) f(*first1++,*first2++); return f; } template inline DstIterator assign_pixels(SrcIterator src,SrcIterator src_end,DstIterator dst) { for_each(src,src_end,dst,pixel_assigns_t::value_type>::type, typename pixel_proxy::value_type>::type>()); return dst+(src_end-src); } namespace detail { template struct inner_product_k_t { template static _Tp apply(_InputIterator1 __first1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); return inner_product_k_t::template apply(__first1+1,__first2+1,__init, __binary_op1, __binary_op2); } }; template <> struct inner_product_k_t<0> { template static _Tp apply(_InputIterator1 __first1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { return __init; } }; } // namespace detail /// static version of std::inner_product template BOOST_FORCEINLINE _Tp inner_product_k(_InputIterator1 __first1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { return detail::inner_product_k_t::template apply(__first1,__first2,__init, __binary_op1, __binary_op2); } /// \brief 1D un-guarded correlation with a variable-size kernel template inline DstIterator correlate_pixels_n(SrcIterator src_begin,SrcIterator src_end, KernelIterator ker_begin,Integer ker_size, DstIterator dst_begin) { typedef typename pixel_proxy::value_type>::type PIXEL_SRC_REF; typedef typename pixel_proxy::value_type>::type PIXEL_DST_REF; typedef typename std::iterator_traits::value_type kernel_type; PixelAccum acc_zero; pixel_zeros_t()(acc_zero); while(src_begin!=src_end) { pixel_assigns_t()( std::inner_product(src_begin,src_begin+ker_size,ker_begin,acc_zero, pixel_plus_t(), pixel_multiplies_scalar_t()), *dst_begin); ++src_begin; ++dst_begin; } return dst_begin; } /// \brief 1D un-guarded correlation with a fixed-size kernel template inline DstIterator correlate_pixels_k(SrcIterator src_begin,SrcIterator src_end, KernelIterator ker_begin, DstIterator dst_begin) { typedef typename pixel_proxy::value_type>::type PIXEL_SRC_REF; typedef typename pixel_proxy::value_type>::type PIXEL_DST_REF; typedef typename std::iterator_traits::value_type kernel_type; PixelAccum acc_zero; pixel_zeros_t()(acc_zero); while(src_begin!=src_end) { pixel_assigns_t()( inner_product_k(src_begin,ker_begin,acc_zero, pixel_plus_t(), pixel_multiplies_scalar_t()), *dst_begin); ++src_begin; ++dst_begin; } return dst_begin; } /// \brief destination is set to be product of the source and a scalar template inline void view_multiplies_scalar(const SrcView& src,const Scalar& scalar,const DstView& dst) { assert(src.dimensions()==dst.dimensions()); typedef typename pixel_proxy::type PIXEL_SRC_REF; typedef typename pixel_proxy::type PIXEL_DST_REF; int height=src.height(); for(int rr=0;rr()( pixel_multiplies_scalar_t()(*it_src,scalar), *it_dst); ++it_src; ++it_dst; } } } } } // namespace boost::gil #endif ================================================ FILE: k3dsdk/gil/boost/gil/extension/numeric/channel_numeric_operations.hpp ================================================ /* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef GIL_CHANNEL_NUMERIC_OPERATIONS_HPP #define GIL_CHANNEL_NUMERIC_OPERATIONS_HPP /*! /// \file /// \brief Structures for channel-wise numeric operations /// \author Hailin Jin and Lubomir Bourdev \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on September 30, 2006 /// Currently defined structures: /// channel_plus_t (+), channel_minus_t (-), /// channel_multiplies_t (*), channel_divides_t (/), /// channel_plus_scalar_t (+s), channel_minus_scalar_t (-s), /// channel_multiplies_scalar_t (*s), channel_divides_scalar_t (/s), /// channel_halves_t (/=2), channel_zeros_t (=0), channel_assigns_t (=) */ #include #include #if BOOST_VERSION < 106900 #include #else #include #endif #include namespace boost { namespace gil { /// \ingroup ChannelNumericOperations /// structure for adding one channel to another /// this is a generic implementation; user should specialize it for better performance template struct channel_plus_t : public std::binary_function { ChannelR operator()(typename channel_traits::const_reference ch1, typename channel_traits::const_reference ch2) const { return ChannelR(ch1)+ChannelR(ch2); } }; /// \ingroup ChannelNumericOperations /// structure for subtracting one channel from another /// this is a generic implementation; user should specialize it for better performance template struct channel_minus_t : public std::binary_function { ChannelR operator()(typename channel_traits::const_reference ch1, typename channel_traits::const_reference ch2) const { return ChannelR(ch1)-ChannelR(ch2); } }; /// \ingroup ChannelNumericOperations /// structure for multiplying one channel to another /// this is a generic implementation; user should specialize it for better performance template struct channel_multiplies_t : public std::binary_function { ChannelR operator()(typename channel_traits::const_reference ch1, typename channel_traits::const_reference ch2) const { return ChannelR(ch1)*ChannelR(ch2); } }; /// \ingroup ChannelNumericOperations /// structure for dividing channels /// this is a generic implementation; user should specialize it for better performance template struct channel_divides_t : public std::binary_function { ChannelR operator()(typename channel_traits::const_reference ch1, typename channel_traits::const_reference ch2) const { return ChannelR(ch1)/ChannelR(ch2); } }; /// \ingroup ChannelNumericOperations /// structure for adding a scalar to a channel /// this is a generic implementation; user should specialize it for better performance template struct channel_plus_scalar_t : public std::binary_function { ChannelR operator()(typename channel_traits::const_reference ch, const Scalar& s) const { return ChannelR(ch)+ChannelR(s); } }; /// \ingroup ChannelNumericOperations /// structure for subtracting a scalar from a channel /// this is a generic implementation; user should specialize it for better performance template struct channel_minus_scalar_t : public std::binary_function { ChannelR operator()(typename channel_traits::const_reference ch, const Scalar& s) const { return ChannelR(ch-s); } }; /// \ingroup ChannelNumericOperations /// structure for multiplying a scalar to one channel /// this is a generic implementation; user should specialize it for better performance template struct channel_multiplies_scalar_t : public std::binary_function { ChannelR operator()(typename channel_traits::const_reference ch, const Scalar& s) const { return ChannelR(ch)*ChannelR(s); } }; /// \ingroup ChannelNumericOperations /// structure for dividing a channel by a scalar /// this is a generic implementation; user should specialize it for better performance template struct channel_divides_scalar_t : public std::binary_function { ChannelR operator()(typename channel_traits::const_reference ch, const Scalar& s) const { return ChannelR(ch)/ChannelR(s); } }; /// \ingroup ChannelNumericOperations /// structure for halving a channel /// this is a generic implementation; user should specialize it for better performance template struct channel_halves_t : public std::unary_function { typename channel_traits::reference operator()(typename channel_traits::reference ch) const { return ch/=2.0; } }; /// \ingroup ChannelNumericOperations /// structure for setting a channel to zero /// this is a generic implementation; user should specialize it for better performance template struct channel_zeros_t : public std::unary_function { typename channel_traits::reference operator()(typename channel_traits::reference ch) const { return ch=Channel(0); } }; /// \ingroup ChannelNumericOperations /// structure for assigning one channel to another /// this is a generic implementation; user should specialize it for better performance template struct channel_assigns_t : public std::binary_function { typename channel_traits::reference operator()(typename channel_traits::const_reference ch1, typename channel_traits::reference ch2) const { return ch2=Channel2(ch1); } }; } } // namespace boost::gil #endif ================================================ FILE: k3dsdk/gil/boost/gil/extension/numeric/convolve.hpp ================================================ /* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef GIL_CONVOLVE_HPP #define GIL_CONVOLVE_HPP /*! /// \file /// \brief 2D seperable convolutions and correlations /// /// \author Hailin Jin and Lubomir Bourdev \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on February 6, 2007 */ #include #include #include #include #include #include #if BOOST_VERSION < 106900 #include #else #include #endif #include #include #include #include "pixel_numeric_operations.hpp" #include "algorithm.hpp" namespace boost { namespace gil { /// \ingroup ImageAlgorithms /// Boundary options for 1D correlations/convolutions enum convolve_boundary_option { convolve_option_output_ignore, /// do nothing to the output convolve_option_output_zero, /// set the output to zero convolve_option_extend_padded, /// assume the source boundaries to be padded already convolve_option_extend_zero, /// assume the source boundaries to be zero convolve_option_extend_constant /// assume the source boundaries to be the boundary value }; namespace detail { /// compute the correlation of 1D kernel with the rows of an image template void correlate_rows_imp(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option, Correlator correlator) { assert(src.dimensions()==dst.dimensions()); assert(ker.size()!=0); typedef typename pixel_proxy::type PIXEL_SRC_REF; typedef typename pixel_proxy::type PIXEL_DST_REF; typedef typename Kernel::value_type kernel_type; if(ker.size()==1) {//reduces to a multiplication view_multiplies_scalar(src,*ker.begin(),dst); return; } int width=src.width(),height=src.height(); PixelAccum acc_zero; pixel_zeros_t()(acc_zero); if (width==0) return; if (option==convolve_option_output_ignore || option==convolve_option_output_zero) { typename DstView::value_type dst_zero; pixel_assigns_t()(acc_zero,dst_zero); if (width<(int)ker.size()) { if (option==convolve_option_output_zero) fill_pixels(dst,dst_zero); } else { std::vector buffer(width); for(int rr=0;rr buffer(width+ker.size()-1); for(int rr=0;rr()(*src.row_begin(rr),filler); std::fill_n(it_buffer,ker.left_size(),filler); it_buffer+=ker.left_size(); assign_pixels(src.row_begin(rr),src.row_end(rr),it_buffer); it_buffer+=width; pixel_assigns_t()(src.row_end(rr)[-1],filler); std::fill_n(it_buffer,ker.right_size(),filler); } correlator(&buffer.front(),&buffer.front()+width, ker.begin(), dst.row_begin(rr)); } } } template class correlator_n { private: std::size_t _size; public: correlator_n(std::size_t size_in) : _size(size_in) {} template void operator()(SrcIterator src_begin,SrcIterator src_end, KernelIterator ker_begin, DstIterator dst_begin) { correlate_pixels_n(src_begin,src_end,ker_begin,_size,dst_begin); } }; template struct correlator_k { public: template void operator()(SrcIterator src_begin,SrcIterator src_end, KernelIterator ker_begin, DstIterator dst_begin){ correlate_pixels_k(src_begin,src_end,ker_begin,dst_begin); } }; } // namespace detail /// \ingroup ImageAlgorithms ///correlate a 1D variable-size kernel along the rows of an image template BOOST_FORCEINLINE void correlate_rows(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option=convolve_option_extend_zero) { detail::correlate_rows_imp(src,ker,dst,option,detail::correlator_n(ker.size())); } /// \ingroup ImageAlgorithms ///correlate a 1D variable-size kernel along the columns of an image template BOOST_FORCEINLINE void correlate_cols(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option=convolve_option_extend_zero) { correlate_rows(transposed_view(src),ker,transposed_view(dst),option); } /// \ingroup ImageAlgorithms ///convolve a 1D variable-size kernel along the rows of an image template BOOST_FORCEINLINE void convolve_rows(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option=convolve_option_extend_zero) { correlate_rows(src,reverse_kernel(ker),dst,option); } /// \ingroup ImageAlgorithms ///convolve a 1D variable-size kernel along the columns of an image template BOOST_FORCEINLINE void convolve_cols(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option=convolve_option_extend_zero) { convolve_rows(transposed_view(src),ker,transposed_view(dst),option); } /// \ingroup ImageAlgorithms ///correlate a 1D fixed-size kernel along the rows of an image template BOOST_FORCEINLINE void correlate_rows_fixed(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option=convolve_option_extend_zero) { detail::correlate_rows_imp(src,ker,dst,option,detail::correlator_k()); } /// \ingroup ImageAlgorithms ///correlate a 1D fixed-size kernel along the columns of an image template BOOST_FORCEINLINE void correlate_cols_fixed(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option=convolve_option_extend_zero) { correlate_rows_fixed(transposed_view(src),ker,transposed_view(dst),option); } /// \ingroup ImageAlgorithms ///convolve a 1D fixed-size kernel along the rows of an image template BOOST_FORCEINLINE void convolve_rows_fixed(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option=convolve_option_extend_zero) { correlate_rows_fixed(src,reverse_kernel(ker),dst,option); } /// \ingroup ImageAlgorithms ///convolve a 1D fixed-size kernel along the columns of an image template BOOST_FORCEINLINE void convolve_cols_fixed(const SrcView& src, const Kernel& ker, const DstView& dst, convolve_boundary_option option=convolve_option_extend_zero) { convolve_rows_fixed(transposed_view(src),ker,transposed_view(dst),option); } } } // namespace boost::gil #endif ================================================ FILE: k3dsdk/gil/boost/gil/extension/numeric/kernel.hpp ================================================ /* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef GIL_KERNEL_HPP #define GIL_KERNEL_HPP /*! /// \file /// \brief Definitions of 1D fixed-size and variable-size kernels and related operations /// \author Hailin Jin and Lubomir Bourdev \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on September 26, 2006 */ #include #include #include #include #include #include #if BOOST_VERSION < 106900 #include #else #include #endif #include #include namespace boost { namespace gil { namespace detail { /// \brief kernel adaptor for one-dimensional cores /// Core needs to provide size(),begin(),end(),operator[], /// value_type,iterator,const_iterator,reference,const_reference template class kernel_1d_adaptor : public Core { private: std::size_t _center; public: kernel_1d_adaptor() : _center(0) {} explicit kernel_1d_adaptor(std::size_t center_in) : _center(center_in) {assert(_centersize());} kernel_1d_adaptor(std::size_t size_in,std::size_t center_in) : Core(size_in), _center(center_in) {assert(_centersize());} kernel_1d_adaptor(const kernel_1d_adaptor& k_in) : Core(k_in), _center(k_in._center) {} kernel_1d_adaptor& operator=(const kernel_1d_adaptor& k_in) { Core::operator=(k_in); _center=k_in._center; return *this; } std::size_t left_size() const {assert(_centersize());return _center;} std::size_t right_size() const {assert(_centersize());return this->size()-_center-1;} std::size_t& center() {return _center;} const std::size_t& center() const {return _center;} }; } // namespace detail /// \brief variable-size kernel template > class kernel_1d : public detail::kernel_1d_adaptor > { typedef detail::kernel_1d_adaptor > parent_t; public: kernel_1d() {} kernel_1d(std::size_t size_in,std::size_t center_in) : parent_t(size_in,center_in) {} template kernel_1d(FwdIterator elements, std::size_t size_in, std::size_t center_in) : parent_t(size_in,center_in) { detail::copy_n(elements,size_in,this->begin()); } kernel_1d(const kernel_1d& k_in) : parent_t(k_in) {} }; /// \brief static-size kernel template class kernel_1d_fixed : public detail::kernel_1d_adaptor > { typedef detail::kernel_1d_adaptor > parent_t; public: kernel_1d_fixed() {} explicit kernel_1d_fixed(std::size_t center_in) : parent_t(center_in) {} template explicit kernel_1d_fixed(FwdIterator elements, std::size_t center_in) : parent_t(center_in) { detail::copy_n(elements,Size,this->begin()); } kernel_1d_fixed(const kernel_1d_fixed& k_in) : parent_t(k_in) {} }; /// \brief reverse a kernel template inline Kernel reverse_kernel(const Kernel& kernel) { Kernel result(kernel); result.center()=kernel.right_size(); std::reverse(result.begin(), result.end()); return result; } } } // namespace boost::gil #endif ================================================ FILE: k3dsdk/gil/boost/gil/extension/numeric/pixel_numeric_operations.hpp ================================================ /* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef GIL_PIXEL_NUMERIC_OPERATIONS_HPP #define GIL_PIXEL_NUMERIC_OPERATIONS_HPP /*! /// \file /// \brief Structures for pixel-wise numeric operations /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on February 6, 2007 /// Currently defined structures: /// pixel_plus_t (+), pixel_minus_t (-) /// pixel_multiplies_scalar_t (*), pixel_divides_scalar_t (/) /// pixel_halves_t (/=2), pixel_zeros_t (=0) /// pixel_assigns_t (=) */ #include #include #if BOOST_VERSION < 106900 #include #else #include #endif #include #include #include "channel_numeric_operations.hpp" namespace boost { namespace gil { /// \ingroup PixelNumericOperations /// \brief construct for adding two pixels template // models pixel value concept struct pixel_plus_t { PixelR operator() (const PixelRef1& p1, const PixelRef2& p2) const { PixelR result; static_transform(p1,p2,result, channel_plus_t::type, typename channel_type::type, typename channel_type::type>()); return result; } }; /// \ingroup PixelNumericOperations /// \brief construct for subtracting two pixels template // models pixel value concept struct pixel_minus_t { PixelR operator() (const PixelRef1& p1, const PixelRef2& p2) const { PixelR result; static_transform(p1,p2,result, channel_minus_t::type, typename channel_type::type, typename channel_type::type>()); return result; } }; /// \ingroup PixelNumericOperations /// \brief construct for multiplying scalar to a pixel template // models pixel value concept struct pixel_multiplies_scalar_t { PixelR operator () (const PixelRef& p, const Scalar& s) const { PixelR result; static_transform(p,result, std::bind2nd(channel_multiplies_scalar_t::type, Scalar, typename channel_type::type>(),s)); return result; } }; /// \ingroup PixelNumericOperations /// \brief construct for dividing a pixel by a scalar template // models pixel value concept struct pixel_divides_scalar_t { PixelR operator () (const PixelRef& p, const Scalar& s) const { PixelR result; static_transform(p,result, std::bind2nd(channel_divides_scalar_t::type, Scalar, typename channel_type::type>(),s)); return result; } }; /// \ingroup PixelNumericOperations /// \brief construct for dividing a pixel by 2 template // models pixel concept struct pixel_halves_t { PixelRef& operator () (PixelRef& p) const { static_for_each(p,channel_halves_t::type>()); return p; } }; /// \ingroup PixelNumericOperations /// \brief construct for setting a pixel to zero (for whatever zero means) template // models pixel concept struct pixel_zeros_t { PixelRef& operator () (PixelRef& p) const { static_for_each(p,channel_zeros_t::type>()); return p; } }; // Hailin: This is how you can do it: template void zero_channels(Pixel& p) { static_for_each(p,channel_zeros_t::type>()); } /// \ingroup PixelNumericOperations ///definition and a generic implementation for casting and assigning a pixel to another ///user should specialize it for better performance template // models pixel concept struct pixel_assigns_t { PixelRefR operator () (const PixelRef& src, PixelRefR& dst) const { static_for_each(src,dst,channel_assigns_t::type, typename channel_type::type>()); return dst; } }; } } // namespace boost::gil #endif ================================================ FILE: k3dsdk/gil/boost/gil/extension/numeric/resample.hpp ================================================ /* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef GIL_RESAMPLE_HPP #define GIL_RESAMPLE_HPP #include #include #include #include "affine.hpp" //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief support for generic image resampling /// NOTE: The code is for example use only. It is not optimized for performance /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n October 30, 2006 /// //////////////////////////////////////////////////////////////////////////////////////// namespace boost { namespace gil { /////////////////////////////////////////////////////////////////////////// //// //// resample_pixels: set each pixel in the destination view as the result of a sampling function over the transformed coordinates of the source view //// /////////////////////////////////////////////////////////////////////////// template struct mapping_traits {}; /// \brief Set each pixel in the destination view as the result of a sampling function over the transformed coordinates of the source view /// \ingroup ImageAlgorithms /// /// The provided implementation works for 2D image views only template // Models MappingFunctionConcept void resample_pixels(const SrcView& src_view, const DstView& dst_view, const MapFn& dst_to_src, Sampler sampler=Sampler()) { typename DstView::point_t dst_dims=dst_view.dimensions(); typename DstView::point_t dst_p; typename mapping_traits::result_type src_p; for (dst_p.y=0; dst_p.y struct resample_pixels_fn : public binary_operation_obj > { MapFn _dst_to_src; Sampler _sampler; resample_pixels_fn(const MapFn& dst_to_src, const Sampler& sampler) : _dst_to_src(dst_to_src), _sampler(sampler) {} template BOOST_FORCEINLINE void apply_compatible(const SrcView& src, const DstView& dst) const { resample_pixels(src, dst, _dst_to_src, _sampler); } }; } /// \brief resample_pixels when the source is run-time specified /// If invoked on incompatible views, throws std::bad_cast() /// \ingroup ImageAlgorithms template void resample_pixels(const any_image_view& src, const V2& dst, const MapFn& dst_to_src, Sampler sampler=Sampler()) { apply_operation(src,bind(detail::resample_pixels_fn(dst_to_src,sampler), _1, dst)); } /// \brief resample_pixels when the destination is run-time specified /// If invoked on incompatible views, throws std::bad_cast() /// \ingroup ImageAlgorithms template void resample_pixels(const V1& src, const any_image_view& dst, const MapFn& dst_to_src, Sampler sampler=Sampler()) { apply_operation(dst,bind(detail::resample_pixels_fn(dst_to_src,sampler), src, _1)); } /// \brief resample_pixels when both the source and the destination are run-time specified /// If invoked on incompatible views, throws std::bad_cast() /// \ingroup ImageAlgorithms template void resample_pixels(const any_image_view& src, const any_image_view& dst, const MapFn& dst_to_src, Sampler sampler=Sampler()) { apply_operation(src,dst,detail::resample_pixels_fn(dst_to_src,sampler)); } /////////////////////////////////////////////////////////////////////////// //// //// resample_subimage: copy into the destination a rotated rectangular region from the source, rescaling it to fit into the destination //// /////////////////////////////////////////////////////////////////////////// // Extract into dst the rotated bounds [src_min..src_max] rotated at 'angle' from the source view 'src' // The source coordinates are in the coordinate space of the source image // Note that the views could also be variants (i.e. any_image_view) template void resample_subimage(const SrcMetaView& src, const DstMetaView& dst, double src_min_x, double src_min_y, double src_max_x, double src_max_y, double angle, const Sampler& sampler=Sampler()) { double src_width = std::max(src_max_x - src_min_x - 1,1); double src_height = std::max(src_max_y - src_min_y - 1,1); double dst_width = std::max(dst.width()-1,1); double dst_height = std::max(dst.height()-1,1); matrix3x2 mat = matrix3x2::get_translate(-dst_width/2.0, -dst_height/2.0) * matrix3x2::get_scale(src_width / dst_width, src_height / dst_height)* matrix3x2::get_rotate(-angle)* matrix3x2::get_translate(src_min_x + src_width/2.0, src_min_y + src_height/2.0); resample_pixels(src,dst,mat,sampler); } /////////////////////////////////////////////////////////////////////////// //// //// resize_view: Copy the source view into the destination, scaling to fit //// /////////////////////////////////////////////////////////////////////////// template void resize_view(const SrcMetaView& src, const DstMetaView& dst, const Sampler& sampler=Sampler()) { resample_subimage(src,dst,0,0,src.width(),src.height(),0,sampler); } } } // namespace boost::gil #endif ================================================ FILE: k3dsdk/gil/boost/gil/extension/numeric/sampler.hpp ================================================ /* Copyright 2005-2007 Adobe Systems Incorporated Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt or a copy at http://opensource.adobe.com/licenses.html) */ /*************************************************************************************************/ #ifndef GIL_SAMPLER_HPP #define GIL_SAMPLER_HPP #include #include "pixel_numeric_operations.hpp" //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief Nearest-neighbor and bilinear image samplers. /// NOTE: The code is for example use only. It is not optimized for performance /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n October 30, 2006 /// //////////////////////////////////////////////////////////////////////////////////////// namespace boost { namespace gil { /////////////////////////////////////////////////////////////////////////// //// //// resample_pixels: set each pixel in the destination view as the result of a sampling function over the transformed coordinates of the source view //// /////////////////////////////////////////////////////////////////////////// /* template concept SamplerConcept { template // Models PointNDConcept, where S_COORDS::num_dimensions == SrcView::num_dimensions bool sample(const Sampler& s, const SrcView& src, const S_COORDS& p, DstP result); }; */ /// \brief A sampler that sets the destination pixel to the closest one in the source. If outside the bounds, it doesn't change the destination /// \ingroup ImageAlgorithms struct nearest_neighbor_sampler {}; template bool sample(nearest_neighbor_sampler, const SrcView& src, const point2& p, DstP& result) { point2 center(iround(p)); if (center.x>=0 && center.y>=0 && center.x void cast_pixel(const SrcPixel& src, DstPixel& dst) { static_for_each(src,dst,channel_assigns_t::type, typename channel_type::type>()); } namespace detail { template struct add_dst_mul_src_channel { Weight _w; add_dst_mul_src_channel(Weight w) : _w(w) {} template void operator()(const SrcChannel& src, DstChannel& dst) const { dst += DstChannel(src*_w); } }; // dst += DST_TYPE(src * w) template struct add_dst_mul_src { void operator()(const SrcP& src, Weight weight, DstP& dst) const { static_for_each(src,dst, add_dst_mul_src_channel(weight)); // pixel_assigns_t()( // pixel_plus_t()( // pixel_multiplies_scalar_t()(src,weight), // dst), // dst); } }; } // namespace detail /// \brief A sampler that sets the destination pixel as the bilinear interpolation of the four closest pixels from the source. /// If outside the bounds, it doesn't change the destination /// \ingroup ImageAlgorithms struct bilinear_sampler {}; template bool sample(bilinear_sampler, const SrcView& src, const point2& p, DstP& result) { typedef typename SrcView::value_type SrcP; point2 p0(ifloor(p)); // the closest integer coordinate top left from p point2 frac(p.x-p0.x, p.y-p0.y); if (p0.x < 0 || p0.y < 0 || p0.x>=src.width() || p0.y>=src.height()) return false; pixel::value> > mp(0); // suboptimal typename SrcView::xy_locator loc=src.xy_at(p0.x,p0.y); if (p0.x+1::value> > >()(*loc, (1-frac.x)*(1-frac.y),mp); detail::add_dst_mul_src::value> > >()(loc.x()[1], frac.x *(1-frac.y),mp); ++loc.y(); detail::add_dst_mul_src::value> > >()(*loc, (1-frac.x)* frac.y ,mp); detail::add_dst_mul_src::value> > >()(loc.x()[1], frac.x * frac.y ,mp); } else { // on the last row, but not the bottom-right corner pixel detail::add_dst_mul_src::value> > >()(*loc, (1-frac.x),mp); detail::add_dst_mul_src::value> > >()(loc.x()[1], frac.x ,mp); } } else { if (p0.y+1::value> > >()(*loc, (1-frac.y),mp); ++loc.y(); detail::add_dst_mul_src::value> > >()(*loc, frac.y ,mp); } else { // the bottom-right corner pixel detail::add_dst_mul_src::value> > >()(*loc,1,mp); } } // pixel_assigns_t::value> >,DstP&>()(mp,result); cast_pixel(mp,result); return true; } } } // namespace boost::gil #endif ================================================ FILE: k3dsdk/gil/boost/uuid/nil_generator.hpp ================================================ // Boost nil_generator.hpp header file ----------------------------------------------// // Copyright 2010 Andy Tompkins. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UUID_NIL_GENERATOR_HPP #define BOOST_UUID_NIL_GENERATOR_HPP #include namespace boost { namespace uuids { // generate a nil uuid struct nil_generator { typedef uuid result_type; uuid operator()() const { // initialize to all zeros uuid u = {{0}}; return u; } }; inline uuid nil_uuid() { return nil_generator()(); } }} // namespace boost::uuids #endif // BOOST_UUID_NIL_GENERATOR_HPP ================================================ FILE: k3dsdk/gil/boost/uuid/random_generator.hpp ================================================ // Boost random_generator.hpp header file ----------------------------------------------// // Copyright 2010 Andy Tompkins. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_UUID_RANDOM_GENERATOR_HPP #define BOOST_UUID_RANDOM_GENERATOR_HPP #include #include #include #include #include #include #include #include namespace boost { namespace uuids { // generate a random-based uuid template class basic_random_generator { private: typedef uniform_int distribution_type; typedef variate_generator generator_type; struct null_deleter { void operator()(void const *) const {} }; public: typedef uuid result_type; // default constructor creates the random number generator basic_random_generator() : pURNG(new UniformRandomNumberGenerator) , generator ( pURNG.get() , distribution_type ( (std::numeric_limits::min)() , (std::numeric_limits::max)() ) ) { // seed the random number generator detail::seed(*pURNG); } // keep a reference to a random number generator // don't seed a given random number generator explicit basic_random_generator(UniformRandomNumberGenerator& gen) : pURNG(&gen, null_deleter()) , generator ( pURNG.get() , distribution_type ( (std::numeric_limits::min)() , (std::numeric_limits::max)() ) ) {} // keep a pointer to a random number generator // don't seed a given random number generator explicit basic_random_generator(UniformRandomNumberGenerator* pGen) : pURNG(pGen, null_deleter()) , generator ( pURNG.get() , distribution_type ( (std::numeric_limits::min)() , (std::numeric_limits::max)() ) ) { BOOST_ASSERT(pURNG); } uuid operator()() { uuid u; int i=0; unsigned long random_value = generator(); for (uuid::iterator it=u.begin(); it!=u.end(); ++it, ++i) { if (i==sizeof(unsigned long)) { random_value = generator(); i = 0; } *it = ((random_value >> (i*8)) & 0xFF); } // set variant // must be 0b10xxxxxx *(u.begin()+8) &= 0xBF; *(u.begin()+8) |= 0x80; // set version // must be 0b0100xxxx *(u.begin()+6) &= 0x4F; //0b01001111 *(u.begin()+6) |= 0x40; //0b01000000 return u; } private: shared_ptr pURNG; generator_type generator; }; typedef basic_random_generator random_generator; }} // namespace boost::uuids #endif //BOOST_UUID_RANDOM_GENERATOR_HPP ================================================ FILE: k3dsdk/gil/boost/uuid/seed_rng.hpp ================================================ // Boost seed_rng.hpp header file ----------------------------------------------// // Copyright 2007 Andy Tompkins. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Revision History // 09 Nov 2007 - Initial Revision // 25 Feb 2008 - moved to namespace boost::uuids::detail // 28 Nov 2009 - disabled deprecated warnings for MSVC // seed_rng models a UniformRandomNumberGenerator (see Boost.Random). // Random number generators are hard to seed well. This is intended to provide // good seed values for random number generators. // It creates random numbers from a sha1 hash of data from a variary of sources, // all of which are standard function calls. It produces random numbers slowly. // Peter Dimov provided the details of sha1_random_digest_(). // see http://archives.free.net.ph/message/20070507.175609.4c4f503a.en.html #ifndef BOOST_UUID_SEED_RNG_HPP #define BOOST_UUID_SEED_RNG_HPP #include #include // for memcpy #include #include #include // for time_t, time, clock_t, clock #include // for rand #include // for FILE, fopen, fread, fclose #include //#include //forward declare boost::random_device // can't use boost::generator_iterator since boost::random number seed(Iter&, Iter) // functions need a last iterator //#include # include #if defined(_MSC_VER) #pragma warning(push) // Save warning settings. #pragma warning(disable : 4996) // Disable deprecated std::fopen #endif #ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::memcpy; using ::time_t; using ::time; using ::clock_t; using ::clock; using ::rand; using ::FILE; using ::fopen; using ::fread; using ::fclose; } //namespace std #endif // forward declare random number generators namespace boost { class random_device; } //namespace boost namespace boost { namespace uuids { namespace detail { // should this be part of Boost.Random? class seed_rng { public: typedef unsigned int result_type; BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); //BOOST_STATIC_CONSTANT(unsigned int, min_value = 0); //BOOST_STATIC_CONSTANT(unsigned int, max_value = UINT_MAX); public: // note: rd_ intentionally left uninitialized seed_rng() : rd_index_(5) , random_(std::fopen( "/dev/urandom", "rb" )) {} ~seed_rng() { if (random_) { std::fclose(random_); } } result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (std::numeric_limits::min)(); } result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (std::numeric_limits::max)(); } result_type operator()() { if (rd_index_ >= 5) { //get new digest sha1_random_digest_(); rd_index_ = 0; } return rd_[rd_index_++]; } private: static unsigned int * sha1_random_digest_state_() { // intentionally left uninitialized static unsigned int state[ 5 ]; return state; } void sha1_random_digest_() { boost::uuids::detail::sha1 sha; unsigned int * ps = sha1_random_digest_state_(); unsigned int state[ 5 ]; std::memcpy( state, ps, sizeof( state ) ); // harmless data race sha.process_bytes( (unsigned char const*)state, sizeof( state ) ); sha.process_bytes( (unsigned char const*)&ps, sizeof( ps ) ); { std::time_t tm = std::time( 0 ); sha.process_bytes( (unsigned char const*)&tm, sizeof( tm ) ); } { std::clock_t ck = std::clock(); sha.process_bytes( (unsigned char const*)&ck, sizeof( ck ) ); } { unsigned int rn[] = { static_cast(std::rand()), static_cast(std::rand()), static_cast(std::rand()) }; sha.process_bytes( (unsigned char const*)rn, sizeof( rn ) ); } { // intentionally left uninitialized unsigned char buffer[ 20 ]; if(random_) { std::fread( buffer, 1, 20, random_ ); } // using an uninitialized buffer[] if fopen fails // intentional, we rely on its contents being random sha.process_bytes( buffer, sizeof( buffer ) ); } { // *p is intentionally left uninitialized unsigned int * p = new unsigned int; sha.process_bytes( (unsigned char const*)p, sizeof( *p ) ); sha.process_bytes( (unsigned char const*)&p, sizeof( p ) ); delete p; } sha.process_bytes( (unsigned char const*)rd_, sizeof( rd_ ) ); unsigned int digest[ 5 ]; sha.get_digest( digest ); for( int i = 0; i < 5; ++i ) { // harmless data race ps[ i ] ^= digest[ i ]; rd_[ i ] ^= digest[ i ]; } } private: unsigned int rd_[5]; int rd_index_; std::FILE * random_; private: // make seed_rng noncopyable seed_rng(seed_rng const&); seed_rng& operator=(seed_rng const&); }; // almost a copy of boost::generator_iterator // but default constructor sets m_g to NULL template class generator_iterator : public iterator_facade< generator_iterator , typename Generator::result_type , single_pass_traversal_tag , typename Generator::result_type const& > { typedef iterator_facade< generator_iterator , typename Generator::result_type , single_pass_traversal_tag , typename Generator::result_type const& > super_t; public: generator_iterator() : m_g(NULL) {} generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {} void increment() { m_value = (*m_g)(); } const typename Generator::result_type& dereference() const { return m_value; } bool equal(generator_iterator const& y) const { return this->m_g == y.m_g && this->m_value == y.m_value; } private: Generator* m_g; typename Generator::result_type m_value; }; // seed() seeds a random number generator with good seed values template inline void seed(UniformRandomNumberGenerator& rng) { seed_rng seed_gen; generator_iterator begin(&seed_gen); generator_iterator end; rng.seed(begin, end); } // random_device does not / can not be seeded template <> inline void seed(boost::random_device&) {} // random_device does not / can not be seeded template <> inline void seed(seed_rng&) {} }}} //namespace boost::uuids::detail #if defined(_MSC_VER) #pragma warning(pop) // Restore warnings to previous state. #endif #endif ================================================ FILE: k3dsdk/gil/boost/uuid/sha1.hpp ================================================ // boost/uuid/sha1.hpp header file ----------------------------------------------// // Copyright 2007 Andy Tompkins. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Revision History // 29 May 2007 - Initial Revision // 25 Feb 2008 - moved to namespace boost::uuids::detail // This is a byte oriented implementation // Note: this implementation does not handle message longer than // 2^32 bytes. #ifndef BOOST_UUID_SHA1_H #define BOOST_UUID_SHA1_H #include #include #ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::size_t; } // namespace std #endif namespace boost { namespace uuids { namespace detail { BOOST_STATIC_ASSERT(sizeof(unsigned char)*8 == 8); BOOST_STATIC_ASSERT(sizeof(unsigned int)*8 == 32); inline unsigned int left_rotate(unsigned int x, std::size_t n) { return (x<> (32-n)); } class sha1 { public: typedef unsigned int(&digest_type)[5]; public: sha1(); void reset(); void process_byte(unsigned char byte); void process_block(void const* bytes_begin, void const* bytes_end); void process_bytes(void const* buffer, std::size_t byte_count); void get_digest(digest_type digest); private: void process_block(); private: unsigned int h_[5]; unsigned char block_[64]; std::size_t block_byte_index_; std::size_t byte_count_; }; inline sha1::sha1() { reset(); } inline void sha1::reset() { h_[0] = 0x67452301; h_[1] = 0xEFCDAB89; h_[2] = 0x98BADCFE; h_[3] = 0x10325476; h_[4] = 0xC3D2E1F0; block_byte_index_ = 0; byte_count_ = 0; } inline void sha1::process_byte(unsigned char byte) { block_[block_byte_index_++] = byte; ++byte_count_; if (block_byte_index_ == 64) { block_byte_index_ = 0; process_block(); } } inline void sha1::process_block(void const* bytes_begin, void const* bytes_end) { unsigned char const* begin = static_cast(bytes_begin); unsigned char const* end = static_cast(bytes_end); for(; begin != end; ++begin) { process_byte(*begin); } } inline void sha1::process_bytes(void const* buffer, std::size_t byte_count) { unsigned char const* b = static_cast(buffer); process_block(b, b+byte_count); } inline void sha1::process_block() { unsigned int w[80]; for (std::size_t i=0; i<16; ++i) { w[i] = (block_[i*4 + 0] << 24); w[i] |= (block_[i*4 + 1] << 16); w[i] |= (block_[i*4 + 2] << 8); w[i] |= (block_[i*4 + 3]); } for (std::size_t i=16; i<80; ++i) { w[i] = left_rotate((w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16]), 1); } unsigned int a = h_[0]; unsigned int b = h_[1]; unsigned int c = h_[2]; unsigned int d = h_[3]; unsigned int e = h_[4]; for (std::size_t i=0; i<80; ++i) { unsigned int f; unsigned int k; if (i<20) { f = (b & c) | (~b & d); k = 0x5A827999; } else if (i<40) { f = b ^ c ^ d; k = 0x6ED9EBA1; } else if (i<60) { f = (b & c) | (b & d) | (c & d); k = 0x8F1BBCDC; } else { f = b ^ c ^ d; k = 0xCA62C1D6; } unsigned temp = left_rotate(a, 5) + f + e + k + w[i]; e = d; d = c; c = left_rotate(b, 30); b = a; a = temp; } h_[0] += a; h_[1] += b; h_[2] += c; h_[3] += d; h_[4] += e; } inline void sha1::get_digest(digest_type digest) { std::size_t bit_count = byte_count_*8; // append the bit '1' to the message process_byte(0x80); // append k bits '0', where k is the minimum number >= 0 // such that the resulting message length is congruent to 56 (mod 64) // check if there is enough space for padding and bit_count if (block_byte_index_ > 56) { // finish this block while (block_byte_index_ != 0) { process_byte(0); } // one more block while (block_byte_index_ < 56) { process_byte(0); } } else { while (block_byte_index_ < 56) { process_byte(0); } } // append length of message (before pre-processing) // as a 64-bit big-endian integer process_byte(0); process_byte(0); process_byte(0); process_byte(0); process_byte( static_cast((bit_count>>24) & 0xFF)); process_byte( static_cast((bit_count>>16) & 0xFF)); process_byte( static_cast((bit_count>>8 ) & 0xFF)); process_byte( static_cast((bit_count) & 0xFF)); // get final digest digest[0] = h_[0]; digest[1] = h_[1]; digest[2] = h_[2]; digest[3] = h_[3]; digest[4] = h_[4]; } }}} // namespace boost::uuids::detail #endif ================================================ FILE: k3dsdk/gl/CMakeLists.txt ================================================ FILE(GLOB HEADERS *.h) FILE(GLOB SOURCES *.cpp) LIST(SORT HEADERS) LIST(SORT SOURCES) K3D_ADD_LIBRARY(k3dsdk-opengl SHARED ${HEADERS} ${SOURCES}) K3D_GENERATE_DEF_FILE(K3dsdk-opengl) TARGET_LINK_LIBRARIES(k3dsdk-opengl k3dsdk ) INSTALL(TARGETS k3dsdk-opengl RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) ================================================ FILE: k3dsdk/gl/context.cpp ================================================ // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace gl { static context*& g_current() { static context* storage = 0; return storage; } static GLEWContext*& g_current_glew() { static GLEWContext* storage = 0; return storage; } void context::begin() { g_current() = this; g_current_glew() = glew_context(); on_begin(); } context* context::current() { return g_current(); } GLEWContext* context::current_glew_context() { return g_current_glew(); } void context::end() { on_end(); g_current() = 0; } GLEWContext* context::glew_context() { if(!m_glew_context) { on_begin(); m_glew_context.reset(new GLEWContext()); g_current_glew() = m_glew_context.get(); GLenum err = glewInit(); // needs to be called after context creation if (GLEW_OK != err) { k3d::log() << error << "GLEW init failed: " << glewGetErrorString(err) << std::endl; m_glew_context.reset(); } on_end(); assert(m_glew_context); } return m_glew_context.get(); } } // namespace gl } // namespace k3d ================================================ FILE: k3dsdk/gl/context.h ================================================ #ifndef K3DSDK_GL_CONTEXT_H #define K3DSDK_GL_CONTEXT_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #if K3D_GLEW_MAJOR_VERSION > 1 struct GLEWContext {}; #endif namespace k3d { namespace gl { /// Abstract interface implemented by OpenGL context objects class context : public virtual iunknown { public: virtual ~context() {} /// Activates this context for drawing in the calling thread void begin(); /// Returns the currently-active context, if any, or NULL. static context* current(); /// Returns the currently-active GLEW context, if any, or NULL. Mostly used internally by GLEW static GLEWContext* current_glew_context(); /// If the context is double-buffered, swaps the front and back buffers. Otherwise, a no-op. void end(); /// Return the GLEW context associated with this context, or NULL if there is none GLEWContext* glew_context(); protected: context() {} context(const context&) {} context& operator=(const context&) { return *this; } /// Concrete implementations should activate this context for drawing in the calling thread virtual void on_begin() = 0; /// If the context is double-buffered, concrete implementations should swap the front and back buffers. Otherwise, a no-op. virtual void on_end() = 0; private: boost::scoped_ptr m_glew_context; }; } // namespace gl } // namespace k3d #define glewGetContext() k3d::gl::context::current_glew_context() #endif // !K3DSDK_GL_CONTEXT_H ================================================ FILE: k3dsdk/gl/context_factory.h ================================================ #ifndef K3DSDK_GL_CONTEXT_FACTORY_H #define K3DSDK_GL_CONTEXT_FACTORY_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace gl { class context; /// Abstract interface implemented by objects that can create OpenGL render context objects, class context_factory : public virtual iunknown { public: virtual ~context_factory() {} /// Creates a new OpenGL render context for use with the given drawable. Note that /// the drawable could be an X11 XID, a Windows HWND, etc. The caller is responsible /// for the lifetime of the returned object. virtual context* create(uint64_t Drawable) = 0; protected: context_factory() {} context_factory(const context_factory&) {} context_factory& operator=(const context_factory&) { return *this; } }; } // namespace gl } // namespace k3d #endif // !K3DSDK_GL_CONTEXT_FACTORY_H ================================================ FILE: k3dsdk/gl/enum.spec ================================================ # This is the OpenGL and OpenGL ES enumerant registry. # # It is an extremely important file. Do not mess with it unless # you know what you're doing and have permission to do so. # # $Revision: 10796 $ on $Date: 2010-03-19 17:31:10 -0700 (Fri, 19 Mar 2010) $ ############################################################################### # # Before modifying this file, read the following: # # ONLY the Khronos API Registrar (Jon Leech, jon 'at' alumni.caltech.edu) # may allocate new enumerants outside the 'experimental' range described # below. Any modifications to this file not performed by the Registrar # are incompatible with the OpenGL API. The master copy of the registry, # showing up-to-date enumerant allocations, is maintained in the # OpenGL registry at # # http://www.opengl.org/registry/ # # The following guidelines are thus only for reference purposes # (unless you're the Registrar) # # Enumerant values for extensions CANNOT be chosen arbitrarily, since # the enumerant value space is shared by all GL implementations. It is # therefore imperative that the procedures described in this file be # followed carefully when allocating extension enum values. # # - Use tabs, not spaces. # # - When adding enum values for a new extension, use existing extensions # as a guide. # # - When a vendor has committed to releasing a new extension and needs to # allocate enum values for that extension, the vendor may request that the # ARB allocate a previously unallocated block of 16 enum values, in the # range 0x8000-0xFFFF, for the vendor's exclusive use. # # - The vendor that introduces an extension will allocate enum values for # it as if it is a single-vendor extension, even if it is a multi-vendor # (EXT) extension. # # - The file enum.spec is primarily a reference. The file enumext.spec # contains enumerants for all OpenGL 1.2 and OpenGL extensions in a form # used to generate . # # - If a vendor hasn't yet released an extension, just add a comment to # enum.spec that contains the name of the extension and the range of enum # values used by the extension. When the vendor releases the extension, # put the actual enum assignments in enum.spec and enumext.spec. # # - Allocate all of the enum values for an extension in a single contiguous # block. # # - If an extension is experimental, allocate temporary enum values in the # range 0x6000-0x8000 during development work. When the vendor commits to # releasing the extension, allocate permanent enum values (see below). # There are two reasons for this policy: # # 1. It is desirable to keep extension enum values tightly packed and to # make all of the enum values for an extension be contiguous. This is # possible only if permanent enum values for a new extension are not # allocated until the extension spec is stable and the number of new # enum values needed by the extension has therefore stopped changing. # # 2. OpenGL ARB policy is that a vendor may allocate a new block of 16 # extension enum values only if it has committed to releasing an # extension that will use values in that block. # # - To allocate a new block of permanent enum values for an extension, do the # following: # # 1. Start at the top of enum.spec and choose the first future_use # range that is not allocated to another vendor and is large enough # to contain the new block. This will almost certainly be the # 'Any_vendor_future_use' range near the end of enum.spec. This # process helps keep allocated enum values tightly packed into # the start of the 0x8000-0xFFFF range. # # 2. Allocate a block of enum values at the start of this range. If # the enum definitions are going into enumfuture.spec, add a comment # to enum.spec that contains the name of the extension and the range # of values in the new block. Use existing extensions as a guide. # # 3. Add the size of the block you just allocated to the start of the # chosen future_use range. If you have allocated the entire range, # eliminate its future_use entry. # # 4. Note that there are historical enum allocations above 0xFFFF, but # no new allocations will be made there in the forseeable future. # ############################################################################### Extensions define: VERSION_1_1 = 1 VERSION_1_2 = 1 VERSION_1_3 = 1 VERSION_1_4 = 1 VERSION_1_5 = 1 VERSION_2_0 = 1 VERSION_2_1 = 1 VERSION_3_0 = 1 VERSION_3_1 = 1 VERSION_3_2 = 1 ARB_imaging = 1 EXT_abgr = 1 EXT_blend_color = 1 EXT_blend_logic_op = 1 EXT_blend_minmax = 1 EXT_blend_subtract = 1 EXT_cmyka = 1 EXT_convolution = 1 EXT_copy_texture = 1 EXT_histogram = 1 EXT_packed_pixels = 1 EXT_point_parameters = 1 EXT_polygon_offset = 1 EXT_rescale_normal = 1 EXT_shared_texture_palette = 1 EXT_subtexture = 1 EXT_texture = 1 EXT_texture3D = 1 EXT_texture_object = 1 EXT_vertex_array = 1 SGIS_detail_texture = 1 SGIS_fog_function = 1 SGIS_generate_mipmap = 1 SGIS_multisample = 1 SGIS_pixel_texture = 1 SGIS_point_line_texgen = 1 SGIS_point_parameters = 1 SGIS_sharpen_texture = 1 SGIS_texture4D = 1 SGIS_texture_border_clamp = 1 SGIS_texture_edge_clamp = 1 SGIS_texture_filter4 = 1 SGIS_texture_lod = 1 SGIS_texture_select = 1 SGIX_async = 1 SGIX_async_histogram = 1 SGIX_async_pixel = 1 SGIX_blend_alpha_minmax = 1 SGIX_calligraphic_fragment = 1 SGIX_clipmap = 1 SGIX_convolution_accuracy = 1 SGIX_depth_texture = 1 SGIX_flush_raster = 1 SGIX_fog_offset = 1 SGIX_fragment_lighting = 1 SGIX_framezoom = 1 SGIX_icc_texture = 1 SGIX_impact_pixel_texture = 1 SGIX_instruments = 1 SGIX_interlace = 1 SGIX_ir_instrument1 = 1 SGIX_list_priority = 1 SGIX_pixel_texture = 1 SGIX_pixel_tiles = 1 SGIX_polynomial_ffd = 1 SGIX_reference_plane = 1 SGIX_resample = 1 SGIX_scalebias_hint = 1 SGIX_shadow = 1 SGIX_shadow_ambient = 1 SGIX_sprite = 1 SGIX_subsample = 1 SGIX_tag_sample_buffer = 1 SGIX_texture_add_env = 1 SGIX_texture_coordinate_clamp = 1 SGIX_texture_lod_bias = 1 SGIX_texture_multi_buffer = 1 SGIX_texture_scale_bias = 1 SGIX_vertex_preclip = 1 SGIX_ycrcb = 1 SGI_color_matrix = 1 SGI_color_table = 1 SGI_texture_color_table = 1 ############################################################################### AttribMask enum: CURRENT_BIT = 0x00000001 POINT_BIT = 0x00000002 LINE_BIT = 0x00000004 POLYGON_BIT = 0x00000008 POLYGON_STIPPLE_BIT = 0x00000010 PIXEL_MODE_BIT = 0x00000020 LIGHTING_BIT = 0x00000040 FOG_BIT = 0x00000080 DEPTH_BUFFER_BIT = 0x00000100 ACCUM_BUFFER_BIT = 0x00000200 STENCIL_BUFFER_BIT = 0x00000400 VIEWPORT_BIT = 0x00000800 TRANSFORM_BIT = 0x00001000 ENABLE_BIT = 0x00002000 COLOR_BUFFER_BIT = 0x00004000 HINT_BIT = 0x00008000 EVAL_BIT = 0x00010000 LIST_BIT = 0x00020000 TEXTURE_BIT = 0x00040000 SCISSOR_BIT = 0x00080000 ALL_ATTRIB_BITS = 0xFFFFFFFF #??? ALL_ATTRIB_BITS mask value changed to all-1s in OpenGL 1.3 - this affects covgl. # use ARB_multisample MULTISAMPLE_BIT_ARB # use EXT_multisample MULTISAMPLE_BIT_EXT # use 3DFX_multisample MULTISAMPLE_BIT_3DFX VERSION_1_3 enum: (Promoted for OpenGL 1.3) MULTISAMPLE_BIT = 0x20000000 ARB_multisample enum: MULTISAMPLE_BIT_ARB = 0x20000000 EXT_multisample enum: MULTISAMPLE_BIT_EXT = 0x20000000 3DFX_multisample enum: MULTISAMPLE_BIT_3DFX = 0x20000000 ############################################################################### # Note that COVERAGE_BUFFER_BIT_NV collides with AttribMask bit # HINT_BIT. This is OK since the extension is for OpenGL ES 2, which # doesn't have attribute groups. ClearBufferMask enum: use AttribMask DEPTH_BUFFER_BIT # = 0x00000100 use AttribMask ACCUM_BUFFER_BIT # = 0x00000200 use AttribMask STENCIL_BUFFER_BIT # = 0x00000400 use AttribMask COLOR_BUFFER_BIT # = 0x00004000 use NV_coverage_sample COVERAGE_BUFFER_BIT_NV # = 0x00008000 ############################################################################### ClientAttribMask enum: CLIENT_PIXEL_STORE_BIT = 0x00000001 CLIENT_VERTEX_ARRAY_BIT = 0x00000002 CLIENT_ALL_ATTRIB_BITS = 0xFFFFFFFF ############################################################################### # There's no obvious better place to put non-attribute-group mask bits VERSION_3_0 enum: use ARB_map_buffer_range MAP_READ_BIT use ARB_map_buffer_range MAP_WRITE_BIT use ARB_map_buffer_range MAP_INVALIDATE_RANGE_BIT use ARB_map_buffer_range MAP_INVALIDATE_BUFFER_BIT use ARB_map_buffer_range MAP_FLUSH_EXPLICIT_BIT use ARB_map_buffer_range MAP_UNSYNCHRONIZED_BIT ARB_map_buffer_range enum: MAP_READ_BIT = 0x0001 # VERSION_3_0 / ARB_mbr MAP_WRITE_BIT = 0x0002 # VERSION_3_0 / ARB_mbr MAP_INVALIDATE_RANGE_BIT = 0x0004 # VERSION_3_0 / ARB_mbr MAP_INVALIDATE_BUFFER_BIT = 0x0008 # VERSION_3_0 / ARB_mbr MAP_FLUSH_EXPLICIT_BIT = 0x0010 # VERSION_3_0 / ARB_mbr MAP_UNSYNCHRONIZED_BIT = 0x0020 # VERSION_3_0 / ARB_mbr ############################################################################### VERSION_3_0 enum: CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001 # VERSION_3_0 ############################################################################### Boolean enum: FALSE = 0 TRUE = 1 ############################################################################### BeginMode enum: POINTS = 0x0000 LINES = 0x0001 LINE_LOOP = 0x0002 LINE_STRIP = 0x0003 TRIANGLES = 0x0004 TRIANGLE_STRIP = 0x0005 TRIANGLE_FAN = 0x0006 QUADS = 0x0007 QUAD_STRIP = 0x0008 POLYGON = 0x0009 VERSION_3_2 enum: LINES_ADJACENCY = 0x000A LINE_STRIP_ADJACENCY = 0x000B TRIANGLES_ADJACENCY = 0x000C TRIANGLE_STRIP_ADJACENCY = 0x000D ARB_geometry_shader4 enum: (additional; see below) LINES_ADJACENCY_ARB = 0x000A LINE_STRIP_ADJACENCY_ARB = 0x000B TRIANGLES_ADJACENCY_ARB = 0x000C TRIANGLE_STRIP_ADJACENCY_ARB = 0x000D NV_geometry_program4 enum: (additional; see below) LINES_ADJACENCY_EXT = 0x000A LINE_STRIP_ADJACENCY_EXT = 0x000B TRIANGLES_ADJACENCY_EXT = 0x000C TRIANGLE_STRIP_ADJACENCY_EXT = 0x000D # BeginMode_future_use: 0x000E ############################################################################### AccumOp enum: ACCUM = 0x0100 LOAD = 0x0101 RETURN = 0x0102 MULT = 0x0103 ADD = 0x0104 ############################################################################### AlphaFunction enum: NEVER = 0x0200 LESS = 0x0201 EQUAL = 0x0202 LEQUAL = 0x0203 GREATER = 0x0204 NOTEQUAL = 0x0205 GEQUAL = 0x0206 ALWAYS = 0x0207 ############################################################################### BlendingFactorDest enum: ZERO = 0 ONE = 1 SRC_COLOR = 0x0300 ONE_MINUS_SRC_COLOR = 0x0301 SRC_ALPHA = 0x0302 ONE_MINUS_SRC_ALPHA = 0x0303 DST_ALPHA = 0x0304 ONE_MINUS_DST_ALPHA = 0x0305 use EXT_blend_color CONSTANT_COLOR_EXT use EXT_blend_color ONE_MINUS_CONSTANT_COLOR_EXT use EXT_blend_color CONSTANT_ALPHA_EXT use EXT_blend_color ONE_MINUS_CONSTANT_ALPHA_EXT ############################################################################### BlendingFactorSrc enum: use BlendingFactorDest ZERO use BlendingFactorDest ONE DST_COLOR = 0x0306 ONE_MINUS_DST_COLOR = 0x0307 SRC_ALPHA_SATURATE = 0x0308 use BlendingFactorDest SRC_ALPHA use BlendingFactorDest ONE_MINUS_SRC_ALPHA use BlendingFactorDest DST_ALPHA use BlendingFactorDest ONE_MINUS_DST_ALPHA use EXT_blend_color CONSTANT_COLOR_EXT use EXT_blend_color ONE_MINUS_CONSTANT_COLOR_EXT use EXT_blend_color CONSTANT_ALPHA_EXT use EXT_blend_color ONE_MINUS_CONSTANT_ALPHA_EXT ############################################################################### BlendEquationModeEXT enum: use GetPName LOGIC_OP use EXT_blend_minmax FUNC_ADD_EXT use EXT_blend_minmax MIN_EXT use EXT_blend_minmax MAX_EXT use EXT_blend_subtract FUNC_SUBTRACT_EXT use EXT_blend_subtract FUNC_REVERSE_SUBTRACT_EXT use SGIX_blend_alpha_minmax ALPHA_MIN_SGIX use SGIX_blend_alpha_minmax ALPHA_MAX_SGIX ############################################################################### ColorMaterialFace enum: use DrawBufferMode FRONT use DrawBufferMode BACK use DrawBufferMode FRONT_AND_BACK ############################################################################### ColorMaterialParameter enum: use LightParameter AMBIENT use LightParameter DIFFUSE use LightParameter SPECULAR use MaterialParameter EMISSION use MaterialParameter AMBIENT_AND_DIFFUSE ############################################################################### ColorPointerType enum: use DataType BYTE use DataType UNSIGNED_BYTE use DataType SHORT use DataType UNSIGNED_SHORT use DataType INT use DataType UNSIGNED_INT use DataType FLOAT use DataType DOUBLE ############################################################################### ColorTableParameterPNameSGI enum: use SGI_color_table COLOR_TABLE_SCALE_SGI use SGI_color_table COLOR_TABLE_BIAS_SGI ############################################################################### ColorTableTargetSGI enum: use SGI_color_table COLOR_TABLE_SGI use SGI_color_table POST_CONVOLUTION_COLOR_TABLE_SGI use SGI_color_table POST_COLOR_MATRIX_COLOR_TABLE_SGI use SGI_color_table PROXY_COLOR_TABLE_SGI use SGI_color_table PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI use SGI_color_table PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI use SGI_texture_color_table TEXTURE_COLOR_TABLE_SGI use SGI_texture_color_table PROXY_TEXTURE_COLOR_TABLE_SGI ############################################################################### ConvolutionBorderModeEXT enum: use EXT_convolution REDUCE_EXT ############################################################################### ConvolutionParameterEXT enum: use EXT_convolution CONVOLUTION_BORDER_MODE_EXT use EXT_convolution CONVOLUTION_FILTER_SCALE_EXT use EXT_convolution CONVOLUTION_FILTER_BIAS_EXT ############################################################################### ConvolutionTargetEXT enum: use EXT_convolution CONVOLUTION_1D_EXT use EXT_convolution CONVOLUTION_2D_EXT ############################################################################### CullFaceMode enum: use DrawBufferMode FRONT use DrawBufferMode BACK use DrawBufferMode FRONT_AND_BACK ############################################################################### DepthFunction enum: use AlphaFunction NEVER use AlphaFunction LESS use AlphaFunction EQUAL use AlphaFunction LEQUAL use AlphaFunction GREATER use AlphaFunction NOTEQUAL use AlphaFunction GEQUAL use AlphaFunction ALWAYS ############################################################################### DrawBufferMode enum: NONE = 0 FRONT_LEFT = 0x0400 FRONT_RIGHT = 0x0401 BACK_LEFT = 0x0402 BACK_RIGHT = 0x0403 FRONT = 0x0404 BACK = 0x0405 LEFT = 0x0406 RIGHT = 0x0407 FRONT_AND_BACK = 0x0408 AUX0 = 0x0409 AUX1 = 0x040A AUX2 = 0x040B AUX3 = 0x040C # Aliases DrawBufferMode enum above OES_framebuffer_object enum: (OpenGL ES only; additional; see below) # NONE_OES = 0 ############################################################################### EnableCap enum: use GetPName FOG use GetPName LIGHTING use GetPName TEXTURE_1D use GetPName TEXTURE_2D use GetPName LINE_STIPPLE use GetPName POLYGON_STIPPLE use GetPName CULL_FACE use GetPName ALPHA_TEST use GetPName BLEND use GetPName INDEX_LOGIC_OP use GetPName COLOR_LOGIC_OP use GetPName DITHER use GetPName STENCIL_TEST use GetPName DEPTH_TEST use GetPName CLIP_PLANE0 use GetPName CLIP_PLANE1 use GetPName CLIP_PLANE2 use GetPName CLIP_PLANE3 use GetPName CLIP_PLANE4 use GetPName CLIP_PLANE5 use GetPName LIGHT0 use GetPName LIGHT1 use GetPName LIGHT2 use GetPName LIGHT3 use GetPName LIGHT4 use GetPName LIGHT5 use GetPName LIGHT6 use GetPName LIGHT7 use GetPName TEXTURE_GEN_S use GetPName TEXTURE_GEN_T use GetPName TEXTURE_GEN_R use GetPName TEXTURE_GEN_Q use GetPName MAP1_VERTEX_3 use GetPName MAP1_VERTEX_4 use GetPName MAP1_COLOR_4 use GetPName MAP1_INDEX use GetPName MAP1_NORMAL use GetPName MAP1_TEXTURE_COORD_1 use GetPName MAP1_TEXTURE_COORD_2 use GetPName MAP1_TEXTURE_COORD_3 use GetPName MAP1_TEXTURE_COORD_4 use GetPName MAP2_VERTEX_3 use GetPName MAP2_VERTEX_4 use GetPName MAP2_COLOR_4 use GetPName MAP2_INDEX use GetPName MAP2_NORMAL use GetPName MAP2_TEXTURE_COORD_1 use GetPName MAP2_TEXTURE_COORD_2 use GetPName MAP2_TEXTURE_COORD_3 use GetPName MAP2_TEXTURE_COORD_4 use GetPName POINT_SMOOTH use GetPName LINE_SMOOTH use GetPName POLYGON_SMOOTH use GetPName SCISSOR_TEST use GetPName COLOR_MATERIAL use GetPName NORMALIZE use GetPName AUTO_NORMAL use GetPName POLYGON_OFFSET_POINT use GetPName POLYGON_OFFSET_LINE use GetPName POLYGON_OFFSET_FILL use GetPName VERTEX_ARRAY use GetPName NORMAL_ARRAY use GetPName COLOR_ARRAY use GetPName INDEX_ARRAY use GetPName TEXTURE_COORD_ARRAY use GetPName EDGE_FLAG_ARRAY use EXT_convolution CONVOLUTION_1D_EXT use EXT_convolution CONVOLUTION_2D_EXT use EXT_convolution SEPARABLE_2D_EXT use EXT_histogram HISTOGRAM_EXT use EXT_histogram MINMAX_EXT use EXT_rescale_normal RESCALE_NORMAL_EXT use EXT_shared_texture_palette SHARED_TEXTURE_PALETTE_EXT use EXT_texture3D TEXTURE_3D_EXT use SGIS_multisample MULTISAMPLE_SGIS use SGIS_multisample SAMPLE_ALPHA_TO_MASK_SGIS use SGIS_multisample SAMPLE_ALPHA_TO_ONE_SGIS use SGIS_multisample SAMPLE_MASK_SGIS use SGIS_texture4D TEXTURE_4D_SGIS use SGIX_async_histogram ASYNC_HISTOGRAM_SGIX use SGIX_async_pixel ASYNC_TEX_IMAGE_SGIX use SGIX_async_pixel ASYNC_DRAW_PIXELS_SGIX use SGIX_async_pixel ASYNC_READ_PIXELS_SGIX use SGIX_calligraphic_fragment CALLIGRAPHIC_FRAGMENT_SGIX use SGIX_fog_offset FOG_OFFSET_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHTING_SGIX use SGIX_fragment_lighting FRAGMENT_COLOR_MATERIAL_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT0_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT1_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT2_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT3_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT4_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT5_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT6_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT7_SGIX use SGIX_framezoom FRAMEZOOM_SGIX use SGIX_interlace INTERLACE_SGIX use SGIX_ir_instrument1 IR_INSTRUMENT1_SGIX use SGIX_pixel_texture PIXEL_TEX_GEN_SGIX use SGIS_pixel_texture PIXEL_TEXTURE_SGIS use SGIX_reference_plane REFERENCE_PLANE_SGIX use SGIX_sprite SPRITE_SGIX use SGI_color_table COLOR_TABLE_SGI use SGI_color_table POST_CONVOLUTION_COLOR_TABLE_SGI use SGI_color_table POST_COLOR_MATRIX_COLOR_TABLE_SGI use SGI_texture_color_table TEXTURE_COLOR_TABLE_SGI ############################################################################### ErrorCode enum: NO_ERROR = 0 INVALID_ENUM = 0x0500 INVALID_VALUE = 0x0501 INVALID_OPERATION = 0x0502 STACK_OVERFLOW = 0x0503 STACK_UNDERFLOW = 0x0504 OUT_OF_MEMORY = 0x0505 use EXT_histogram TABLE_TOO_LARGE_EXT use EXT_texture TEXTURE_TOO_LARGE_EXT # Additional error codes VERSION_3_0 enum: # use ARB_framebuffer_object INVALID_FRAMEBUFFER_OPERATION ARB_framebuffer_object enum: (note: no ARB suffixes) INVALID_FRAMEBUFFER_OPERATION = 0x0506 # VERSION_3_0 / ARB_fbo EXT_framebuffer_object enum: INVALID_FRAMEBUFFER_OPERATION_EXT = 0x0506 # Aliases EXT_fbo enum above OES_framebuffer_object enum: (OpenGL ES only; additional; see below) INVALID_FRAMEBUFFER_OPERATION_OES = 0x0506 ############################################################################### FeedbackType enum: 2D = 0x0600 3D = 0x0601 3D_COLOR = 0x0602 3D_COLOR_TEXTURE = 0x0603 4D_COLOR_TEXTURE = 0x0604 ############################################################################### FeedBackToken enum: PASS_THROUGH_TOKEN = 0x0700 POINT_TOKEN = 0x0701 LINE_TOKEN = 0x0702 POLYGON_TOKEN = 0x0703 BITMAP_TOKEN = 0x0704 DRAW_PIXEL_TOKEN = 0x0705 COPY_PIXEL_TOKEN = 0x0706 LINE_RESET_TOKEN = 0x0707 ############################################################################### FfdMaskSGIX enum: TEXTURE_DEFORMATION_BIT_SGIX = 0x00000001 GEOMETRY_DEFORMATION_BIT_SGIX = 0x00000002 ############################################################################### FfdTargetSGIX enum: use SGIX_polynomial_ffd GEOMETRY_DEFORMATION_SGIX use SGIX_polynomial_ffd TEXTURE_DEFORMATION_SGIX ############################################################################### FogMode enum: use TextureMagFilter LINEAR EXP = 0x0800 EXP2 = 0x0801 use SGIS_fog_function FOG_FUNC_SGIS ############################################################################### FogParameter enum: use GetPName FOG_COLOR use GetPName FOG_DENSITY use GetPName FOG_END use GetPName FOG_INDEX use GetPName FOG_MODE use GetPName FOG_START use SGIX_fog_offset FOG_OFFSET_VALUE_SGIX ############################################################################### FragmentLightModelParameterSGIX enum: use SGIX_fragment_lighting FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX ############################################################################### FrontFaceDirection enum: CW = 0x0900 CCW = 0x0901 ############################################################################### GetColorTableParameterPNameSGI enum: use SGI_color_table COLOR_TABLE_SCALE_SGI use SGI_color_table COLOR_TABLE_BIAS_SGI use SGI_color_table COLOR_TABLE_FORMAT_SGI use SGI_color_table COLOR_TABLE_WIDTH_SGI use SGI_color_table COLOR_TABLE_RED_SIZE_SGI use SGI_color_table COLOR_TABLE_GREEN_SIZE_SGI use SGI_color_table COLOR_TABLE_BLUE_SIZE_SGI use SGI_color_table COLOR_TABLE_ALPHA_SIZE_SGI use SGI_color_table COLOR_TABLE_LUMINANCE_SIZE_SGI use SGI_color_table COLOR_TABLE_INTENSITY_SIZE_SGI ############################################################################### GetConvolutionParameter enum: use EXT_convolution CONVOLUTION_BORDER_MODE_EXT use EXT_convolution CONVOLUTION_FILTER_SCALE_EXT use EXT_convolution CONVOLUTION_FILTER_BIAS_EXT use EXT_convolution CONVOLUTION_FORMAT_EXT use EXT_convolution CONVOLUTION_WIDTH_EXT use EXT_convolution CONVOLUTION_HEIGHT_EXT use EXT_convolution MAX_CONVOLUTION_WIDTH_EXT use EXT_convolution MAX_CONVOLUTION_HEIGHT_EXT ############################################################################### GetHistogramParameterPNameEXT enum: use EXT_histogram HISTOGRAM_WIDTH_EXT use EXT_histogram HISTOGRAM_FORMAT_EXT use EXT_histogram HISTOGRAM_RED_SIZE_EXT use EXT_histogram HISTOGRAM_GREEN_SIZE_EXT use EXT_histogram HISTOGRAM_BLUE_SIZE_EXT use EXT_histogram HISTOGRAM_ALPHA_SIZE_EXT use EXT_histogram HISTOGRAM_LUMINANCE_SIZE_EXT use EXT_histogram HISTOGRAM_SINK_EXT ############################################################################### GetMapQuery enum: COEFF = 0x0A00 ORDER = 0x0A01 DOMAIN = 0x0A02 ############################################################################### GetMinmaxParameterPNameEXT enum: use EXT_histogram MINMAX_FORMAT_EXT use EXT_histogram MINMAX_SINK_EXT ############################################################################### GetPixelMap enum: PIXEL_MAP_I_TO_I = 0x0C70 PIXEL_MAP_S_TO_S = 0x0C71 PIXEL_MAP_I_TO_R = 0x0C72 PIXEL_MAP_I_TO_G = 0x0C73 PIXEL_MAP_I_TO_B = 0x0C74 PIXEL_MAP_I_TO_A = 0x0C75 PIXEL_MAP_R_TO_R = 0x0C76 PIXEL_MAP_G_TO_G = 0x0C77 PIXEL_MAP_B_TO_B = 0x0C78 PIXEL_MAP_A_TO_A = 0x0C79 ############################################################################### GetPointervPName enum: VERTEX_ARRAY_POINTER = 0x808E NORMAL_ARRAY_POINTER = 0x808F COLOR_ARRAY_POINTER = 0x8090 INDEX_ARRAY_POINTER = 0x8091 TEXTURE_COORD_ARRAY_POINTER = 0x8092 EDGE_FLAG_ARRAY_POINTER = 0x8093 FEEDBACK_BUFFER_POINTER = 0x0DF0 SELECTION_BUFFER_POINTER = 0x0DF3 use SGIX_instruments INSTRUMENT_BUFFER_POINTER_SGIX ############################################################################### # the columns after the comment symbol (#) indicate: number of params, type # (F - float, D - double, I - integer) for the returned values GetPName enum: CURRENT_COLOR = 0x0B00 # 4 F CURRENT_INDEX = 0x0B01 # 1 F CURRENT_NORMAL = 0x0B02 # 3 F CURRENT_TEXTURE_COORDS = 0x0B03 # 4 F CURRENT_RASTER_COLOR = 0x0B04 # 4 F CURRENT_RASTER_INDEX = 0x0B05 # 1 F CURRENT_RASTER_TEXTURE_COORDS = 0x0B06 # 4 F CURRENT_RASTER_POSITION = 0x0B07 # 4 F CURRENT_RASTER_POSITION_VALID = 0x0B08 # 1 I CURRENT_RASTER_DISTANCE = 0x0B09 # 1 F POINT_SMOOTH = 0x0B10 # 1 I POINT_SIZE = 0x0B11 # 1 F POINT_SIZE_RANGE = 0x0B12 # 2 F POINT_SIZE_GRANULARITY = 0x0B13 # 1 F LINE_SMOOTH = 0x0B20 # 1 I LINE_WIDTH = 0x0B21 # 1 F LINE_WIDTH_RANGE = 0x0B22 # 2 F LINE_WIDTH_GRANULARITY = 0x0B23 # 1 F LINE_STIPPLE = 0x0B24 # 1 I LINE_STIPPLE_PATTERN = 0x0B25 # 1 I LINE_STIPPLE_REPEAT = 0x0B26 # 1 I use VERSION_1_2 SMOOTH_POINT_SIZE_RANGE use VERSION_1_2 SMOOTH_POINT_SIZE_GRANULARITY use VERSION_1_2 SMOOTH_LINE_WIDTH_RANGE use VERSION_1_2 SMOOTH_LINE_WIDTH_GRANULARITY use VERSION_1_2 ALIASED_POINT_SIZE_RANGE use VERSION_1_2 ALIASED_LINE_WIDTH_RANGE LIST_MODE = 0x0B30 # 1 I MAX_LIST_NESTING = 0x0B31 # 1 I LIST_BASE = 0x0B32 # 1 I LIST_INDEX = 0x0B33 # 1 I POLYGON_MODE = 0x0B40 # 2 I POLYGON_SMOOTH = 0x0B41 # 1 I POLYGON_STIPPLE = 0x0B42 # 1 I EDGE_FLAG = 0x0B43 # 1 I CULL_FACE = 0x0B44 # 1 I CULL_FACE_MODE = 0x0B45 # 1 I FRONT_FACE = 0x0B46 # 1 I LIGHTING = 0x0B50 # 1 I LIGHT_MODEL_LOCAL_VIEWER = 0x0B51 # 1 I LIGHT_MODEL_TWO_SIDE = 0x0B52 # 1 I LIGHT_MODEL_AMBIENT = 0x0B53 # 4 F SHADE_MODEL = 0x0B54 # 1 I COLOR_MATERIAL_FACE = 0x0B55 # 1 I COLOR_MATERIAL_PARAMETER = 0x0B56 # 1 I COLOR_MATERIAL = 0x0B57 # 1 I FOG = 0x0B60 # 1 I FOG_INDEX = 0x0B61 # 1 I FOG_DENSITY = 0x0B62 # 1 F FOG_START = 0x0B63 # 1 F FOG_END = 0x0B64 # 1 F FOG_MODE = 0x0B65 # 1 I FOG_COLOR = 0x0B66 # 4 F DEPTH_RANGE = 0x0B70 # 2 F DEPTH_TEST = 0x0B71 # 1 I DEPTH_WRITEMASK = 0x0B72 # 1 I DEPTH_CLEAR_VALUE = 0x0B73 # 1 F DEPTH_FUNC = 0x0B74 # 1 I ACCUM_CLEAR_VALUE = 0x0B80 # 4 F STENCIL_TEST = 0x0B90 # 1 I STENCIL_CLEAR_VALUE = 0x0B91 # 1 I STENCIL_FUNC = 0x0B92 # 1 I STENCIL_VALUE_MASK = 0x0B93 # 1 I STENCIL_FAIL = 0x0B94 # 1 I STENCIL_PASS_DEPTH_FAIL = 0x0B95 # 1 I STENCIL_PASS_DEPTH_PASS = 0x0B96 # 1 I STENCIL_REF = 0x0B97 # 1 I STENCIL_WRITEMASK = 0x0B98 # 1 I MATRIX_MODE = 0x0BA0 # 1 I NORMALIZE = 0x0BA1 # 1 I VIEWPORT = 0x0BA2 # 4 I MODELVIEW_STACK_DEPTH = 0x0BA3 # 1 I PROJECTION_STACK_DEPTH = 0x0BA4 # 1 I TEXTURE_STACK_DEPTH = 0x0BA5 # 1 I MODELVIEW_MATRIX = 0x0BA6 # 16 F PROJECTION_MATRIX = 0x0BA7 # 16 F TEXTURE_MATRIX = 0x0BA8 # 16 F ATTRIB_STACK_DEPTH = 0x0BB0 # 1 I CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1 # 1 I ALPHA_TEST = 0x0BC0 # 1 I ALPHA_TEST_FUNC = 0x0BC1 # 1 I ALPHA_TEST_REF = 0x0BC2 # 1 F DITHER = 0x0BD0 # 1 I BLEND_DST = 0x0BE0 # 1 I BLEND_SRC = 0x0BE1 # 1 I BLEND = 0x0BE2 # 1 I LOGIC_OP_MODE = 0x0BF0 # 1 I INDEX_LOGIC_OP = 0x0BF1 # 1 I LOGIC_OP = 0x0BF1 # 1 I COLOR_LOGIC_OP = 0x0BF2 # 1 I AUX_BUFFERS = 0x0C00 # 1 I DRAW_BUFFER = 0x0C01 # 1 I READ_BUFFER = 0x0C02 # 1 I SCISSOR_BOX = 0x0C10 # 4 I SCISSOR_TEST = 0x0C11 # 1 I INDEX_CLEAR_VALUE = 0x0C20 # 1 I INDEX_WRITEMASK = 0x0C21 # 1 I COLOR_CLEAR_VALUE = 0x0C22 # 4 F COLOR_WRITEMASK = 0x0C23 # 4 I INDEX_MODE = 0x0C30 # 1 I RGBA_MODE = 0x0C31 # 1 I DOUBLEBUFFER = 0x0C32 # 1 I STEREO = 0x0C33 # 1 I RENDER_MODE = 0x0C40 # 1 I PERSPECTIVE_CORRECTION_HINT = 0x0C50 # 1 I POINT_SMOOTH_HINT = 0x0C51 # 1 I LINE_SMOOTH_HINT = 0x0C52 # 1 I POLYGON_SMOOTH_HINT = 0x0C53 # 1 I FOG_HINT = 0x0C54 # 1 I TEXTURE_GEN_S = 0x0C60 # 1 I TEXTURE_GEN_T = 0x0C61 # 1 I TEXTURE_GEN_R = 0x0C62 # 1 I TEXTURE_GEN_Q = 0x0C63 # 1 I PIXEL_MAP_I_TO_I_SIZE = 0x0CB0 # 1 I PIXEL_MAP_S_TO_S_SIZE = 0x0CB1 # 1 I PIXEL_MAP_I_TO_R_SIZE = 0x0CB2 # 1 I PIXEL_MAP_I_TO_G_SIZE = 0x0CB3 # 1 I PIXEL_MAP_I_TO_B_SIZE = 0x0CB4 # 1 I PIXEL_MAP_I_TO_A_SIZE = 0x0CB5 # 1 I PIXEL_MAP_R_TO_R_SIZE = 0x0CB6 # 1 I PIXEL_MAP_G_TO_G_SIZE = 0x0CB7 # 1 I PIXEL_MAP_B_TO_B_SIZE = 0x0CB8 # 1 I PIXEL_MAP_A_TO_A_SIZE = 0x0CB9 # 1 I UNPACK_SWAP_BYTES = 0x0CF0 # 1 I UNPACK_LSB_FIRST = 0x0CF1 # 1 I UNPACK_ROW_LENGTH = 0x0CF2 # 1 I UNPACK_SKIP_ROWS = 0x0CF3 # 1 I UNPACK_SKIP_PIXELS = 0x0CF4 # 1 I UNPACK_ALIGNMENT = 0x0CF5 # 1 I PACK_SWAP_BYTES = 0x0D00 # 1 I PACK_LSB_FIRST = 0x0D01 # 1 I PACK_ROW_LENGTH = 0x0D02 # 1 I PACK_SKIP_ROWS = 0x0D03 # 1 I PACK_SKIP_PIXELS = 0x0D04 # 1 I PACK_ALIGNMENT = 0x0D05 # 1 I MAP_COLOR = 0x0D10 # 1 I MAP_STENCIL = 0x0D11 # 1 I INDEX_SHIFT = 0x0D12 # 1 I INDEX_OFFSET = 0x0D13 # 1 I RED_SCALE = 0x0D14 # 1 F RED_BIAS = 0x0D15 # 1 F ZOOM_X = 0x0D16 # 1 F ZOOM_Y = 0x0D17 # 1 F GREEN_SCALE = 0x0D18 # 1 F GREEN_BIAS = 0x0D19 # 1 F BLUE_SCALE = 0x0D1A # 1 F BLUE_BIAS = 0x0D1B # 1 F ALPHA_SCALE = 0x0D1C # 1 F ALPHA_BIAS = 0x0D1D # 1 F DEPTH_SCALE = 0x0D1E # 1 F DEPTH_BIAS = 0x0D1F # 1 F MAX_EVAL_ORDER = 0x0D30 # 1 I MAX_LIGHTS = 0x0D31 # 1 I # VERSION_3_0 enum: (aliases) MAX_CLIP_DISTANCES = 0x0D32 # VERSION_3_0 # alias GL_MAX_CLIP_PLANES MAX_CLIP_PLANES = 0x0D32 # 1 I MAX_TEXTURE_SIZE = 0x0D33 # 1 I MAX_PIXEL_MAP_TABLE = 0x0D34 # 1 I MAX_ATTRIB_STACK_DEPTH = 0x0D35 # 1 I MAX_MODELVIEW_STACK_DEPTH = 0x0D36 # 1 I MAX_NAME_STACK_DEPTH = 0x0D37 # 1 I MAX_PROJECTION_STACK_DEPTH = 0x0D38 # 1 I MAX_TEXTURE_STACK_DEPTH = 0x0D39 # 1 I MAX_VIEWPORT_DIMS = 0x0D3A # 2 F MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B # 1 I SUBPIXEL_BITS = 0x0D50 # 1 I INDEX_BITS = 0x0D51 # 1 I RED_BITS = 0x0D52 # 1 I GREEN_BITS = 0x0D53 # 1 I BLUE_BITS = 0x0D54 # 1 I ALPHA_BITS = 0x0D55 # 1 I DEPTH_BITS = 0x0D56 # 1 I STENCIL_BITS = 0x0D57 # 1 I ACCUM_RED_BITS = 0x0D58 # 1 I ACCUM_GREEN_BITS = 0x0D59 # 1 I ACCUM_BLUE_BITS = 0x0D5A # 1 I ACCUM_ALPHA_BITS = 0x0D5B # 1 I NAME_STACK_DEPTH = 0x0D70 # 1 I AUTO_NORMAL = 0x0D80 # 1 I MAP1_COLOR_4 = 0x0D90 # 1 I MAP1_INDEX = 0x0D91 # 1 I MAP1_NORMAL = 0x0D92 # 1 I MAP1_TEXTURE_COORD_1 = 0x0D93 # 1 I MAP1_TEXTURE_COORD_2 = 0x0D94 # 1 I MAP1_TEXTURE_COORD_3 = 0x0D95 # 1 I MAP1_TEXTURE_COORD_4 = 0x0D96 # 1 I MAP1_VERTEX_3 = 0x0D97 # 1 I MAP1_VERTEX_4 = 0x0D98 # 1 I MAP2_COLOR_4 = 0x0DB0 # 1 I MAP2_INDEX = 0x0DB1 # 1 I MAP2_NORMAL = 0x0DB2 # 1 I MAP2_TEXTURE_COORD_1 = 0x0DB3 # 1 I MAP2_TEXTURE_COORD_2 = 0x0DB4 # 1 I MAP2_TEXTURE_COORD_3 = 0x0DB5 # 1 I MAP2_TEXTURE_COORD_4 = 0x0DB6 # 1 I MAP2_VERTEX_3 = 0x0DB7 # 1 I MAP2_VERTEX_4 = 0x0DB8 # 1 I MAP1_GRID_DOMAIN = 0x0DD0 # 2 F MAP1_GRID_SEGMENTS = 0x0DD1 # 1 I MAP2_GRID_DOMAIN = 0x0DD2 # 4 F MAP2_GRID_SEGMENTS = 0x0DD3 # 2 I TEXTURE_1D = 0x0DE0 # 1 I TEXTURE_2D = 0x0DE1 # 1 I FEEDBACK_BUFFER_SIZE = 0x0DF1 # 1 I FEEDBACK_BUFFER_TYPE = 0x0DF2 # 1 I SELECTION_BUFFER_SIZE = 0x0DF4 # 1 I POLYGON_OFFSET_UNITS = 0x2A00 # 1 F POLYGON_OFFSET_POINT = 0x2A01 # 1 I POLYGON_OFFSET_LINE = 0x2A02 # 1 I POLYGON_OFFSET_FILL = 0x8037 # 1 I POLYGON_OFFSET_FACTOR = 0x8038 # 1 F TEXTURE_BINDING_1D = 0x8068 # 1 I TEXTURE_BINDING_2D = 0x8069 # 1 I TEXTURE_BINDING_3D = 0x806A # 1 I VERTEX_ARRAY = 0x8074 # 1 I NORMAL_ARRAY = 0x8075 # 1 I COLOR_ARRAY = 0x8076 # 1 I INDEX_ARRAY = 0x8077 # 1 I TEXTURE_COORD_ARRAY = 0x8078 # 1 I EDGE_FLAG_ARRAY = 0x8079 # 1 I VERTEX_ARRAY_SIZE = 0x807A # 1 I VERTEX_ARRAY_TYPE = 0x807B # 1 I VERTEX_ARRAY_STRIDE = 0x807C # 1 I NORMAL_ARRAY_TYPE = 0x807E # 1 I NORMAL_ARRAY_STRIDE = 0x807F # 1 I COLOR_ARRAY_SIZE = 0x8081 # 1 I COLOR_ARRAY_TYPE = 0x8082 # 1 I COLOR_ARRAY_STRIDE = 0x8083 # 1 I INDEX_ARRAY_TYPE = 0x8085 # 1 I INDEX_ARRAY_STRIDE = 0x8086 # 1 I TEXTURE_COORD_ARRAY_SIZE = 0x8088 # 1 I TEXTURE_COORD_ARRAY_TYPE = 0x8089 # 1 I TEXTURE_COORD_ARRAY_STRIDE = 0x808A # 1 I EDGE_FLAG_ARRAY_STRIDE = 0x808C # 1 I use ClipPlaneName CLIP_PLANE0 use ClipPlaneName CLIP_PLANE1 use ClipPlaneName CLIP_PLANE2 use ClipPlaneName CLIP_PLANE3 use ClipPlaneName CLIP_PLANE4 use ClipPlaneName CLIP_PLANE5 use LightName LIGHT0 use LightName LIGHT1 use LightName LIGHT2 use LightName LIGHT3 use LightName LIGHT4 use LightName LIGHT5 use LightName LIGHT6 use LightName LIGHT7 # use ARB_transpose_matrix TRANSPOSE_MODELVIEW_MATRIX_ARB # use ARB_transpose_matrix TRANSPOSE_PROJECTION_MATRIX_ARB # use ARB_transpose_matrix TRANSPOSE_TEXTURE_MATRIX_ARB # use ARB_transpose_matrix TRANSPOSE_COLOR_MATRIX_ARB use VERSION_1_2 LIGHT_MODEL_COLOR_CONTROL use EXT_blend_color BLEND_COLOR_EXT use EXT_blend_minmax BLEND_EQUATION_EXT use EXT_cmyka PACK_CMYK_HINT_EXT use EXT_cmyka UNPACK_CMYK_HINT_EXT use EXT_convolution CONVOLUTION_1D_EXT use EXT_convolution CONVOLUTION_2D_EXT use EXT_convolution SEPARABLE_2D_EXT use EXT_convolution POST_CONVOLUTION_RED_SCALE_EXT use EXT_convolution POST_CONVOLUTION_GREEN_SCALE_EXT use EXT_convolution POST_CONVOLUTION_BLUE_SCALE_EXT use EXT_convolution POST_CONVOLUTION_ALPHA_SCALE_EXT use EXT_convolution POST_CONVOLUTION_RED_BIAS_EXT use EXT_convolution POST_CONVOLUTION_GREEN_BIAS_EXT use EXT_convolution POST_CONVOLUTION_BLUE_BIAS_EXT use EXT_convolution POST_CONVOLUTION_ALPHA_BIAS_EXT use EXT_histogram HISTOGRAM_EXT use EXT_histogram MINMAX_EXT use EXT_polygon_offset POLYGON_OFFSET_BIAS_EXT use EXT_rescale_normal RESCALE_NORMAL_EXT use EXT_shared_texture_palette SHARED_TEXTURE_PALETTE_EXT use EXT_texture_object TEXTURE_3D_BINDING_EXT use EXT_texture3D PACK_SKIP_IMAGES_EXT use EXT_texture3D PACK_IMAGE_HEIGHT_EXT use EXT_texture3D UNPACK_SKIP_IMAGES_EXT use EXT_texture3D UNPACK_IMAGE_HEIGHT_EXT use EXT_texture3D TEXTURE_3D_EXT use EXT_texture3D MAX_3D_TEXTURE_SIZE_EXT use EXT_vertex_array VERTEX_ARRAY_COUNT_EXT use EXT_vertex_array NORMAL_ARRAY_COUNT_EXT use EXT_vertex_array COLOR_ARRAY_COUNT_EXT use EXT_vertex_array INDEX_ARRAY_COUNT_EXT use EXT_vertex_array TEXTURE_COORD_ARRAY_COUNT_EXT use EXT_vertex_array EDGE_FLAG_ARRAY_COUNT_EXT use SGIS_detail_texture DETAIL_TEXTURE_2D_BINDING_SGIS use SGIS_fog_function FOG_FUNC_POINTS_SGIS use SGIS_fog_function MAX_FOG_FUNC_POINTS_SGIS use SGIS_generate_mipmap GENERATE_MIPMAP_HINT_SGIS use SGIS_multisample MULTISAMPLE_SGIS use SGIS_multisample SAMPLE_ALPHA_TO_MASK_SGIS use SGIS_multisample SAMPLE_ALPHA_TO_ONE_SGIS use SGIS_multisample SAMPLE_MASK_SGIS use SGIS_multisample SAMPLE_BUFFERS_SGIS use SGIS_multisample SAMPLES_SGIS use SGIS_multisample SAMPLE_MASK_VALUE_SGIS use SGIS_multisample SAMPLE_MASK_INVERT_SGIS use SGIS_multisample SAMPLE_PATTERN_SGIS use SGIS_pixel_texture PIXEL_TEXTURE_SGIS use SGIS_point_parameters POINT_SIZE_MIN_SGIS use SGIS_point_parameters POINT_SIZE_MAX_SGIS use SGIS_point_parameters POINT_FADE_THRESHOLD_SIZE_SGIS use SGIS_point_parameters DISTANCE_ATTENUATION_SGIS use SGIS_texture4D PACK_SKIP_VOLUMES_SGIS use SGIS_texture4D PACK_IMAGE_DEPTH_SGIS use SGIS_texture4D UNPACK_SKIP_VOLUMES_SGIS use SGIS_texture4D UNPACK_IMAGE_DEPTH_SGIS use SGIS_texture4D TEXTURE_4D_SGIS use SGIS_texture4D MAX_4D_TEXTURE_SIZE_SGIS use SGIS_texture4D TEXTURE_4D_BINDING_SGIS use SGIX_async ASYNC_MARKER_SGIX use SGIX_async_histogram ASYNC_HISTOGRAM_SGIX use SGIX_async_histogram MAX_ASYNC_HISTOGRAM_SGIX use SGIX_async_pixel ASYNC_TEX_IMAGE_SGIX use SGIX_async_pixel ASYNC_DRAW_PIXELS_SGIX use SGIX_async_pixel ASYNC_READ_PIXELS_SGIX use SGIX_async_pixel MAX_ASYNC_TEX_IMAGE_SGIX use SGIX_async_pixel MAX_ASYNC_DRAW_PIXELS_SGIX use SGIX_async_pixel MAX_ASYNC_READ_PIXELS_SGIX use SGIX_calligraphic_fragment CALLIGRAPHIC_FRAGMENT_SGIX use SGIX_clipmap MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX use SGIX_clipmap MAX_CLIPMAP_DEPTH_SGIX use SGIX_convolution_accuracy CONVOLUTION_HINT_SGIX use SGIX_fog_offset FOG_OFFSET_SGIX use SGIX_fog_offset FOG_OFFSET_VALUE_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHTING_SGIX use SGIX_fragment_lighting FRAGMENT_COLOR_MATERIAL_SGIX use SGIX_fragment_lighting FRAGMENT_COLOR_MATERIAL_FACE_SGIX use SGIX_fragment_lighting FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX use SGIX_fragment_lighting MAX_FRAGMENT_LIGHTS_SGIX use SGIX_fragment_lighting MAX_ACTIVE_LIGHTS_SGIX use SGIX_fragment_lighting LIGHT_ENV_MODE_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT0_SGIX use SGIX_framezoom FRAMEZOOM_SGIX use SGIX_framezoom FRAMEZOOM_FACTOR_SGIX use SGIX_framezoom MAX_FRAMEZOOM_FACTOR_SGIX use SGIX_instruments INSTRUMENT_MEASUREMENTS_SGIX use SGIX_interlace INTERLACE_SGIX use SGIX_ir_instrument1 IR_INSTRUMENT1_SGIX use SGIX_pixel_texture PIXEL_TEX_GEN_SGIX use SGIX_pixel_texture PIXEL_TEX_GEN_MODE_SGIX use SGIX_pixel_tiles PIXEL_TILE_BEST_ALIGNMENT_SGIX use SGIX_pixel_tiles PIXEL_TILE_CACHE_INCREMENT_SGIX use SGIX_pixel_tiles PIXEL_TILE_WIDTH_SGIX use SGIX_pixel_tiles PIXEL_TILE_HEIGHT_SGIX use SGIX_pixel_tiles PIXEL_TILE_GRID_WIDTH_SGIX use SGIX_pixel_tiles PIXEL_TILE_GRID_HEIGHT_SGIX use SGIX_pixel_tiles PIXEL_TILE_GRID_DEPTH_SGIX use SGIX_pixel_tiles PIXEL_TILE_CACHE_SIZE_SGIX use SGIX_polynomial_ffd DEFORMATIONS_MASK_SGIX use SGIX_reference_plane REFERENCE_PLANE_EQUATION_SGIX use SGIX_reference_plane REFERENCE_PLANE_SGIX use SGIX_sprite SPRITE_SGIX use SGIX_sprite SPRITE_MODE_SGIX use SGIX_sprite SPRITE_AXIS_SGIX use SGIX_sprite SPRITE_TRANSLATION_SGIX use SGIX_subsample PACK_SUBSAMPLE_RATE_SGIX use SGIX_subsample UNPACK_SUBSAMPLE_RATE_SGIX use SGIX_resample PACK_RESAMPLE_SGIX use SGIX_resample UNPACK_RESAMPLE_SGIX use SGIX_texture_scale_bias POST_TEXTURE_FILTER_BIAS_RANGE_SGIX use SGIX_texture_scale_bias POST_TEXTURE_FILTER_SCALE_RANGE_SGIX use SGIX_vertex_preclip VERTEX_PRECLIP_SGIX use SGIX_vertex_preclip VERTEX_PRECLIP_HINT_SGIX use SGI_color_matrix COLOR_MATRIX_SGI use SGI_color_matrix COLOR_MATRIX_STACK_DEPTH_SGI use SGI_color_matrix MAX_COLOR_MATRIX_STACK_DEPTH_SGI use SGI_color_matrix POST_COLOR_MATRIX_RED_SCALE_SGI use SGI_color_matrix POST_COLOR_MATRIX_GREEN_SCALE_SGI use SGI_color_matrix POST_COLOR_MATRIX_BLUE_SCALE_SGI use SGI_color_matrix POST_COLOR_MATRIX_ALPHA_SCALE_SGI use SGI_color_matrix POST_COLOR_MATRIX_RED_BIAS_SGI use SGI_color_matrix POST_COLOR_MATRIX_GREEN_BIAS_SGI use SGI_color_matrix POST_COLOR_MATRIX_BLUE_BIAS_SGI use SGI_color_matrix POST_COLOR_MATRIX_ALPHA_BIAS_SGI use SGI_color_table COLOR_TABLE_SGI use SGI_color_table POST_CONVOLUTION_COLOR_TABLE_SGI use SGI_color_table POST_COLOR_MATRIX_COLOR_TABLE_SGI use SGI_texture_color_table TEXTURE_COLOR_TABLE_SGI ############################################################################### GetTextureParameter enum: use TextureParameterName TEXTURE_MAG_FILTER use TextureParameterName TEXTURE_MIN_FILTER use TextureParameterName TEXTURE_WRAP_S use TextureParameterName TEXTURE_WRAP_T TEXTURE_WIDTH = 0x1000 TEXTURE_HEIGHT = 0x1001 TEXTURE_INTERNAL_FORMAT = 0x1003 TEXTURE_COMPONENTS = 0x1003 TEXTURE_BORDER_COLOR = 0x1004 TEXTURE_BORDER = 0x1005 TEXTURE_RED_SIZE = 0x805C TEXTURE_GREEN_SIZE = 0x805D TEXTURE_BLUE_SIZE = 0x805E TEXTURE_ALPHA_SIZE = 0x805F TEXTURE_LUMINANCE_SIZE = 0x8060 TEXTURE_INTENSITY_SIZE = 0x8061 TEXTURE_PRIORITY = 0x8066 TEXTURE_RESIDENT = 0x8067 use EXT_texture3D TEXTURE_DEPTH_EXT use EXT_texture3D TEXTURE_WRAP_R_EXT use SGIS_detail_texture DETAIL_TEXTURE_LEVEL_SGIS use SGIS_detail_texture DETAIL_TEXTURE_MODE_SGIS use SGIS_detail_texture DETAIL_TEXTURE_FUNC_POINTS_SGIS use SGIS_generate_mipmap GENERATE_MIPMAP_SGIS use SGIS_sharpen_texture SHARPEN_TEXTURE_FUNC_POINTS_SGIS use SGIS_texture_filter4 TEXTURE_FILTER4_SIZE_SGIS use SGIS_texture_lod TEXTURE_MIN_LOD_SGIS use SGIS_texture_lod TEXTURE_MAX_LOD_SGIS use SGIS_texture_lod TEXTURE_BASE_LEVEL_SGIS use SGIS_texture_lod TEXTURE_MAX_LEVEL_SGIS use SGIS_texture_select DUAL_TEXTURE_SELECT_SGIS use SGIS_texture_select QUAD_TEXTURE_SELECT_SGIS use SGIS_texture4D TEXTURE_4DSIZE_SGIS use SGIS_texture4D TEXTURE_WRAP_Q_SGIS use SGIX_clipmap TEXTURE_CLIPMAP_CENTER_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_FRAME_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_OFFSET_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_LOD_OFFSET_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_DEPTH_SGIX use SGIX_shadow TEXTURE_COMPARE_SGIX use SGIX_shadow TEXTURE_COMPARE_OPERATOR_SGIX use SGIX_shadow TEXTURE_LEQUAL_R_SGIX use SGIX_shadow TEXTURE_GEQUAL_R_SGIX use SGIX_shadow_ambient SHADOW_AMBIENT_SGIX use SGIX_texture_coordinate_clamp TEXTURE_MAX_CLAMP_S_SGIX use SGIX_texture_coordinate_clamp TEXTURE_MAX_CLAMP_T_SGIX use SGIX_texture_coordinate_clamp TEXTURE_MAX_CLAMP_R_SGIX use SGIX_texture_lod_bias TEXTURE_LOD_BIAS_S_SGIX use SGIX_texture_lod_bias TEXTURE_LOD_BIAS_T_SGIX use SGIX_texture_lod_bias TEXTURE_LOD_BIAS_R_SGIX use SGIX_texture_scale_bias POST_TEXTURE_FILTER_BIAS_SGIX use SGIX_texture_scale_bias POST_TEXTURE_FILTER_SCALE_SGIX ############################################################################### HintMode enum: DONT_CARE = 0x1100 FASTEST = 0x1101 NICEST = 0x1102 ############################################################################### HintTarget enum: use GetPName PERSPECTIVE_CORRECTION_HINT use GetPName POINT_SMOOTH_HINT use GetPName LINE_SMOOTH_HINT use GetPName POLYGON_SMOOTH_HINT use GetPName FOG_HINT use EXT_cmyka PACK_CMYK_HINT_EXT use EXT_cmyka UNPACK_CMYK_HINT_EXT use SGIS_generate_mipmap GENERATE_MIPMAP_HINT_SGIS use SGIX_convolution_accuracy CONVOLUTION_HINT_SGIX use SGIX_texture_multi_buffer TEXTURE_MULTI_BUFFER_HINT_SGIX use SGIX_vertex_preclip VERTEX_PRECLIP_HINT_SGIX ############################################################################### HistogramTargetEXT enum: use EXT_histogram HISTOGRAM_EXT use EXT_histogram PROXY_HISTOGRAM_EXT ############################################################################### IndexPointerType enum: use DataType SHORT use DataType INT use DataType FLOAT use DataType DOUBLE ############################################################################### LightEnvModeSGIX enum: use StencilOp REPLACE use TextureEnvMode MODULATE use AccumOp ADD ############################################################################### LightEnvParameterSGIX enum: use SGIX_fragment_lighting LIGHT_ENV_MODE_SGIX ############################################################################### LightModelColorControl enum: use VERSION_1_2 SINGLE_COLOR use VERSION_1_2 SEPARATE_SPECULAR_COLOR ############################################################################### LightModelParameter enum: use GetPName LIGHT_MODEL_AMBIENT use GetPName LIGHT_MODEL_LOCAL_VIEWER use GetPName LIGHT_MODEL_TWO_SIDE use VERSION_1_2 LIGHT_MODEL_COLOR_CONTROL ############################################################################### LightParameter enum: AMBIENT = 0x1200 DIFFUSE = 0x1201 SPECULAR = 0x1202 POSITION = 0x1203 SPOT_DIRECTION = 0x1204 SPOT_EXPONENT = 0x1205 SPOT_CUTOFF = 0x1206 CONSTANT_ATTENUATION = 0x1207 LINEAR_ATTENUATION = 0x1208 QUADRATIC_ATTENUATION = 0x1209 ############################################################################### ListMode enum: COMPILE = 0x1300 COMPILE_AND_EXECUTE = 0x1301 ############################################################################### DataType enum: BYTE = 0x1400 UNSIGNED_BYTE = 0x1401 SHORT = 0x1402 UNSIGNED_SHORT = 0x1403 INT = 0x1404 UNSIGNED_INT = 0x1405 FLOAT = 0x1406 2_BYTES = 0x1407 3_BYTES = 0x1408 4_BYTES = 0x1409 DOUBLE = 0x140A DOUBLE_EXT = 0x140A # OES_byte_coordinates: (OpenGL ES only) # use DataType BYTE OES_element_index_uint enum: (OpenGL ES only) # use DataType UNSIGNED_INT OES_texture_float enum: (OpenGL ES only; additional; see below) # use DataType FLOAT VERSION_3_0 enum: # use ARB_half_float_vertex HALF_FLOAT ARB_half_float_vertex enum: (note: no ARB suffixes) HALF_FLOAT = 0x140B # VERSION_3_0 / ARB_half_float_vertex ARB_half_float_pixel enum: HALF_FLOAT_ARB = 0x140B NV_half_float enum: HALF_FLOAT_NV = 0x140B APPLE_float_pixels enum: (additional; see below) HALF_APPLE = 0x140B OES_fixed_point enum: (OpenGL ES only) FIXED_OES = 0x140C # Leave a gap to preserve even/odd int/uint token values # ARB_future_use: 0x140D # Future NV extension (Khronos bug 5172) INT64_NV = 0x140E UNSIGNED_INT64_NV = 0x140F ############################################################################### ListNameType enum: use DataType BYTE use DataType UNSIGNED_BYTE use DataType SHORT use DataType UNSIGNED_SHORT use DataType INT use DataType UNSIGNED_INT use DataType FLOAT use DataType 2_BYTES use DataType 3_BYTES use DataType 4_BYTES ############################################################################### ListParameterName enum: use SGIX_list_priority LIST_PRIORITY_SGIX ############################################################################### LogicOp enum: CLEAR = 0x1500 AND = 0x1501 AND_REVERSE = 0x1502 COPY = 0x1503 AND_INVERTED = 0x1504 NOOP = 0x1505 XOR = 0x1506 OR = 0x1507 NOR = 0x1508 EQUIV = 0x1509 INVERT = 0x150A OR_REVERSE = 0x150B COPY_INVERTED = 0x150C OR_INVERTED = 0x150D NAND = 0x150E SET = 0x150F ############################################################################### MapTarget enum: use GetPName MAP1_COLOR_4 use GetPName MAP1_INDEX use GetPName MAP1_NORMAL use GetPName MAP1_TEXTURE_COORD_1 use GetPName MAP1_TEXTURE_COORD_2 use GetPName MAP1_TEXTURE_COORD_3 use GetPName MAP1_TEXTURE_COORD_4 use GetPName MAP1_VERTEX_3 use GetPName MAP1_VERTEX_4 use GetPName MAP2_COLOR_4 use GetPName MAP2_INDEX use GetPName MAP2_NORMAL use GetPName MAP2_TEXTURE_COORD_1 use GetPName MAP2_TEXTURE_COORD_2 use GetPName MAP2_TEXTURE_COORD_3 use GetPName MAP2_TEXTURE_COORD_4 use GetPName MAP2_VERTEX_3 use GetPName MAP2_VERTEX_4 use SGIX_polynomial_ffd GEOMETRY_DEFORMATION_SGIX use SGIX_polynomial_ffd TEXTURE_DEFORMATION_SGIX ############################################################################### MaterialFace enum: use DrawBufferMode FRONT use DrawBufferMode BACK use DrawBufferMode FRONT_AND_BACK ############################################################################### MaterialParameter enum: EMISSION = 0x1600 SHININESS = 0x1601 AMBIENT_AND_DIFFUSE = 0x1602 COLOR_INDEXES = 0x1603 use LightParameter AMBIENT use LightParameter DIFFUSE use LightParameter SPECULAR ############################################################################### MatrixMode enum: MODELVIEW = 0x1700 PROJECTION = 0x1701 TEXTURE = 0x1702 ############################################################################### MeshMode1 enum: use PolygonMode POINT use PolygonMode LINE ############################################################################### MeshMode2 enum: use PolygonMode POINT use PolygonMode LINE use PolygonMode FILL ############################################################################### MinmaxTargetEXT enum: use EXT_histogram MINMAX_EXT ############################################################################### NormalPointerType enum: use DataType BYTE use DataType SHORT use DataType INT use DataType FLOAT use DataType DOUBLE ############################################################################### PixelCopyType enum: COLOR = 0x1800 DEPTH = 0x1801 STENCIL = 0x1802 EXT_discard_framebuffer enum: (OpenGL ES only) COLOR_EXT = 0x1800 DEPTH_EXT = 0x1801 STENCIL_EXT = 0x1802 ############################################################################### PixelFormat enum: COLOR_INDEX = 0x1900 STENCIL_INDEX = 0x1901 DEPTH_COMPONENT = 0x1902 RED = 0x1903 GREEN = 0x1904 BLUE = 0x1905 ALPHA = 0x1906 RGB = 0x1907 RGBA = 0x1908 LUMINANCE = 0x1909 LUMINANCE_ALPHA = 0x190A use EXT_abgr ABGR_EXT use EXT_cmyka CMYK_EXT use EXT_cmyka CMYKA_EXT use SGIX_icc_texture R5_G6_B5_ICC_SGIX use SGIX_icc_texture R5_G6_B5_A8_ICC_SGIX use SGIX_icc_texture ALPHA16_ICC_SGIX use SGIX_icc_texture LUMINANCE16_ICC_SGIX use SGIX_icc_texture LUMINANCE16_ALPHA8_ICC_SGIX use SGIX_ycrcb YCRCB_422_SGIX use SGIX_ycrcb YCRCB_444_SGIX OES_depth_texture enum: (OpenGL ES only) # use DataType UNSIGNED_SHORT # use DataType UNSIGNED_INT # use PixelFormat DEPTH_COMPONENT ############################################################################### PixelMap enum: use GetPixelMap PIXEL_MAP_I_TO_I use GetPixelMap PIXEL_MAP_S_TO_S use GetPixelMap PIXEL_MAP_I_TO_R use GetPixelMap PIXEL_MAP_I_TO_G use GetPixelMap PIXEL_MAP_I_TO_B use GetPixelMap PIXEL_MAP_I_TO_A use GetPixelMap PIXEL_MAP_R_TO_R use GetPixelMap PIXEL_MAP_G_TO_G use GetPixelMap PIXEL_MAP_B_TO_B use GetPixelMap PIXEL_MAP_A_TO_A ############################################################################### PixelStoreParameter enum: use GetPName UNPACK_SWAP_BYTES use GetPName UNPACK_LSB_FIRST use GetPName UNPACK_ROW_LENGTH use GetPName UNPACK_SKIP_ROWS use GetPName UNPACK_SKIP_PIXELS use GetPName UNPACK_ALIGNMENT use GetPName PACK_SWAP_BYTES use GetPName PACK_LSB_FIRST use GetPName PACK_ROW_LENGTH use GetPName PACK_SKIP_ROWS use GetPName PACK_SKIP_PIXELS use GetPName PACK_ALIGNMENT use EXT_texture3D PACK_SKIP_IMAGES_EXT use EXT_texture3D PACK_IMAGE_HEIGHT_EXT use EXT_texture3D UNPACK_SKIP_IMAGES_EXT use EXT_texture3D UNPACK_IMAGE_HEIGHT_EXT use SGIS_texture4D PACK_SKIP_VOLUMES_SGIS use SGIS_texture4D PACK_IMAGE_DEPTH_SGIS use SGIS_texture4D UNPACK_SKIP_VOLUMES_SGIS use SGIS_texture4D UNPACK_IMAGE_DEPTH_SGIS use SGIX_pixel_tiles PIXEL_TILE_WIDTH_SGIX use SGIX_pixel_tiles PIXEL_TILE_HEIGHT_SGIX use SGIX_pixel_tiles PIXEL_TILE_GRID_WIDTH_SGIX use SGIX_pixel_tiles PIXEL_TILE_GRID_HEIGHT_SGIX use SGIX_pixel_tiles PIXEL_TILE_GRID_DEPTH_SGIX use SGIX_pixel_tiles PIXEL_TILE_CACHE_SIZE_SGIX use SGIX_subsample PACK_SUBSAMPLE_RATE_SGIX use SGIX_subsample UNPACK_SUBSAMPLE_RATE_SGIX use SGIX_resample PACK_RESAMPLE_SGIX use SGIX_resample UNPACK_RESAMPLE_SGIX ############################################################################### PixelStoreResampleMode enum: use SGIX_resample RESAMPLE_REPLICATE_SGIX use SGIX_resample RESAMPLE_ZERO_FILL_SGIX use SGIX_resample RESAMPLE_DECIMATE_SGIX ############################################################################### PixelStoreSubsampleRate enum: use SGIX_subsample PIXEL_SUBSAMPLE_4444_SGIX use SGIX_subsample PIXEL_SUBSAMPLE_2424_SGIX use SGIX_subsample PIXEL_SUBSAMPLE_4242_SGIX ############################################################################### PixelTexGenMode enum: use DrawBufferMode NONE use PixelFormat RGB use PixelFormat RGBA use PixelFormat LUMINANCE use PixelFormat LUMINANCE_ALPHA use SGIX_impact_pixel_texture PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX use SGIX_impact_pixel_texture PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX use SGIX_impact_pixel_texture PIXEL_TEX_GEN_ALPHA_MS_SGIX use SGIX_impact_pixel_texture PIXEL_TEX_GEN_ALPHA_LS_SGIX ############################################################################### PixelTexGenParameterNameSGIS enum: use SGIS_pixel_texture PIXEL_FRAGMENT_RGB_SOURCE_SGIS use SGIS_pixel_texture PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS ############################################################################### PixelTransferParameter enum: use GetPName MAP_COLOR use GetPName MAP_STENCIL use GetPName INDEX_SHIFT use GetPName INDEX_OFFSET use GetPName RED_SCALE use GetPName RED_BIAS use GetPName GREEN_SCALE use GetPName GREEN_BIAS use GetPName BLUE_SCALE use GetPName BLUE_BIAS use GetPName ALPHA_SCALE use GetPName ALPHA_BIAS use GetPName DEPTH_SCALE use GetPName DEPTH_BIAS use EXT_convolution POST_CONVOLUTION_RED_SCALE_EXT use EXT_convolution POST_CONVOLUTION_GREEN_SCALE_EXT use EXT_convolution POST_CONVOLUTION_BLUE_SCALE_EXT use EXT_convolution POST_CONVOLUTION_ALPHA_SCALE_EXT use EXT_convolution POST_CONVOLUTION_RED_BIAS_EXT use EXT_convolution POST_CONVOLUTION_GREEN_BIAS_EXT use EXT_convolution POST_CONVOLUTION_BLUE_BIAS_EXT use EXT_convolution POST_CONVOLUTION_ALPHA_BIAS_EXT use SGI_color_matrix POST_COLOR_MATRIX_RED_SCALE_SGI use SGI_color_matrix POST_COLOR_MATRIX_GREEN_SCALE_SGI use SGI_color_matrix POST_COLOR_MATRIX_BLUE_SCALE_SGI use SGI_color_matrix POST_COLOR_MATRIX_ALPHA_SCALE_SGI use SGI_color_matrix POST_COLOR_MATRIX_RED_BIAS_SGI use SGI_color_matrix POST_COLOR_MATRIX_GREEN_BIAS_SGI use SGI_color_matrix POST_COLOR_MATRIX_BLUE_BIAS_SGI use SGI_color_matrix POST_COLOR_MATRIX_ALPHA_BIAS_SGI ############################################################################### PixelType enum: BITMAP = 0x1A00 use DataType BYTE use DataType UNSIGNED_BYTE use DataType SHORT use DataType UNSIGNED_SHORT use DataType INT use DataType UNSIGNED_INT use DataType FLOAT use EXT_packed_pixels UNSIGNED_BYTE_3_3_2_EXT use EXT_packed_pixels UNSIGNED_SHORT_4_4_4_4_EXT use EXT_packed_pixels UNSIGNED_SHORT_5_5_5_1_EXT use EXT_packed_pixels UNSIGNED_INT_8_8_8_8_EXT use EXT_packed_pixels UNSIGNED_INT_10_10_10_2_EXT ############################################################################### PointParameterNameSGIS enum: use SGIS_point_parameters POINT_SIZE_MIN_SGIS use SGIS_point_parameters POINT_SIZE_MAX_SGIS use SGIS_point_parameters POINT_FADE_THRESHOLD_SIZE_SGIS use SGIS_point_parameters DISTANCE_ATTENUATION_SGIS ############################################################################### PolygonMode enum: POINT = 0x1B00 LINE = 0x1B01 FILL = 0x1B02 ############################################################################### ReadBufferMode enum: use DrawBufferMode FRONT_LEFT use DrawBufferMode FRONT_RIGHT use DrawBufferMode BACK_LEFT use DrawBufferMode BACK_RIGHT use DrawBufferMode FRONT use DrawBufferMode BACK use DrawBufferMode LEFT use DrawBufferMode RIGHT use DrawBufferMode AUX0 use DrawBufferMode AUX1 use DrawBufferMode AUX2 use DrawBufferMode AUX3 ############################################################################### RenderingMode enum: RENDER = 0x1C00 FEEDBACK = 0x1C01 SELECT = 0x1C02 ############################################################################### SamplePatternSGIS enum: use SGIS_multisample 1PASS_SGIS use SGIS_multisample 2PASS_0_SGIS use SGIS_multisample 2PASS_1_SGIS use SGIS_multisample 4PASS_0_SGIS use SGIS_multisample 4PASS_1_SGIS use SGIS_multisample 4PASS_2_SGIS use SGIS_multisample 4PASS_3_SGIS ############################################################################### SeparableTargetEXT enum: use EXT_convolution SEPARABLE_2D_EXT ############################################################################### ShadingModel enum: FLAT = 0x1D00 SMOOTH = 0x1D01 ############################################################################### StencilFunction enum: use AlphaFunction NEVER use AlphaFunction LESS use AlphaFunction EQUAL use AlphaFunction LEQUAL use AlphaFunction GREATER use AlphaFunction NOTEQUAL use AlphaFunction GEQUAL use AlphaFunction ALWAYS ############################################################################### StencilOp enum: use BlendingFactorDest ZERO KEEP = 0x1E00 REPLACE = 0x1E01 INCR = 0x1E02 DECR = 0x1E03 use LogicOp INVERT ############################################################################### StringName enum: VENDOR = 0x1F00 RENDERER = 0x1F01 VERSION = 0x1F02 EXTENSIONS = 0x1F03 ############################################################################### TexCoordPointerType enum: use DataType SHORT use DataType INT use DataType FLOAT use DataType DOUBLE ############################################################################### TextureCoordName enum: S = 0x2000 T = 0x2001 R = 0x2002 Q = 0x2003 ############################################################################### TextureEnvMode enum: MODULATE = 0x2100 DECAL = 0x2101 use GetPName BLEND use EXT_texture REPLACE_EXT use AccumOp ADD use SGIX_texture_add_env TEXTURE_ENV_BIAS_SGIX ############################################################################### TextureEnvParameter enum: TEXTURE_ENV_MODE = 0x2200 TEXTURE_ENV_COLOR = 0x2201 ############################################################################### TextureEnvTarget enum: TEXTURE_ENV = 0x2300 ############################################################################### TextureFilterFuncSGIS enum: use SGIS_texture_filter4 FILTER4_SGIS ############################################################################### TextureGenMode enum: EYE_LINEAR = 0x2400 OBJECT_LINEAR = 0x2401 SPHERE_MAP = 0x2402 use SGIS_point_line_texgen EYE_DISTANCE_TO_POINT_SGIS use SGIS_point_line_texgen OBJECT_DISTANCE_TO_POINT_SGIS use SGIS_point_line_texgen EYE_DISTANCE_TO_LINE_SGIS use SGIS_point_line_texgen OBJECT_DISTANCE_TO_LINE_SGIS ############################################################################### TextureGenParameter enum: TEXTURE_GEN_MODE = 0x2500 OBJECT_PLANE = 0x2501 EYE_PLANE = 0x2502 use SGIS_point_line_texgen EYE_POINT_SGIS use SGIS_point_line_texgen OBJECT_POINT_SGIS use SGIS_point_line_texgen EYE_LINE_SGIS use SGIS_point_line_texgen OBJECT_LINE_SGIS # Aliases TextureGenParameter enum above OES_texture_cube_map enum: (OpenGL ES only; additional; see below) TEXTURE_GEN_MODE = 0x2500 ############################################################################### TextureMagFilter enum: NEAREST = 0x2600 LINEAR = 0x2601 use SGIS_detail_texture LINEAR_DETAIL_SGIS use SGIS_detail_texture LINEAR_DETAIL_ALPHA_SGIS use SGIS_detail_texture LINEAR_DETAIL_COLOR_SGIS use SGIS_sharpen_texture LINEAR_SHARPEN_SGIS use SGIS_sharpen_texture LINEAR_SHARPEN_ALPHA_SGIS use SGIS_sharpen_texture LINEAR_SHARPEN_COLOR_SGIS use SGIS_texture_filter4 FILTER4_SGIS use SGIX_impact_pixel_texture PIXEL_TEX_GEN_Q_CEILING_SGIX use SGIX_impact_pixel_texture PIXEL_TEX_GEN_Q_ROUND_SGIX use SGIX_impact_pixel_texture PIXEL_TEX_GEN_Q_FLOOR_SGIX ############################################################################### TextureMinFilter enum: use TextureMagFilter NEAREST use TextureMagFilter LINEAR NEAREST_MIPMAP_NEAREST = 0x2700 LINEAR_MIPMAP_NEAREST = 0x2701 NEAREST_MIPMAP_LINEAR = 0x2702 LINEAR_MIPMAP_LINEAR = 0x2703 use SGIS_texture_filter4 FILTER4_SGIS use SGIX_clipmap LINEAR_CLIPMAP_LINEAR_SGIX use SGIX_clipmap NEAREST_CLIPMAP_NEAREST_SGIX use SGIX_clipmap NEAREST_CLIPMAP_LINEAR_SGIX use SGIX_clipmap LINEAR_CLIPMAP_NEAREST_SGIX use SGIX_impact_pixel_texture PIXEL_TEX_GEN_Q_CEILING_SGIX use SGIX_impact_pixel_texture PIXEL_TEX_GEN_Q_ROUND_SGIX use SGIX_impact_pixel_texture PIXEL_TEX_GEN_Q_FLOOR_SGIX ############################################################################### TextureParameterName enum: TEXTURE_MAG_FILTER = 0x2800 TEXTURE_MIN_FILTER = 0x2801 TEXTURE_WRAP_S = 0x2802 TEXTURE_WRAP_T = 0x2803 use GetTextureParameter TEXTURE_BORDER_COLOR use GetTextureParameter TEXTURE_PRIORITY use EXT_texture3D TEXTURE_WRAP_R_EXT use SGIS_detail_texture DETAIL_TEXTURE_LEVEL_SGIS use SGIS_detail_texture DETAIL_TEXTURE_MODE_SGIS use SGIS_generate_mipmap GENERATE_MIPMAP_SGIS use SGIS_texture_select DUAL_TEXTURE_SELECT_SGIS use SGIS_texture_select QUAD_TEXTURE_SELECT_SGIS use SGIS_texture4D TEXTURE_WRAP_Q_SGIS use SGIX_clipmap TEXTURE_CLIPMAP_CENTER_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_FRAME_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_OFFSET_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_LOD_OFFSET_SGIX use SGIX_clipmap TEXTURE_CLIPMAP_DEPTH_SGIX use SGIX_shadow TEXTURE_COMPARE_SGIX use SGIX_shadow TEXTURE_COMPARE_OPERATOR_SGIX use SGIX_shadow_ambient SHADOW_AMBIENT_SGIX use SGIX_texture_coordinate_clamp TEXTURE_MAX_CLAMP_S_SGIX use SGIX_texture_coordinate_clamp TEXTURE_MAX_CLAMP_T_SGIX use SGIX_texture_coordinate_clamp TEXTURE_MAX_CLAMP_R_SGIX use SGIX_texture_lod_bias TEXTURE_LOD_BIAS_S_SGIX use SGIX_texture_lod_bias TEXTURE_LOD_BIAS_T_SGIX use SGIX_texture_lod_bias TEXTURE_LOD_BIAS_R_SGIX use SGIX_texture_scale_bias POST_TEXTURE_FILTER_BIAS_SGIX use SGIX_texture_scale_bias POST_TEXTURE_FILTER_SCALE_SGIX ############################################################################### TextureTarget enum: use GetPName TEXTURE_1D use GetPName TEXTURE_2D PROXY_TEXTURE_1D = 0x8063 PROXY_TEXTURE_2D = 0x8064 use EXT_texture3D TEXTURE_3D_EXT use EXT_texture3D PROXY_TEXTURE_3D_EXT use SGIS_detail_texture DETAIL_TEXTURE_2D_SGIS use SGIS_texture4D TEXTURE_4D_SGIS use SGIS_texture4D PROXY_TEXTURE_4D_SGIS use SGIS_texture_lod TEXTURE_MIN_LOD_SGIS use SGIS_texture_lod TEXTURE_MAX_LOD_SGIS use SGIS_texture_lod TEXTURE_BASE_LEVEL_SGIS use SGIS_texture_lod TEXTURE_MAX_LEVEL_SGIS ############################################################################### TextureWrapMode enum: CLAMP = 0x2900 REPEAT = 0x2901 use SGIS_texture_border_clamp CLAMP_TO_BORDER_SGIS use SGIS_texture_edge_clamp CLAMP_TO_EDGE_SGIS ############################################################################### PixelInternalFormat enum: R3_G3_B2 = 0x2A10 ALPHA4 = 0x803B ALPHA8 = 0x803C ALPHA12 = 0x803D ALPHA16 = 0x803E LUMINANCE4 = 0x803F LUMINANCE8 = 0x8040 LUMINANCE12 = 0x8041 LUMINANCE16 = 0x8042 LUMINANCE4_ALPHA4 = 0x8043 LUMINANCE6_ALPHA2 = 0x8044 LUMINANCE8_ALPHA8 = 0x8045 LUMINANCE12_ALPHA4 = 0x8046 LUMINANCE12_ALPHA12 = 0x8047 LUMINANCE16_ALPHA16 = 0x8048 INTENSITY = 0x8049 INTENSITY4 = 0x804A INTENSITY8 = 0x804B INTENSITY12 = 0x804C INTENSITY16 = 0x804D RGB4 = 0x804F RGB5 = 0x8050 RGB8 = 0x8051 RGB10 = 0x8052 RGB12 = 0x8053 RGB16 = 0x8054 RGBA2 = 0x8055 RGBA4 = 0x8056 RGB5_A1 = 0x8057 RGBA8 = 0x8058 RGB10_A2 = 0x8059 RGBA12 = 0x805A RGBA16 = 0x805B use EXT_texture RGB2_EXT use SGIS_texture_select DUAL_ALPHA4_SGIS use SGIS_texture_select DUAL_ALPHA8_SGIS use SGIS_texture_select DUAL_ALPHA12_SGIS use SGIS_texture_select DUAL_ALPHA16_SGIS use SGIS_texture_select DUAL_LUMINANCE4_SGIS use SGIS_texture_select DUAL_LUMINANCE8_SGIS use SGIS_texture_select DUAL_LUMINANCE12_SGIS use SGIS_texture_select DUAL_LUMINANCE16_SGIS use SGIS_texture_select DUAL_INTENSITY4_SGIS use SGIS_texture_select DUAL_INTENSITY8_SGIS use SGIS_texture_select DUAL_INTENSITY12_SGIS use SGIS_texture_select DUAL_INTENSITY16_SGIS use SGIS_texture_select DUAL_LUMINANCE_ALPHA4_SGIS use SGIS_texture_select DUAL_LUMINANCE_ALPHA8_SGIS use SGIS_texture_select QUAD_ALPHA4_SGIS use SGIS_texture_select QUAD_ALPHA8_SGIS use SGIS_texture_select QUAD_LUMINANCE4_SGIS use SGIS_texture_select QUAD_LUMINANCE8_SGIS use SGIS_texture_select QUAD_INTENSITY4_SGIS use SGIS_texture_select QUAD_INTENSITY8_SGIS use SGIX_depth_texture DEPTH_COMPONENT16_SGIX use SGIX_depth_texture DEPTH_COMPONENT24_SGIX use SGIX_depth_texture DEPTH_COMPONENT32_SGIX use SGIX_icc_texture RGB_ICC_SGIX use SGIX_icc_texture RGBA_ICC_SGIX use SGIX_icc_texture ALPHA_ICC_SGIX use SGIX_icc_texture LUMINANCE_ICC_SGIX use SGIX_icc_texture INTENSITY_ICC_SGIX use SGIX_icc_texture LUMINANCE_ALPHA_ICC_SGIX use SGIX_icc_texture R5_G6_B5_ICC_SGIX use SGIX_icc_texture R5_G6_B5_A8_ICC_SGIX use SGIX_icc_texture ALPHA16_ICC_SGIX use SGIX_icc_texture LUMINANCE16_ICC_SGIX use SGIX_icc_texture INTENSITY16_ICC_SGIX use SGIX_icc_texture LUMINANCE16_ALPHA8_ICC_SGIX # Aliases PixelInternalFormat enums above OES_rgb8_rgba8 enum: (OpenGL ES only) RGB8 = 0x8051 RGBA8 = 0x8058 ############################################################################### InterleavedArrayFormat enum: V2F = 0x2A20 V3F = 0x2A21 C4UB_V2F = 0x2A22 C4UB_V3F = 0x2A23 C3F_V3F = 0x2A24 N3F_V3F = 0x2A25 C4F_N3F_V3F = 0x2A26 T2F_V3F = 0x2A27 T4F_V4F = 0x2A28 T2F_C4UB_V3F = 0x2A29 T2F_C3F_V3F = 0x2A2A T2F_N3F_V3F = 0x2A2B T2F_C4F_N3F_V3F = 0x2A2C T4F_C4F_N3F_V4F = 0x2A2D ############################################################################### VertexPointerType enum: use DataType SHORT use DataType INT use DataType FLOAT use DataType DOUBLE ############################################################################### # 0x3000 through 0x3FFF are reserved for clip planes ClipPlaneName enum: CLIP_PLANE0 = 0x3000 # 1 I CLIP_PLANE1 = 0x3001 # 1 I CLIP_PLANE2 = 0x3002 # 1 I CLIP_PLANE3 = 0x3003 # 1 I CLIP_PLANE4 = 0x3004 # 1 I CLIP_PLANE5 = 0x3005 # 1 I VERSION_3_0 enum: (aliases) CLIP_DISTANCE0 = 0x3000 # VERSION_3_0 # alias GL_CLIP_PLANE0 CLIP_DISTANCE1 = 0x3001 # VERSION_3_0 # alias GL_CLIP_PLANE1 CLIP_DISTANCE2 = 0x3002 # VERSION_3_0 # alias GL_CLIP_PLANE2 CLIP_DISTANCE3 = 0x3003 # VERSION_3_0 # alias GL_CLIP_PLANE3 CLIP_DISTANCE4 = 0x3004 # VERSION_3_0 # alias GL_CLIP_PLANE4 CLIP_DISTANCE5 = 0x3005 # VERSION_3_0 # alias GL_CLIP_PLANE5 CLIP_DISTANCE6 = 0x3006 # VERSION_3_0 # alias GL_CLIP_PLANE5 CLIP_DISTANCE7 = 0x3007 # VERSION_3_0 # alias GL_CLIP_PLANE5 ############################################################################### # 0x4000-0x4FFF are reserved for light numbers LightName enum: LIGHT0 = 0x4000 # 1 I LIGHT1 = 0x4001 # 1 I LIGHT2 = 0x4002 # 1 I LIGHT3 = 0x4003 # 1 I LIGHT4 = 0x4004 # 1 I LIGHT5 = 0x4005 # 1 I LIGHT6 = 0x4006 # 1 I LIGHT7 = 0x4007 # 1 I use SGIX_fragment_lighting FRAGMENT_LIGHT0_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT1_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT2_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT3_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT4_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT5_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT6_SGIX use SGIX_fragment_lighting FRAGMENT_LIGHT7_SGIX ############################################################################### EXT_abgr enum: ABGR_EXT = 0x8000 ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) CONSTANT_COLOR = 0x8001 ONE_MINUS_CONSTANT_COLOR = 0x8002 CONSTANT_ALPHA = 0x8003 ONE_MINUS_CONSTANT_ALPHA = 0x8004 BLEND_COLOR = 0x8005 # 4 F EXT_blend_color enum: CONSTANT_COLOR_EXT = 0x8001 ONE_MINUS_CONSTANT_COLOR_EXT = 0x8002 CONSTANT_ALPHA_EXT = 0x8003 ONE_MINUS_CONSTANT_ALPHA_EXT = 0x8004 BLEND_COLOR_EXT = 0x8005 # 4 F ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) EXT_blend_minmax enum: FUNC_ADD = 0x8006 FUNC_ADD_EXT = 0x8006 MIN = 0x8007 MIN_EXT = 0x8007 MAX = 0x8008 MAX_EXT = 0x8008 BLEND_EQUATION = 0x8009 # 1 I BLEND_EQUATION_EXT = 0x8009 # 1 I VERSION_2_0 enum: (Promoted for OpenGL 2.0) BLEND_EQUATION_RGB = 0x8009 # VERSION_2_0 # alias GL_BLEND_EQUATION EXT_blend_equation_separate enum: (separate; see below) BLEND_EQUATION_RGB_EXT = 0x8009 # alias GL_BLEND_EQUATION # Aliases EXT_blend_equation_separate enum above OES_blend_equation_separate enum: (OpenGL ES only; additional; see below) BLEND_EQUATION_RGB_OES = 0x8009 # 1 I ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) EXT_blend_subtract enum: FUNC_SUBTRACT = 0x800A FUNC_SUBTRACT_EXT = 0x800A FUNC_REVERSE_SUBTRACT = 0x800B FUNC_REVERSE_SUBTRACT_EXT = 0x800B # Aliases EXT_blend_minmax and EXT_blend_subtract enums above OES_blend_subtract enum: (OpenGL ES only) FUNC_ADD_OES = 0x8006 BLEND_EQUATION_OES = 0x8009 # 1 I FUNC_SUBTRACT_OES = 0x800A FUNC_REVERSE_SUBTRACT_OES = 0x800B ############################################################################### EXT_cmyka enum: CMYK_EXT = 0x800C CMYKA_EXT = 0x800D PACK_CMYK_HINT_EXT = 0x800E # 1 I UNPACK_CMYK_HINT_EXT = 0x800F # 1 I ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) CONVOLUTION_1D = 0x8010 # 1 I CONVOLUTION_2D = 0x8011 # 1 I SEPARABLE_2D = 0x8012 # 1 I CONVOLUTION_BORDER_MODE = 0x8013 CONVOLUTION_FILTER_SCALE = 0x8014 CONVOLUTION_FILTER_BIAS = 0x8015 REDUCE = 0x8016 CONVOLUTION_FORMAT = 0x8017 CONVOLUTION_WIDTH = 0x8018 CONVOLUTION_HEIGHT = 0x8019 MAX_CONVOLUTION_WIDTH = 0x801A MAX_CONVOLUTION_HEIGHT = 0x801B POST_CONVOLUTION_RED_SCALE = 0x801C # 1 F POST_CONVOLUTION_GREEN_SCALE = 0x801D # 1 F POST_CONVOLUTION_BLUE_SCALE = 0x801E # 1 F POST_CONVOLUTION_ALPHA_SCALE = 0x801F # 1 F POST_CONVOLUTION_RED_BIAS = 0x8020 # 1 F POST_CONVOLUTION_GREEN_BIAS = 0x8021 # 1 F POST_CONVOLUTION_BLUE_BIAS = 0x8022 # 1 F POST_CONVOLUTION_ALPHA_BIAS = 0x8023 # 1 F EXT_convolution enum: CONVOLUTION_1D_EXT = 0x8010 # 1 I CONVOLUTION_2D_EXT = 0x8011 # 1 I SEPARABLE_2D_EXT = 0x8012 # 1 I CONVOLUTION_BORDER_MODE_EXT = 0x8013 CONVOLUTION_FILTER_SCALE_EXT = 0x8014 CONVOLUTION_FILTER_BIAS_EXT = 0x8015 REDUCE_EXT = 0x8016 CONVOLUTION_FORMAT_EXT = 0x8017 CONVOLUTION_WIDTH_EXT = 0x8018 CONVOLUTION_HEIGHT_EXT = 0x8019 MAX_CONVOLUTION_WIDTH_EXT = 0x801A MAX_CONVOLUTION_HEIGHT_EXT = 0x801B POST_CONVOLUTION_RED_SCALE_EXT = 0x801C # 1 F POST_CONVOLUTION_GREEN_SCALE_EXT = 0x801D # 1 F POST_CONVOLUTION_BLUE_SCALE_EXT = 0x801E # 1 F POST_CONVOLUTION_ALPHA_SCALE_EXT = 0x801F # 1 F POST_CONVOLUTION_RED_BIAS_EXT = 0x8020 # 1 F POST_CONVOLUTION_GREEN_BIAS_EXT = 0x8021 # 1 F POST_CONVOLUTION_BLUE_BIAS_EXT = 0x8022 # 1 F POST_CONVOLUTION_ALPHA_BIAS_EXT = 0x8023 # 1 F ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) HISTOGRAM = 0x8024 # 1 I PROXY_HISTOGRAM = 0x8025 HISTOGRAM_WIDTH = 0x8026 HISTOGRAM_FORMAT = 0x8027 HISTOGRAM_RED_SIZE = 0x8028 HISTOGRAM_GREEN_SIZE = 0x8029 HISTOGRAM_BLUE_SIZE = 0x802A HISTOGRAM_ALPHA_SIZE = 0x802B HISTOGRAM_SINK = 0x802D MINMAX = 0x802E # 1 I MINMAX_FORMAT = 0x802F MINMAX_SINK = 0x8030 TABLE_TOO_LARGE = 0x8031 EXT_histogram enum: HISTOGRAM_EXT = 0x8024 # 1 I PROXY_HISTOGRAM_EXT = 0x8025 HISTOGRAM_WIDTH_EXT = 0x8026 HISTOGRAM_FORMAT_EXT = 0x8027 HISTOGRAM_RED_SIZE_EXT = 0x8028 HISTOGRAM_GREEN_SIZE_EXT = 0x8029 HISTOGRAM_BLUE_SIZE_EXT = 0x802A HISTOGRAM_ALPHA_SIZE_EXT = 0x802B HISTOGRAM_LUMINANCE_SIZE = 0x802C HISTOGRAM_LUMINANCE_SIZE_EXT = 0x802C HISTOGRAM_SINK_EXT = 0x802D MINMAX_EXT = 0x802E # 1 I MINMAX_FORMAT_EXT = 0x802F MINMAX_SINK_EXT = 0x8030 TABLE_TOO_LARGE_EXT = 0x8031 ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) UNSIGNED_BYTE_3_3_2 = 0x8032 UNSIGNED_SHORT_4_4_4_4 = 0x8033 UNSIGNED_SHORT_5_5_5_1 = 0x8034 UNSIGNED_INT_8_8_8_8 = 0x8035 UNSIGNED_INT_10_10_10_2 = 0x8036 UNSIGNED_BYTE_2_3_3_REV = 0x8362 UNSIGNED_SHORT_5_6_5 = 0x8363 UNSIGNED_SHORT_5_6_5_REV = 0x8364 UNSIGNED_SHORT_4_4_4_4_REV = 0x8365 UNSIGNED_SHORT_1_5_5_5_REV = 0x8366 UNSIGNED_INT_8_8_8_8_REV = 0x8367 UNSIGNED_INT_2_10_10_10_REV = 0x8368 EXT_packed_pixels enum: UNSIGNED_BYTE_3_3_2_EXT = 0x8032 UNSIGNED_SHORT_4_4_4_4_EXT = 0x8033 UNSIGNED_SHORT_5_5_5_1_EXT = 0x8034 UNSIGNED_INT_8_8_8_8_EXT = 0x8035 UNSIGNED_INT_10_10_10_2_EXT = 0x8036 UNSIGNED_BYTE_2_3_3_REV_EXT = 0x8362 UNSIGNED_SHORT_5_6_5_EXT = 0x8363 UNSIGNED_SHORT_5_6_5_REV_EXT = 0x8364 UNSIGNED_SHORT_4_4_4_4_REV_EXT = 0x8365 UNSIGNED_SHORT_1_5_5_5_REV_EXT = 0x8366 UNSIGNED_INT_8_8_8_8_REV_EXT = 0x8367 UNSIGNED_INT_2_10_10_10_REV_EXT = 0x8368 EXT_texture_type_2_10_10_10_REV enum: (OpenGL ES only) # use EXT_packed_pixels UNSIGNED_INT_2_10_10_10_REV_EXT ############################################################################### EXT_polygon_offset enum: POLYGON_OFFSET_EXT = 0x8037 POLYGON_OFFSET_FACTOR_EXT = 0x8038 POLYGON_OFFSET_BIAS_EXT = 0x8039 # 1 F ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) RESCALE_NORMAL = 0x803A # 1 I EXT_rescale_normal enum: RESCALE_NORMAL_EXT = 0x803A # 1 I ############################################################################### EXT_texture enum: ALPHA4_EXT = 0x803B ALPHA8_EXT = 0x803C ALPHA12_EXT = 0x803D ALPHA16_EXT = 0x803E LUMINANCE4_EXT = 0x803F LUMINANCE8_EXT = 0x8040 LUMINANCE12_EXT = 0x8041 LUMINANCE16_EXT = 0x8042 LUMINANCE4_ALPHA4_EXT = 0x8043 LUMINANCE6_ALPHA2_EXT = 0x8044 LUMINANCE8_ALPHA8_EXT = 0x8045 LUMINANCE12_ALPHA4_EXT = 0x8046 LUMINANCE12_ALPHA12_EXT = 0x8047 LUMINANCE16_ALPHA16_EXT = 0x8048 INTENSITY_EXT = 0x8049 INTENSITY4_EXT = 0x804A INTENSITY8_EXT = 0x804B INTENSITY12_EXT = 0x804C INTENSITY16_EXT = 0x804D RGB2_EXT = 0x804E RGB4_EXT = 0x804F RGB5_EXT = 0x8050 RGB8_EXT = 0x8051 RGB10_EXT = 0x8052 RGB12_EXT = 0x8053 RGB16_EXT = 0x8054 RGBA2_EXT = 0x8055 RGBA4_EXT = 0x8056 RGB5_A1_EXT = 0x8057 RGBA8_EXT = 0x8058 RGB10_A2_EXT = 0x8059 RGBA12_EXT = 0x805A RGBA16_EXT = 0x805B TEXTURE_RED_SIZE_EXT = 0x805C TEXTURE_GREEN_SIZE_EXT = 0x805D TEXTURE_BLUE_SIZE_EXT = 0x805E TEXTURE_ALPHA_SIZE_EXT = 0x805F TEXTURE_LUMINANCE_SIZE_EXT = 0x8060 TEXTURE_INTENSITY_SIZE_EXT = 0x8061 REPLACE_EXT = 0x8062 PROXY_TEXTURE_1D_EXT = 0x8063 PROXY_TEXTURE_2D_EXT = 0x8064 TEXTURE_TOO_LARGE_EXT = 0x8065 # Aliases EXT_texture enums above OES_framebuffer_object enum: (OpenGL ES only; additional; see below) RGBA4_OES = 0x8056 RGB5_A1_OES = 0x8057 ############################################################################### EXT_texture_object enum: TEXTURE_PRIORITY_EXT = 0x8066 TEXTURE_RESIDENT_EXT = 0x8067 TEXTURE_1D_BINDING_EXT = 0x8068 TEXTURE_2D_BINDING_EXT = 0x8069 TEXTURE_3D_BINDING_EXT = 0x806A # 1 I ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) PACK_SKIP_IMAGES = 0x806B # 1 I PACK_IMAGE_HEIGHT = 0x806C # 1 F UNPACK_SKIP_IMAGES = 0x806D # 1 I UNPACK_IMAGE_HEIGHT = 0x806E # 1 F TEXTURE_3D = 0x806F # 1 I PROXY_TEXTURE_3D = 0x8070 TEXTURE_DEPTH = 0x8071 TEXTURE_WRAP_R = 0x8072 MAX_3D_TEXTURE_SIZE = 0x8073 # 1 I EXT_texture3D enum: PACK_SKIP_IMAGES_EXT = 0x806B # 1 I PACK_IMAGE_HEIGHT_EXT = 0x806C # 1 F UNPACK_SKIP_IMAGES_EXT = 0x806D # 1 I UNPACK_IMAGE_HEIGHT_EXT = 0x806E # 1 F TEXTURE_3D_EXT = 0x806F # 1 I PROXY_TEXTURE_3D_EXT = 0x8070 TEXTURE_DEPTH_EXT = 0x8071 TEXTURE_WRAP_R_EXT = 0x8072 MAX_3D_TEXTURE_SIZE_EXT = 0x8073 # 1 I # Aliases EXT_texture_object, EXT_texture3D enums above OES_texture3D enum: (OpenGL ES only) TEXTURE_3D_BINDING_OES = 0x806A # 1 I TEXTURE_3D_OES = 0x806F # 1 I TEXTURE_WRAP_R_OES = 0x8072 MAX_3D_TEXTURE_SIZE_OES = 0x8073 # 1 I ############################################################################### EXT_vertex_array enum: VERTEX_ARRAY_EXT = 0x8074 NORMAL_ARRAY_EXT = 0x8075 COLOR_ARRAY_EXT = 0x8076 INDEX_ARRAY_EXT = 0x8077 TEXTURE_COORD_ARRAY_EXT = 0x8078 EDGE_FLAG_ARRAY_EXT = 0x8079 VERTEX_ARRAY_SIZE_EXT = 0x807A VERTEX_ARRAY_TYPE_EXT = 0x807B VERTEX_ARRAY_STRIDE_EXT = 0x807C VERTEX_ARRAY_COUNT_EXT = 0x807D # 1 I NORMAL_ARRAY_TYPE_EXT = 0x807E NORMAL_ARRAY_STRIDE_EXT = 0x807F NORMAL_ARRAY_COUNT_EXT = 0x8080 # 1 I COLOR_ARRAY_SIZE_EXT = 0x8081 COLOR_ARRAY_TYPE_EXT = 0x8082 COLOR_ARRAY_STRIDE_EXT = 0x8083 COLOR_ARRAY_COUNT_EXT = 0x8084 # 1 I INDEX_ARRAY_TYPE_EXT = 0x8085 INDEX_ARRAY_STRIDE_EXT = 0x8086 INDEX_ARRAY_COUNT_EXT = 0x8087 # 1 I TEXTURE_COORD_ARRAY_SIZE_EXT = 0x8088 TEXTURE_COORD_ARRAY_TYPE_EXT = 0x8089 TEXTURE_COORD_ARRAY_STRIDE_EXT = 0x808A TEXTURE_COORD_ARRAY_COUNT_EXT = 0x808B # 1 I EDGE_FLAG_ARRAY_STRIDE_EXT = 0x808C EDGE_FLAG_ARRAY_COUNT_EXT = 0x808D # 1 I VERTEX_ARRAY_POINTER_EXT = 0x808E NORMAL_ARRAY_POINTER_EXT = 0x808F COLOR_ARRAY_POINTER_EXT = 0x8090 INDEX_ARRAY_POINTER_EXT = 0x8091 TEXTURE_COORD_ARRAY_POINTER_EXT = 0x8092 EDGE_FLAG_ARRAY_POINTER_EXT = 0x8093 ############################################################################### SGIX_interlace enum: INTERLACE_SGIX = 0x8094 # 1 I ############################################################################### SGIS_detail_texture enum: DETAIL_TEXTURE_2D_SGIS = 0x8095 DETAIL_TEXTURE_2D_BINDING_SGIS = 0x8096 # 1 I LINEAR_DETAIL_SGIS = 0x8097 LINEAR_DETAIL_ALPHA_SGIS = 0x8098 LINEAR_DETAIL_COLOR_SGIS = 0x8099 DETAIL_TEXTURE_LEVEL_SGIS = 0x809A DETAIL_TEXTURE_MODE_SGIS = 0x809B DETAIL_TEXTURE_FUNC_POINTS_SGIS = 0x809C ############################################################################### # Reuses some SGIS_multisample values VERSION_1_3 enum: (Promoted for OpenGL 1.3) MULTISAMPLE = 0x809D SAMPLE_ALPHA_TO_COVERAGE = 0x809E SAMPLE_ALPHA_TO_ONE = 0x809F SAMPLE_COVERAGE = 0x80A0 SAMPLE_BUFFERS = 0x80A8 # 1 I SAMPLES = 0x80A9 # 1 I SAMPLE_COVERAGE_VALUE = 0x80AA # 1 F SAMPLE_COVERAGE_INVERT = 0x80AB # 1 I ARB_multisample enum: MULTISAMPLE_ARB = 0x809D SAMPLE_ALPHA_TO_COVERAGE_ARB = 0x809E SAMPLE_ALPHA_TO_ONE_ARB = 0x809F SAMPLE_COVERAGE_ARB = 0x80A0 SAMPLE_BUFFERS_ARB = 0x80A8 # 1 I SAMPLES_ARB = 0x80A9 # 1 I SAMPLE_COVERAGE_VALUE_ARB = 0x80AA # 1 F SAMPLE_COVERAGE_INVERT_ARB = 0x80AB # 1 I SGIS_multisample enum: MULTISAMPLE_SGIS = 0x809D # 1 I SAMPLE_ALPHA_TO_MASK_SGIS = 0x809E # 1 I SAMPLE_ALPHA_TO_ONE_SGIS = 0x809F # 1 I SAMPLE_MASK_SGIS = 0x80A0 # 1 I 1PASS_SGIS = 0x80A1 2PASS_0_SGIS = 0x80A2 2PASS_1_SGIS = 0x80A3 4PASS_0_SGIS = 0x80A4 4PASS_1_SGIS = 0x80A5 4PASS_2_SGIS = 0x80A6 4PASS_3_SGIS = 0x80A7 SAMPLE_BUFFERS_SGIS = 0x80A8 # 1 I SAMPLES_SGIS = 0x80A9 # 1 I SAMPLE_MASK_VALUE_SGIS = 0x80AA # 1 F SAMPLE_MASK_INVERT_SGIS = 0x80AB # 1 I SAMPLE_PATTERN_SGIS = 0x80AC # 1 I # Reuses SGIS_multisample values. EXT_multisample enum: MULTISAMPLE_EXT = 0x809D SAMPLE_ALPHA_TO_MASK_EXT = 0x809E SAMPLE_ALPHA_TO_ONE_EXT = 0x809F SAMPLE_MASK_EXT = 0x80A0 1PASS_EXT = 0x80A1 2PASS_0_EXT = 0x80A2 2PASS_1_EXT = 0x80A3 4PASS_0_EXT = 0x80A4 4PASS_1_EXT = 0x80A5 4PASS_2_EXT = 0x80A6 4PASS_3_EXT = 0x80A7 SAMPLE_BUFFERS_EXT = 0x80A8 # 1 I SAMPLES_EXT = 0x80A9 # 1 I SAMPLE_MASK_VALUE_EXT = 0x80AA # 1 F SAMPLE_MASK_INVERT_EXT = 0x80AB # 1 I SAMPLE_PATTERN_EXT = 0x80AC # 1 I MULTISAMPLE_BIT_EXT = 0x20000000 ############################################################################### SGIS_sharpen_texture enum: LINEAR_SHARPEN_SGIS = 0x80AD LINEAR_SHARPEN_ALPHA_SGIS = 0x80AE LINEAR_SHARPEN_COLOR_SGIS = 0x80AF SHARPEN_TEXTURE_FUNC_POINTS_SGIS = 0x80B0 ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) COLOR_MATRIX = 0x80B1 # 16 F COLOR_MATRIX_STACK_DEPTH = 0x80B2 # 1 I MAX_COLOR_MATRIX_STACK_DEPTH = 0x80B3 # 1 I POST_COLOR_MATRIX_RED_SCALE = 0x80B4 # 1 F POST_COLOR_MATRIX_GREEN_SCALE = 0x80B5 # 1 F POST_COLOR_MATRIX_BLUE_SCALE = 0x80B6 # 1 F POST_COLOR_MATRIX_ALPHA_SCALE = 0x80B7 # 1 F POST_COLOR_MATRIX_RED_BIAS = 0x80B8 # 1 F POST_COLOR_MATRIX_GREEN_BIAS = 0x80B9 # 1 F POST_COLOR_MATRIX_BLUE_BIAS = 0x80BA # 1 F POST_COLOR_MATRIX_ALPHA_BIAS = 0x80BB # 1 F SGI_color_matrix enum: COLOR_MATRIX_SGI = 0x80B1 # 16 F COLOR_MATRIX_STACK_DEPTH_SGI = 0x80B2 # 1 I MAX_COLOR_MATRIX_STACK_DEPTH_SGI = 0x80B3 # 1 I POST_COLOR_MATRIX_RED_SCALE_SGI = 0x80B4 # 1 F POST_COLOR_MATRIX_GREEN_SCALE_SGI = 0x80B5 # 1 F POST_COLOR_MATRIX_BLUE_SCALE_SGI = 0x80B6 # 1 F POST_COLOR_MATRIX_ALPHA_SCALE_SGI = 0x80B7 # 1 F POST_COLOR_MATRIX_RED_BIAS_SGI = 0x80B8 # 1 F POST_COLOR_MATRIX_GREEN_BIAS_SGI = 0x80B9 # 1 F POST_COLOR_MATRIX_BLUE_BIAS_SGI = 0x80BA # 1 F POST_COLOR_MATRIX_ALPHA_BIAS_SGI = 0x80BB # 1 F ############################################################################### SGI_texture_color_table enum: TEXTURE_COLOR_TABLE_SGI = 0x80BC # 1 I PROXY_TEXTURE_COLOR_TABLE_SGI = 0x80BD ############################################################################### SGIX_texture_add_env enum: TEXTURE_ENV_BIAS_SGIX = 0x80BE ############################################################################### SGIX_shadow_ambient enum: SHADOW_AMBIENT_SGIX = 0x80BF ############################################################################### # Intergraph/Intense3D/3Dlabs: 0x80C0-0x80CF # 3Dlabs_future_use: 0x80C0-0x80C7 VERSION_1_4 enum: (Promoted for OpenGL 1.4) BLEND_DST_RGB = 0x80C8 BLEND_SRC_RGB = 0x80C9 BLEND_DST_ALPHA = 0x80CA BLEND_SRC_ALPHA = 0x80CB EXT_blend_func_separate enum: BLEND_DST_RGB_EXT = 0x80C8 BLEND_SRC_RGB_EXT = 0x80C9 BLEND_DST_ALPHA_EXT = 0x80CA BLEND_SRC_ALPHA_EXT = 0x80CB # Aliases EXT_blend_func_separate enums above OES_blend_func_separate enum: (OpenGL ES only) BLEND_DST_RGB_OES = 0x80C8 BLEND_SRC_RGB_OES = 0x80C9 BLEND_DST_ALPHA_OES = 0x80CA BLEND_SRC_ALPHA_OES = 0x80CB EXT_422_pixels enum: 422_EXT = 0x80CC 422_REV_EXT = 0x80CD 422_AVERAGE_EXT = 0x80CE 422_REV_AVERAGE_EXT = 0x80CF ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) COLOR_TABLE = 0x80D0 # 1 I POST_CONVOLUTION_COLOR_TABLE = 0x80D1 # 1 I POST_COLOR_MATRIX_COLOR_TABLE = 0x80D2 # 1 I PROXY_COLOR_TABLE = 0x80D3 PROXY_POST_CONVOLUTION_COLOR_TABLE = 0x80D4 PROXY_POST_COLOR_MATRIX_COLOR_TABLE = 0x80D5 COLOR_TABLE_SCALE = 0x80D6 COLOR_TABLE_BIAS = 0x80D7 COLOR_TABLE_FORMAT = 0x80D8 COLOR_TABLE_WIDTH = 0x80D9 COLOR_TABLE_RED_SIZE = 0x80DA COLOR_TABLE_GREEN_SIZE = 0x80DB COLOR_TABLE_BLUE_SIZE = 0x80DC COLOR_TABLE_ALPHA_SIZE = 0x80DD COLOR_TABLE_LUMINANCE_SIZE = 0x80DE COLOR_TABLE_INTENSITY_SIZE = 0x80DF SGI_color_table enum: COLOR_TABLE_SGI = 0x80D0 # 1 I POST_CONVOLUTION_COLOR_TABLE_SGI = 0x80D1 # 1 I POST_COLOR_MATRIX_COLOR_TABLE_SGI = 0x80D2 # 1 I PROXY_COLOR_TABLE_SGI = 0x80D3 PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = 0x80D4 PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = 0x80D5 COLOR_TABLE_SCALE_SGI = 0x80D6 COLOR_TABLE_BIAS_SGI = 0x80D7 COLOR_TABLE_FORMAT_SGI = 0x80D8 COLOR_TABLE_WIDTH_SGI = 0x80D9 COLOR_TABLE_RED_SIZE_SGI = 0x80DA COLOR_TABLE_GREEN_SIZE_SGI = 0x80DB COLOR_TABLE_BLUE_SIZE_SGI = 0x80DC COLOR_TABLE_ALPHA_SIZE_SGI = 0x80DD COLOR_TABLE_LUMINANCE_SIZE_SGI = 0x80DE COLOR_TABLE_INTENSITY_SIZE_SGI = 0x80DF ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) BGR = 0x80E0 BGRA = 0x80E1 ARB_vertex_array_bgra enum: # use VERSION_1_2 BGRA EXT_bgra enum: BGR_EXT = 0x80E0 BGRA_EXT = 0x80E1 ############################################################################### # Microsoft: 0x80E2-0x80E7 ############################################################################### VERSION_1_2 enum: MAX_ELEMENTS_VERTICES = 0x80E8 MAX_ELEMENTS_INDICES = 0x80E9 ############################################################################### # Microsoft: 0x80EA-0x810F ############################################################################### SGIS_texture_select enum: DUAL_ALPHA4_SGIS = 0x8110 DUAL_ALPHA8_SGIS = 0x8111 DUAL_ALPHA12_SGIS = 0x8112 DUAL_ALPHA16_SGIS = 0x8113 DUAL_LUMINANCE4_SGIS = 0x8114 DUAL_LUMINANCE8_SGIS = 0x8115 DUAL_LUMINANCE12_SGIS = 0x8116 DUAL_LUMINANCE16_SGIS = 0x8117 DUAL_INTENSITY4_SGIS = 0x8118 DUAL_INTENSITY8_SGIS = 0x8119 DUAL_INTENSITY12_SGIS = 0x811A DUAL_INTENSITY16_SGIS = 0x811B DUAL_LUMINANCE_ALPHA4_SGIS = 0x811C DUAL_LUMINANCE_ALPHA8_SGIS = 0x811D QUAD_ALPHA4_SGIS = 0x811E QUAD_ALPHA8_SGIS = 0x811F QUAD_LUMINANCE4_SGIS = 0x8120 QUAD_LUMINANCE8_SGIS = 0x8121 QUAD_INTENSITY4_SGIS = 0x8122 QUAD_INTENSITY8_SGIS = 0x8123 DUAL_TEXTURE_SELECT_SGIS = 0x8124 QUAD_TEXTURE_SELECT_SGIS = 0x8125 ############################################################################### VERSION_1_4 enum: (Promoted for OpenGL 1.4) POINT_SIZE_MIN = 0x8126 # 1 F POINT_SIZE_MAX = 0x8127 # 1 F POINT_FADE_THRESHOLD_SIZE = 0x8128 # 1 F POINT_DISTANCE_ATTENUATION = 0x8129 # 3 F ARB_point_parameters enum: POINT_SIZE_MIN_ARB = 0x8126 # 1 F POINT_SIZE_MAX_ARB = 0x8127 # 1 F POINT_FADE_THRESHOLD_SIZE_ARB = 0x8128 # 1 F POINT_DISTANCE_ATTENUATION_ARB = 0x8129 # 3 F EXT_point_parameters enum: POINT_SIZE_MIN_EXT = 0x8126 # 1 F POINT_SIZE_MAX_EXT = 0x8127 # 1 F POINT_FADE_THRESHOLD_SIZE_EXT = 0x8128 # 1 F DISTANCE_ATTENUATION_EXT = 0x8129 # 3 F SGIS_point_parameters enum: POINT_SIZE_MIN_SGIS = 0x8126 # 1 F POINT_SIZE_MAX_SGIS = 0x8127 # 1 F POINT_FADE_THRESHOLD_SIZE_SGIS = 0x8128 # 1 F DISTANCE_ATTENUATION_SGIS = 0x8129 # 3 F ############################################################################### SGIS_fog_function enum: FOG_FUNC_SGIS = 0x812A FOG_FUNC_POINTS_SGIS = 0x812B # 1 I MAX_FOG_FUNC_POINTS_SGIS = 0x812C # 1 I ############################################################################### VERSION_1_3 enum: (Promoted for OpenGL 1.3) CLAMP_TO_BORDER = 0x812D ARB_texture_border_clamp enum: CLAMP_TO_BORDER_ARB = 0x812D SGIS_texture_border_clamp enum: CLAMP_TO_BORDER_SGIS = 0x812D ############################################################################### SGIX_texture_multi_buffer enum: TEXTURE_MULTI_BUFFER_HINT_SGIX = 0x812E ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) CLAMP_TO_EDGE = 0x812F SGIS_texture_edge_clamp enum: CLAMP_TO_EDGE_SGIS = 0x812F ############################################################################### SGIS_texture4D enum: PACK_SKIP_VOLUMES_SGIS = 0x8130 # 1 I PACK_IMAGE_DEPTH_SGIS = 0x8131 # 1 I UNPACK_SKIP_VOLUMES_SGIS = 0x8132 # 1 I UNPACK_IMAGE_DEPTH_SGIS = 0x8133 # 1 I TEXTURE_4D_SGIS = 0x8134 # 1 I PROXY_TEXTURE_4D_SGIS = 0x8135 TEXTURE_4DSIZE_SGIS = 0x8136 TEXTURE_WRAP_Q_SGIS = 0x8137 MAX_4D_TEXTURE_SIZE_SGIS = 0x8138 # 1 I TEXTURE_4D_BINDING_SGIS = 0x814F # 1 I ############################################################################### SGIX_pixel_texture enum: PIXEL_TEX_GEN_SGIX = 0x8139 # 1 I PIXEL_TEX_GEN_MODE_SGIX = 0x832B # 1 I ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) TEXTURE_MIN_LOD = 0x813A TEXTURE_MAX_LOD = 0x813B TEXTURE_BASE_LEVEL = 0x813C TEXTURE_MAX_LEVEL = 0x813D SGIS_texture_lod enum: TEXTURE_MIN_LOD_SGIS = 0x813A TEXTURE_MAX_LOD_SGIS = 0x813B TEXTURE_BASE_LEVEL_SGIS = 0x813C TEXTURE_MAX_LEVEL_SGIS = 0x813D ############################################################################### SGIX_pixel_tiles enum: PIXEL_TILE_BEST_ALIGNMENT_SGIX = 0x813E # 1 I PIXEL_TILE_CACHE_INCREMENT_SGIX = 0x813F # 1 I PIXEL_TILE_WIDTH_SGIX = 0x8140 # 1 I PIXEL_TILE_HEIGHT_SGIX = 0x8141 # 1 I PIXEL_TILE_GRID_WIDTH_SGIX = 0x8142 # 1 I PIXEL_TILE_GRID_HEIGHT_SGIX = 0x8143 # 1 I PIXEL_TILE_GRID_DEPTH_SGIX = 0x8144 # 1 I PIXEL_TILE_CACHE_SIZE_SGIX = 0x8145 # 1 I ############################################################################### SGIS_texture_filter4 enum: FILTER4_SGIS = 0x8146 TEXTURE_FILTER4_SIZE_SGIS = 0x8147 ############################################################################### SGIX_sprite enum: SPRITE_SGIX = 0x8148 # 1 I SPRITE_MODE_SGIX = 0x8149 # 1 I SPRITE_AXIS_SGIX = 0x814A # 3 F SPRITE_TRANSLATION_SGIX = 0x814B # 3 F SPRITE_AXIAL_SGIX = 0x814C SPRITE_OBJECT_ALIGNED_SGIX = 0x814D SPRITE_EYE_ALIGNED_SGIX = 0x814E ############################################################################### # SGIS_texture4D (additional; see above): 0x814F ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) CONSTANT_BORDER = 0x8151 # WRAP_BORDER = 0x8152 # Not actually used REPLICATE_BORDER = 0x8153 CONVOLUTION_BORDER_COLOR = 0x8154 HP_convolution_border_modes enum: IGNORE_BORDER_HP = 0x8150 # Not promoted CONSTANT_BORDER_HP = 0x8151 REPLICATE_BORDER_HP = 0x8153 CONVOLUTION_BORDER_COLOR_HP = 0x8154 ############################################################################### # HP: 0x8155-0x816F ############################################################################### SGIX_clipmap enum: LINEAR_CLIPMAP_LINEAR_SGIX = 0x8170 TEXTURE_CLIPMAP_CENTER_SGIX = 0x8171 TEXTURE_CLIPMAP_FRAME_SGIX = 0x8172 TEXTURE_CLIPMAP_OFFSET_SGIX = 0x8173 TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = 0x8174 TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = 0x8175 TEXTURE_CLIPMAP_DEPTH_SGIX = 0x8176 MAX_CLIPMAP_DEPTH_SGIX = 0x8177 # 1 I MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = 0x8178 # 1 I NEAREST_CLIPMAP_NEAREST_SGIX = 0x844D NEAREST_CLIPMAP_LINEAR_SGIX = 0x844E LINEAR_CLIPMAP_NEAREST_SGIX = 0x844F ############################################################################### SGIX_texture_scale_bias enum: POST_TEXTURE_FILTER_BIAS_SGIX = 0x8179 POST_TEXTURE_FILTER_SCALE_SGIX = 0x817A POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = 0x817B # 2 F POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = 0x817C # 2 F ############################################################################### SGIX_reference_plane enum: REFERENCE_PLANE_SGIX = 0x817D # 1 I REFERENCE_PLANE_EQUATION_SGIX = 0x817E # 4 F ############################################################################### SGIX_ir_instrument1 enum: IR_INSTRUMENT1_SGIX = 0x817F # 1 I ############################################################################### SGIX_instruments enum: INSTRUMENT_BUFFER_POINTER_SGIX = 0x8180 INSTRUMENT_MEASUREMENTS_SGIX = 0x8181 # 1 I ############################################################################### SGIX_list_priority enum: LIST_PRIORITY_SGIX = 0x8182 ############################################################################### SGIX_calligraphic_fragment enum: CALLIGRAPHIC_FRAGMENT_SGIX = 0x8183 # 1 I ############################################################################### SGIX_impact_pixel_texture enum: PIXEL_TEX_GEN_Q_CEILING_SGIX = 0x8184 PIXEL_TEX_GEN_Q_ROUND_SGIX = 0x8185 PIXEL_TEX_GEN_Q_FLOOR_SGIX = 0x8186 PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX = 0x8187 PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX = 0x8188 PIXEL_TEX_GEN_ALPHA_LS_SGIX = 0x8189 PIXEL_TEX_GEN_ALPHA_MS_SGIX = 0x818A ############################################################################### SGIX_framezoom enum: FRAMEZOOM_SGIX = 0x818B # 1 I FRAMEZOOM_FACTOR_SGIX = 0x818C # 1 I MAX_FRAMEZOOM_FACTOR_SGIX = 0x818D # 1 I ############################################################################### SGIX_texture_lod_bias enum: TEXTURE_LOD_BIAS_S_SGIX = 0x818E TEXTURE_LOD_BIAS_T_SGIX = 0x818F TEXTURE_LOD_BIAS_R_SGIX = 0x8190 ############################################################################### VERSION_1_4 enum: (Promoted for OpenGL 1.4) GENERATE_MIPMAP = 0x8191 GENERATE_MIPMAP_HINT = 0x8192 # 1 I SGIS_generate_mipmap enum: GENERATE_MIPMAP_SGIS = 0x8191 GENERATE_MIPMAP_HINT_SGIS = 0x8192 # 1 I ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_spotlight_cutoff: 0x8193 # SPOT_CUTOFF_DELTA_SGIX = 0x8193 ############################################################################### SGIX_polynomial_ffd enum: GEOMETRY_DEFORMATION_SGIX = 0x8194 TEXTURE_DEFORMATION_SGIX = 0x8195 DEFORMATIONS_MASK_SGIX = 0x8196 # 1 I MAX_DEFORMATION_ORDER_SGIX = 0x8197 ############################################################################### SGIX_fog_offset enum: FOG_OFFSET_SGIX = 0x8198 # 1 I FOG_OFFSET_VALUE_SGIX = 0x8199 # 4 F ############################################################################### SGIX_shadow enum: TEXTURE_COMPARE_SGIX = 0x819A TEXTURE_COMPARE_OPERATOR_SGIX = 0x819B TEXTURE_LEQUAL_R_SGIX = 0x819C TEXTURE_GEQUAL_R_SGIX = 0x819D ############################################################################### # SGI private extension, not in enumext.spec # SGIX_igloo_interface: 0x819E-0x81A4 # IGLOO_FULLSCREEN_SGIX = 0x819E # IGLOO_VIEWPORT_OFFSET_SGIX = 0x819F # IGLOO_SWAPTMESH_SGIX = 0x81A0 # IGLOO_COLORNORMAL_SGIX = 0x81A1 # IGLOO_IRISGL_MODE_SGIX = 0x81A2 # IGLOO_LMC_COLOR_SGIX = 0x81A3 # IGLOO_TMESHMODE_SGIX = 0x81A4 ############################################################################### VERSION_1_4 enum: (Promoted for OpenGL 1.4) DEPTH_COMPONENT16 = 0x81A5 DEPTH_COMPONENT24 = 0x81A6 DEPTH_COMPONENT32 = 0x81A7 ARB_depth_texture enum: DEPTH_COMPONENT16_ARB = 0x81A5 DEPTH_COMPONENT24_ARB = 0x81A6 DEPTH_COMPONENT32_ARB = 0x81A7 SGIX_depth_texture enum: DEPTH_COMPONENT16_SGIX = 0x81A5 DEPTH_COMPONENT24_SGIX = 0x81A6 DEPTH_COMPONENT32_SGIX = 0x81A7 # Aliases ARB_depth_texture enum above OES_framebuffer_object enum: (OpenGL ES only; additional; see below) DEPTH_COMPONENT16_OES = 0x81A5 # Aliases ARB_depth_texture enum above OES_depth24 enum: (OpenGL ES only) DEPTH_COMPONENT24_OES = 0x81A6 # Aliases ARB_depth_texture enum above OES_depth32 enum: (OpenGL ES only) DEPTH_COMPONENT32_OES = 0x81A7 ############################################################################### EXT_compiled_vertex_array enum: ARRAY_ELEMENT_LOCK_FIRST_EXT = 0x81A8 ARRAY_ELEMENT_LOCK_COUNT_EXT = 0x81A9 ############################################################################### EXT_cull_vertex enum: CULL_VERTEX_EXT = 0x81AA CULL_VERTEX_EYE_POSITION_EXT = 0x81AB CULL_VERTEX_OBJECT_POSITION_EXT = 0x81AC ############################################################################### # Promoted from SGI? EXT_index_array_formats enum: IUI_V2F_EXT = 0x81AD IUI_V3F_EXT = 0x81AE IUI_N3F_V2F_EXT = 0x81AF IUI_N3F_V3F_EXT = 0x81B0 T2F_IUI_V2F_EXT = 0x81B1 T2F_IUI_V3F_EXT = 0x81B2 T2F_IUI_N3F_V2F_EXT = 0x81B3 T2F_IUI_N3F_V3F_EXT = 0x81B4 ############################################################################### # Promoted from SGI? EXT_index_func enum: INDEX_TEST_EXT = 0x81B5 INDEX_TEST_FUNC_EXT = 0x81B6 INDEX_TEST_REF_EXT = 0x81B7 ############################################################################### # Promoted from SGI? EXT_index_material enum: INDEX_MATERIAL_EXT = 0x81B8 INDEX_MATERIAL_PARAMETER_EXT = 0x81B9 INDEX_MATERIAL_FACE_EXT = 0x81BA ############################################################################### SGIX_ycrcb enum: YCRCB_422_SGIX = 0x81BB YCRCB_444_SGIX = 0x81BC ############################################################################### # Incomplete extension, not in enumext.spec # SGI_complex_type: 0x81BD-0x81C3 # COMPLEX_UNSIGNED_BYTE_SGI = 0x81BD # COMPLEX_BYTE_SGI = 0x81BE # COMPLEX_UNSIGNED_SHORT_SGI = 0x81BF # COMPLEX_SHORT_SGI = 0x81C0 # COMPLEX_UNSIGNED_INT_SGI = 0x81C1 # COMPLEX_INT_SGI = 0x81C2 # COMPLEX_FLOAT_SGI = 0x81C3 ############################################################################### # Incomplete extension, not in enumext.spec # SGI_fft: 0x81C4-0x81CA # POST_TRANSFORM_RED_SCALE_SGI = ???? # 1 F # POST_TRANSFORM_GREEN_SCALE_SGI = ???? # 1 F # POST_TRANSFORM_BLUE_SCALE_SGI = ???? # 1 F # POST_TRANSFORM_ALPHA_SCALE_SGI = ???? # 1 F # POST_TRANSFORM_RED_BIAS_SGI = ???? # 1 F # POST_TRANSFORM_GREEN_BIAS_SGI = ???? # 1 F # POST_TRANSFORM_BLUE_BIAS_SGI = ???? # 1 F # POST_TRANSFORM_ALPHA_BIAS_SGI = ???? # 1 F # PIXEL_TRANSFORM_OPERATOR_SGI = 0x81C4 # 1 I # CONVOLUTION_SGI = 0x81C5 # FFT_1D_SGI = 0x81C6 # PIXEL_TRANSFORM_SGI = 0x81C7 # MAX_FFT_WIDTH_SGI = 0x81C8 # SORT_SGI = 0x81C9 # TRANSPOSE_SGI = 0x81CA ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_nurbs_eval: 0x81CB-0x81CF # MAP1_VERTEX_3_NURBS_SGIX = 0x81CB # 1 I # MAP1_VERTEX_4_NURBS_SGIX = 0x81CC # 1 I # MAP1_INDEX_NURBS_SGIX = 0x81CD # 1 I # MAP1_COLOR_4_NURBS_SGIX = 0x81CE # 1 I # MAP1_NORMAL_NURBS_SGIX = 0x81CF # 1 I # MAP1_TEXTURE_COORD_1_NURBS_SGIX = 0x81E0 # 1 I # MAP1_TEXTURE_COORD_2_NURBS_SGIX = 0x81E1 # 1 I # MAP1_TEXTURE_COORD_3_NURBS_SGIX = 0x81E2 # 1 I # MAP1_TEXTURE_COORD_4_NURBS_SGIX = 0x81E3 # 1 I # MAP2_VERTEX_3_NURBS_SGIX = 0x81E4 # 1 I # MAP2_VERTEX_4_NURBS_SGIX = 0x81E5 # 1 I # MAP2_INDEX_NURBS_SGIX = 0x81E6 # 1 I # MAP2_COLOR_4_NURBS_SGIX = 0x81E7 # 1 I # MAP2_NORMAL_NURBS_SGIX = 0x81E8 # 1 I # MAP2_TEXTURE_COORD_1_NURBS_SGIX = 0x81E9 # 1 I # MAP2_TEXTURE_COORD_2_NURBS_SGIX = 0x81EA # 1 I # MAP2_TEXTURE_COORD_3_NURBS_SGIX = 0x81EB # 1 I # MAP2_TEXTURE_COORD_4_NURBS_SGIX = 0x81EC # 1 I # NURBS_KNOT_COUNT_SGIX = 0x81ED # NURBS_KNOT_VECTOR_SGIX = 0x81EE ############################################################################### # Sun: 0x81D0-0x81DF # No extension spec, not in enumext.spec # SUNX_surface_hint enum: # SURFACE_SIZE_HINT_SUNX = 0x81D2 # LARGE_SUNX = 0x81D3 SUNX_general_triangle_list enum: RESTART_SUN = 0x0001 REPLACE_MIDDLE_SUN = 0x0002 REPLACE_OLDEST_SUN = 0x0003 WRAP_BORDER_SUN = 0x81D4 TRIANGLE_LIST_SUN = 0x81D7 REPLACEMENT_CODE_SUN = 0x81D8 SUNX_constant_data enum: UNPACK_CONSTANT_DATA_SUNX = 0x81D5 TEXTURE_CONSTANT_DATA_SUNX = 0x81D6 SUN_global_alpha enum: GLOBAL_ALPHA_SUN = 0x81D9 GLOBAL_ALPHA_FACTOR_SUN = 0x81DA ############################################################################### # SGIX_nurbs_eval (additional; see above): 0x81E0-0x81EE ############################################################################### SGIS_texture_color_mask enum: TEXTURE_COLOR_WRITEMASK_SGIS = 0x81EF ############################################################################### SGIS_point_line_texgen enum: EYE_DISTANCE_TO_POINT_SGIS = 0x81F0 OBJECT_DISTANCE_TO_POINT_SGIS = 0x81F1 EYE_DISTANCE_TO_LINE_SGIS = 0x81F2 OBJECT_DISTANCE_TO_LINE_SGIS = 0x81F3 EYE_POINT_SGIS = 0x81F4 OBJECT_POINT_SGIS = 0x81F5 EYE_LINE_SGIS = 0x81F6 OBJECT_LINE_SGIS = 0x81F7 ############################################################################### VERSION_1_2 enum: (Promoted for OpenGL 1.2) LIGHT_MODEL_COLOR_CONTROL = 0x81F8 # 1 I SINGLE_COLOR = 0x81F9 SEPARATE_SPECULAR_COLOR = 0x81FA EXT_separate_specular_color enum: LIGHT_MODEL_COLOR_CONTROL_EXT = 0x81F8 SINGLE_COLOR_EXT = 0x81F9 SEPARATE_SPECULAR_COLOR_EXT = 0x81FA ############################################################################### EXT_shared_texture_palette enum: SHARED_TEXTURE_PALETTE_EXT = 0x81FB # 1 I ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_fog_scale: 0x81FC-0x81FD # FOG_SCALE_SGIX = 0x81FC # 1 I # FOG_SCALE_VALUE_SGIX = 0x81FD # 1 F ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_fog_blend: 0x81FE-0x81FF # FOG_BLEND_ALPHA_SGIX = 0x81FE # 1 I # FOG_BLEND_COLOR_SGIX = 0x81FF # 1 I ############################################################################### # ATI: 0x8200-0x820F (released by Microsoft 2002/9/16) ATI_text_fragment_shader enum: TEXT_FRAGMENT_SHADER_ATI = 0x8200 ############################################################################### # OpenGL ARB: 0x8210-0x823F VERSION_3_0 enum: use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_RED_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_GREEN_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_BLUE_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE use ARB_framebuffer_object FRAMEBUFFER_DEFAULT use ARB_framebuffer_object FRAMEBUFFER_UNDEFINED use ARB_framebuffer_object DEPTH_STENCIL_ATTACHMENT ARB_framebuffer_object enum: (note: no ARB suffixes) FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_DEFAULT = 0x8218 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_UNDEFINED = 0x8219 # VERSION_3_0 / ARB_fbo DEPTH_STENCIL_ATTACHMENT = 0x821A # VERSION_3_0 / ARB_fbo VERSION_3_0 enum: MAJOR_VERSION = 0x821B # VERSION_3_0 MINOR_VERSION = 0x821C # VERSION_3_0 NUM_EXTENSIONS = 0x821D # VERSION_3_0 CONTEXT_FLAGS = 0x821E # VERSION_3_0 # ARB_future_use: 0x821F-0x8221 VERSION_3_0 enum: use ARB_framebuffer_object INDEX ARB_framebuffer_object enum: (note: no ARB suffixes) INDEX = 0x8222 # VERSION_3_0 / ARB_fbo VERSION_3_0 enum: DEPTH_BUFFER = 0x8223 # VERSION_3_0 STENCIL_BUFFER = 0x8224 # VERSION_3_0 COMPRESSED_RED = 0x8225 # VERSION_3_0 COMPRESSED_RG = 0x8226 # VERSION_3_0 VERSION_3_0 enum: use ARB_texture_rg RG use ARB_texture_rg RG_INTEGER use ARB_texture_rg R8 use ARB_texture_rg R16 use ARB_texture_rg RG8 use ARB_texture_rg RG16 use ARB_texture_rg R16F use ARB_texture_rg R32F use ARB_texture_rg RG16F use ARB_texture_rg RG32F use ARB_texture_rg R8I use ARB_texture_rg R8UI use ARB_texture_rg R16I use ARB_texture_rg R16UI use ARB_texture_rg R32I use ARB_texture_rg R32UI use ARB_texture_rg RG8I use ARB_texture_rg RG8UI use ARB_texture_rg RG16I use ARB_texture_rg RG16UI use ARB_texture_rg RG32I use ARB_texture_rg RG32UI ARB_texture_rg enum: (note: no ARB suffixes) RG = 0x8227 # VERSION_3_0 / ARB_trg RG_INTEGER = 0x8228 # VERSION_3_0 / ARB_trg R8 = 0x8229 # VERSION_3_0 / ARB_trg R16 = 0x822A # VERSION_3_0 / ARB_trg RG8 = 0x822B # VERSION_3_0 / ARB_trg RG16 = 0x822C # VERSION_3_0 / ARB_trg R16F = 0x822D # VERSION_3_0 / ARB_trg R32F = 0x822E # VERSION_3_0 / ARB_trg RG16F = 0x822F # VERSION_3_0 / ARB_trg RG32F = 0x8230 # VERSION_3_0 / ARB_trg R8I = 0x8231 # VERSION_3_0 / ARB_trg R8UI = 0x8232 # VERSION_3_0 / ARB_trg R16I = 0x8233 # VERSION_3_0 / ARB_trg R16UI = 0x8234 # VERSION_3_0 / ARB_trg R32I = 0x8235 # VERSION_3_0 / ARB_trg R32UI = 0x8236 # VERSION_3_0 / ARB_trg RG8I = 0x8237 # VERSION_3_0 / ARB_trg RG8UI = 0x8238 # VERSION_3_0 / ARB_trg RG16I = 0x8239 # VERSION_3_0 / ARB_trg RG16UI = 0x823A # VERSION_3_0 / ARB_trg RG32I = 0x823B # VERSION_3_0 / ARB_trg RG32UI = 0x823C # VERSION_3_0 / ARB_trg # ARB_future_use: 0x823D-0x823F ############################################################################### # @@@ Any_vendor_future_use: 0x8240-0x82AF (released by Microsoft 2002/9/16) ############################################################################### # ADD: 0x82B0-0x830F ############################################################################### SGIX_depth_pass_instrument enum: 0x8310-0x8312 DEPTH_PASS_INSTRUMENT_SGIX = 0x8310 DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = 0x8311 DEPTH_PASS_INSTRUMENT_MAX_SGIX = 0x8312 ############################################################################### SGIX_fragments_instrument enum: 0x8313-0x8315 FRAGMENTS_INSTRUMENT_SGIX = 0x8313 # 1 I FRAGMENTS_INSTRUMENT_COUNTERS_SGIX = 0x8314 # 1 I FRAGMENTS_INSTRUMENT_MAX_SGIX = 0x8315 # 1 I ############################################################################### SGIX_convolution_accuracy enum: CONVOLUTION_HINT_SGIX = 0x8316 # 1 I ############################################################################### # SGIX_color_matrix_accuracy: 0x8317 ############################################################################### # 0x8318-0x8319 SGIX_ycrcba enum: YCRCB_SGIX = 0x8318 YCRCBA_SGIX = 0x8319 ############################################################################### # 0x831A-0x831F SGIX_slim enum: UNPACK_COMPRESSED_SIZE_SGIX = 0x831A PACK_MAX_COMPRESSED_SIZE_SGIX = 0x831B PACK_COMPRESSED_SIZE_SGIX = 0x831C SLIM8U_SGIX = 0x831D SLIM10U_SGIX = 0x831E SLIM12S_SGIX = 0x831F ############################################################################### SGIX_blend_alpha_minmax enum: ALPHA_MIN_SGIX = 0x8320 ALPHA_MAX_SGIX = 0x8321 ############################################################################### SGIX_scalebias_hint enum: SCALEBIAS_HINT_SGIX = 0x8322 ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_fog_layers: 0x8323-0x8328 # FOG_TYPE_SGIX = 0x8323 # 1 I # UNIFORM_SGIX = 0x8324 # LAYERED_SGIX = 0x8325 # FOG_GROUND_PLANE_SGIX = 0x8326 # 4 F # FOG_LAYERS_POINTS_SGIX = 0x8327 # 1 I # MAX_FOG_LAYERS_POINTS_SGIX = 0x8328 # 1 I ############################################################################### SGIX_async enum: ASYNC_MARKER_SGIX = 0x8329 ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_texture_phase: 0x832A # PHASE_SGIX = 0x832A ############################################################################### # SGIX_pixel_texture (additional; see above): 0x832B ############################################################################### SGIX_async_histogram enum: ASYNC_HISTOGRAM_SGIX = 0x832C MAX_ASYNC_HISTOGRAM_SGIX = 0x832D ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_texture_mipmap_anisotropic: 0x832E-0x832F # TEXTURE_MIPMAP_ANISOTROPY_SGIX = 0x832E # MAX_MIPMAP_ANISOTROPY_SGIX = 0x832F # 1 I ############################################################################### EXT_pixel_transform enum: PIXEL_TRANSFORM_2D_EXT = 0x8330 PIXEL_MAG_FILTER_EXT = 0x8331 PIXEL_MIN_FILTER_EXT = 0x8332 PIXEL_CUBIC_WEIGHT_EXT = 0x8333 CUBIC_EXT = 0x8334 AVERAGE_EXT = 0x8335 PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = 0x8336 MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = 0x8337 PIXEL_TRANSFORM_2D_MATRIX_EXT = 0x8338 # SUN_future_use: 0x8339-0x833F ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_cube_map: 0x8340-0x8348 # ENV_MAP_SGIX = 0x8340 # CUBE_MAP_SGIX = 0x8341 # CUBE_MAP_ZP_SGIX = 0x8342 # CUBE_MAP_ZN_SGIX = 0x8343 # CUBE_MAP_XN_SGIX = 0x8344 # CUBE_MAP_XP_SGIX = 0x8345 # CUBE_MAP_YN_SGIX = 0x8346 # CUBE_MAP_YP_SGIX = 0x8347 # CUBE_MAP_BINDING_SGIX = 0x8348 # 1 I ############################################################################### # Unfortunately, there was a collision promoting to EXT from SGIX. # Use fog_coord's value of 0x8452 instead of the previously # assigned FRAGMENT_DEPTH_EXT -> 0x834B. # EXT_light_texture: 0x8349-0x8352 EXT_light_texture enum: 0x8349-0x8352 FRAGMENT_MATERIAL_EXT = 0x8349 FRAGMENT_NORMAL_EXT = 0x834A FRAGMENT_COLOR_EXT = 0x834C ATTENUATION_EXT = 0x834D SHADOW_ATTENUATION_EXT = 0x834E TEXTURE_APPLICATION_MODE_EXT = 0x834F # 1 I TEXTURE_LIGHT_EXT = 0x8350 # 1 I TEXTURE_MATERIAL_FACE_EXT = 0x8351 # 1 I TEXTURE_MATERIAL_PARAMETER_EXT = 0x8352 # 1 I use EXT_fog_coord FRAGMENT_DEPTH_EXT ############################################################################### SGIS_pixel_texture enum: PIXEL_TEXTURE_SGIS = 0x8353 # 1 I PIXEL_FRAGMENT_RGB_SOURCE_SGIS = 0x8354 # 1 I PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = 0x8355 # 1 I PIXEL_GROUP_COLOR_SGIS = 0x8356 # 1 I ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_pixel_texture_bits: 0x8357-0x8359 # COLOR_TO_TEXTURE_COORD_SGIX = 0x8357 # COLOR_BIT_PATTERN_SGIX = 0x8358 # COLOR_VALUE_SGIX = 0x8359 ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_pixel_texture_lod: 0x835A # PIXEL_TEX_GEN_LAMBDA_SOURCE_SGIX = 0x835A ############################################################################### SGIX_line_quality_hint enum: LINE_QUALITY_HINT_SGIX = 0x835B ############################################################################### SGIX_async_pixel enum: ASYNC_TEX_IMAGE_SGIX = 0x835C ASYNC_DRAW_PIXELS_SGIX = 0x835D ASYNC_READ_PIXELS_SGIX = 0x835E MAX_ASYNC_TEX_IMAGE_SGIX = 0x835F MAX_ASYNC_DRAW_PIXELS_SGIX = 0x8360 MAX_ASYNC_READ_PIXELS_SGIX = 0x8361 ############################################################################### # EXT_packed_pixels (additional; see above): 0x8362-0x8368 ############################################################################### SGIX_texture_coordinate_clamp enum: TEXTURE_MAX_CLAMP_S_SGIX = 0x8369 TEXTURE_MAX_CLAMP_T_SGIX = 0x836A TEXTURE_MAX_CLAMP_R_SGIX = 0x836B ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_fog_texture: 0x836C-0x836E # FRAGMENT_FOG_SGIX = 0x836C # TEXTURE_FOG_SGIX = 0x836D # 1 I # FOG_PATCHY_FACTOR_SGIX = 0x836E ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_fog_factor_to_alpha: 0x836F FOG_FACTOR_TO_ALPHA_SGIX = 0x836F ############################################################################### # HP: 0x8370-0x837F # NOTE: IBM is using values in this range, because of a bobble # when Pat Brown left at the same time as I assigned them the # next range and their registry became inconsistent. Unknown # whether HP has any conflicts as they have never reported using # any values in this range. VERSION_1_4 enum: (Promoted for OpenGL 1.4) MIRRORED_REPEAT = 0x8370 ARB_texture_mirrored_repeat enum: MIRRORED_REPEAT_ARB = 0x8370 IBM_texture_mirrored_repeat enum: MIRRORED_REPEAT_IBM = 0x8370 # Aliases ARB_texture_mirrored_repeat enum above OES_texture_mirrored_repeat enum: (OpenGL ES only) MIRRORED_REPEAT_OES = 0x8370 ############################################################################### # IBM: 0x8380-0x839F ############################################################################### # S3: 0x83A0-0x83BF S3_s3tc enum: RGB_S3TC = 0x83A0 RGB4_S3TC = 0x83A1 RGBA_S3TC = 0x83A2 RGBA4_S3TC = 0x83A3 # S3_future_use: 0x83A4-0x83BF ############################################################################### # Obsolete extension, never to be put in enumext.spec # SGIS_multitexture: 0x83C0-0x83E5 # SELECTED_TEXTURE_SGIS = 0x83C0 # 1 I # SELECTED_TEXTURE_COORD_SET_SGIS = 0x83C1 # 1 I # SELECTED_TEXTURE_TRANSFORM_SGIS = 0x83C2 # 1 I # MAX_TEXTURES_SGIS = 0x83C3 # 1 I # MAX_TEXTURE_COORD_SETS_SGIS = 0x83C4 # 1 I # TEXTURE_COORD_SET_INTERLEAVE_FACTOR_SGIS = 0x83C5 # 1 I # TEXTURE_ENV_COORD_SET_SGIS = 0x83C6 # TEXTURE0_SGIS = 0x83C7 # TEXTURE1_SGIS = 0x83C8 # TEXTURE2_SGIS = 0x83C9 # TEXTURE3_SGIS = 0x83CA # # SGIS_multitexture_future_use: 0x83CB-0x83E5 ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_bali_g_instruments: 0x83E6-0x83E9 # BALI_NUM_TRIS_CULLED_INSTRUMENT_SGIX = 0x83E6 # 1 I # BALI_NUM_PRIMS_CLIPPED_INSTRUMENT_SGIX = 0x83E7 # 1 I # BALI_NUM_PRIMS_REJECT_INSTRUMENT_SGIX = 0x83E8 # 1 I # BALI_NUM_PRIMS_CLIP_RESULT_INSTRUMENT_SGIX = 0x83E9 # 1 I ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_bali_r_instruments: 0x83EA-0x83EC # BALI_FRAGMENTS_GENERATED_INSTRUMENT_SGIX = 0x83EA # 1 I # BALI_DEPTH_PASS_INSTRUMENT_SGIX = 0x83EB # 1 I # BALI_R_CHIP_COUNT_SGIX = 0x83EC # 1 I ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_occlusion_instrument: 0x83ED # OCCLUSION_INSTRUMENT_SGIX = 0x83ED # 1 I ############################################################################### SGIX_vertex_preclip enum: VERTEX_PRECLIP_SGIX = 0x83EE VERTEX_PRECLIP_HINT_SGIX = 0x83EF ############################################################################### # INTEL: 0x83F0-0x83FF # Note that this block was reclaimed from NTP, who never shipped it, # and reassigned to Intel. EXT_texture_compression_s3tc enum: COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0 COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1 COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2 COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3 INTEL_parallel_arrays enum: PARALLEL_ARRAYS_INTEL = 0x83F4 VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F5 NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F6 COLOR_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F7 TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F8 # INTEL_future_use: 0x83F9-0x83FF ############################################################################### SGIX_fragment_lighting enum: FRAGMENT_LIGHTING_SGIX = 0x8400 # 1 I FRAGMENT_COLOR_MATERIAL_SGIX = 0x8401 # 1 I FRAGMENT_COLOR_MATERIAL_FACE_SGIX = 0x8402 # 1 I FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = 0x8403 # 1 I MAX_FRAGMENT_LIGHTS_SGIX = 0x8404 # 1 I MAX_ACTIVE_LIGHTS_SGIX = 0x8405 # 1 I CURRENT_RASTER_NORMAL_SGIX = 0x8406 # 1 I LIGHT_ENV_MODE_SGIX = 0x8407 # 1 I FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = 0x8408 # 1 I FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = 0x8409 # 1 I FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = 0x840A # 4 F FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = 0x840B # 1 I FRAGMENT_LIGHT0_SGIX = 0x840C # 1 I FRAGMENT_LIGHT1_SGIX = 0x840D FRAGMENT_LIGHT2_SGIX = 0x840E FRAGMENT_LIGHT3_SGIX = 0x840F FRAGMENT_LIGHT4_SGIX = 0x8410 FRAGMENT_LIGHT5_SGIX = 0x8411 FRAGMENT_LIGHT6_SGIX = 0x8412 FRAGMENT_LIGHT7_SGIX = 0x8413 # SGIX_fragment_lighting_future_use: 0x8414-0x842B ############################################################################### SGIX_resample enum: PACK_RESAMPLE_SGIX = 0x842C UNPACK_RESAMPLE_SGIX = 0x842D RESAMPLE_REPLICATE_SGIX = 0x842E RESAMPLE_ZERO_FILL_SGIX = 0x842F RESAMPLE_DECIMATE_SGIX = 0x8430 # SGIX_resample_future_use: 0x8431-0x8435 ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_fragment_lighting_space: 0x8436-0x8449 # EYE_SPACE_SGIX = 0x8436 # TANGENT_SPACE_SGIX = 0x8437 # OBJECT_SPACE_SGIX = 0x8438 # TANGENT_ARRAY_SGIX = 0x8439 # BINORMAL_ARRAY_SGIX = 0x843A # CURRENT_TANGENT_SGIX = 0x843B # 3 F # CURRENT_BINORMAL_SGIX = 0x843C # 3 F # FRAGMENT_LIGHT_SPACE_SGIX = 0x843D # 1 I # TANGENT_ARRAY_TYPE_SGIX = 0x843E # TANGENT_ARRAY_STRIDE_SGIX = 0x843F # TANGENT_ARRAY_COUNT_SGIX = 0x8440 # BINORMAL_ARRAY_TYPE_SGIX = 0x8441 # BINORMAL_ARRAY_STRIDE_SGIX = 0x8442 # BINORMAL_ARRAY_COUNT_SGIX = 0x8443 # TANGENT_ARRAY_POINTER_SGIX = 0x8444 # BINORMAL_ARRAY_POINTER_SGIX = 0x8445 # MAP1_TANGENT_SGIX = 0x8446 # MAP2_TANGENT_SGIX = 0x8447 # MAP1_BINORMAL_SGIX = 0x8448 # MAP2_BINORMAL_SGIX = 0x8449 ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_bali_timer_instruments: 0x844A-0x844C # BALI_GEOM_TIMER_INSTRUMENT_SGIX = 0x844A # 1 I # BALI_RASTER_TIMER_INSTRUMENT_SGIX = 0x844B # 1 I # BALI_INSTRUMENT_TIME_UNIT_SGIX = 0x844C # 1 I ############################################################################### # SGIX_clipmap (additional; see above): 0x844D-0x844F ############################################################################### # SGI (actually brokered for Id Software): 0x8450-0x845F VERSION_1_5 enum: (Consistent naming scheme for OpenGL 1.5) FOG_COORD_SRC = 0x8450 # alias GL_FOG_COORDINATE_SOURCE FOG_COORD = 0x8451 # alias GL_FOG_COORDINATE CURRENT_FOG_COORD = 0x8453 # alias GL_CURRENT_FOG_COORDINATE FOG_COORD_ARRAY_TYPE = 0x8454 # alias GL_FOG_COORDINATE_ARRAY_TYPE FOG_COORD_ARRAY_STRIDE = 0x8455 # alias GL_FOG_COORDINATE_ARRAY_STRIDE FOG_COORD_ARRAY_POINTER = 0x8456 # alias GL_FOG_COORDINATE_ARRAY_POINTER FOG_COORD_ARRAY = 0x8457 # alias GL_FOG_COORDINATE_ARRAY VERSION_1_4 enum: (Promoted for OpenGL 1.4) FOG_COORDINATE_SOURCE = 0x8450 # 1 I FOG_COORDINATE = 0x8451 FRAGMENT_DEPTH = 0x8452 CURRENT_FOG_COORDINATE = 0x8453 # 1 F FOG_COORDINATE_ARRAY_TYPE = 0x8454 # 1 I FOG_COORDINATE_ARRAY_STRIDE = 0x8455 # 1 I FOG_COORDINATE_ARRAY_POINTER = 0x8456 FOG_COORDINATE_ARRAY = 0x8457 # 1 I EXT_fog_coord enum: FOG_COORDINATE_SOURCE_EXT = 0x8450 # 1 I FOG_COORDINATE_EXT = 0x8451 FRAGMENT_DEPTH_EXT = 0x8452 CURRENT_FOG_COORDINATE_EXT = 0x8453 # 1 F FOG_COORDINATE_ARRAY_TYPE_EXT = 0x8454 # 1 I FOG_COORDINATE_ARRAY_STRIDE_EXT = 0x8455 # 1 I FOG_COORDINATE_ARRAY_POINTER_EXT = 0x8456 FOG_COORDINATE_ARRAY_EXT = 0x8457 # 1 I VERSION_1_4 enum: (Promoted for OpenGL 1.4) COLOR_SUM = 0x8458 # 1 I CURRENT_SECONDARY_COLOR = 0x8459 # 3 F SECONDARY_COLOR_ARRAY_SIZE = 0x845A # 1 I SECONDARY_COLOR_ARRAY_TYPE = 0x845B # 1 I SECONDARY_COLOR_ARRAY_STRIDE = 0x845C # 1 I SECONDARY_COLOR_ARRAY_POINTER = 0x845D SECONDARY_COLOR_ARRAY = 0x845E # 1 I EXT_secondary_color enum: COLOR_SUM_EXT = 0x8458 # 1 I CURRENT_SECONDARY_COLOR_EXT = 0x8459 # 3 F SECONDARY_COLOR_ARRAY_SIZE_EXT = 0x845A # 1 I SECONDARY_COLOR_ARRAY_TYPE_EXT = 0x845B # 1 I SECONDARY_COLOR_ARRAY_STRIDE_EXT = 0x845C # 1 I SECONDARY_COLOR_ARRAY_POINTER_EXT = 0x845D SECONDARY_COLOR_ARRAY_EXT = 0x845E # 1 I ARB_vertex_program enum: COLOR_SUM_ARB = 0x8458 # 1 I # ARB_vertex_program VERSION_2_1 enum: CURRENT_RASTER_SECONDARY_COLOR = 0x845F ############################################################################### # Incomplete extension, not in enumext.spec SGIX_icc_texture enum: # RGB_ICC_SGIX = 0x8460 # RGBA_ICC_SGIX = 0x8461 # ALPHA_ICC_SGIX = 0x8462 # LUMINANCE_ICC_SGIX = 0x8463 # INTENSITY_ICC_SGIX = 0x8464 # LUMINANCE_ALPHA_ICC_SGIX = 0x8465 # R5_G6_B5_ICC_SGIX = 0x8466 # R5_G6_B5_A8_ICC_SGIX = 0x8467 # ALPHA16_ICC_SGIX = 0x8468 # LUMINANCE16_ICC_SGIX = 0x8469 # INTENSITY16_ICC_SGIX = 0x846A # LUMINANCE16_ALPHA8_ICC_SGIX = 0x846B ############################################################################### # SGI_future_use: 0x846C ############################################################################### # SMOOTH_* enums are new names for pre-1.2 enums. VERSION_1_2 enum: SMOOTH_POINT_SIZE_RANGE = 0x0B12 # 2 F SMOOTH_POINT_SIZE_GRANULARITY = 0x0B13 # 1 F SMOOTH_LINE_WIDTH_RANGE = 0x0B22 # 2 F SMOOTH_LINE_WIDTH_GRANULARITY = 0x0B23 # 1 F ALIASED_POINT_SIZE_RANGE = 0x846D # 2 F ALIASED_LINE_WIDTH_RANGE = 0x846E # 2 F ############################################################################### # SGI_future_use: 0x846F ############################################################################### # ATI Technologies (vendor multitexture, spec not yet released): 0x8470-0x848F ############################################################################### # REND (Rendition): 0x8490-0x849F REND_screen_coordinates enum: SCREEN_COORDINATES_REND = 0x8490 INVERTED_SCREEN_W_REND = 0x8491 ############################################################################### # ATI Technologies (vendor multitexture, spec not yet released): 0x84A0-84BF ############################################################################### # OpenGL ARB: 0x84C0-0x84EF VERSION_1_3 enum: (Promoted for OpenGL 1.3) TEXTURE0 = 0x84C0 TEXTURE1 = 0x84C1 TEXTURE2 = 0x84C2 TEXTURE3 = 0x84C3 TEXTURE4 = 0x84C4 TEXTURE5 = 0x84C5 TEXTURE6 = 0x84C6 TEXTURE7 = 0x84C7 TEXTURE8 = 0x84C8 TEXTURE9 = 0x84C9 TEXTURE10 = 0x84CA TEXTURE11 = 0x84CB TEXTURE12 = 0x84CC TEXTURE13 = 0x84CD TEXTURE14 = 0x84CE TEXTURE15 = 0x84CF TEXTURE16 = 0x84D0 TEXTURE17 = 0x84D1 TEXTURE18 = 0x84D2 TEXTURE19 = 0x84D3 TEXTURE20 = 0x84D4 TEXTURE21 = 0x84D5 TEXTURE22 = 0x84D6 TEXTURE23 = 0x84D7 TEXTURE24 = 0x84D8 TEXTURE25 = 0x84D9 TEXTURE26 = 0x84DA TEXTURE27 = 0x84DB TEXTURE28 = 0x84DC TEXTURE29 = 0x84DD TEXTURE30 = 0x84DE TEXTURE31 = 0x84DF ACTIVE_TEXTURE = 0x84E0 # 1 I CLIENT_ACTIVE_TEXTURE = 0x84E1 # 1 I MAX_TEXTURE_UNITS = 0x84E2 # 1 I ARB_multitexture enum: TEXTURE0_ARB = 0x84C0 TEXTURE1_ARB = 0x84C1 TEXTURE2_ARB = 0x84C2 TEXTURE3_ARB = 0x84C3 TEXTURE4_ARB = 0x84C4 TEXTURE5_ARB = 0x84C5 TEXTURE6_ARB = 0x84C6 TEXTURE7_ARB = 0x84C7 TEXTURE8_ARB = 0x84C8 TEXTURE9_ARB = 0x84C9 TEXTURE10_ARB = 0x84CA TEXTURE11_ARB = 0x84CB TEXTURE12_ARB = 0x84CC TEXTURE13_ARB = 0x84CD TEXTURE14_ARB = 0x84CE TEXTURE15_ARB = 0x84CF TEXTURE16_ARB = 0x84D0 TEXTURE17_ARB = 0x84D1 TEXTURE18_ARB = 0x84D2 TEXTURE19_ARB = 0x84D3 TEXTURE20_ARB = 0x84D4 TEXTURE21_ARB = 0x84D5 TEXTURE22_ARB = 0x84D6 TEXTURE23_ARB = 0x84D7 TEXTURE24_ARB = 0x84D8 TEXTURE25_ARB = 0x84D9 TEXTURE26_ARB = 0x84DA TEXTURE27_ARB = 0x84DB TEXTURE28_ARB = 0x84DC TEXTURE29_ARB = 0x84DD TEXTURE30_ARB = 0x84DE TEXTURE31_ARB = 0x84DF ACTIVE_TEXTURE_ARB = 0x84E0 # 1 I CLIENT_ACTIVE_TEXTURE_ARB = 0x84E1 # 1 I MAX_TEXTURE_UNITS_ARB = 0x84E2 # 1 I # These are really core ES 1.1 enums, but haven't included # ES core enums in enum.spec yet OES_texture_env_crossbar enum: (OpenGL ES only) use VERSION_1_3 TEXTURE0 use VERSION_1_3 TEXTURE1 use VERSION_1_3 TEXTURE2 use VERSION_1_3 TEXTURE3 use VERSION_1_3 TEXTURE4 use VERSION_1_3 TEXTURE5 use VERSION_1_3 TEXTURE6 use VERSION_1_3 TEXTURE7 use VERSION_1_3 TEXTURE8 use VERSION_1_3 TEXTURE9 use VERSION_1_3 TEXTURE10 use VERSION_1_3 TEXTURE11 use VERSION_1_3 TEXTURE12 use VERSION_1_3 TEXTURE13 use VERSION_1_3 TEXTURE14 use VERSION_1_3 TEXTURE15 use VERSION_1_3 TEXTURE16 use VERSION_1_3 TEXTURE17 use VERSION_1_3 TEXTURE18 use VERSION_1_3 TEXTURE19 use VERSION_1_3 TEXTURE20 use VERSION_1_3 TEXTURE21 use VERSION_1_3 TEXTURE22 use VERSION_1_3 TEXTURE23 use VERSION_1_3 TEXTURE24 use VERSION_1_3 TEXTURE25 use VERSION_1_3 TEXTURE26 use VERSION_1_3 TEXTURE27 use VERSION_1_3 TEXTURE28 use VERSION_1_3 TEXTURE29 use VERSION_1_3 TEXTURE30 use VERSION_1_3 TEXTURE31 ############################################################################### VERSION_1_3 enum: (Promoted for OpenGL 1.3) TRANSPOSE_MODELVIEW_MATRIX = 0x84E3 # 16 F TRANSPOSE_PROJECTION_MATRIX = 0x84E4 # 16 F TRANSPOSE_TEXTURE_MATRIX = 0x84E5 # 16 F TRANSPOSE_COLOR_MATRIX = 0x84E6 # 16 F ARB_transpose_matrix enum: TRANSPOSE_MODELVIEW_MATRIX_ARB = 0x84E3 # 16 F TRANSPOSE_PROJECTION_MATRIX_ARB = 0x84E4 # 16 F TRANSPOSE_TEXTURE_MATRIX_ARB = 0x84E5 # 16 F TRANSPOSE_COLOR_MATRIX_ARB = 0x84E6 # 16 F VERSION_1_3 enum: (Promoted for OpenGL 1.3) SUBTRACT = 0x84E7 ARB_texture_env_combine enum: SUBTRACT_ARB = 0x84E7 VERSION_3_0 enum: use ARB_framebuffer_object MAX_RENDERBUFFER_SIZE ARB_framebuffer_object enum: (note: no ARB suffixes) MAX_RENDERBUFFER_SIZE = 0x84E8 # VERSION_3_0 / ARB_fbo EXT_framebuffer_object enum: (additional; see below): MAX_RENDERBUFFER_SIZE_EXT = 0x84E8 # Aliases EXT_framebuffer_object enum above OES_framebuffer_object enum: (OpenGL ES only; additional; see below) MAX_RENDERBUFFER_SIZE_OES = 0x84E8 VERSION_1_3 enum: (Promoted for OpenGL 1.3) COMPRESSED_ALPHA = 0x84E9 COMPRESSED_LUMINANCE = 0x84EA COMPRESSED_LUMINANCE_ALPHA = 0x84EB COMPRESSED_INTENSITY = 0x84EC COMPRESSED_RGB = 0x84ED COMPRESSED_RGBA = 0x84EE TEXTURE_COMPRESSION_HINT = 0x84EF TEXTURE_COMPRESSED_IMAGE_SIZE = 0x86A0 TEXTURE_COMPRESSED = 0x86A1 NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2 COMPRESSED_TEXTURE_FORMATS = 0x86A3 ARB_texture_compression enum: COMPRESSED_ALPHA_ARB = 0x84E9 COMPRESSED_LUMINANCE_ARB = 0x84EA COMPRESSED_LUMINANCE_ALPHA_ARB = 0x84EB COMPRESSED_INTENSITY_ARB = 0x84EC COMPRESSED_RGB_ARB = 0x84ED COMPRESSED_RGBA_ARB = 0x84EE TEXTURE_COMPRESSION_HINT_ARB = 0x84EF TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = 0x86A0 TEXTURE_COMPRESSED_ARB = 0x86A1 NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A2 COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A3 ############################################################################### # NVIDIA: 0x84F0-0x855F # NV_future_use: 0x84F0-0x84F1 NV_fence enum: ALL_COMPLETED_NV = 0x84F2 FENCE_STATUS_NV = 0x84F3 FENCE_CONDITION_NV = 0x84F4 VERSION_3_1 enum: TEXTURE_RECTANGLE = 0x84F5 TEXTURE_BINDING_RECTANGLE = 0x84F6 PROXY_TEXTURE_RECTANGLE = 0x84F7 MAX_RECTANGLE_TEXTURE_SIZE = 0x84F8 ARB_texture_rectangle enum: TEXTURE_RECTANGLE_ARB = 0x84F5 TEXTURE_BINDING_RECTANGLE_ARB = 0x84F6 PROXY_TEXTURE_RECTANGLE_ARB = 0x84F7 MAX_RECTANGLE_TEXTURE_SIZE_ARB = 0x84F8 NV_texture_rectangle enum: TEXTURE_RECTANGLE_NV = 0x84F5 TEXTURE_BINDING_RECTANGLE_NV = 0x84F6 PROXY_TEXTURE_RECTANGLE_NV = 0x84F7 MAX_RECTANGLE_TEXTURE_SIZE_NV = 0x84F8 VERSION_3_0 enum: use ARB_framebuffer_object DEPTH_STENCIL use ARB_framebuffer_object UNSIGNED_INT_24_8 ARB_framebuffer_object enum: (note: no ARB suffixes) DEPTH_STENCIL = 0x84F9 # VERSION_3_0 / ARB_fbo UNSIGNED_INT_24_8 = 0x84FA # VERSION_3_0 / ARB_fbo EXT_packed_depth_stencil enum: DEPTH_STENCIL_EXT = 0x84F9 UNSIGNED_INT_24_8_EXT = 0x84FA NV_packed_depth_stencil enum: DEPTH_STENCIL_NV = 0x84F9 UNSIGNED_INT_24_8_NV = 0x84FA # Aliases EXT_packed_depth_stencil enums above OES_packed_depth_stencil enum: (OpenGL ES only) DEPTH_STENCIL_OES = 0x84F9 UNSIGNED_INT_24_8_OES = 0x84FA # NV_future_use: 0x84FB-0x84FC VERSION_1_4 enum: (Promoted for OpenGL 1.4) MAX_TEXTURE_LOD_BIAS = 0x84FD EXT_texture_lod_bias enum: MAX_TEXTURE_LOD_BIAS_EXT = 0x84FD EXT_texture_filter_anisotropic enum: TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF VERSION_1_4 enum: (Promoted for OpenGL 1.4) TEXTURE_FILTER_CONTROL = 0x8500 TEXTURE_LOD_BIAS = 0x8501 EXT_texture_lod_bias enum: TEXTURE_FILTER_CONTROL_EXT = 0x8500 TEXTURE_LOD_BIAS_EXT = 0x8501 EXT_vertex_weighting enum: MODELVIEW1_STACK_DEPTH_EXT = 0x8502 # NV_texture_env_combine4 (additional; see below): 0x8503 NV_light_max_exponent enum: MAX_SHININESS_NV = 0x8504 MAX_SPOT_EXPONENT_NV = 0x8505 EXT_vertex_weighting enum: MODELVIEW_MATRIX1_EXT = 0x8506 VERSION_1_4 enum: (Promoted for OpenGL 1.4) INCR_WRAP = 0x8507 DECR_WRAP = 0x8508 EXT_stencil_wrap enum: INCR_WRAP_EXT = 0x8507 DECR_WRAP_EXT = 0x8508 # Aliases EXT_stencil_wrap enums above OES_stencil_wrap enum: (OpenGL ES only) INCR_WRAP_OES = 0x8507 DECR_WRAP_OES = 0x8508 EXT_vertex_weighting enum: VERTEX_WEIGHTING_EXT = 0x8509 MODELVIEW1_EXT = 0x850A CURRENT_VERTEX_WEIGHT_EXT = 0x850B VERTEX_WEIGHT_ARRAY_EXT = 0x850C VERTEX_WEIGHT_ARRAY_SIZE_EXT = 0x850D VERTEX_WEIGHT_ARRAY_TYPE_EXT = 0x850E VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 0x850F VERTEX_WEIGHT_ARRAY_POINTER_EXT = 0x8510 VERSION_1_3 enum: (Promoted for OpenGL 1.3) NORMAL_MAP = 0x8511 REFLECTION_MAP = 0x8512 TEXTURE_CUBE_MAP = 0x8513 TEXTURE_BINDING_CUBE_MAP = 0x8514 TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515 TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516 TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517 TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518 TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519 TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A PROXY_TEXTURE_CUBE_MAP = 0x851B MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C EXT_texture_cube_map enum: NORMAL_MAP_EXT = 0x8511 REFLECTION_MAP_EXT = 0x8512 TEXTURE_CUBE_MAP_EXT = 0x8513 TEXTURE_BINDING_CUBE_MAP_EXT = 0x8514 TEXTURE_CUBE_MAP_POSITIVE_X_EXT = 0x8515 TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = 0x8516 TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = 0x8517 TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = 0x8518 TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = 0x8519 TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = 0x851A PROXY_TEXTURE_CUBE_MAP_EXT = 0x851B MAX_CUBE_MAP_TEXTURE_SIZE_EXT = 0x851C NV_texgen_reflection enum: NORMAL_MAP = 0x8511 REFLECTION_MAP = 0x8512 ARB_texture_cube_map enum: NORMAL_MAP_ARB = 0x8511 REFLECTION_MAP_ARB = 0x8512 TEXTURE_CUBE_MAP_ARB = 0x8513 TEXTURE_BINDING_CUBE_MAP_ARB = 0x8514 TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 0x8515 TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 0x8516 TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 0x8517 TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 0x8518 TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 0x8519 TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 0x851A PROXY_TEXTURE_CUBE_MAP_ARB = 0x851B MAX_CUBE_MAP_TEXTURE_SIZE_ARB = 0x851C # Aliases ARB_texture_cube_map enums above OES_texture_cube_map enum: (OpenGL ES only; additional; see below) NORMAL_MAP_OES = 0x8511 REFLECTION_MAP_OES = 0x8512 TEXTURE_CUBE_MAP_OES = 0x8513 TEXTURE_BINDING_CUBE_MAP_OES = 0x8514 TEXTURE_CUBE_MAP_POSITIVE_X_OES = 0x8515 TEXTURE_CUBE_MAP_NEGATIVE_X_OES = 0x8516 TEXTURE_CUBE_MAP_POSITIVE_Y_OES = 0x8517 TEXTURE_CUBE_MAP_NEGATIVE_Y_OES = 0x8518 TEXTURE_CUBE_MAP_POSITIVE_Z_OES = 0x8519 TEXTURE_CUBE_MAP_NEGATIVE_Z_OES = 0x851A MAX_CUBE_MAP_TEXTURE_SIZE_OES = 0x851C NV_vertex_array_range enum: VERTEX_ARRAY_RANGE_NV = 0x851D VERTEX_ARRAY_RANGE_LENGTH_NV = 0x851E VERTEX_ARRAY_RANGE_VALID_NV = 0x851F MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = 0x8520 VERTEX_ARRAY_RANGE_POINTER_NV = 0x8521 # @@@ How does this interact with NV_vertex_array_range? APPLE_vertex_array_range enum: VERTEX_ARRAY_RANGE_APPLE = 0x851D VERTEX_ARRAY_RANGE_LENGTH_APPLE = 0x851E VERTEX_ARRAY_STORAGE_HINT_APPLE = 0x851F VERTEX_ARRAY_RANGE_POINTER_APPLE = 0x8521 STORAGE_CACHED_APPLE = 0x85BE STORAGE_SHARED_APPLE = 0x85BF NV_register_combiners enum: REGISTER_COMBINERS_NV = 0x8522 VARIABLE_A_NV = 0x8523 VARIABLE_B_NV = 0x8524 VARIABLE_C_NV = 0x8525 VARIABLE_D_NV = 0x8526 VARIABLE_E_NV = 0x8527 VARIABLE_F_NV = 0x8528 VARIABLE_G_NV = 0x8529 CONSTANT_COLOR0_NV = 0x852A CONSTANT_COLOR1_NV = 0x852B PRIMARY_COLOR_NV = 0x852C SECONDARY_COLOR_NV = 0x852D SPARE0_NV = 0x852E SPARE1_NV = 0x852F DISCARD_NV = 0x8530 E_TIMES_F_NV = 0x8531 SPARE0_PLUS_SECONDARY_COLOR_NV = 0x8532 # NV_vertex_array_range2: VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = 0x8533 # NV_multisample_filter_hint: MULTISAMPLE_FILTER_HINT_NV = 0x8534 NV_register_combiners2 enum: PER_STAGE_CONSTANTS_NV = 0x8535 NV_register_combiners enum: (additional; see above): UNSIGNED_IDENTITY_NV = 0x8536 UNSIGNED_INVERT_NV = 0x8537 EXPAND_NORMAL_NV = 0x8538 EXPAND_NEGATE_NV = 0x8539 HALF_BIAS_NORMAL_NV = 0x853A HALF_BIAS_NEGATE_NV = 0x853B SIGNED_IDENTITY_NV = 0x853C UNSIGNED_NEGATE_NV = 0x853D SCALE_BY_TWO_NV = 0x853E SCALE_BY_FOUR_NV = 0x853F SCALE_BY_ONE_HALF_NV = 0x8540 BIAS_BY_NEGATIVE_ONE_HALF_NV = 0x8541 COMBINER_INPUT_NV = 0x8542 COMBINER_MAPPING_NV = 0x8543 COMBINER_COMPONENT_USAGE_NV = 0x8544 COMBINER_AB_DOT_PRODUCT_NV = 0x8545 COMBINER_CD_DOT_PRODUCT_NV = 0x8546 COMBINER_MUX_SUM_NV = 0x8547 COMBINER_SCALE_NV = 0x8548 COMBINER_BIAS_NV = 0x8549 COMBINER_AB_OUTPUT_NV = 0x854A COMBINER_CD_OUTPUT_NV = 0x854B COMBINER_SUM_OUTPUT_NV = 0x854C MAX_GENERAL_COMBINERS_NV = 0x854D NUM_GENERAL_COMBINERS_NV = 0x854E COLOR_SUM_CLAMP_NV = 0x854F COMBINER0_NV = 0x8550 COMBINER1_NV = 0x8551 COMBINER2_NV = 0x8552 COMBINER3_NV = 0x8553 COMBINER4_NV = 0x8554 COMBINER5_NV = 0x8555 COMBINER6_NV = 0x8556 COMBINER7_NV = 0x8557 NV_primitive_restart enum: PRIMITIVE_RESTART_NV = 0x8558 PRIMITIVE_RESTART_INDEX_NV = 0x8559 NV_fog_distance enum: FOG_GEN_MODE_NV = 0x855A EYE_RADIAL_NV = 0x855B EYE_PLANE_ABSOLUTE_NV = 0x855C NV_texgen_emboss enum: EMBOSS_LIGHT_NV = 0x855D EMBOSS_CONSTANT_NV = 0x855E EMBOSS_MAP_NV = 0x855F ############################################################################### # Intergraph/Intense3D/3Dlabs: 0x8560-0x856F INGR_color_clamp enum: RED_MIN_CLAMP_INGR = 0x8560 GREEN_MIN_CLAMP_INGR = 0x8561 BLUE_MIN_CLAMP_INGR = 0x8562 ALPHA_MIN_CLAMP_INGR = 0x8563 RED_MAX_CLAMP_INGR = 0x8564 GREEN_MAX_CLAMP_INGR = 0x8565 BLUE_MAX_CLAMP_INGR = 0x8566 ALPHA_MAX_CLAMP_INGR = 0x8567 INGR_interlace_read enum: INTERLACE_READ_INGR = 0x8568 # 3Dlabs_future_use: 0x8569-0x856F ############################################################################### # ATI/NVIDIA: 0x8570-0x859F VERSION_1_5 enum: (Consistent naming scheme for OpenGL 1.5) SRC0_RGB = 0x8580 # alias GL_SOURCE0_RGB SRC1_RGB = 0x8581 # alias GL_SOURCE1_RGB SRC2_RGB = 0x8582 # alias GL_SOURCE2_RGB SRC0_ALPHA = 0x8588 # alias GL_SOURCE0_ALPHA SRC1_ALPHA = 0x8589 # alias GL_SOURCE1_ALPHA SRC2_ALPHA = 0x858A # alias GL_SOURCE2_ALPHA VERSION_1_3 enum: (Promoted for OpenGL 1.3) COMBINE = 0x8570 COMBINE_RGB = 0x8571 COMBINE_ALPHA = 0x8572 RGB_SCALE = 0x8573 ADD_SIGNED = 0x8574 INTERPOLATE = 0x8575 CONSTANT = 0x8576 PRIMARY_COLOR = 0x8577 PREVIOUS = 0x8578 SOURCE0_RGB = 0x8580 SOURCE1_RGB = 0x8581 SOURCE2_RGB = 0x8582 SOURCE0_ALPHA = 0x8588 SOURCE1_ALPHA = 0x8589 SOURCE2_ALPHA = 0x858A OPERAND0_RGB = 0x8590 OPERAND1_RGB = 0x8591 OPERAND2_RGB = 0x8592 OPERAND0_ALPHA = 0x8598 OPERAND1_ALPHA = 0x8599 OPERAND2_ALPHA = 0x859A EXT_texture_env_combine enum: COMBINE_EXT = 0x8570 COMBINE_RGB_EXT = 0x8571 COMBINE_ALPHA_EXT = 0x8572 RGB_SCALE_EXT = 0x8573 ADD_SIGNED_EXT = 0x8574 INTERPOLATE_EXT = 0x8575 CONSTANT_EXT = 0x8576 PRIMARY_COLOR_EXT = 0x8577 PREVIOUS_EXT = 0x8578 SOURCE0_RGB_EXT = 0x8580 SOURCE1_RGB_EXT = 0x8581 SOURCE2_RGB_EXT = 0x8582 SOURCE0_ALPHA_EXT = 0x8588 SOURCE1_ALPHA_EXT = 0x8589 SOURCE2_ALPHA_EXT = 0x858A OPERAND0_RGB_EXT = 0x8590 OPERAND1_RGB_EXT = 0x8591 OPERAND2_RGB_EXT = 0x8592 OPERAND0_ALPHA_EXT = 0x8598 OPERAND1_ALPHA_EXT = 0x8599 OPERAND2_ALPHA_EXT = 0x859A NV_texture_env_combine4 enum: COMBINE4_NV = 0x8503 SOURCE3_RGB_NV = 0x8583 SOURCE3_ALPHA_NV = 0x858B OPERAND3_RGB_NV = 0x8593 OPERAND3_ALPHA_NV = 0x859B # "Future use" => "additional combiner input/output enums" only # ATI/NVIDIA_future_use: 0x8584-0x8587 # ATI/NVIDIA_future_use: 0x858C-0x858F # ATI/NVIDIA_future_use: 0x8594-0x8597 # ATI/NVIDIA_future_use: 0x859C-0x859F ############################################################################### SGIX_subsample enum: PACK_SUBSAMPLE_RATE_SGIX = 0x85A0 UNPACK_SUBSAMPLE_RATE_SGIX = 0x85A1 PIXEL_SUBSAMPLE_4444_SGIX = 0x85A2 PIXEL_SUBSAMPLE_2424_SGIX = 0x85A3 PIXEL_SUBSAMPLE_4242_SGIX = 0x85A4 ############################################################################### # Incomplete extension, not in enumext.spec # SGIS_color_range: 0x85A5-0x85AD # EXTENDED_RANGE_SGIS = 0x85A5 # MIN_RED_SGIS = 0x85A6 # MAX_RED_SGIS = 0x85A7 # MIN_GREEN_SGIS = 0x85A8 # MAX_GREEN_SGIS = 0x85A9 # MIN_BLUE_SGIS = 0x85AA # MAX_BLUE_SGIS = 0x85AB # MIN_ALPHA_SGIS = 0x85AC # MAX_ALPHA_SGIS = 0x85AD ############################################################################### EXT_texture_perturb_normal enum: PERTURB_EXT = 0x85AE TEXTURE_NORMAL_EXT = 0x85AF ############################################################################### # Apple: 0x85B0-0x85BF APPLE_specular_vector enum: LIGHT_MODEL_SPECULAR_VECTOR_APPLE = 0x85B0 APPLE_transform_hint enum: TRANSFORM_HINT_APPLE = 0x85B1 APPLE_client_storage enum: UNPACK_CLIENT_STORAGE_APPLE = 0x85B2 # May also be part of APPLE_fence APPLE_object_purgeable enum: (additional; see below) BUFFER_OBJECT_APPLE = 0x85B3 # APPLE_future_use: 0x85B4 ## From Jeremy 2006/10/18 (Khronos bug 632) - unknown extension name # STORAGE_CLIENT_APPLE = 0x85B4 VERSION_3_0 enum: use ARB_vertex_array_object VERTEX_ARRAY_BINDING ARB_vertex_array_object enum: (note: no ARB suffixes) VERTEX_ARRAY_BINDING = 0x85B5 # VERSION_3_0 / ARB_vao APPLE_vertex_array_object enum: VERTEX_ARRAY_BINDING_APPLE = 0x85B5 # APPLE_future_use: 0x85B6 ## From Jeremy 2006/10/18 (Khronos bug 632) - unknown extension name # TEXTURE_MINIMIZE_STORAGE_APPLE = 0x85B6 APPLE_texture_range enum: (additional; see below) TEXTURE_RANGE_LENGTH_APPLE = 0x85B7 TEXTURE_RANGE_POINTER_APPLE = 0x85B8 APPLE_ycbcr_422 enum: YCBCR_422_APPLE = 0x85B9 UNSIGNED_SHORT_8_8_APPLE = 0x85BA UNSIGNED_SHORT_8_8_REV_APPLE = 0x85BB MESA_ycbcr_texture enum: (additional; see below) UNSIGNED_SHORT_8_8_MESA = 0x85BA UNSIGNED_SHORT_8_8_REV_MESA = 0x85BB APPLE_texture_range enum: TEXTURE_STORAGE_HINT_APPLE = 0x85BC STORAGE_PRIVATE_APPLE = 0x85BD APPLE_vertex_array_range enum: (additional; see above): STORAGE_CACHED_APPLE = 0x85BE STORAGE_SHARED_APPLE = 0x85BF APPLE_texture_range enum: use APPLE_vertex_array_range STORAGE_CACHED_APPLE use APPLE_vertex_array_range STORAGE_SHARED_APPLE ############################################################################### # Sun: 0x85C0-0x85CF SUNX_general_triangle_list enum: (additional; see above) REPLACEMENT_CODE_ARRAY_SUN = 0x85C0 REPLACEMENT_CODE_ARRAY_TYPE_SUN = 0x85C1 REPLACEMENT_CODE_ARRAY_STRIDE_SUN = 0x85C2 REPLACEMENT_CODE_ARRAY_POINTER_SUN = 0x85C3 R1UI_V3F_SUN = 0x85C4 R1UI_C4UB_V3F_SUN = 0x85C5 R1UI_C3F_V3F_SUN = 0x85C6 R1UI_N3F_V3F_SUN = 0x85C7 R1UI_C4F_N3F_V3F_SUN = 0x85C8 R1UI_T2F_V3F_SUN = 0x85C9 R1UI_T2F_N3F_V3F_SUN = 0x85CA R1UI_T2F_C4F_N3F_V3F_SUN = 0x85CB SUN_slice_accum enum: SLICE_ACCUM_SUN = 0x85CC # SUN_future_use: 0x85CD-0x85CF ############################################################################### # Unknown extension name, not in enumext.spec # 3Dlabs/Autodesk: 0x85D0-0x85DF # FACET_NORMAL_AUTODESK = 0x85D0 # FACET_NORMAL_ARRAY_AUTODESK = 0x85D1 ############################################################################### # Incomplete extension, not in enumext.spec # SGIX_texture_range: 0x85E0-0x85FB # RGB_SIGNED_SGIX = 0x85E0 # RGBA_SIGNED_SGIX = 0x85E1 # ALPHA_SIGNED_SGIX = 0x85E2 # LUMINANCE_SIGNED_SGIX = 0x85E3 # INTENSITY_SIGNED_SGIX = 0x85E4 # LUMINANCE_ALPHA_SIGNED_SGIX = 0x85E5 # RGB16_SIGNED_SGIX = 0x85E6 # RGBA16_SIGNED_SGIX = 0x85E7 # ALPHA16_SIGNED_SGIX = 0x85E8 # LUMINANCE16_SIGNED_SGIX = 0x85E9 # INTENSITY16_SIGNED_SGIX = 0x85EA # LUMINANCE16_ALPHA16_SIGNED_SGIX = 0x85EB # RGB_EXTENDED_RANGE_SGIX = 0x85EC # RGBA_EXTENDED_RANGE_SGIX = 0x85ED # ALPHA_EXTENDED_RANGE_SGIX = 0x85EE # LUMINANCE_EXTENDED_RANGE_SGIX = 0x85EF # INTENSITY_EXTENDED_RANGE_SGIX = 0x85F0 # LUMINANCE_ALPHA_EXTENDED_RANGE_SGIX = 0x85F1 # RGB16_EXTENDED_RANGE_SGIX = 0x85F2 # RGBA16_EXTENDED_RANGE_SGIX = 0x85F3 # ALPHA16_EXTENDED_RANGE_SGIX = 0x85F4 # LUMINANCE16_EXTENDED_RANGE_SGIX = 0x85F5 # INTENSITY16_EXTENDED_RANGE_SGIX = 0x85F6 # LUMINANCE16_ALPHA16_EXTENDED_RANGE_SGIX = 0x85F7 # MIN_LUMINANCE_SGIS = 0x85F8 # MAX_LUMINANCE_SGIS = 0x85F9 # MIN_INTENSITY_SGIS = 0x85FA # MAX_INTENSITY_SGIS = 0x85FB ############################################################################### # SGI_future_use: 0x85FC-0x85FF ############################################################################### # Sun: 0x8600-0x861F # SUN_future_use: 0x8600-0x8613 SUN_mesh_array enum: 0x8614-0x8615 QUAD_MESH_SUN = 0x8614 TRIANGLE_MESH_SUN = 0x8615 # SUN_future_use: 0x8614-0x861F ############################################################################### # NVIDIA: 0x8620-0x867F NV_vertex_program enum: VERTEX_PROGRAM_NV = 0x8620 VERTEX_STATE_PROGRAM_NV = 0x8621 ATTRIB_ARRAY_SIZE_NV = 0x8623 ATTRIB_ARRAY_STRIDE_NV = 0x8624 ATTRIB_ARRAY_TYPE_NV = 0x8625 CURRENT_ATTRIB_NV = 0x8626 PROGRAM_LENGTH_NV = 0x8627 PROGRAM_STRING_NV = 0x8628 MODELVIEW_PROJECTION_NV = 0x8629 IDENTITY_NV = 0x862A INVERSE_NV = 0x862B TRANSPOSE_NV = 0x862C INVERSE_TRANSPOSE_NV = 0x862D MAX_TRACK_MATRIX_STACK_DEPTH_NV = 0x862E MAX_TRACK_MATRICES_NV = 0x862F MATRIX0_NV = 0x8630 MATRIX1_NV = 0x8631 MATRIX2_NV = 0x8632 MATRIX3_NV = 0x8633 MATRIX4_NV = 0x8634 MATRIX5_NV = 0x8635 MATRIX6_NV = 0x8636 MATRIX7_NV = 0x8637 ################## # # Reserved: # # MATRIX8_NV = 0x8638 # MATRIX9_NV = 0x8639 # MATRIX10_NV = 0x863A # MATRIX11_NV = 0x863B # MATRIX12_NV = 0x863C # MATRIX13_NV = 0x863D # MATRIX14_NV = 0x863E # MATRIX15_NV = 0x863F # ################### CURRENT_MATRIX_STACK_DEPTH_NV = 0x8640 CURRENT_MATRIX_NV = 0x8641 VERTEX_PROGRAM_POINT_SIZE_NV = 0x8642 VERTEX_PROGRAM_TWO_SIDE_NV = 0x8643 PROGRAM_PARAMETER_NV = 0x8644 ATTRIB_ARRAY_POINTER_NV = 0x8645 PROGRAM_TARGET_NV = 0x8646 PROGRAM_RESIDENT_NV = 0x8647 TRACK_MATRIX_NV = 0x8648 TRACK_MATRIX_TRANSFORM_NV = 0x8649 VERTEX_PROGRAM_BINDING_NV = 0x864A PROGRAM_ERROR_POSITION_NV = 0x864B VERTEX_ATTRIB_ARRAY0_NV = 0x8650 VERTEX_ATTRIB_ARRAY1_NV = 0x8651 VERTEX_ATTRIB_ARRAY2_NV = 0x8652 VERTEX_ATTRIB_ARRAY3_NV = 0x8653 VERTEX_ATTRIB_ARRAY4_NV = 0x8654 VERTEX_ATTRIB_ARRAY5_NV = 0x8655 VERTEX_ATTRIB_ARRAY6_NV = 0x8656 VERTEX_ATTRIB_ARRAY7_NV = 0x8657 VERTEX_ATTRIB_ARRAY8_NV = 0x8658 VERTEX_ATTRIB_ARRAY9_NV = 0x8659 VERTEX_ATTRIB_ARRAY10_NV = 0x865A VERTEX_ATTRIB_ARRAY11_NV = 0x865B VERTEX_ATTRIB_ARRAY12_NV = 0x865C VERTEX_ATTRIB_ARRAY13_NV = 0x865D VERTEX_ATTRIB_ARRAY14_NV = 0x865E VERTEX_ATTRIB_ARRAY15_NV = 0x865F MAP1_VERTEX_ATTRIB0_4_NV = 0x8660 MAP1_VERTEX_ATTRIB1_4_NV = 0x8661 MAP1_VERTEX_ATTRIB2_4_NV = 0x8662 MAP1_VERTEX_ATTRIB3_4_NV = 0x8663 MAP1_VERTEX_ATTRIB4_4_NV = 0x8664 MAP1_VERTEX_ATTRIB5_4_NV = 0x8665 MAP1_VERTEX_ATTRIB6_4_NV = 0x8666 MAP1_VERTEX_ATTRIB7_4_NV = 0x8667 MAP1_VERTEX_ATTRIB8_4_NV = 0x8668 MAP1_VERTEX_ATTRIB9_4_NV = 0x8669 MAP1_VERTEX_ATTRIB10_4_NV = 0x866A MAP1_VERTEX_ATTRIB11_4_NV = 0x866B MAP1_VERTEX_ATTRIB12_4_NV = 0x866C MAP1_VERTEX_ATTRIB13_4_NV = 0x866D MAP1_VERTEX_ATTRIB14_4_NV = 0x866E MAP1_VERTEX_ATTRIB15_4_NV = 0x866F MAP2_VERTEX_ATTRIB0_4_NV = 0x8670 MAP2_VERTEX_ATTRIB1_4_NV = 0x8671 MAP2_VERTEX_ATTRIB2_4_NV = 0x8672 MAP2_VERTEX_ATTRIB3_4_NV = 0x8673 MAP2_VERTEX_ATTRIB4_4_NV = 0x8674 MAP2_VERTEX_ATTRIB5_4_NV = 0x8675 MAP2_VERTEX_ATTRIB6_4_NV = 0x8676 MAP2_VERTEX_ATTRIB7_4_NV = 0x8677 MAP2_VERTEX_ATTRIB8_4_NV = 0x8678 MAP2_VERTEX_ATTRIB9_4_NV = 0x8679 MAP2_VERTEX_ATTRIB10_4_NV = 0x867A MAP2_VERTEX_ATTRIB11_4_NV = 0x867B MAP2_VERTEX_ATTRIB12_4_NV = 0x867C MAP2_VERTEX_ATTRIB13_4_NV = 0x867D MAP2_VERTEX_ATTRIB14_4_NV = 0x867E MAP2_VERTEX_ATTRIB15_4_NV = 0x867F # NV_texture_shader (additional; see below): 0x864C-0x864E VERSION_3_2 enum: PROGRAM_POINT_SIZE = 0x8642 ARB_geometry_shader4 enum: (additional; see below) PROGRAM_POINT_SIZE_ARB = 0x8642 NV_geometry_program4 enum: (additional; see below) PROGRAM_POINT_SIZE_EXT = 0x8642 VERSION_3_2 enum: use ARB_depth_clamp DEPTH_CLAMP ARB_depth_clamp enum: DEPTH_CLAMP = 0x864F NV_depth_clamp enum: DEPTH_CLAMP_NV = 0x864F VERSION_2_0 enum: (Promoted from ARB_vertex_shader; only some values) VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622 # VERSION_2_0 VERTEX_ATTRIB_ARRAY_SIZE = 0x8623 # VERSION_2_0 VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624 # VERSION_2_0 VERTEX_ATTRIB_ARRAY_TYPE = 0x8625 # VERSION_2_0 CURRENT_VERTEX_ATTRIB = 0x8626 # VERSION_2_0 VERTEX_PROGRAM_POINT_SIZE = 0x8642 # VERSION_2_0 VERTEX_PROGRAM_TWO_SIDE = 0x8643 # VERSION_2_0 VERTEX_ATTRIB_ARRAY_POINTER = 0x8645 # VERSION_2_0 ARB_vertex_program enum: (additional; see above; reuses NV_vertex_program values) ARB_fragment_program enum: (additional; only some values; see below) # (Unfortunately, PROGRAM_BINDING_ARB does accidentally reuse 0x8677) VERTEX_PROGRAM_ARB = 0x8620 VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622 VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623 VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624 VERTEX_ATTRIB_ARRAY_TYPE_ARB = 0x8625 CURRENT_VERTEX_ATTRIB_ARB = 0x8626 PROGRAM_LENGTH_ARB = 0x8627 # ARB_fragment_program PROGRAM_STRING_ARB = 0x8628 # ARB_fragment_program MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = 0x862E # ARB_fragment_program MAX_PROGRAM_MATRICES_ARB = 0x862F # ARB_fragment_program CURRENT_MATRIX_STACK_DEPTH_ARB = 0x8640 # ARB_fragment_program CURRENT_MATRIX_ARB = 0x8641 # ARB_fragment_program VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642 VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643 VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645 PROGRAM_ERROR_POSITION_ARB = 0x864B # ARB_fragment_program PROGRAM_BINDING_ARB = 0x8677 # ARB_fragment_program ############################################################################### # Pixelfusion: 0x8680-0x869F ############################################################################### # OpenGL ARB: 0x86A0-0x86AF # ARB_texture_compression/1.3 (additional; see above): 0x86A0-0x86A3 ARB_vertex_blend enum: MAX_VERTEX_UNITS_ARB = 0x86A4 ACTIVE_VERTEX_UNITS_ARB = 0x86A5 WEIGHT_SUM_UNITY_ARB = 0x86A6 VERTEX_BLEND_ARB = 0x86A7 CURRENT_WEIGHT_ARB = 0x86A8 WEIGHT_ARRAY_TYPE_ARB = 0x86A9 WEIGHT_ARRAY_STRIDE_ARB = 0x86AA WEIGHT_ARRAY_SIZE_ARB = 0x86AB WEIGHT_ARRAY_POINTER_ARB = 0x86AC WEIGHT_ARRAY_ARB = 0x86AD # Note: MODELVIEW0/1 are defined in other extensions, but not as ARB) MODELVIEW0_ARB = 0x1700 MODELVIEW1_ARB = 0x850A MODELVIEW2_ARB = 0x8722 MODELVIEW3_ARB = 0x8723 MODELVIEW4_ARB = 0x8724 MODELVIEW5_ARB = 0x8725 MODELVIEW6_ARB = 0x8726 MODELVIEW7_ARB = 0x8727 MODELVIEW8_ARB = 0x8728 MODELVIEW9_ARB = 0x8729 MODELVIEW10_ARB = 0x872A MODELVIEW11_ARB = 0x872B MODELVIEW12_ARB = 0x872C MODELVIEW13_ARB = 0x872D MODELVIEW14_ARB = 0x872E MODELVIEW15_ARB = 0x872F MODELVIEW16_ARB = 0x8730 MODELVIEW17_ARB = 0x8731 MODELVIEW18_ARB = 0x8732 MODELVIEW19_ARB = 0x8733 MODELVIEW20_ARB = 0x8734 MODELVIEW21_ARB = 0x8735 MODELVIEW22_ARB = 0x8736 MODELVIEW23_ARB = 0x8737 MODELVIEW24_ARB = 0x8738 MODELVIEW25_ARB = 0x8739 MODELVIEW26_ARB = 0x873A MODELVIEW27_ARB = 0x873B MODELVIEW28_ARB = 0x873C MODELVIEW29_ARB = 0x873D MODELVIEW30_ARB = 0x873E MODELVIEW31_ARB = 0x873F # Aliases ARB_vertex_blend enums above OES_matrix_palette enum: (OpenGL ES only; additional; see below) MAX_VERTEX_UNITS_OES = 0x86A4 WEIGHT_ARRAY_OES = 0x86AD WEIGHT_ARRAY_TYPE_OES = 0x86A9 WEIGHT_ARRAY_STRIDE_OES = 0x86AA WEIGHT_ARRAY_SIZE_OES = 0x86AB WEIGHT_ARRAY_POINTER_OES = 0x86AC VERSION_1_3 enum: (Promoted for OpenGL 1.3) DOT3_RGB = 0x86AE DOT3_RGBA = 0x86AF ARB_texture_env_dot3 enum: DOT3_RGB_ARB = 0x86AE DOT3_RGBA_ARB = 0x86AF IMG_texture_env_enhanced_fixed_function enum: (OpenGL ES only; additional; see below) DOT3_RGBA_IMG = 0x86AF ############################################################################### # 3Dfx: 0x86B0-0x86BF 3DFX_texture_compression_FXT1 enum: COMPRESSED_RGB_FXT1_3DFX = 0x86B0 COMPRESSED_RGBA_FXT1_3DFX = 0x86B1 3DFX_multisample enum: MULTISAMPLE_3DFX = 0x86B2 SAMPLE_BUFFERS_3DFX = 0x86B3 SAMPLES_3DFX = 0x86B4 MULTISAMPLE_BIT_3DFX = 0x20000000 # 3DFX_future_use: 0x86B5-0x86BF ############################################################################### # NVIDIA: 0x86C0-0x871F NV_evaluators enum: EVAL_2D_NV = 0x86C0 EVAL_TRIANGULAR_2D_NV = 0x86C1 MAP_TESSELLATION_NV = 0x86C2 MAP_ATTRIB_U_ORDER_NV = 0x86C3 MAP_ATTRIB_V_ORDER_NV = 0x86C4 EVAL_FRACTIONAL_TESSELLATION_NV = 0x86C5 EVAL_VERTEX_ATRRIB0_NV = 0x86C6 EVAL_VERTEX_ATRRIB1_NV = 0x86C7 EVAL_VERTEX_ATRRIB2_NV = 0x86C8 EVAL_VERTEX_ATRRIB3_NV = 0x86C9 EVAL_VERTEX_ATRRIB4_NV = 0x86CA EVAL_VERTEX_ATRRIB5_NV = 0x86CB EVAL_VERTEX_ATRRIB6_NV = 0x86CC EVAL_VERTEX_ATRRIB7_NV = 0x86CD EVAL_VERTEX_ATRRIB8_NV = 0x86CE EVAL_VERTEX_ATRRIB9_NV = 0x86CF EVAL_VERTEX_ATRRIB10_NV = 0x86D0 EVAL_VERTEX_ATRRIB11_NV = 0x86D1 EVAL_VERTEX_ATRRIB12_NV = 0x86D2 EVAL_VERTEX_ATRRIB13_NV = 0x86D3 EVAL_VERTEX_ATRRIB14_NV = 0x86D4 EVAL_VERTEX_ATRRIB15_NV = 0x86D5 MAX_MAP_TESSELLATION_NV = 0x86D6 MAX_RATIONAL_EVAL_ORDER_NV = 0x86D7 # NV_future_use: 0x86D8 NV_texture_shader enum: OFFSET_TEXTURE_RECTANGLE_NV = 0x864C OFFSET_TEXTURE_RECTANGLE_SCALE_NV = 0x864D DOT_PRODUCT_TEXTURE_RECTANGLE_NV = 0x864E RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = 0x86D9 UNSIGNED_INT_S8_S8_8_8_NV = 0x86DA UNSIGNED_INT_8_8_S8_S8_REV_NV = 0x86DB DSDT_MAG_INTENSITY_NV = 0x86DC SHADER_CONSISTENT_NV = 0x86DD TEXTURE_SHADER_NV = 0x86DE SHADER_OPERATION_NV = 0x86DF CULL_MODES_NV = 0x86E0 OFFSET_TEXTURE_MATRIX_NV = 0x86E1 OFFSET_TEXTURE_SCALE_NV = 0x86E2 OFFSET_TEXTURE_BIAS_NV = 0x86E3 OFFSET_TEXTURE_2D_MATRIX_NV = GL_OFFSET_TEXTURE_MATRIX_NV OFFSET_TEXTURE_2D_SCALE_NV = GL_OFFSET_TEXTURE_SCALE_NV OFFSET_TEXTURE_2D_BIAS_NV = GL_OFFSET_TEXTURE_BIAS_NV PREVIOUS_TEXTURE_INPUT_NV = 0x86E4 CONST_EYE_NV = 0x86E5 PASS_THROUGH_NV = 0x86E6 CULL_FRAGMENT_NV = 0x86E7 OFFSET_TEXTURE_2D_NV = 0x86E8 DEPENDENT_AR_TEXTURE_2D_NV = 0x86E9 DEPENDENT_GB_TEXTURE_2D_NV = 0x86EA DOT_PRODUCT_NV = 0x86EC DOT_PRODUCT_DEPTH_REPLACE_NV = 0x86ED DOT_PRODUCT_TEXTURE_2D_NV = 0x86EE DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = 0x86F0 DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = 0x86F1 DOT_PRODUCT_REFLECT_CUBE_MAP_NV = 0x86F2 DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = 0x86F3 HILO_NV = 0x86F4 DSDT_NV = 0x86F5 DSDT_MAG_NV = 0x86F6 DSDT_MAG_VIB_NV = 0x86F7 HILO16_NV = 0x86F8 SIGNED_HILO_NV = 0x86F9 SIGNED_HILO16_NV = 0x86FA SIGNED_RGBA_NV = 0x86FB SIGNED_RGBA8_NV = 0x86FC SIGNED_RGB_NV = 0x86FE SIGNED_RGB8_NV = 0x86FF SIGNED_LUMINANCE_NV = 0x8701 SIGNED_LUMINANCE8_NV = 0x8702 SIGNED_LUMINANCE_ALPHA_NV = 0x8703 SIGNED_LUMINANCE8_ALPHA8_NV = 0x8704 SIGNED_ALPHA_NV = 0x8705 SIGNED_ALPHA8_NV = 0x8706 SIGNED_INTENSITY_NV = 0x8707 SIGNED_INTENSITY8_NV = 0x8708 DSDT8_NV = 0x8709 DSDT8_MAG8_NV = 0x870A DSDT8_MAG8_INTENSITY8_NV = 0x870B SIGNED_RGB_UNSIGNED_ALPHA_NV = 0x870C SIGNED_RGB8_UNSIGNED_ALPHA8_NV = 0x870D HI_SCALE_NV = 0x870E LO_SCALE_NV = 0x870F DS_SCALE_NV = 0x8710 DT_SCALE_NV = 0x8711 MAGNITUDE_SCALE_NV = 0x8712 VIBRANCE_SCALE_NV = 0x8713 HI_BIAS_NV = 0x8714 LO_BIAS_NV = 0x8715 DS_BIAS_NV = 0x8716 DT_BIAS_NV = 0x8717 MAGNITUDE_BIAS_NV = 0x8718 VIBRANCE_BIAS_NV = 0x8719 TEXTURE_BORDER_VALUES_NV = 0x871A TEXTURE_HI_SIZE_NV = 0x871B TEXTURE_LO_SIZE_NV = 0x871C TEXTURE_DS_SIZE_NV = 0x871D TEXTURE_DT_SIZE_NV = 0x871E TEXTURE_MAG_SIZE_NV = 0x871F NV_texture_shader2 enum: DOT_PRODUCT_TEXTURE_3D_NV = 0x86EF # NV_future_use: 0x86EB # NV_future_use: 0x86FD # NV_future_use: 0x8700 ############################################################################### # OpenGL ARB: 0x8720-0x873F # ARB_vertex_blend (additional; see above): 0x8720-0x873F ############################################################################### # ATI: 0x8740-0x874F EXT_texture_env_dot3 enum: DOT3_RGB_EXT = 0x8740 DOT3_RGBA_EXT = 0x8741 # There's a collision between AMD_program_binary_Z400 and EXT_texture_env_dot3! AMD_program_binary_Z400 enum: (OpenGL ES only) Z400_BINARY_AMD = 0x8740 # There's a collision between OES_get_program_binary and EXT_texture_env_dot3! OES_get_program_binary enum: (OpenGL ES only; additional; see below) PROGRAM_BINARY_LENGTH_OES = 0x8741 ATI_texture_mirror_once enum: MIRROR_CLAMP_ATI = 0x8742 MIRROR_CLAMP_TO_EDGE_ATI = 0x8743 EXT_texture_mirror_clamp enum: MIRROR_CLAMP_EXT = 0x8742 MIRROR_CLAMP_TO_EDGE_EXT = 0x8743 ATI_texture_env_combine3 enum: MODULATE_ADD_ATI = 0x8744 MODULATE_SIGNED_ADD_ATI = 0x8745 MODULATE_SUBTRACT_ATI = 0x8746 # ATI_future_use: 0x8747-0x874F ############################################################################### # MESA: 0x8750-0x875F MESA_packed_depth_stencil enum: DEPTH_STENCIL_MESA = 0x8750 UNSIGNED_INT_24_8_MESA = 0x8751 UNSIGNED_INT_8_24_REV_MESA = 0x8752 UNSIGNED_SHORT_15_1_MESA = 0x8753 UNSIGNED_SHORT_1_15_REV_MESA = 0x8754 MESA_trace enum: TRACE_ALL_BITS_MESA = 0xFFFF TRACE_OPERATIONS_BIT_MESA = 0x0001 TRACE_PRIMITIVES_BIT_MESA = 0x0002 TRACE_ARRAYS_BIT_MESA = 0x0004 TRACE_TEXTURES_BIT_MESA = 0x0008 TRACE_PIXELS_BIT_MESA = 0x0010 TRACE_ERRORS_BIT_MESA = 0x0020 TRACE_MASK_MESA = 0x8755 TRACE_NAME_MESA = 0x8756 MESA_ycbcr_texture enum: YCBCR_MESA = 0x8757 MESA_pack_invert enum: PACK_INVERT_MESA = 0x8758 MESAX_texture_stack enum: TEXTURE_1D_STACK_MESAX = 0x8759 TEXTURE_2D_STACK_MESAX = 0x875A PROXY_TEXTURE_1D_STACK_MESAX = 0x875B PROXY_TEXTURE_2D_STACK_MESAX = 0x875C TEXTURE_1D_STACK_BINDING_MESAX = 0x875D TEXTURE_2D_STACK_BINDING_MESAX = 0x875E MESA_shader_debug enum: DEBUG_OBJECT_MESA = 0x8759 DEBUG_PRINT_MESA = 0x875A DEBUG_ASSERT_MESA = 0x875B # MESA_future_use: 0x875F ############################################################################### # ATI: 0x8760-0x883F ATI_vertex_array_object enum: STATIC_ATI = 0x8760 DYNAMIC_ATI = 0x8761 PRESERVE_ATI = 0x8762 DISCARD_ATI = 0x8763 OBJECT_BUFFER_SIZE_ATI = 0x8764 OBJECT_BUFFER_USAGE_ATI = 0x8765 ARRAY_OBJECT_BUFFER_ATI = 0x8766 ARRAY_OBJECT_OFFSET_ATI = 0x8767 VERSION_1_5 enum: (Promoted for OpenGL 1.5) BUFFER_SIZE = 0x8764 BUFFER_USAGE = 0x8765 ARB_vertex_buffer_object enum: (additional; aliases some ATI enums; see below) BUFFER_SIZE_ARB = 0x8764 BUFFER_USAGE_ARB = 0x8765 ATI_element_array enum: ELEMENT_ARRAY_ATI = 0x8768 ELEMENT_ARRAY_TYPE_ATI = 0x8769 ELEMENT_ARRAY_POINTER_ATI = 0x876A # @@@ (extends ATI_element_array, I think???) APPLE_element_array enum: ELEMENT_ARRAY_APPLE = 0x8768 ELEMENT_ARRAY_TYPE_APPLE = 0x8769 ELEMENT_ARRAY_POINTER_APPLE = 0x876A ATI_vertex_streams enum: MAX_VERTEX_STREAMS_ATI = 0x876B VERTEX_STREAM0_ATI = 0x876C VERTEX_STREAM1_ATI = 0x876D VERTEX_STREAM2_ATI = 0x876E VERTEX_STREAM3_ATI = 0x876F VERTEX_STREAM4_ATI = 0x8770 VERTEX_STREAM5_ATI = 0x8771 VERTEX_STREAM6_ATI = 0x8772 VERTEX_STREAM7_ATI = 0x8773 VERTEX_SOURCE_ATI = 0x8774 ATI_envmap_bumpmap enum: BUMP_ROT_MATRIX_ATI = 0x8775 BUMP_ROT_MATRIX_SIZE_ATI = 0x8776 BUMP_NUM_TEX_UNITS_ATI = 0x8777 BUMP_TEX_UNITS_ATI = 0x8778 DUDV_ATI = 0x8779 DU8DV8_ATI = 0x877A BUMP_ENVMAP_ATI = 0x877B BUMP_TARGET_ATI = 0x877C # ATI_future_use: 0x877D-0x877F EXT_vertex_shader enum: VERTEX_SHADER_EXT = 0x8780 VERTEX_SHADER_BINDING_EXT = 0x8781 OP_INDEX_EXT = 0x8782 OP_NEGATE_EXT = 0x8783 OP_DOT3_EXT = 0x8784 OP_DOT4_EXT = 0x8785 OP_MUL_EXT = 0x8786 OP_ADD_EXT = 0x8787 OP_MADD_EXT = 0x8788 OP_FRAC_EXT = 0x8789 OP_MAX_EXT = 0x878A OP_MIN_EXT = 0x878B OP_SET_GE_EXT = 0x878C OP_SET_LT_EXT = 0x878D OP_CLAMP_EXT = 0x878E OP_FLOOR_EXT = 0x878F OP_ROUND_EXT = 0x8790 OP_EXP_BASE_2_EXT = 0x8791 OP_LOG_BASE_2_EXT = 0x8792 OP_POWER_EXT = 0x8793 OP_RECIP_EXT = 0x8794 OP_RECIP_SQRT_EXT = 0x8795 OP_SUB_EXT = 0x8796 OP_CROSS_PRODUCT_EXT = 0x8797 OP_MULTIPLY_MATRIX_EXT = 0x8798 OP_MOV_EXT = 0x8799 OUTPUT_VERTEX_EXT = 0x879A OUTPUT_COLOR0_EXT = 0x879B OUTPUT_COLOR1_EXT = 0x879C OUTPUT_TEXTURE_COORD0_EXT = 0x879D OUTPUT_TEXTURE_COORD1_EXT = 0x879E OUTPUT_TEXTURE_COORD2_EXT = 0x879F OUTPUT_TEXTURE_COORD3_EXT = 0x87A0 OUTPUT_TEXTURE_COORD4_EXT = 0x87A1 OUTPUT_TEXTURE_COORD5_EXT = 0x87A2 OUTPUT_TEXTURE_COORD6_EXT = 0x87A3 OUTPUT_TEXTURE_COORD7_EXT = 0x87A4 OUTPUT_TEXTURE_COORD8_EXT = 0x87A5 OUTPUT_TEXTURE_COORD9_EXT = 0x87A6 OUTPUT_TEXTURE_COORD10_EXT = 0x87A7 OUTPUT_TEXTURE_COORD11_EXT = 0x87A8 OUTPUT_TEXTURE_COORD12_EXT = 0x87A9 OUTPUT_TEXTURE_COORD13_EXT = 0x87AA OUTPUT_TEXTURE_COORD14_EXT = 0x87AB OUTPUT_TEXTURE_COORD15_EXT = 0x87AC OUTPUT_TEXTURE_COORD16_EXT = 0x87AD OUTPUT_TEXTURE_COORD17_EXT = 0x87AE OUTPUT_TEXTURE_COORD18_EXT = 0x87AF OUTPUT_TEXTURE_COORD19_EXT = 0x87B0 OUTPUT_TEXTURE_COORD20_EXT = 0x87B1 OUTPUT_TEXTURE_COORD21_EXT = 0x87B2 OUTPUT_TEXTURE_COORD22_EXT = 0x87B3 OUTPUT_TEXTURE_COORD23_EXT = 0x87B4 OUTPUT_TEXTURE_COORD24_EXT = 0x87B5 OUTPUT_TEXTURE_COORD25_EXT = 0x87B6 OUTPUT_TEXTURE_COORD26_EXT = 0x87B7 OUTPUT_TEXTURE_COORD27_EXT = 0x87B8 OUTPUT_TEXTURE_COORD28_EXT = 0x87B9 OUTPUT_TEXTURE_COORD29_EXT = 0x87BA OUTPUT_TEXTURE_COORD30_EXT = 0x87BB OUTPUT_TEXTURE_COORD31_EXT = 0x87BC OUTPUT_FOG_EXT = 0x87BD SCALAR_EXT = 0x87BE VECTOR_EXT = 0x87BF MATRIX_EXT = 0x87C0 VARIANT_EXT = 0x87C1 INVARIANT_EXT = 0x87C2 LOCAL_CONSTANT_EXT = 0x87C3 LOCAL_EXT = 0x87C4 MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87C5 MAX_VERTEX_SHADER_VARIANTS_EXT = 0x87C6 MAX_VERTEX_SHADER_INVARIANTS_EXT = 0x87C7 MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87C8 MAX_VERTEX_SHADER_LOCALS_EXT = 0x87C9 MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87CA MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = 0x87CB MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87CC MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = 0x87CD MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = 0x87CE VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87CF VERTEX_SHADER_VARIANTS_EXT = 0x87D0 VERTEX_SHADER_INVARIANTS_EXT = 0x87D1 VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87D2 VERTEX_SHADER_LOCALS_EXT = 0x87D3 VERTEX_SHADER_OPTIMIZED_EXT = 0x87D4 X_EXT = 0x87D5 Y_EXT = 0x87D6 Z_EXT = 0x87D7 W_EXT = 0x87D8 NEGATIVE_X_EXT = 0x87D9 NEGATIVE_Y_EXT = 0x87DA NEGATIVE_Z_EXT = 0x87DB NEGATIVE_W_EXT = 0x87DC ZERO_EXT = 0x87DD ONE_EXT = 0x87DE NEGATIVE_ONE_EXT = 0x87DF NORMALIZED_RANGE_EXT = 0x87E0 FULL_RANGE_EXT = 0x87E1 CURRENT_VERTEX_EXT = 0x87E2 MVP_MATRIX_EXT = 0x87E3 VARIANT_VALUE_EXT = 0x87E4 VARIANT_DATATYPE_EXT = 0x87E5 VARIANT_ARRAY_STRIDE_EXT = 0x87E6 VARIANT_ARRAY_TYPE_EXT = 0x87E7 VARIANT_ARRAY_EXT = 0x87E8 VARIANT_ARRAY_POINTER_EXT = 0x87E9 INVARIANT_VALUE_EXT = 0x87EA INVARIANT_DATATYPE_EXT = 0x87EB LOCAL_CONSTANT_VALUE_EXT = 0x87EC LOCAL_CONSTANT_DATATYPE_EXT = 0x87ED AMD_compressed_ATC_texture enum: (OpenGL ES only) (additional; see below) ATC_RGBA_INTERPOLATED_ALPHA_AMD = 0x87EE ATI_pn_triangles enum: PN_TRIANGLES_ATI = 0x87F0 MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = 0x87F1 PN_TRIANGLES_POINT_MODE_ATI = 0x87F2 PN_TRIANGLES_NORMAL_MODE_ATI = 0x87F3 PN_TRIANGLES_TESSELATION_LEVEL_ATI = 0x87F4 PN_TRIANGLES_POINT_MODE_LINEAR_ATI = 0x87F5 PN_TRIANGLES_POINT_MODE_CUBIC_ATI = 0x87F6 PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = 0x87F7 PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = 0x87F8 AMD_compressed_3DC_texture enum: (OpenGL ES only) 3DC_X_AMD = 0x87F9 3DC_XY_AMD = 0x87FA ATI_meminfo enum: VBO_FREE_MEMORY_ATI = 0x87FB TEXTURE_FREE_MEMORY_ATI = 0x87FC RENDERBUFFER_FREE_MEMORY_ATI = 0x87FD OES_get_program_binary enum: (OpenGL ES only; NUM_PROGRAM_BINARY_FORMATS_OES = 0x87FE PROGRAM_BINARY_FORMATS_OES = 0x87FF VERSION_2_0 enum: (Promoted for OpenGL 2.0) STENCIL_BACK_FUNC = 0x8800 # VERSION_2_0 STENCIL_BACK_FAIL = 0x8801 # VERSION_2_0 STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802 # VERSION_2_0 STENCIL_BACK_PASS_DEPTH_PASS = 0x8803 # VERSION_2_0 STENCIL_BACK_FAIL_ATI = 0x8801 ATI_separate_stencil enum: STENCIL_BACK_FUNC_ATI = 0x8800 STENCIL_BACK_PASS_DEPTH_FAIL_ATI = 0x8802 STENCIL_BACK_PASS_DEPTH_PASS_ATI = 0x8803 ARB_fragment_program enum: FRAGMENT_PROGRAM_ARB = 0x8804 PROGRAM_ALU_INSTRUCTIONS_ARB = 0x8805 PROGRAM_TEX_INSTRUCTIONS_ARB = 0x8806 PROGRAM_TEX_INDIRECTIONS_ARB = 0x8807 PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 0x8808 PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 0x8809 PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 0x880A MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = 0x880B MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = 0x880C MAX_PROGRAM_TEX_INDIRECTIONS_ARB = 0x880D MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 0x880E MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 0x880F MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 0x8810 # ATI_future_use: 0x8811-0x8813 VERSION_3_0 enum: RGBA32F = 0x8814 # VERSION_3_0 RGB32F = 0x8815 # VERSION_3_0 RGBA16F = 0x881A # VERSION_3_0 RGB16F = 0x881B # VERSION_3_0 ARB_texture_float enum: RGBA32F_ARB = 0x8814 RGB32F_ARB = 0x8815 ALPHA32F_ARB = 0x8816 INTENSITY32F_ARB = 0x8817 LUMINANCE32F_ARB = 0x8818 LUMINANCE_ALPHA32F_ARB = 0x8819 RGBA16F_ARB = 0x881A RGB16F_ARB = 0x881B ALPHA16F_ARB = 0x881C INTENSITY16F_ARB = 0x881D LUMINANCE16F_ARB = 0x881E LUMINANCE_ALPHA16F_ARB = 0x881F ATI_texture_float enum: RGBA_FLOAT32_ATI = 0x8814 RGB_FLOAT32_ATI = 0x8815 ALPHA_FLOAT32_ATI = 0x8816 INTENSITY_FLOAT32_ATI = 0x8817 LUMINANCE_FLOAT32_ATI = 0x8818 LUMINANCE_ALPHA_FLOAT32_ATI = 0x8819 RGBA_FLOAT16_ATI = 0x881A RGB_FLOAT16_ATI = 0x881B ALPHA_FLOAT16_ATI = 0x881C INTENSITY_FLOAT16_ATI = 0x881D LUMINANCE_FLOAT16_ATI = 0x881E LUMINANCE_ALPHA_FLOAT16_ATI = 0x881F APPLE_float_pixels enum: (additional; see below) RGBA_FLOAT32_APPLE = 0x8814 RGB_FLOAT32_APPLE = 0x8815 ALPHA_FLOAT32_APPLE = 0x8816 INTENSITY_FLOAT32_APPLE = 0x8817 LUMINANCE_FLOAT32_APPLE = 0x8818 LUMINANCE_ALPHA_FLOAT32_APPLE = 0x8819 RGBA_FLOAT16_APPLE = 0x881A RGB_FLOAT16_APPLE = 0x881B ALPHA_FLOAT16_APPLE = 0x881C INTENSITY_FLOAT16_APPLE = 0x881D LUMINANCE_FLOAT16_APPLE = 0x881E LUMINANCE_ALPHA_FLOAT16_APPLE = 0x881F ARB_color_buffer_float enum: RGBA_FLOAT_MODE_ARB = 0x8820 # Equivalent to TYPE_RGBA_FLOAT_ATI ATI_pixel_format_float enum: (really WGL_ATI_pixel_format_float) TYPE_RGBA_FLOAT_ATI = 0x8820 # ATI_future_use: 0x8821-0x8822 QCOM_writeonly_rendering enum: (OpenGL ES only) WRITEONLY_RENDERING_QCOM = 0x8823 VERSION_2_0 enum: (Promoted for OpenGL 2.0) MAX_DRAW_BUFFERS = 0x8824 # VERSION_2_0 DRAW_BUFFER0 = 0x8825 # VERSION_2_0 DRAW_BUFFER1 = 0x8826 # VERSION_2_0 DRAW_BUFFER2 = 0x8827 # VERSION_2_0 DRAW_BUFFER3 = 0x8828 # VERSION_2_0 DRAW_BUFFER4 = 0x8829 # VERSION_2_0 DRAW_BUFFER5 = 0x882A # VERSION_2_0 DRAW_BUFFER6 = 0x882B # VERSION_2_0 DRAW_BUFFER7 = 0x882C # VERSION_2_0 DRAW_BUFFER8 = 0x882D # VERSION_2_0 DRAW_BUFFER9 = 0x882E # VERSION_2_0 DRAW_BUFFER10 = 0x882F # VERSION_2_0 DRAW_BUFFER11 = 0x8830 # VERSION_2_0 DRAW_BUFFER12 = 0x8831 # VERSION_2_0 DRAW_BUFFER13 = 0x8832 # VERSION_2_0 DRAW_BUFFER14 = 0x8833 # VERSION_2_0 DRAW_BUFFER15 = 0x8834 # VERSION_2_0 ARB_draw_buffers enum: MAX_DRAW_BUFFERS_ARB = 0x8824 DRAW_BUFFER0_ARB = 0x8825 DRAW_BUFFER1_ARB = 0x8826 DRAW_BUFFER2_ARB = 0x8827 DRAW_BUFFER3_ARB = 0x8828 DRAW_BUFFER4_ARB = 0x8829 DRAW_BUFFER5_ARB = 0x882A DRAW_BUFFER6_ARB = 0x882B DRAW_BUFFER7_ARB = 0x882C DRAW_BUFFER8_ARB = 0x882D DRAW_BUFFER9_ARB = 0x882E DRAW_BUFFER10_ARB = 0x882F DRAW_BUFFER11_ARB = 0x8830 DRAW_BUFFER12_ARB = 0x8831 DRAW_BUFFER13_ARB = 0x8832 DRAW_BUFFER14_ARB = 0x8833 DRAW_BUFFER15_ARB = 0x8834 ATI_draw_buffers enum: MAX_DRAW_BUFFERS_ATI = 0x8824 DRAW_BUFFER0_ATI = 0x8825 DRAW_BUFFER1_ATI = 0x8826 DRAW_BUFFER2_ATI = 0x8827 DRAW_BUFFER3_ATI = 0x8828 DRAW_BUFFER4_ATI = 0x8829 DRAW_BUFFER5_ATI = 0x882A DRAW_BUFFER6_ATI = 0x882B DRAW_BUFFER7_ATI = 0x882C DRAW_BUFFER8_ATI = 0x882D DRAW_BUFFER9_ATI = 0x882E DRAW_BUFFER10_ATI = 0x882F DRAW_BUFFER11_ATI = 0x8830 DRAW_BUFFER12_ATI = 0x8831 DRAW_BUFFER13_ATI = 0x8832 DRAW_BUFFER14_ATI = 0x8833 DRAW_BUFFER15_ATI = 0x8834 ATI_pixel_format_float enum: (really WGL_ATI_pixel_format_float) (additional; see above) COLOR_CLEAR_UNCLAMPED_VALUE_ATI = 0x8835 # ATI_future_use: 0x8836-0x883F VERSION_2_0 enum: (Promoted for OpenGL 2.0) BLEND_EQUATION_ALPHA = 0x883D # VERSION_2_0 EXT_blend_equation_separate enum: BLEND_EQUATION_ALPHA_EXT = 0x883D # Aliases EXT_blend_equation_separate enum above OES_blend_equation_separate enum: (OpenGL ES only) BLEND_EQUATION_ALPHA_OES = 0x883D ############################################################################### # OpenGL ARB: 0x8840-0x884F ARB_matrix_palette enum: MATRIX_PALETTE_ARB = 0x8840 MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = 0x8841 MAX_PALETTE_MATRICES_ARB = 0x8842 CURRENT_PALETTE_MATRIX_ARB = 0x8843 MATRIX_INDEX_ARRAY_ARB = 0x8844 CURRENT_MATRIX_INDEX_ARB = 0x8845 MATRIX_INDEX_ARRAY_SIZE_ARB = 0x8846 MATRIX_INDEX_ARRAY_TYPE_ARB = 0x8847 MATRIX_INDEX_ARRAY_STRIDE_ARB = 0x8848 MATRIX_INDEX_ARRAY_POINTER_ARB = 0x8849 # Aliases ARB_matrix_palette enums above OES_matrix_palette enum: (OpenGL ES only; additional; see below) MATRIX_PALETTE_OES = 0x8840 MAX_PALETTE_MATRICES_OES = 0x8842 CURRENT_PALETTE_MATRIX_OES = 0x8843 MATRIX_INDEX_ARRAY_OES = 0x8844 MATRIX_INDEX_ARRAY_SIZE_OES = 0x8846 MATRIX_INDEX_ARRAY_TYPE_OES = 0x8847 MATRIX_INDEX_ARRAY_STRIDE_OES = 0x8848 MATRIX_INDEX_ARRAY_POINTER_OES = 0x8849 VERSION_1_4 enum: (Promoted for OpenGL 1.4) TEXTURE_DEPTH_SIZE = 0x884A DEPTH_TEXTURE_MODE = 0x884B ARB_depth_texture enum: TEXTURE_DEPTH_SIZE_ARB = 0x884A DEPTH_TEXTURE_MODE_ARB = 0x884B VERSION_3_0 enum: (aliases) COMPARE_REF_TO_TEXTURE = 0x884E # VERSION_3_0 # alias GL_COMPARE_R_TO_TEXTURE_ARB VERSION_1_4 enum: (Promoted for OpenGL 1.4) TEXTURE_COMPARE_MODE = 0x884C TEXTURE_COMPARE_FUNC = 0x884D COMPARE_R_TO_TEXTURE = 0x884E ARB_shadow enum: TEXTURE_COMPARE_MODE_ARB = 0x884C TEXTURE_COMPARE_FUNC_ARB = 0x884D COMPARE_R_TO_TEXTURE_ARB = 0x884E EXT_texture_array enum: (additional; see below) COMPARE_REF_DEPTH_TO_TEXTURE_EXT = 0x884E VERSION_3_2 enum: use ARB_seamless_cube_map TEXTURE_CUBE_MAP_SEAMLESS ARB_seamless_cube_map enum: TEXTURE_CUBE_MAP_SEAMLESS = 0x884F ############################################################################### # NVIDIA: 0x8850-0x891F NV_texture_shader3 enum: OFFSET_PROJECTIVE_TEXTURE_2D_NV = 0x8850 OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = 0x8851 OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = 0x8852 OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = 0x8853 OFFSET_HILO_TEXTURE_2D_NV = 0x8854 OFFSET_HILO_TEXTURE_RECTANGLE_NV = 0x8855 OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = 0x8856 OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = 0x8857 DEPENDENT_HILO_TEXTURE_2D_NV = 0x8858 DEPENDENT_RGB_TEXTURE_3D_NV = 0x8859 DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = 0x885A DOT_PRODUCT_PASS_THROUGH_NV = 0x885B DOT_PRODUCT_TEXTURE_1D_NV = 0x885C DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = 0x885D HILO8_NV = 0x885E SIGNED_HILO8_NV = 0x885F FORCE_BLUE_TO_ONE_NV = 0x8860 VERSION_2_0 enum: (Promoted for OpenGL 2.0) POINT_SPRITE = 0x8861 # VERSION_2_0 COORD_REPLACE = 0x8862 # VERSION_2_0 ARB_point_sprite enum: POINT_SPRITE_ARB = 0x8861 COORD_REPLACE_ARB = 0x8862 NV_point_sprite enum: POINT_SPRITE_NV = 0x8861 COORD_REPLACE_NV = 0x8862 # Aliases ARB_point_sprite enums above OES_point_sprite enum: (OpenGL ES only) POINT_SPRITE_ARB = 0x8861 COORD_REPLACE_ARB = 0x8862 NV_point_sprite enum: POINT_SPRITE_R_MODE_NV = 0x8863 VERSION_1_5 enum: (Promoted for OpenGL 1.5) QUERY_COUNTER_BITS = 0x8864 CURRENT_QUERY = 0x8865 QUERY_RESULT = 0x8866 QUERY_RESULT_AVAILABLE = 0x8867 ARB_occlusion_query enum: QUERY_COUNTER_BITS_ARB = 0x8864 CURRENT_QUERY_ARB = 0x8865 QUERY_RESULT_ARB = 0x8866 QUERY_RESULT_AVAILABLE_ARB = 0x8867 NV_occlusion_query enum: PIXEL_COUNTER_BITS_NV = 0x8864 CURRENT_OCCLUSION_QUERY_ID_NV = 0x8865 PIXEL_COUNT_NV = 0x8866 PIXEL_COUNT_AVAILABLE_NV = 0x8867 NV_fragment_program enum: MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = 0x8868 VERSION_2_0 enum: (Promoted from ARB_vertex_shader) MAX_VERTEX_ATTRIBS = 0x8869 # VERSION_2_0 VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A # VERSION_2_0 ARB_vertex_program enum: (additional; see above) MAX_VERTEX_ATTRIBS_ARB = 0x8869 VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A # NV_future_use: 0x886B-0x886D NV_copy_depth_to_color enum: DEPTH_STENCIL_TO_RGBA_NV = 0x886E DEPTH_STENCIL_TO_BGRA_NV = 0x886F NV_fragment_program enum: (additional; see above) FRAGMENT_PROGRAM_NV = 0x8870 MAX_TEXTURE_COORDS_NV = 0x8871 MAX_TEXTURE_IMAGE_UNITS_NV = 0x8872 FRAGMENT_PROGRAM_BINDING_NV = 0x8873 PROGRAM_ERROR_STRING_NV = 0x8874 VERSION_2_0 enum: (Promoted from ARB_fragment_shader; only some values) MAX_TEXTURE_COORDS = 0x8871 # VERSION_2_0 MAX_TEXTURE_IMAGE_UNITS = 0x8872 # VERSION_2_0 ARB_vertex_program enum: (additional; see above) ARB_fragment_program enum: (additional; see above) MAX_TEXTURE_COORDS_ARB = 0x8871 # ARB_fragment_program MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872 # ARB_fragment_program PROGRAM_ERROR_STRING_ARB = 0x8874 # ARB_vertex_program / ARB_fragment_program PROGRAM_FORMAT_ASCII_ARB = 0x8875 # ARB_vertex_program / ARB_fragment_program PROGRAM_FORMAT_ARB = 0x8876 # ARB_vertex_program / ARB_fragment_program # 0x8877 *should have been* assigned to PROGRAM_BINDING_ARB. Oops. NV_pixel_data_range enum: WRITE_PIXEL_DATA_RANGE_NV = 0x8878 READ_PIXEL_DATA_RANGE_NV = 0x8879 WRITE_PIXEL_DATA_RANGE_LENGTH_NV = 0x887A READ_PIXEL_DATA_RANGE_LENGTH_NV = 0x887B WRITE_PIXEL_DATA_RANGE_POINTER_NV = 0x887C READ_PIXEL_DATA_RANGE_POINTER_NV = 0x887D # NV_future_use: 0x887E-0x887F NV_float_buffer enum: FLOAT_R_NV = 0x8880 FLOAT_RG_NV = 0x8881 FLOAT_RGB_NV = 0x8882 FLOAT_RGBA_NV = 0x8883 FLOAT_R16_NV = 0x8884 FLOAT_R32_NV = 0x8885 FLOAT_RG16_NV = 0x8886 FLOAT_RG32_NV = 0x8887 FLOAT_RGB16_NV = 0x8888 FLOAT_RGB32_NV = 0x8889 FLOAT_RGBA16_NV = 0x888A FLOAT_RGBA32_NV = 0x888B TEXTURE_FLOAT_COMPONENTS_NV = 0x888C FLOAT_CLEAR_COLOR_VALUE_NV = 0x888D FLOAT_RGBA_MODE_NV = 0x888E NV_texture_expand_normal enum: TEXTURE_UNSIGNED_REMAP_MODE_NV = 0x888F EXT_depth_bounds_test enum: DEPTH_BOUNDS_TEST_EXT = 0x8890 DEPTH_BOUNDS_EXT = 0x8891 VERSION_1_5 enum: (Promoted for OpenGL 1.5) ARRAY_BUFFER = 0x8892 ELEMENT_ARRAY_BUFFER = 0x8893 ARRAY_BUFFER_BINDING = 0x8894 ELEMENT_ARRAY_BUFFER_BINDING = 0x8895 VERTEX_ARRAY_BUFFER_BINDING = 0x8896 NORMAL_ARRAY_BUFFER_BINDING = 0x8897 COLOR_ARRAY_BUFFER_BINDING = 0x8898 INDEX_ARRAY_BUFFER_BINDING = 0x8899 TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A EDGE_FLAG_ARRAY_BUFFER_BINDING = 0x889B SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 0x889C FOG_COORD_ARRAY_BUFFER_BINDING = 0x889D # alias GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889D WEIGHT_ARRAY_BUFFER_BINDING = 0x889E VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F ARB_vertex_buffer_object enum: ARRAY_BUFFER_ARB = 0x8892 ELEMENT_ARRAY_BUFFER_ARB = 0x8893 ARRAY_BUFFER_BINDING_ARB = 0x8894 ELEMENT_ARRAY_BUFFER_BINDING_ARB = 0x8895 VERTEX_ARRAY_BUFFER_BINDING_ARB = 0x8896 NORMAL_ARRAY_BUFFER_BINDING_ARB = 0x8897 COLOR_ARRAY_BUFFER_BINDING_ARB = 0x8898 INDEX_ARRAY_BUFFER_BINDING_ARB = 0x8899 TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = 0x889A EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = 0x889B SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = 0x889C FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = 0x889D WEIGHT_ARRAY_BUFFER_BINDING_ARB = 0x889E VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = 0x889F # Aliases ARB_vertex_buffer_object enum above OES_matrix_palette enum: (OpenGL ES only; additional; see below) WEIGHT_ARRAY_BUFFER_BINDING_OES = 0x889E ARB_vertex_program enum: (additional; see above) ARB_fragment_program enum: (additional; see above) PROGRAM_INSTRUCTIONS_ARB = 0x88A0 MAX_PROGRAM_INSTRUCTIONS_ARB = 0x88A1 PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A2 MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A3 PROGRAM_TEMPORARIES_ARB = 0x88A4 MAX_PROGRAM_TEMPORARIES_ARB = 0x88A5 PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A6 MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A7 PROGRAM_PARAMETERS_ARB = 0x88A8 MAX_PROGRAM_PARAMETERS_ARB = 0x88A9 PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AA MAX_PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AB PROGRAM_ATTRIBS_ARB = 0x88AC MAX_PROGRAM_ATTRIBS_ARB = 0x88AD PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AE MAX_PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AF PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B0 MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B1 PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B2 MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B3 MAX_PROGRAM_LOCAL_PARAMETERS_ARB = 0x88B4 MAX_PROGRAM_ENV_PARAMETERS_ARB = 0x88B5 PROGRAM_UNDER_NATIVE_LIMITS_ARB = 0x88B6 TRANSPOSE_CURRENT_MATRIX_ARB = 0x88B7 VERSION_1_5 enum: (Promoted for OpenGL 1.5) READ_ONLY = 0x88B8 WRITE_ONLY = 0x88B9 READ_WRITE = 0x88BA BUFFER_ACCESS = 0x88BB BUFFER_MAPPED = 0x88BC BUFFER_MAP_POINTER = 0x88BD ARB_vertex_buffer_object enum: (additional; see above) READ_ONLY_ARB = 0x88B8 WRITE_ONLY_ARB = 0x88B9 READ_WRITE_ARB = 0x88BA BUFFER_ACCESS_ARB = 0x88BB BUFFER_MAPPED_ARB = 0x88BC BUFFER_MAP_POINTER_ARB = 0x88BD # Aliases ARB_vertex_buffer_object enums above OES_mapbuffer enum: (OpenGL ES only) WRITE_ONLY_OES = 0x88B9 BUFFER_ACCESS_OES = 0x88BB BUFFER_MAPPED_OES = 0x88BC BUFFER_MAP_POINTER_OES = 0x88BD # NV_future_use: 0x88BE EXT_timer_query enum: TIME_ELAPSED_EXT = 0x88BF ARB_vertex_program enum: (additional; see above) ARB_fragment_program enum: (additional; see above) MATRIX0_ARB = 0x88C0 MATRIX1_ARB = 0x88C1 MATRIX2_ARB = 0x88C2 MATRIX3_ARB = 0x88C3 MATRIX4_ARB = 0x88C4 MATRIX5_ARB = 0x88C5 MATRIX6_ARB = 0x88C6 MATRIX7_ARB = 0x88C7 MATRIX8_ARB = 0x88C8 MATRIX9_ARB = 0x88C9 MATRIX10_ARB = 0x88CA MATRIX11_ARB = 0x88CB MATRIX12_ARB = 0x88CC MATRIX13_ARB = 0x88CD MATRIX14_ARB = 0x88CE MATRIX15_ARB = 0x88CF MATRIX16_ARB = 0x88D0 MATRIX17_ARB = 0x88D1 MATRIX18_ARB = 0x88D2 MATRIX19_ARB = 0x88D3 MATRIX20_ARB = 0x88D4 MATRIX21_ARB = 0x88D5 MATRIX22_ARB = 0x88D6 MATRIX23_ARB = 0x88D7 MATRIX24_ARB = 0x88D8 MATRIX25_ARB = 0x88D9 MATRIX26_ARB = 0x88DA MATRIX27_ARB = 0x88DB MATRIX28_ARB = 0x88DC MATRIX29_ARB = 0x88DD MATRIX30_ARB = 0x88DE MATRIX31_ARB = 0x88DF VERSION_1_5 enum: (Promoted for OpenGL 1.5) STREAM_DRAW = 0x88E0 STREAM_READ = 0x88E1 STREAM_COPY = 0x88E2 STATIC_DRAW = 0x88E4 STATIC_READ = 0x88E5 STATIC_COPY = 0x88E6 DYNAMIC_DRAW = 0x88E8 DYNAMIC_READ = 0x88E9 DYNAMIC_COPY = 0x88EA ARB_vertex_buffer_object enum: (additional; see above) STREAM_DRAW_ARB = 0x88E0 STREAM_READ_ARB = 0x88E1 STREAM_COPY_ARB = 0x88E2 STATIC_DRAW_ARB = 0x88E4 STATIC_READ_ARB = 0x88E5 STATIC_COPY_ARB = 0x88E6 DYNAMIC_DRAW_ARB = 0x88E8 DYNAMIC_READ_ARB = 0x88E9 DYNAMIC_COPY_ARB = 0x88EA VERSION_2_1 enum: PIXEL_PACK_BUFFER = 0x88EB # VERSION_2_1 PIXEL_UNPACK_BUFFER = 0x88EC # VERSION_2_1 PIXEL_PACK_BUFFER_BINDING = 0x88ED # VERSION_2_1 PIXEL_UNPACK_BUFFER_BINDING = 0x88EF # VERSION_2_1 ARB_pixel_buffer_object enum: PIXEL_PACK_BUFFER_ARB = 0x88EB # ARB_pixel_buffer_object PIXEL_UNPACK_BUFFER_ARB = 0x88EC # ARB_pixel_buffer_object PIXEL_PACK_BUFFER_BINDING_ARB = 0x88ED # ARB_pixel_buffer_object PIXEL_UNPACK_BUFFER_BINDING_ARB = 0x88EF # ARB_pixel_buffer_object EXT_pixel_buffer_object enum: PIXEL_PACK_BUFFER_EXT = 0x88EB # EXT_pixel_buffer_object PIXEL_UNPACK_BUFFER_EXT = 0x88EC # EXT_pixel_buffer_object PIXEL_PACK_BUFFER_BINDING_EXT = 0x88ED # EXT_pixel_buffer_object PIXEL_UNPACK_BUFFER_BINDING_EXT = 0x88EF # EXT_pixel_buffer_object # ARB_future_use: 0x88E3, 0x88E7, 0x88EE # (for extending ARB_vertex_buffer_object): VERSION_3_0 enum: use ARB_framebuffer_object DEPTH24_STENCIL8 use ARB_framebuffer_object TEXTURE_STENCIL_SIZE ARB_framebuffer_object enum: (note: no ARB suffixes) DEPTH24_STENCIL8 = 0x88F0 # VERSION_3_0 / ARB_fbo TEXTURE_STENCIL_SIZE = 0x88F1 # VERSION_3_0 / ARB_fbo EXT_packed_depth_stencil enum: (additional; see above) DEPTH24_STENCIL8_EXT = 0x88F0 TEXTURE_STENCIL_SIZE_EXT = 0x88F1 # Aliases EXT_packed_depth_stencil enum above OES_packed_depth_stencil enum: (OpenGL ES only; additional; see above) DEPTH24_STENCIL8_OES = 0x88F0 EXT_stencil_clear_tag enum: STENCIL_TAG_BITS_EXT = 0x88F2 STENCIL_CLEAR_TAG_VALUE_EXT = 0x88F3 NV_vertex_program2_option enum: (duplicated in NV_fragment_prgoram2 below) MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = 0x88F4 MAX_PROGRAM_CALL_DEPTH_NV = 0x88F5 NV_fragment_program2 enum: MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = 0x88F4 MAX_PROGRAM_CALL_DEPTH_NV = 0x88F5 MAX_PROGRAM_IF_DEPTH_NV = 0x88F6 MAX_PROGRAM_LOOP_DEPTH_NV = 0x88F7 MAX_PROGRAM_LOOP_COUNT_NV = 0x88F8 # NV_future_use: 0x88F9-0x88FC VERSION_3_0 enum: VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD # VERSION_3_0 NV_vertex_program4 enum: VERTEX_ATTRIB_ARRAY_INTEGER_NV = 0x88FD ARB_instanced_arrays enum: VERTEX_ATTRIB_ARRAY_DIVISOR_ARB = 0x88FE VERSION_3_0 enum: MAX_ARRAY_TEXTURE_LAYERS = 0x88FF # VERSION_3_0 EXT_texture_array enum: (additional; see below) MAX_ARRAY_TEXTURE_LAYERS_EXT = 0x88FF VERSION_3_0 enum: MIN_PROGRAM_TEXEL_OFFSET = 0x8904 # VERSION_3_0 MAX_PROGRAM_TEXEL_OFFSET = 0x8905 # VERSION_3_0 NV_gpu_program4 enum: MIN_PROGRAM_TEXEL_OFFSET_NV = 0x8904 MAX_PROGRAM_TEXEL_OFFSET_NV = 0x8905 PROGRAM_ATTRIB_COMPONENTS_NV = 0x8906 PROGRAM_RESULT_COMPONENTS_NV = 0x8907 MAX_PROGRAM_ATTRIB_COMPONENTS_NV = 0x8908 MAX_PROGRAM_RESULT_COMPONENTS_NV = 0x8909 EXT_stencil_two_side enum: STENCIL_TEST_TWO_SIDE_EXT = 0x8910 ACTIVE_STENCIL_FACE_EXT = 0x8911 EXT_texture_mirror_clamp enum: (additional; see above): MIRROR_CLAMP_TO_BORDER_EXT = 0x8912 # NV_future_use: 0x8913 VERSION_1_5 enum: (Promoted for OpenGL 1.5) SAMPLES_PASSED = 0x8914 ARB_occlusion_query enum: (additional; see above) SAMPLES_PASSED_ARB = 0x8914 # NV_future_use: 0x8915 VERSION_3_2 enum: GEOMETRY_VERTICES_OUT = 0x8916 GEOMETRY_INPUT_TYPE = 0x8917 GEOMETRY_OUTPUT_TYPE = 0x8918 # NV_future_use: 0x8919 VERSION_3_0 enum: CLAMP_VERTEX_COLOR = 0x891A # VERSION_3_0 CLAMP_FRAGMENT_COLOR = 0x891B # VERSION_3_0 CLAMP_READ_COLOR = 0x891C # VERSION_3_0 FIXED_ONLY = 0x891D # VERSION_3_0 ARB_color_buffer_float enum: (additional; see above) CLAMP_VERTEX_COLOR_ARB = 0x891A CLAMP_FRAGMENT_COLOR_ARB = 0x891B CLAMP_READ_COLOR_ARB = 0x891C FIXED_ONLY_ARB = 0x891D # NV_future_use: 0x891E-0x891F ############################################################################### # ATI: 0x8920-0x897F ATI_fragment_shader enum: FRAGMENT_SHADER_ATI = 0x8920 REG_0_ATI = 0x8921 REG_1_ATI = 0x8922 REG_2_ATI = 0x8923 REG_3_ATI = 0x8924 REG_4_ATI = 0x8925 REG_5_ATI = 0x8926 REG_6_ATI = 0x8927 REG_7_ATI = 0x8928 REG_8_ATI = 0x8929 REG_9_ATI = 0x892A REG_10_ATI = 0x892B REG_11_ATI = 0x892C REG_12_ATI = 0x892D REG_13_ATI = 0x892E REG_14_ATI = 0x892F REG_15_ATI = 0x8930 REG_16_ATI = 0x8931 REG_17_ATI = 0x8932 REG_18_ATI = 0x8933 REG_19_ATI = 0x8934 REG_20_ATI = 0x8935 REG_21_ATI = 0x8936 REG_22_ATI = 0x8937 REG_23_ATI = 0x8938 REG_24_ATI = 0x8939 REG_25_ATI = 0x893A REG_26_ATI = 0x893B REG_27_ATI = 0x893C REG_28_ATI = 0x893D REG_29_ATI = 0x893E REG_30_ATI = 0x893F REG_31_ATI = 0x8940 CON_0_ATI = 0x8941 CON_1_ATI = 0x8942 CON_2_ATI = 0x8943 CON_3_ATI = 0x8944 CON_4_ATI = 0x8945 CON_5_ATI = 0x8946 CON_6_ATI = 0x8947 CON_7_ATI = 0x8948 CON_8_ATI = 0x8949 CON_9_ATI = 0x894A CON_10_ATI = 0x894B CON_11_ATI = 0x894C CON_12_ATI = 0x894D CON_13_ATI = 0x894E CON_14_ATI = 0x894F CON_15_ATI = 0x8950 CON_16_ATI = 0x8951 CON_17_ATI = 0x8952 CON_18_ATI = 0x8953 CON_19_ATI = 0x8954 CON_20_ATI = 0x8955 CON_21_ATI = 0x8956 CON_22_ATI = 0x8957 CON_23_ATI = 0x8958 CON_24_ATI = 0x8959 CON_25_ATI = 0x895A CON_26_ATI = 0x895B CON_27_ATI = 0x895C CON_28_ATI = 0x895D CON_29_ATI = 0x895E CON_30_ATI = 0x895F CON_31_ATI = 0x8960 MOV_ATI = 0x8961 ADD_ATI = 0x8963 MUL_ATI = 0x8964 SUB_ATI = 0x8965 DOT3_ATI = 0x8966 DOT4_ATI = 0x8967 MAD_ATI = 0x8968 LERP_ATI = 0x8969 CND_ATI = 0x896A CND0_ATI = 0x896B DOT2_ADD_ATI = 0x896C SECONDARY_INTERPOLATOR_ATI = 0x896D NUM_FRAGMENT_REGISTERS_ATI = 0x896E NUM_FRAGMENT_CONSTANTS_ATI = 0x896F NUM_PASSES_ATI = 0x8970 NUM_INSTRUCTIONS_PER_PASS_ATI = 0x8971 NUM_INSTRUCTIONS_TOTAL_ATI = 0x8972 NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI = 0x8973 NUM_LOOPBACK_COMPONENTS_ATI = 0x8974 COLOR_ALPHA_PAIRING_ATI = 0x8975 SWIZZLE_STR_ATI = 0x8976 SWIZZLE_STQ_ATI = 0x8977 SWIZZLE_STR_DR_ATI = 0x8978 SWIZZLE_STQ_DQ_ATI = 0x8979 SWIZZLE_STRQ_ATI = 0x897A SWIZZLE_STRQ_DQ_ATI = 0x897B # ??? Not clear where to put new types of mask bits yet RED_BIT_ATI = 0x00000001 GREEN_BIT_ATI = 0x00000002 BLUE_BIT_ATI = 0x00000004 2X_BIT_ATI = 0x00000001 4X_BIT_ATI = 0x00000002 8X_BIT_ATI = 0x00000004 HALF_BIT_ATI = 0x00000008 QUARTER_BIT_ATI = 0x00000010 EIGHTH_BIT_ATI = 0x00000020 SATURATE_BIT_ATI = 0x00000040 2X_BIT_ATI = 0x00000001 COMP_BIT_ATI = 0x00000002 NEGATE_BIT_ATI = 0x00000004 BIAS_BIT_ATI = 0x00000008 # ATI_future_use: 0x897C-0x897F ############################################################################### # Khronos OpenML WG / OpenGL ES WG: 0x8980-0x898F OML_interlace enum: INTERLACE_OML = 0x8980 INTERLACE_READ_OML = 0x8981 OML_subsample enum: FORMAT_SUBSAMPLE_24_24_OML = 0x8982 FORMAT_SUBSAMPLE_244_244_OML = 0x8983 OML_resample enum: PACK_RESAMPLE_OML = 0x8984 UNPACK_RESAMPLE_OML = 0x8985 RESAMPLE_REPLICATE_OML = 0x8986 RESAMPLE_ZERO_FILL_OML = 0x8987 RESAMPLE_AVERAGE_OML = 0x8988 RESAMPLE_DECIMATE_OML = 0x8989 OES_point_size_array enum: (OpenGL ES only) POINT_SIZE_ARRAY_TYPE_OES = 0x898A POINT_SIZE_ARRAY_STRIDE_OES = 0x898B POINT_SIZE_ARRAY_POINTER_OES = 0x898C OES_matrix_get enum: (OpenGL ES only) MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898D PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898E TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 0x898F ############################################################################### # 3dlabs: 0x8990-0x899F ############################################################################### # Matrox: 0x89A0-0x89FF ############################################################################### # Apple: 0x8A00-0x8A7F APPLE_vertex_program_evaluators enum: VERTEX_ATTRIB_MAP1_APPLE = 0x8A00 VERTEX_ATTRIB_MAP2_APPLE = 0x8A01 VERTEX_ATTRIB_MAP1_SIZE_APPLE = 0x8A02 VERTEX_ATTRIB_MAP1_COEFF_APPLE = 0x8A03 VERTEX_ATTRIB_MAP1_ORDER_APPLE = 0x8A04 VERTEX_ATTRIB_MAP1_DOMAIN_APPLE = 0x8A05 VERTEX_ATTRIB_MAP2_SIZE_APPLE = 0x8A06 VERTEX_ATTRIB_MAP2_COEFF_APPLE = 0x8A07 VERTEX_ATTRIB_MAP2_ORDER_APPLE = 0x8A08 VERTEX_ATTRIB_MAP2_DOMAIN_APPLE = 0x8A09 APPLE_fence enum: DRAW_PIXELS_APPLE = 0x8A0A FENCE_APPLE = 0x8A0B ## From Jeremy 2006/10/18 (Khronos bug 632) - unknown extension name ELEMENT_ARRAY_APPLE = 0x8A0C ELEMENT_ARRAY_TYPE_APPLE = 0x8A0D ELEMENT_ARRAY_POINTER_APPLE = 0x8A0E APPLE_float_pixels enum: COLOR_FLOAT_APPLE = 0x8A0F # APPLE_future_use: 0x8A10 ## From Jeremy 2006/10/18 (Khronos bug 632) - unknown extension name # MIN_PBUFFER_VIEWPORT_DIMS_APPLE = 0x8A10 # ELEMENT_BUFFER_BINDING_APPLE = 0x8A11 # Apple says the extension that defined ELEMENT_BUFFER_BINDING_APPLE # never shipped and there's no actual collision with UNIFORM_BUFFER VERSION_3_1 enum: use ARB_uniform_buffer_object UNIFORM_BUFFER ARB_uniform_buffer_object enum: (additional; see below) UNIFORM_BUFFER = 0x8A11 APPLE_flush_buffer_range enum: BUFFER_SERIALIZED_MODIFY_APPLE = 0x8A12 BUFFER_FLUSHING_UNMAP_APPLE = 0x8A13 APPLE_aux_depth_stencil enum: AUX_DEPTH_STENCIL_APPLE = 0x8A14 APPLE_row_bytes enum: PACK_ROW_BYTES_APPLE = 0x8A15 UNPACK_ROW_BYTES_APPLE = 0x8A16 # APPLE_future_use: 0x8A17-0x8A18 APPLE_object_purgeable enum: RELEASED_APPLE = 0x8A19 VOLATILE_APPLE = 0x8A1A RETAINED_APPLE = 0x8A1B UNDEFINED_APPLE = 0x8A1C PURGEABLE_APPLE = 0x8A1D # APPLE_future_use: 0x8A1E APPLE_rgb_422 enum: RGB_422_APPLE = 0x8A1F use APPLE_ycbcr_422 UNSIGNED_SHORT_8_8_APPLE use APPLE_ycbcr_422 UNSIGNED_SHORT_8_8_REV_APPLE # APPLE_future_use: 0x8A20--0x8A27 VERSION_3_1 enum: use ARB_uniform_buffer_object UNIFORM_BUFFER_BINDING use ARB_uniform_buffer_object UNIFORM_BUFFER_START use ARB_uniform_buffer_object UNIFORM_BUFFER_SIZE use ARB_uniform_buffer_object MAX_VERTEX_UNIFORM_BLOCKS use ARB_uniform_buffer_object MAX_GEOMETRY_UNIFORM_BLOCKS use ARB_uniform_buffer_object MAX_FRAGMENT_UNIFORM_BLOCKS use ARB_uniform_buffer_object MAX_COMBINED_UNIFORM_BLOCKS use ARB_uniform_buffer_object MAX_UNIFORM_BUFFER_BINDINGS use ARB_uniform_buffer_object MAX_UNIFORM_BLOCK_SIZE use ARB_uniform_buffer_object MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS use ARB_uniform_buffer_object MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS use ARB_uniform_buffer_object MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS use ARB_uniform_buffer_object UNIFORM_BUFFER_OFFSET_ALIGNMENT use ARB_uniform_buffer_object ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH use ARB_uniform_buffer_object ACTIVE_UNIFORM_BLOCKS use ARB_uniform_buffer_object UNIFORM_TYPE use ARB_uniform_buffer_object UNIFORM_SIZE use ARB_uniform_buffer_object UNIFORM_NAME_LENGTH use ARB_uniform_buffer_object UNIFORM_BLOCK_INDEX use ARB_uniform_buffer_object UNIFORM_OFFSET use ARB_uniform_buffer_object UNIFORM_ARRAY_STRIDE use ARB_uniform_buffer_object UNIFORM_MATRIX_STRIDE use ARB_uniform_buffer_object UNIFORM_IS_ROW_MAJOR use ARB_uniform_buffer_object UNIFORM_BLOCK_BINDING use ARB_uniform_buffer_object UNIFORM_BLOCK_DATA_SIZE use ARB_uniform_buffer_object UNIFORM_BLOCK_NAME_LENGTH use ARB_uniform_buffer_object UNIFORM_BLOCK_ACTIVE_UNIFORMS use ARB_uniform_buffer_object UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES use ARB_uniform_buffer_object UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER use ARB_uniform_buffer_object UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER use ARB_uniform_buffer_object UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER use ARB_uniform_buffer_object INVALID_INDEX ARB_uniform_buffer_object enum: UNIFORM_BUFFER_BINDING = 0x8A28 UNIFORM_BUFFER_START = 0x8A29 UNIFORM_BUFFER_SIZE = 0x8A2A MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B MAX_GEOMETRY_UNIFORM_BLOCKS = 0x8A2C MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F MAX_UNIFORM_BLOCK_SIZE = 0x8A30 MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31 MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 0x8A32 MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33 UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34 ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35 ACTIVE_UNIFORM_BLOCKS = 0x8A36 UNIFORM_TYPE = 0x8A37 UNIFORM_SIZE = 0x8A38 UNIFORM_NAME_LENGTH = 0x8A39 UNIFORM_BLOCK_INDEX = 0x8A3A UNIFORM_OFFSET = 0x8A3B UNIFORM_ARRAY_STRIDE = 0x8A3C UNIFORM_MATRIX_STRIDE = 0x8A3D UNIFORM_IS_ROW_MAJOR = 0x8A3E UNIFORM_BLOCK_BINDING = 0x8A3F UNIFORM_BLOCK_DATA_SIZE = 0x8A40 UNIFORM_BLOCK_NAME_LENGTH = 0x8A41 UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42 UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43 UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44 UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 0x8A45 UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46 INVALID_INDEX = 0xFFFFFFFFu # APPLE_future_use: 0x8A47-0x8A7F ############################################################################### # Matrox: 0x8A80-0x8AEF ############################################################################### # Chromium (Brian Paul): 0x8AF0-0x8B2F ############################################################################### # ARB HLSL shader extensions: 0x8B30-0x8B8F VERSION_3_1 enum: (Promoted from ARB_shader_objects + ARB_texture_rectangle) SAMPLER_2D_RECT = 0x8B63 # ARB_shader_objects + ARB_texture_rectangle SAMPLER_2D_RECT_SHADOW = 0x8B64 # ARB_shader_objects + ARB_texture_rectangle #@@ separate extensions VERSION_2_0 enum: (Promoted for OpenGL 2.0; only some values; renaming in many cases) ARB_shader_objects, ARB_vertex_shader, ARB_fragment_shader enum: NV_vertex_program3 enum: (reuses 0x8B4C) ##Shader types + room for expansion FRAGMENT_SHADER = 0x8B30 # VERSION_2_0 FRAGMENT_SHADER_ARB = 0x8B30 # ARB_fragment_shader VERTEX_SHADER = 0x8B31 # VERSION_2_0 VERTEX_SHADER_ARB = 0x8B31 # ARB_vertex_shader # ARB_future_use: 0x8B32-0x8B3F (for shader types) ##Container types + room for expansion PROGRAM_OBJECT_ARB = 0x8B40 # ARB_shader_objects # ARB_future_use: 0x8B41-0x8B47 (for container types) ##Misc. shader enums SHADER_OBJECT_ARB = 0x8B48 # ARB_shader_objects MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49 # VERSION_2_0 MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 0x8B49 # ARB_fragment_shader MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A # VERSION_2_0 MAX_VERTEX_UNIFORM_COMPONENTS_ARB = 0x8B4A # ARB_vertex_shader MAX_VARYING_FLOATS = 0x8B4B # VERSION_2_0 MAX_VARYING_FLOATS_ARB = 0x8B4B # ARB_vertex_shader MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C # VERSION_2_0 MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 0x8B4C # ARB_vertex_shader, NV_vertex_program3 MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D # VERSION_2_0 MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = 0x8B4D # ARB_vertex_shader OBJECT_TYPE_ARB = 0x8B4E # ARB_shader_objects SHADER_TYPE = 0x8B4F # VERSION_2_0 (renamed) OBJECT_SUBTYPE_ARB = 0x8B4F # ARB_shader_objects ##Attribute types + room for expansion. FLOAT_VEC2 = 0x8B50 # VERSION_2_0 FLOAT_VEC2_ARB = 0x8B50 # ARB_shader_objects FLOAT_VEC3 = 0x8B51 # VERSION_2_0 FLOAT_VEC3_ARB = 0x8B51 # ARB_shader_objects FLOAT_VEC4 = 0x8B52 # VERSION_2_0 FLOAT_VEC4_ARB = 0x8B52 # ARB_shader_objects INT_VEC2 = 0x8B53 # VERSION_2_0 INT_VEC2_ARB = 0x8B53 # ARB_shader_objects INT_VEC3 = 0x8B54 # VERSION_2_0 INT_VEC3_ARB = 0x8B54 # ARB_shader_objects INT_VEC4 = 0x8B55 # VERSION_2_0 INT_VEC4_ARB = 0x8B55 # ARB_shader_objects BOOL = 0x8B56 # VERSION_2_0 BOOL_ARB = 0x8B56 # ARB_shader_objects BOOL_VEC2 = 0x8B57 # VERSION_2_0 BOOL_VEC2_ARB = 0x8B57 # ARB_shader_objects BOOL_VEC3 = 0x8B58 # VERSION_2_0 BOOL_VEC3_ARB = 0x8B58 # ARB_shader_objects BOOL_VEC4 = 0x8B59 # VERSION_2_0 BOOL_VEC4_ARB = 0x8B59 # ARB_shader_objects FLOAT_MAT2 = 0x8B5A # VERSION_2_0 FLOAT_MAT2_ARB = 0x8B5A # ARB_shader_objects FLOAT_MAT3 = 0x8B5B # VERSION_2_0 FLOAT_MAT3_ARB = 0x8B5B # ARB_shader_objects FLOAT_MAT4 = 0x8B5C # VERSION_2_0 FLOAT_MAT4_ARB = 0x8B5C # ARB_shader_objects SAMPLER_1D = 0x8B5D # VERSION_2_0 SAMPLER_1D_ARB = 0x8B5D # ARB_shader_objects SAMPLER_2D = 0x8B5E # VERSION_2_0 SAMPLER_2D_ARB = 0x8B5E # ARB_shader_objects SAMPLER_3D = 0x8B5F # VERSION_2_0 SAMPLER_3D_ARB = 0x8B5F # ARB_shader_objects SAMPLER_CUBE = 0x8B60 # VERSION_2_0 SAMPLER_CUBE_ARB = 0x8B60 # ARB_shader_objects SAMPLER_1D_SHADOW = 0x8B61 # VERSION_2_0 SAMPLER_1D_SHADOW_ARB = 0x8B61 # ARB_shader_objects SAMPLER_2D_SHADOW = 0x8B62 # VERSION_2_0 SAMPLER_2D_SHADOW_ARB = 0x8B62 # ARB_shader_objects SAMPLER_2D_RECT_ARB = 0x8B63 # ARB_shader_objects SAMPLER_2D_RECT_SHADOW_ARB = 0x8B64 # ARB_shader_objects FLOAT_MAT2x3 = 0x8B65 # VERSION_2_1 FLOAT_MAT2x4 = 0x8B66 # VERSION_2_1 FLOAT_MAT3x2 = 0x8B67 # VERSION_2_1 FLOAT_MAT3x4 = 0x8B68 # VERSION_2_1 FLOAT_MAT4x2 = 0x8B69 # VERSION_2_1 FLOAT_MAT4x3 = 0x8B6A # VERSION_2_1 # ARB_future_use: 0x8B6B-0x8B7F (for attribute types) DELETE_STATUS = 0x8B80 # VERSION_2_0 (renamed) OBJECT_DELETE_STATUS_ARB = 0x8B80 # ARB_shader_objects COMPILE_STATUS = 0x8B81 # VERSION_2_0 (renamed) OBJECT_COMPILE_STATUS_ARB = 0x8B81 # ARB_shader_objects LINK_STATUS = 0x8B82 # VERSION_2_0 (renamed) OBJECT_LINK_STATUS_ARB = 0x8B82 # ARB_shader_objects VALIDATE_STATUS = 0x8B83 # VERSION_2_0 (renamed) OBJECT_VALIDATE_STATUS_ARB = 0x8B83 # ARB_shader_objects INFO_LOG_LENGTH = 0x8B84 # VERSION_2_0 (renamed) OBJECT_INFO_LOG_LENGTH_ARB = 0x8B84 # ARB_shader_objects ATTACHED_SHADERS = 0x8B85 # VERSION_2_0 (renamed) OBJECT_ATTACHED_OBJECTS_ARB = 0x8B85 # ARB_shader_objects ACTIVE_UNIFORMS = 0x8B86 # VERSION_2_0 (renamed) OBJECT_ACTIVE_UNIFORMS_ARB = 0x8B86 # ARB_shader_objects ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87 # VERSION_2_0 (renamed) OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = 0x8B87 # ARB_shader_objects SHADER_SOURCE_LENGTH = 0x8B88 # VERSION_2_0 (renamed) OBJECT_SHADER_SOURCE_LENGTH_ARB = 0x8B88 # ARB_shader_objects ACTIVE_ATTRIBUTES = 0x8B89 # VERSION_2_0 (renamed) OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89 # ARB_vertex_shader ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A # VERSION_2_0 (renamed) OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A # ARB_vertex_shader FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B # VERSION_2_0 FRAGMENT_SHADER_DERIVATIVE_HINT_ARB = 0x8B8B # ARB_fragment_shader SHADING_LANGUAGE_VERSION = 0x8B8C # VERSION_2_0 SHADING_LANGUAGE_VERSION_ARB = 0x8B8C # ARB_shading_language_100 # Aliases ARB_shader_objects enum above OES_texture3D enum: (OpenGL ES only; additional; see above) SAMPLER_3D_OES = 0x8B5F # ARB_shader_objects # Aliases ARB_fragment_shader enum above OES_standard_derivatives enum: (OpenGL ES only) FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B VERSION_3_0 enum: MAX_VARYING_COMPONENTS = 0x8B4B # VERSION_3_0 # alias GL_MAX_VARYING_FLOATS ARB_geometry_shader4 enum: (additional; see below; note: no ARB suffixes) use VERSION_3_0 MAX_VARYING_COMPONENTS EXT_geometry_shader4 enum: (additional; see below) MAX_VARYING_COMPONENTS_EXT = 0x8B4B VERSION_2_0 enum: CURRENT_PROGRAM = 0x8B8D # Aliases CURRENT_PROGRAM EXT_separate_shader_objects enum: ACTIVE_PROGRAM_EXT = 0x8B8D # ARB_future_use: 0x8B8E-0x8B8F ############################################################################### # Khronos OpenGL ES WG: 0x8B90-0x8B9F OES_compressed_paletted_texture enum: (OpenGL ES only) PALETTE4_RGB8_OES = 0x8B90 PALETTE4_RGBA8_OES = 0x8B91 PALETTE4_R5_G6_B5_OES = 0x8B92 PALETTE4_RGBA4_OES = 0x8B93 PALETTE4_RGB5_A1_OES = 0x8B94 PALETTE8_RGB8_OES = 0x8B95 PALETTE8_RGBA8_OES = 0x8B96 PALETTE8_R5_G6_B5_OES = 0x8B97 PALETTE8_RGBA4_OES = 0x8B98 PALETTE8_RGB5_A1_OES = 0x8B99 OES_read_format enum: (OpenGL ES, also implemented in Mesa) IMPLEMENTATION_COLOR_READ_TYPE_OES = 0x8B9A IMPLEMENTATION_COLOR_READ_FORMAT_OES = 0x8B9B OES_point_size_array enum: (OpenGL ES only; additional; see above) POINT_SIZE_ARRAY_OES = 0x8B9C OES_draw_texture enum: (OpenGL ES only) TEXTURE_CROP_RECT_OES = 0x8B9D OES_matrix_palette enum: (OpenGL ES only) MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 0x8B9E OES_point_size_array enum: (OpenGL ES only; additional; see above) POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 0x8B9F ############################################################################### # Seaweed: 0x8BA0-0x8BAF ############################################################################### # Mesa: 0x8BB0-0x8BBF # Probably one of the two 0x8BB4 enums should be 0x8BB5, but the # extension spec is not complete in any event. MESA_program_debug enum: FRAGMENT_PROGRAM_POSITION_MESA = 0x8BB0 FRAGMENT_PROGRAM_CALLBACK_MESA = 0x8BB1 FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA = 0x8BB2 FRAGMENT_PROGRAM_CALLBACK_DATA_MESA = 0x8BB3 VERTEX_PROGRAM_CALLBACK_MESA = 0x8BB4 VERTEX_PROGRAM_POSITION_MESA = 0x8BB4 VERTEX_PROGRAM_CALLBACK_FUNC_MESA = 0x8BB6 VERTEX_PROGRAM_CALLBACK_DATA_MESA = 0x8BB7 ############################################################################### # ATI: 0x8BC0-0x8BFF AMD_performance_monitor enum: COUNTER_TYPE_AMD = 0x8BC0 COUNTER_RANGE_AMD = 0x8BC1 UNSIGNED_INT64_AMD = 0x8BC2 PERCENTAGE_AMD = 0x8BC3 PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4 PERFMON_RESULT_SIZE_AMD = 0x8BC5 PERFMON_RESULT_AMD = 0x8BC6 # ATI_future_use: 0x8BC7-0x8BD1 QCOM_extended_get enum: (OpenGL ES only) TEXTURE_WIDTH_QCOM = 0x8BD2 TEXTURE_HEIGHT_QCOM = 0x8BD3 TEXTURE_DEPTH_QCOM = 0x8BD4 TEXTURE_INTERNAL_FORMAT_QCOM = 0x8BD5 TEXTURE_FORMAT_QCOM = 0x8BD6 TEXTURE_TYPE_QCOM = 0x8BD7 TEXTURE_IMAGE_VALID_QCOM = 0x8BD8 TEXTURE_NUM_LEVELS_QCOM = 0x8BD9 TEXTURE_TARGET_QCOM = 0x8BDA TEXTURE_OBJECT_VALID_QCOM = 0x8BDB STATE_RESTORE = 0x8BDC # ATI_future_use: 0x8BDD-0x8BFF ############################################################################### # Imagination Tech.: 0x8C00-0x8C0F IMG_texture_compression_pvrtc enum: (OpenGL ES only) COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00 COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01 COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02 COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03 IMG_texture_env_enhanced_fixed_function enum: (OpenGL ES only) MODULATE_COLOR_IMG = 0x8C04 RECIP_ADD_SIGNED_ALPHA_IMG = 0x8C05 TEXTURE_ALPHA_MODULATE_IMG = 0x8C06 FACTOR_ALPHA_MODULATE_IMG = 0x8C07 FRAGMENT_ALPHA_MODULATE_IMG = 0x8C08 ADD_BLEND_IMG = 0x8C09 IMG_shader_binary: (OpenGL ES only) SGX_BINARY_IMG = 0x8C0A # IMG_future_use: 0x8C0B-0x8C0F ############################################################################### # NVIDIA: 0x8C10-0x8C8F (Pat Brown) VERSION_3_0 enum: use ARB_framebuffer_object TEXTURE_RED_TYPE use ARB_framebuffer_object TEXTURE_GREEN_TYPE use ARB_framebuffer_object TEXTURE_BLUE_TYPE use ARB_framebuffer_object TEXTURE_ALPHA_TYPE use ARB_framebuffer_object TEXTURE_LUMINANCE_TYPE use ARB_framebuffer_object TEXTURE_INTENSITY_TYPE use ARB_framebuffer_object TEXTURE_DEPTH_TYPE use ARB_framebuffer_object UNSIGNED_NORMALIZED ARB_framebuffer_object enum: (note: no ARB suffixes) TEXTURE_RED_TYPE = 0x8C10 # VERSION_3_0 / ARB_fbo TEXTURE_GREEN_TYPE = 0x8C11 # VERSION_3_0 / ARB_fbo TEXTURE_BLUE_TYPE = 0x8C12 # VERSION_3_0 / ARB_fbo TEXTURE_ALPHA_TYPE = 0x8C13 # VERSION_3_0 / ARB_fbo TEXTURE_LUMINANCE_TYPE = 0x8C14 # VERSION_3_0 / ARB_fbo TEXTURE_INTENSITY_TYPE = 0x8C15 # VERSION_3_0 / ARB_fbo TEXTURE_DEPTH_TYPE = 0x8C16 # VERSION_3_0 / ARB_fbo UNSIGNED_NORMALIZED = 0x8C17 # VERSION_3_0 / ARB_fbo ARB_texture_float enum: (additional; see above) TEXTURE_RED_TYPE_ARB = 0x8C10 TEXTURE_GREEN_TYPE_ARB = 0x8C11 TEXTURE_BLUE_TYPE_ARB = 0x8C12 TEXTURE_ALPHA_TYPE_ARB = 0x8C13 TEXTURE_LUMINANCE_TYPE_ARB = 0x8C14 TEXTURE_INTENSITY_TYPE_ARB = 0x8C15 TEXTURE_DEPTH_TYPE_ARB = 0x8C16 UNSIGNED_NORMALIZED_ARB = 0x8C17 VERSION_3_0 enum: TEXTURE_1D_ARRAY = 0x8C18 # VERSION_3_0 PROXY_TEXTURE_1D_ARRAY = 0x8C19 # VERSION_3_0 TEXTURE_2D_ARRAY = 0x8C1A # VERSION_3_0 PROXY_TEXTURE_2D_ARRAY = 0x8C1B # VERSION_3_0 TEXTURE_BINDING_1D_ARRAY = 0x8C1C # VERSION_3_0 TEXTURE_BINDING_2D_ARRAY = 0x8C1D # VERSION_3_0 EXT_texture_array enum: TEXTURE_1D_ARRAY_EXT = 0x8C18 PROXY_TEXTURE_1D_ARRAY_EXT = 0x8C19 TEXTURE_2D_ARRAY_EXT = 0x8C1A PROXY_TEXTURE_2D_ARRAY_EXT = 0x8C1B TEXTURE_BINDING_1D_ARRAY_EXT = 0x8C1C TEXTURE_BINDING_2D_ARRAY_EXT = 0x8C1D # NV_future_use: 0x8C1E-0x8C25 VERSION_3_2 enum: MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29 ARB_geometry_shader4 enum: (additional; see below) MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB = 0x8C29 NV_geometry_program4 enum: GEOMETRY_PROGRAM_NV = 0x8C26 MAX_PROGRAM_OUTPUT_VERTICES_NV = 0x8C27 MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV = 0x8C28 MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = 0x8C29 VERSION_3_1 enum: TEXTURE_BUFFER = 0x8C2A MAX_TEXTURE_BUFFER_SIZE = 0x8C2B TEXTURE_BINDING_BUFFER = 0x8C2C TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D TEXTURE_BUFFER_FORMAT = 0x8C2E ARB_texture_buffer_object enum: TEXTURE_BUFFER_ARB = 0x8C2A MAX_TEXTURE_BUFFER_SIZE_ARB = 0x8C2B TEXTURE_BINDING_BUFFER_ARB = 0x8C2C TEXTURE_BUFFER_DATA_STORE_BINDING_ARB = 0x8C2D TEXTURE_BUFFER_FORMAT_ARB = 0x8C2E EXT_texture_buffer_object enum: TEXTURE_BUFFER_EXT = 0x8C2A MAX_TEXTURE_BUFFER_SIZE_EXT = 0x8C2B TEXTURE_BINDING_BUFFER_EXT = 0x8C2C TEXTURE_BUFFER_DATA_STORE_BINDING_EXT = 0x8C2D TEXTURE_BUFFER_FORMAT_EXT = 0x8C2E # NV_future_use: 0x8C2F-0x8C35 ARB_sample_shading enum: SAMPLE_SHADING_ARB = 0x8C36 MIN_SAMPLE_SHADING_VALUE_ARB = 0x8C37 # NV_future_use: 0x8C38-0x8C39 VERSION_3_0 enum: R11F_G11F_B10F = 0x8C3A # VERSION_3_0 UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B # VERSION_3_0 EXT_packed_float enum: R11F_G11F_B10F_EXT = 0x8C3A UNSIGNED_INT_10F_11F_11F_REV_EXT = 0x8C3B RGBA_SIGNED_COMPONENTS_EXT = 0x8C3C VERSION_3_0 enum: RGB9_E5 = 0x8C3D # VERSION_3_0 UNSIGNED_INT_5_9_9_9_REV = 0x8C3E # VERSION_3_0 TEXTURE_SHARED_SIZE = 0x8C3F # VERSION_3_0 EXT_texture_shared_exponent enum: RGB9_E5_EXT = 0x8C3D UNSIGNED_INT_5_9_9_9_REV_EXT = 0x8C3E TEXTURE_SHARED_SIZE_EXT = 0x8C3F VERSION_2_1 enum: (Generic formats promoted for OpenGL 2.1) SRGB = 0x8C40 # VERSION_2_1 SRGB8 = 0x8C41 # VERSION_2_1 SRGB_ALPHA = 0x8C42 # VERSION_2_1 SRGB8_ALPHA8 = 0x8C43 # VERSION_2_1 SLUMINANCE_ALPHA = 0x8C44 # VERSION_2_1 SLUMINANCE8_ALPHA8 = 0x8C45 # VERSION_2_1 SLUMINANCE = 0x8C46 # VERSION_2_1 SLUMINANCE8 = 0x8C47 # VERSION_2_1 COMPRESSED_SRGB = 0x8C48 # VERSION_2_1 COMPRESSED_SRGB_ALPHA = 0x8C49 # VERSION_2_1 COMPRESSED_SLUMINANCE = 0x8C4A # VERSION_2_1 COMPRESSED_SLUMINANCE_ALPHA = 0x8C4B # VERSION_2_1 EXT_texture_sRGB enum: SRGB_EXT = 0x8C40 # EXT_texture_sRGB SRGB8_EXT = 0x8C41 # EXT_texture_sRGB SRGB_ALPHA_EXT = 0x8C42 # EXT_texture_sRGB SRGB8_ALPHA8_EXT = 0x8C43 # EXT_texture_sRGB SLUMINANCE_ALPHA_EXT = 0x8C44 # EXT_texture_sRGB SLUMINANCE8_ALPHA8_EXT = 0x8C45 # EXT_texture_sRGB SLUMINANCE_EXT = 0x8C46 # EXT_texture_sRGB SLUMINANCE8_EXT = 0x8C47 # EXT_texture_sRGB COMPRESSED_SRGB_EXT = 0x8C48 # EXT_texture_sRGB COMPRESSED_SRGB_ALPHA_EXT = 0x8C49 # EXT_texture_sRGB COMPRESSED_SLUMINANCE_EXT = 0x8C4A # EXT_texture_sRGB COMPRESSED_SLUMINANCE_ALPHA_EXT = 0x8C4B # EXT_texture_sRGB COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F # NV_future_use: 0x8C50-0x8C6F EXT_texture_compression_latc enum: COMPRESSED_LUMINANCE_LATC1_EXT = 0x8C70 COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 0x8C71 COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C72 COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C73 # NV_future_use: 0x8C74-0x8C75 #@@ separate extensions VERSION_3_0 enum: EXT_transform_feedback enum: NV_transform_feedback enum: TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76 # VERSION_3_0 TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT = 0x8C76 BACK_PRIMARY_COLOR_NV = 0x8C77 BACK_SECONDARY_COLOR_NV = 0x8C78 TEXTURE_COORD_NV = 0x8C79 CLIP_DISTANCE_NV = 0x8C7A VERTEX_ID_NV = 0x8C7B PRIMITIVE_ID_NV = 0x8C7C GENERIC_ATTRIB_NV = 0x8C7D TRANSFORM_FEEDBACK_ATTRIBS_NV = 0x8C7E TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F # VERSION_3_0 TRANSFORM_FEEDBACK_BUFFER_MODE_EXT = 0x8C7F TRANSFORM_FEEDBACK_BUFFER_MODE_NV = 0x8C7F MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80 # VERSION_3_0 MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT = 0x8C80 MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV = 0x8C80 ACTIVE_VARYINGS_NV = 0x8C81 ACTIVE_VARYING_MAX_LENGTH_NV = 0x8C82 TRANSFORM_FEEDBACK_VARYINGS = 0x8C83 # VERSION_3_0 TRANSFORM_FEEDBACK_VARYINGS_EXT = 0x8C83 TRANSFORM_FEEDBACK_VARYINGS_NV = 0x8C83 TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84 # VERSION_3_0 TRANSFORM_FEEDBACK_BUFFER_START_EXT = 0x8C84 TRANSFORM_FEEDBACK_BUFFER_START_NV = 0x8C84 TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85 # VERSION_3_0 TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT = 0x8C85 TRANSFORM_FEEDBACK_BUFFER_SIZE_NV = 0x8C85 TRANSFORM_FEEDBACK_RECORD_NV = 0x8C86 PRIMITIVES_GENERATED = 0x8C87 # VERSION_3_0 PRIMITIVES_GENERATED_EXT = 0x8C87 PRIMITIVES_GENERATED_NV = 0x8C87 TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88 # VERSION_3_0 TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT = 0x8C88 TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV = 0x8C88 RASTERIZER_DISCARD = 0x8C89 # VERSION_3_0 RASTERIZER_DISCARD_EXT = 0x8C89 RASTERIZER_DISCARD_NV = 0x8C89 MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A # VERSION_3_0 MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT = 0x8C8A MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV = 0x8C8A MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B # VERSION_3_0 MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT = 0x8C8B MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV = 0x8C8B INTERLEAVED_ATTRIBS = 0x8C8C # VERSION_3_0 INTERLEAVED_ATTRIBS_EXT = 0x8C8C INTERLEAVED_ATTRIBS_NV = 0x8C8C SEPARATE_ATTRIBS = 0x8C8D # VERSION_3_0 SEPARATE_ATTRIBS_EXT = 0x8C8D SEPARATE_ATTRIBS_NV = 0x8C8D TRANSFORM_FEEDBACK_BUFFER = 0x8C8E # VERSION_3_0 TRANSFORM_FEEDBACK_BUFFER_EXT = 0x8C8E TRANSFORM_FEEDBACK_BUFFER_NV = 0x8C8E TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F # VERSION_3_0 TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT = 0x8C8F TRANSFORM_FEEDBACK_BUFFER_BINDING_NV = 0x8C8F ############################################################################### # ATI: 0x8C90-0x8C9F (Affie Munshi, OpenGL ES extensions) # Reassigned to Qualcomm at time of mobile/desktop split (bug 5874) # Qualcomm__future_use: 0x8C90-0x8C91 AMD_compressed_ATC_texture enum: (OpenGL ES only) ATC_RGB_AMD = 0x8C92 ATC_RGBA_EXPLICIT_ALPHA_AMD = 0x8C93 # Reassigned to Qualcomm at time of mobile/desktop split (bug 5874) # Qualcomm_future_use: 0x8C94-0x8C9F ############################################################################### # OpenGL ARB: 0x8CA0-0x8CAF VERSION_2_0 enum: POINT_SPRITE_COORD_ORIGIN = 0x8CA0 LOWER_LEFT = 0x8CA1 UPPER_LEFT = 0x8CA2 STENCIL_BACK_REF = 0x8CA3 STENCIL_BACK_VALUE_MASK = 0x8CA4 STENCIL_BACK_WRITEMASK = 0x8CA5 VERSION_3_0 enum: use ARB_framebuffer_object FRAMEBUFFER_BINDING use ARB_framebuffer_object DRAW_FRAMEBUFFER_BINDING use ARB_framebuffer_object RENDERBUFFER_BINDING ARB_framebuffer_object enum: (note: no ARB suffixes) FRAMEBUFFER_BINDING = 0x8CA6 # VERSION_3_0 / ARB_fbo DRAW_FRAMEBUFFER_BINDING = 0x8CA6 # VERSION_3_0 / ARB_fbo # alias GL_FRAMEBUFFER_BINDING RENDERBUFFER_BINDING = 0x8CA7 # VERSION_3_0 / ARB_fbo EXT_framebuffer_object enum: (additional; see below) FRAMEBUFFER_BINDING_EXT = 0x8CA6 RENDERBUFFER_BINDING_EXT = 0x8CA7 EXT_framebuffer_blit enum: (additional; see below) DRAW_FRAMEBUFFER_BINDING_EXT = 0x8CA6 # EXT_framebuffer_blit # alias GL_FRAMEBUFFER_BINDING_EXT # Aliases EXT_framebuffer_object enums above OES_framebuffer_object enum: (OpenGL ES only; additional; see below) FRAMEBUFFER_BINDING_OES = 0x8CA6 RENDERBUFFER_BINDING_OES = 0x8CA7 VERSION_3_0 enum: use ARB_framebuffer_object READ_FRAMEBUFFER use ARB_framebuffer_object DRAW_FRAMEBUFFER use ARB_framebuffer_object READ_FRAMEBUFFER_BINDING ARB_framebuffer_object enum: (note: no ARB suffixes) READ_FRAMEBUFFER = 0x8CA8 # VERSION_3_0 / ARB_fbo DRAW_FRAMEBUFFER = 0x8CA9 # VERSION_3_0 / ARB_fbo READ_FRAMEBUFFER_BINDING = 0x8CAA # VERSION_3_0 / ARB_fbo EXT_framebuffer_blit enum: READ_FRAMEBUFFER_EXT = 0x8CA8 DRAW_FRAMEBUFFER_EXT = 0x8CA9 DRAW_FRAMEBUFFER_BINDING_EXT = 0x8CA6 # alias GL_FRAMEBUFFER_BINDING_EXT READ_FRAMEBUFFER_BINDING_EXT = 0x8CAA VERSION_3_0 enum: use ARB_framebuffer_object RENDERBUFFER_SAMPLES ARB_framebuffer_object enum: (note: no ARB suffixes) RENDERBUFFER_SAMPLES = 0x8CAB # VERSION_3_0 / ARB_fbo EXT_framebuffer_multisample enum: RENDERBUFFER_SAMPLES_EXT = 0x8CAB NV_framebuffer_multisample_coverage enum: (additional; see below) RENDERBUFFER_COVERAGE_SAMPLES_NV = 0x8CAB # All enums except external format are incompatible with NV_depth_buffer_float VERSION_3_0 enum: ARB_depth_buffer_float enum: (note: no ARB suffixes) DEPTH_COMPONENT32F = 0x8CAC DEPTH32F_STENCIL8 = 0x8CAD # ARB_future_use: 0x8CAF ############################################################################### # 3Dlabs: 0x8CB0-0x8CCF (Barthold Lichtenbelt, 2004/12/1) ############################################################################### # OpenGL ARB: 0x8CD0-0x8D5F (Framebuffer object specification + headroom) #@@ separate extensions VERSION_3_0 enum: ARB_geometry_shader4 enum: (additional; see below; note: no ARB suffixes) ARB_framebuffer_object enum: (note: no ARB suffixes) EXT_framebuffer_object enum: (additional; see above) FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = 0x8CD0 FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = 0x8CD1 FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = 0x8CD2 FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = 0x8CD3 FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = 0x8CD4 FRAMEBUFFER_COMPLETE = 0x8CD5 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_COMPLETE_EXT = 0x8CD5 FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = 0x8CD6 FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = 0x8CD7 ## Removed 2005/09/26 in revision #117 of the extension: ## FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT = 0x8CD8 FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = 0x8CD9 FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = 0x8CDA FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB # VERSION_3_0 / ARB_fbo FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = 0x8CDB FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC # VERSION_3_0 / ARB_fbo FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = 0x8CDC FRAMEBUFFER_UNSUPPORTED = 0x8CDD # VERSION_3_0 / ARB_fbo FRAMEBUFFER_UNSUPPORTED_EXT = 0x8CDD ## Removed 2005/05/31 in revision #113 of the extension: ## FRAMEBUFFER_STATUS_ERROR_EXT = 0x8CDE MAX_COLOR_ATTACHMENTS = 0x8CDF # VERSION_3_0 / ARB_fbo MAX_COLOR_ATTACHMENTS_EXT = 0x8CDF COLOR_ATTACHMENT0 = 0x8CE0 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT0_EXT = 0x8CE0 COLOR_ATTACHMENT1 = 0x8CE1 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT1_EXT = 0x8CE1 COLOR_ATTACHMENT2 = 0x8CE2 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT2_EXT = 0x8CE2 COLOR_ATTACHMENT3 = 0x8CE3 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT3_EXT = 0x8CE3 COLOR_ATTACHMENT4 = 0x8CE4 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT4_EXT = 0x8CE4 COLOR_ATTACHMENT5 = 0x8CE5 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT5_EXT = 0x8CE5 COLOR_ATTACHMENT6 = 0x8CE6 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT6_EXT = 0x8CE6 COLOR_ATTACHMENT7 = 0x8CE7 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT7_EXT = 0x8CE7 COLOR_ATTACHMENT8 = 0x8CE8 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT8_EXT = 0x8CE8 COLOR_ATTACHMENT9 = 0x8CE9 # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT9_EXT = 0x8CE9 COLOR_ATTACHMENT10 = 0x8CEA # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT10_EXT = 0x8CEA COLOR_ATTACHMENT11 = 0x8CEB # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT11_EXT = 0x8CEB COLOR_ATTACHMENT12 = 0x8CEC # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT12_EXT = 0x8CEC COLOR_ATTACHMENT13 = 0x8CED # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT13_EXT = 0x8CED COLOR_ATTACHMENT14 = 0x8CEE # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT14_EXT = 0x8CEE COLOR_ATTACHMENT15 = 0x8CEF # VERSION_3_0 / ARB_fbo COLOR_ATTACHMENT15_EXT = 0x8CEF # 0x8CF0-0x8CFF reserved for color attachments 16-31, if needed DEPTH_ATTACHMENT = 0x8D00 # VERSION_3_0 / ARB_fbo DEPTH_ATTACHMENT_EXT = 0x8D00 # 0x8D01-0x8D1F reserved for depth attachments 1-31, if needed STENCIL_ATTACHMENT = 0x8D20 # VERSION_3_0 / ARB_fbo STENCIL_ATTACHMENT_EXT = 0x8D20 # 0x8D21-0x8D3F reserved for stencil attachments 1-31, if needed FRAMEBUFFER = 0x8D40 # VERSION_3_0 / ARB_fbo FRAMEBUFFER_EXT = 0x8D40 RENDERBUFFER = 0x8D41 # VERSION_3_0 / ARB_fbo RENDERBUFFER_EXT = 0x8D41 RENDERBUFFER_WIDTH = 0x8D42 # VERSION_3_0 / ARB_fbo RENDERBUFFER_WIDTH_EXT = 0x8D42 RENDERBUFFER_HEIGHT = 0x8D43 # VERSION_3_0 / ARB_fbo RENDERBUFFER_HEIGHT_EXT = 0x8D43 RENDERBUFFER_INTERNAL_FORMAT = 0x8D44 # VERSION_3_0 / ARB_fbo RENDERBUFFER_INTERNAL_FORMAT_EXT = 0x8D44 # 0x8D45 unused (reserved for STENCIL_INDEX_EXT, but now use core STENCIL_INDEX instead) STENCIL_INDEX1 = 0x8D46 # VERSION_3_0 / ARB_fbo STENCIL_INDEX1_EXT = 0x8D46 STENCIL_INDEX4 = 0x8D47 # VERSION_3_0 / ARB_fbo STENCIL_INDEX4_EXT = 0x8D47 STENCIL_INDEX8 = 0x8D48 # VERSION_3_0 / ARB_fbo STENCIL_INDEX8_EXT = 0x8D48 STENCIL_INDEX16 = 0x8D49 # VERSION_3_0 / ARB_fbo STENCIL_INDEX16_EXT = 0x8D49 # 0x8D4A-0x8D4D reserved for additional stencil formats # Added 2005/05/31 in revision #113 of the extension: RENDERBUFFER_RED_SIZE = 0x8D50 # VERSION_3_0 / ARB_fbo RENDERBUFFER_RED_SIZE_EXT = 0x8D50 RENDERBUFFER_GREEN_SIZE = 0x8D51 # VERSION_3_0 / ARB_fbo RENDERBUFFER_GREEN_SIZE_EXT = 0x8D51 RENDERBUFFER_BLUE_SIZE = 0x8D52 # VERSION_3_0 / ARB_fbo RENDERBUFFER_BLUE_SIZE_EXT = 0x8D52 RENDERBUFFER_ALPHA_SIZE = 0x8D53 # VERSION_3_0 / ARB_fbo RENDERBUFFER_ALPHA_SIZE_EXT = 0x8D53 RENDERBUFFER_DEPTH_SIZE = 0x8D54 # VERSION_3_0 / ARB_fbo RENDERBUFFER_DEPTH_SIZE_EXT = 0x8D54 RENDERBUFFER_STENCIL_SIZE = 0x8D55 # VERSION_3_0 / ARB_fbo RENDERBUFFER_STENCIL_SIZE_EXT = 0x8D55 # Aliases EXT_framebuffer_object enum above # @@@??? does this appear in OES_texture3D, or OES_framebuffer_object? # extension spec & gl2ext.h disagree! OES_texture3D enum: (OpenGL ES only; additional; see above) FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = 0x8CD4 # Aliases EXT_framebuffer_object enums above OES_framebuffer_object enum: (OpenGL ES only; additional; see below) FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 0x8CD0 FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 0x8CD1 FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 0x8CD2 FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 0x8CD3 FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = 0x8CD4 FRAMEBUFFER_COMPLETE_OES = 0x8CD5 FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 0x8CD6 FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 0x8CD7 FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 0x8CD9 FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 0x8CDA FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES = 0x8CDB FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES = 0x8CDC FRAMEBUFFER_UNSUPPORTED_OES = 0x8CDD COLOR_ATTACHMENT0_OES = 0x8CE0 DEPTH_ATTACHMENT_OES = 0x8D00 STENCIL_ATTACHMENT_OES = 0x8D20 FRAMEBUFFER_OES = 0x8D40 RENDERBUFFER_OES = 0x8D41 RENDERBUFFER_WIDTH_OES = 0x8D42 RENDERBUFFER_HEIGHT_OES = 0x8D43 RENDERBUFFER_INTERNAL_FORMAT_OES = 0x8D44 STENCIL_INDEX1_OES = 0x8D46 STENCIL_INDEX4_OES = 0x8D47 STENCIL_INDEX8_OES = 0x8D48 RENDERBUFFER_RED_SIZE_OES = 0x8D50 RENDERBUFFER_GREEN_SIZE_OES = 0x8D51 RENDERBUFFER_BLUE_SIZE_OES = 0x8D52 RENDERBUFFER_ALPHA_SIZE_OES = 0x8D53 RENDERBUFFER_DEPTH_SIZE_OES = 0x8D54 RENDERBUFFER_STENCIL_SIZE_OES = 0x8D55 OES_stencil1 enum: (OpenGL ES only; additional; see below) use OES_framebuffer_object STENCIL_INDEX1_OES OES_stencil4 enum: (OpenGL ES only; additional; see below) use OES_framebuffer_object STENCIL_INDEX4_OES OES_stencil8 enum: (OpenGL ES only; additional; see below) use OES_framebuffer_object STENCIL_INDEX8_OES VERSION_3_0 enum: ARB_framebuffer_object enum: (note: no ARB suffixes) # Added 2006/10/10 in revision #6b of the extension. FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56 # VERSION_3_0 / ARB_fbo MAX_SAMPLES = 0x8D57 # VERSION_3_0 / ARB_fbo EXT_framebuffer_multisample enum: (additional; see above) FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 0x8D56 MAX_SAMPLES_EXT = 0x8D57 # 0x8D58-0x8D5F reserved for additional FBO enums NV_geometry_program4 enum: (additional; see above) FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = 0x8CD4 ############################################################################### # Khronos OpenGL ES WG: 0x8D60-0x8D6F OES_texture_cube_map enum: (OpenGL ES only) TEXTURE_GEN_STR_OES = 0x8D60 OES_texture_float enum: (OpenGL ES only) HALF_FLOAT_OES = 0x8D61 OES_vertex_half_float enum: (OpenGL ES only) use OES_texture_float HALF_FLOAT_OES OES_framebuffer_object enum: (OpenGL ES only) RGB565_OES = 0x8D62 # Khronos_future_use: 0x8D63 OES_compressed_ETC1_RGB8_texture enum: (OpenGL ES only) ETC1_RGB8_OES = 0x8D64 OES_EGL_image_external enum: (OpenGL ES only) (Khronos bug 4621) TEXTURE_EXTERNAL_OES = 0x8D65 SAMPLER_EXTERNAL_OES = 0x8D66 TEXTURE_BINDING_EXTERNAL_OES = 0x8D67 REQUIRED_TEXTURE_IMAGE_UNITS_OES = 0x8D68 # Khronos_future_use: 0x8D69-0x8D6F ############################################################################### # NVIDIA: 0x8D70-0x8DEF # Reserved per email from Pat Brown 2005/10/13 #@@ separate extensions VERSION_3_0 enum: EXT_texture_integer enum: RGBA32UI = 0x8D70 # VERSION_3_0 RGBA32UI_EXT = 0x8D70 RGB32UI = 0x8D71 # VERSION_3_0 RGB32UI_EXT = 0x8D71 ALPHA32UI_EXT = 0x8D72 INTENSITY32UI_EXT = 0x8D73 LUMINANCE32UI_EXT = 0x8D74 LUMINANCE_ALPHA32UI_EXT = 0x8D75 RGBA16UI = 0x8D76 # VERSION_3_0 RGBA16UI_EXT = 0x8D76 RGB16UI = 0x8D77 # VERSION_3_0 RGB16UI_EXT = 0x8D77 ALPHA16UI_EXT = 0x8D78 INTENSITY16UI_EXT = 0x8D79 LUMINANCE16UI_EXT = 0x8D7A LUMINANCE_ALPHA16UI_EXT = 0x8D7B RGBA8UI = 0x8D7C # VERSION_3_0 RGBA8UI_EXT = 0x8D7C RGB8UI = 0x8D7D # VERSION_3_0 RGB8UI_EXT = 0x8D7D ALPHA8UI_EXT = 0x8D7E INTENSITY8UI_EXT = 0x8D7F LUMINANCE8UI_EXT = 0x8D80 LUMINANCE_ALPHA8UI_EXT = 0x8D81 RGBA32I = 0x8D82 # VERSION_3_0 RGBA32I_EXT = 0x8D82 RGB32I = 0x8D83 # VERSION_3_0 RGB32I_EXT = 0x8D83 ALPHA32I_EXT = 0x8D84 INTENSITY32I_EXT = 0x8D85 LUMINANCE32I_EXT = 0x8D86 LUMINANCE_ALPHA32I_EXT = 0x8D87 RGBA16I = 0x8D88 # VERSION_3_0 RGBA16I_EXT = 0x8D88 RGB16I = 0x8D89 # VERSION_3_0 RGB16I_EXT = 0x8D89 ALPHA16I_EXT = 0x8D8A INTENSITY16I_EXT = 0x8D8B LUMINANCE16I_EXT = 0x8D8C LUMINANCE_ALPHA16I_EXT = 0x8D8D RGBA8I = 0x8D8E # VERSION_3_0 RGBA8I_EXT = 0x8D8E RGB8I = 0x8D8F # VERSION_3_0 RGB8I_EXT = 0x8D8F ALPHA8I_EXT = 0x8D90 INTENSITY8I_EXT = 0x8D91 LUMINANCE8I_EXT = 0x8D92 LUMINANCE_ALPHA8I_EXT = 0x8D93 RED_INTEGER = 0x8D94 # VERSION_3_0 RED_INTEGER_EXT = 0x8D94 GREEN_INTEGER = 0x8D95 # VERSION_3_0 GREEN_INTEGER_EXT = 0x8D95 BLUE_INTEGER = 0x8D96 # VERSION_3_0 BLUE_INTEGER_EXT = 0x8D96 ALPHA_INTEGER = 0x8D97 # VERSION_3_0 ALPHA_INTEGER_EXT = 0x8D97 RGB_INTEGER = 0x8D98 # VERSION_3_0 RGB_INTEGER_EXT = 0x8D98 RGBA_INTEGER = 0x8D99 # VERSION_3_0 RGBA_INTEGER_EXT = 0x8D99 BGR_INTEGER = 0x8D9A # VERSION_3_0 BGR_INTEGER_EXT = 0x8D9A BGRA_INTEGER = 0x8D9B # VERSION_3_0 BGRA_INTEGER_EXT = 0x8D9B LUMINANCE_INTEGER_EXT = 0x8D9C LUMINANCE_ALPHA_INTEGER_EXT = 0x8D9D RGBA_INTEGER_MODE_EXT = 0x8D9E # NV_future_use: 0x8D9F NV_parameter_buffer_object enum: MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV = 0x8DA0 MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV = 0x8DA1 VERTEX_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA2 GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA3 FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA4 NV_gpu_program4 enum: (additional; see above) MAX_PROGRAM_GENERIC_ATTRIBS_NV = 0x8DA5 MAX_PROGRAM_GENERIC_RESULTS_NV = 0x8DA6 VERSION_3_2 enum: FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7 FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0x8DA8 ARB_geometry_shader4 enum: (additional; see below) FRAMEBUFFER_ATTACHMENT_LAYERED_ARB = 0x8DA7 FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB = 0x8DA8 FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB = 0x8DA9 NV_geometry_program4 enum: (additional; see above) FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = 0x8DA7 FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = 0x8DA8 FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT = 0x8DA9 # NV_future_use: 0x8DAA VERSION_3_0 enum: ARB_depth_buffer_float enum: (additional; see above; some values different from NV; note: no ARB suffixes) FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD NV_depth_buffer_float enum: DEPTH_COMPONENT32F_NV = 0x8DAB DEPTH32F_STENCIL8_NV = 0x8DAC FLOAT_32_UNSIGNED_INT_24_8_REV_NV = 0x8DAD DEPTH_BUFFER_FLOAT_MODE_NV = 0x8DAF # NV_future_use: 0x8DAE # NV_future_use: 0x8DB0-0x8DB8 VERSION_3_0 enum: ARB_framebuffer_sRGB enum: (note: no ARB suffixes) FRAMEBUFFER_SRGB = 0x8DB9 # VERSION_3_0 / ARB_sRGB EXT_framebuffer_sRGB enum: FRAMEBUFFER_SRGB_EXT = 0x8DB9 FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x8DBA VERSION_3_0 enum: ARB_texture_compression_rgtc enum: (note: no ARB suffixes) COMPRESSED_RED_RGTC1 = 0x8DBB # VERSION_3_0 / ARB_tcrgtc COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC # VERSION_3_0 / ARB_tcrgtc COMPRESSED_RG_RGTC2 = 0x8DBD # VERSION_3_0 / ARB_tcrgtc COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE # VERSION_3_0 / ARB_tcrgtc EXT_texture_compression_rgtc enum: COMPRESSED_RED_RGTC1_EXT = 0x8DBB COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE # NV_future_use: 0x8DBF VERSION_3_0 enum: SAMPLER_1D_ARRAY = 0x8DC0 # VERSION_3_0 SAMPLER_2D_ARRAY = 0x8DC1 # VERSION_3_0 SAMPLER_1D_ARRAY_SHADOW = 0x8DC3 # VERSION_3_0 SAMPLER_2D_ARRAY_SHADOW = 0x8DC4 # VERSION_3_0 SAMPLER_CUBE_SHADOW = 0x8DC5 # VERSION_3_0 UNSIGNED_INT_VEC2 = 0x8DC6 # VERSION_3_0 UNSIGNED_INT_VEC3 = 0x8DC7 # VERSION_3_0 UNSIGNED_INT_VEC4 = 0x8DC8 # VERSION_3_0 INT_SAMPLER_1D = 0x8DC9 # VERSION_3_0 INT_SAMPLER_2D = 0x8DCA # VERSION_3_0 INT_SAMPLER_3D = 0x8DCB # VERSION_3_0 INT_SAMPLER_CUBE = 0x8DCC # VERSION_3_0 INT_SAMPLER_1D_ARRAY = 0x8DCE # VERSION_3_0 INT_SAMPLER_2D_ARRAY = 0x8DCF # VERSION_3_0 UNSIGNED_INT_SAMPLER_1D = 0x8DD1 # VERSION_3_0 UNSIGNED_INT_SAMPLER_2D = 0x8DD2 # VERSION_3_0 UNSIGNED_INT_SAMPLER_3D = 0x8DD3 # VERSION_3_0 UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4 # VERSION_3_0 UNSIGNED_INT_SAMPLER_1D_ARRAY = 0x8DD6 # VERSION_3_0 UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7 # VERSION_3_0 VERSION_3_1 enum: (Promoted from EXT_gpu_shader4 + ARB_texture_rectangle / ARB_uniform_buffer_object) SAMPLER_BUFFER = 0x8DC2 # EXT_gpu_shader4 + ARB_texture_buffer_object INT_SAMPLER_2D_RECT = 0x8DCD # EXT_gpu_shader4 + ARB_texture_rectangle INT_SAMPLER_BUFFER = 0x8DD0 # EXT_gpu_shader4 + ARB_texture_buffer_object UNSIGNED_INT_SAMPLER_2D_RECT = 0x8DD5 # EXT_gpu_shader4 + ARB_texture_rectangle UNSIGNED_INT_SAMPLER_BUFFER = 0x8DD8 # EXT_gpu_shader4 + ARB_texture_buffer_object EXT_gpu_shader4 enum: SAMPLER_1D_ARRAY_EXT = 0x8DC0 SAMPLER_2D_ARRAY_EXT = 0x8DC1 SAMPLER_BUFFER_EXT = 0x8DC2 SAMPLER_1D_ARRAY_SHADOW_EXT = 0x8DC3 SAMPLER_2D_ARRAY_SHADOW_EXT = 0x8DC4 SAMPLER_CUBE_SHADOW_EXT = 0x8DC5 UNSIGNED_INT_VEC2_EXT = 0x8DC6 UNSIGNED_INT_VEC3_EXT = 0x8DC7 UNSIGNED_INT_VEC4_EXT = 0x8DC8 INT_SAMPLER_1D_EXT = 0x8DC9 INT_SAMPLER_2D_EXT = 0x8DCA INT_SAMPLER_3D_EXT = 0x8DCB INT_SAMPLER_CUBE_EXT = 0x8DCC INT_SAMPLER_2D_RECT_EXT = 0x8DCD INT_SAMPLER_1D_ARRAY_EXT = 0x8DCE INT_SAMPLER_2D_ARRAY_EXT = 0x8DCF INT_SAMPLER_BUFFER_EXT = 0x8DD0 UNSIGNED_INT_SAMPLER_1D_EXT = 0x8DD1 UNSIGNED_INT_SAMPLER_2D_EXT = 0x8DD2 UNSIGNED_INT_SAMPLER_3D_EXT = 0x8DD3 UNSIGNED_INT_SAMPLER_CUBE_EXT = 0x8DD4 UNSIGNED_INT_SAMPLER_2D_RECT_EXT = 0x8DD5 UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT = 0x8DD6 UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT = 0x8DD7 UNSIGNED_INT_SAMPLER_BUFFER_EXT = 0x8DD8 VERSION_3_2 enum: GEOMETRY_SHADER = 0x8DD9 ARB_geometry_shader4 enum: GEOMETRY_SHADER_ARB = 0x8DD9 EXT_geometry_shader4 enum: GEOMETRY_SHADER_EXT = 0x8DD9 ARB_geometry_shader4 enum: (additional; see above) GEOMETRY_VERTICES_OUT_ARB = 0x8DDA GEOMETRY_INPUT_TYPE_ARB = 0x8DDB GEOMETRY_OUTPUT_TYPE_ARB = 0x8DDC NV_geometry_program4 enum: (additional; see above) GEOMETRY_VERTICES_OUT_EXT = 0x8DDA GEOMETRY_INPUT_TYPE_EXT = 0x8DDB GEOMETRY_OUTPUT_TYPE_EXT = 0x8DDC ARB_geometry_shader4 enum: (additional; see above) MAX_GEOMETRY_VARYING_COMPONENTS_ARB = 0x8DDD MAX_VERTEX_VARYING_COMPONENTS_ARB = 0x8DDE MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB = 0x8DDF MAX_GEOMETRY_OUTPUT_VERTICES_ARB = 0x8DE0 MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB = 0x8DE1 VERSION_3_2 enum: MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0 MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 0x8DE1 EXT_geometry_shader4 enum: (additional; see above) MAX_GEOMETRY_VARYING_COMPONENTS_EXT = 0x8DDD MAX_VERTEX_VARYING_COMPONENTS_EXT = 0x8DDE MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT = 0x8DDF MAX_GEOMETRY_OUTPUT_VERTICES_EXT = 0x8DE0 MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT = 0x8DE1 EXT_bindable_uniform enum: MAX_VERTEX_BINDABLE_UNIFORMS_EXT = 0x8DE2 MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT = 0x8DE3 MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT = 0x8DE4 # NV_future_use: 0x8DE5-0x8DEC EXT_bindable_uniform enum: (additional; see above) MAX_BINDABLE_UNIFORM_SIZE_EXT = 0x8DED UNIFORM_BUFFER_EXT = 0x8DEE UNIFORM_BUFFER_BINDING_EXT = 0x8DEF ############################################################################### # Khronos OpenGL ES WG: 0x8DF0-0x8E0F # Khronos_future_use: 0x8DF0-0x8DF5 OES_vertex_type_10_10_10_2 enum: (OpenGL ES only) UNSIGNED_INT_10_10_10_2_OES = 0x8DF6 INT_10_10_10_2_OES = 0x8DF7 # Khronos_future_use: 0x8DF8-0x8E0F ############################################################################### # NVIDIA: 0x8E10-0x8E8F # Reserved per email from Michael Gold 2006/8/7 NV_framebuffer_multisample_coverage enum: RENDERBUFFER_COLOR_SAMPLES_NV = 0x8E10 MAX_MULTISAMPLE_COVERAGE_MODES_NV = 0x8E11 MULTISAMPLE_COVERAGE_MODES_NV = 0x8E12 VERSION_3_0 enum: QUERY_WAIT = 0x8E13 # VERSION_3_0 QUERY_NO_WAIT = 0x8E14 # VERSION_3_0 QUERY_BY_REGION_WAIT = 0x8E15 # VERSION_3_0 QUERY_BY_REGION_NO_WAIT = 0x8E16 # VERSION_3_0 GL_NV_conditional_render enum: QUERY_WAIT_NV = 0x8E13 QUERY_NO_WAIT_NV = 0x8E14 QUERY_BY_REGION_WAIT_NV = 0x8E15 QUERY_BY_REGION_NO_WAIT_NV = 0x8E16 # NV_future_use: 0x8E17-0x8E21 NV_transform_feedback2 enum: TRANSFORM_FEEDBACK_NV = 0x8E22 TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV = 0x8E23 TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV = 0x8E24 TRANSFORM_FEEDBACK_BINDING_NV = 0x8E25 NV_present_video enum: FRAME_NV = 0x8E26 FIELDS_NV = 0x8E27 CURRENT_TIME_NV = 0x8E28 NUM_FILL_STREAMS_NV = 0x8E29 PRESENT_TIME_NV = 0x8E2A PRESENT_DURATION_NV = 0x8E2B NV_depth_nonlinear enum: (OpenGL ES only) DEPTH_COMPONENT16_NONLINEAR_NV = 0x8E2C EXT_direct_state_access enum: PROGRAM_MATRIX_EXT = 0x8E2D TRANSPOSE_PROGRAM_MATRIX_EXT = 0x8E2E PROGRAM_MATRIX_STACK_DEPTH_EXT = 0x8E2F # NV_future_use: 0x8E30-0x8E41 EXT_texture_swizzle enum: TEXTURE_SWIZZLE_R_EXT = 0x8E42 TEXTURE_SWIZZLE_G_EXT = 0x8E43 TEXTURE_SWIZZLE_B_EXT = 0x8E44 TEXTURE_SWIZZLE_A_EXT = 0x8E45 TEXTURE_SWIZZLE_RGBA_EXT = 0x8E46 # NV_future_use: 0x8E47-0x8E4B VERSION_3_2 enum: use ARB_provoking_vertex QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION use ARB_provoking_vertex FIRST_VERTEX_CONVENTION use ARB_provoking_vertex LAST_VERTEX_CONVENTION use ARB_provoking_vertex PROVOKING_VERTEX ARB_provoking_vertex enum: QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 0x8E4C FIRST_VERTEX_CONVENTION = 0x8E4D LAST_VERTEX_CONVENTION = 0x8E4E PROVOKING_VERTEX = 0x8E4F EXT_provoking_vertex enum: QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT = 0x8E4C FIRST_VERTEX_CONVENTION_EXT = 0x8E4D LAST_VERTEX_CONVENTION_EXT = 0x8E4E PROVOKING_VERTEX_EXT = 0x8E4F VERSION_3_2 enum: use ARB_texture_multisample SAMPLE_POSITION use ARB_texture_multisample SAMPLE_MASK use ARB_texture_multisample SAMPLE_MASK_VALUE use ARB_texture_multisample MAX_SAMPLE_MASK_WORDS ARB_texture_multisample enum: SAMPLE_POSITION = 0x8E50 SAMPLE_MASK = 0x8E51 SAMPLE_MASK_VALUE = 0x8E52 MAX_SAMPLE_MASK_WORDS = 0x8E59 NV_explicit_multisample enum: SAMPLE_POSITION_NV = 0x8E50 SAMPLE_MASK_NV = 0x8E51 SAMPLE_MASK_VALUE_NV = 0x8E52 TEXTURE_BINDING_RENDERBUFFER_NV = 0x8E53 TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV = 0x8E54 TEXTURE_RENDERBUFFER_NV = 0x8E55 SAMPLER_RENDERBUFFER_NV = 0x8E56 INT_SAMPLER_RENDERBUFFER_NV = 0x8E57 UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV = 0x8E58 MAX_SAMPLE_MASK_WORDS_NV = 0x8E59 # NV_future_use: 0x8E5A-0x8E5D ARB_texture_gather enum: MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5E MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5F # NV_future_use: 0x8E60-0x8E8F ############################################################################### # QNX: 0x8E90-0x8E9F # For GL_QNX_texture_tiling, GL_QNX_complex_polygon, GL_QNX_stippled_lines # (Khronos bug 696) # QNX_future_use: 0x8E90-0x8E9F ############################################################################### # Imagination Tech.: 0x8EA0-0x8EAF ############################################################################### # Khronos OpenGL ES WG: 0x8EB0-0x8EBF # Assigned for Affie Munshi on 2007/07/20 ############################################################################### # Vincent: 0x8EC0-0x8ECF ############################################################################### # NVIDIA: 0x8ED0-0x8F4F # Assigned for Pat Brown (Khronos bug 3191) NV_coverage_sample enum: (OpenGL ES only) COVERAGE_COMPONENT_NV = 0x8ED0 COVERAGE_COMPONENT4_NV = 0x8ED1 COVERAGE_ATTACHMENT_NV = 0x8ED2 COVERAGE_BUFFERS_NV = 0x8ED3 COVERAGE_SAMPLES_NV = 0x8ED4 COVERAGE_ALL_FRAGMENTS_NV = 0x8ED5 COVERAGE_EDGE_FRAGMENTS_NV = 0x8ED6 COVERAGE_AUTOMATIC_NV = 0x8ED7 COVERAGE_BUFFER_BIT_NV = 0x00008000 # NV_future_use: 0x8ED8-0x8F1C NV_shader_buffer_load enum: BUFFER_GPU_ADDRESS_NV = 0x8F1D NV_vertex_buffer_unified_memory enum: VERTEX_ATTRIB_ARRAY_UNIFIED_NV = 0x8F1E ELEMENT_ARRAY_UNIFIED_NV = 0x8F1F VERTEX_ATTRIB_ARRAY_ADDRESS_NV = 0x8F20 VERTEX_ARRAY_ADDRESS_NV = 0x8F21 NORMAL_ARRAY_ADDRESS_NV = 0x8F22 COLOR_ARRAY_ADDRESS_NV = 0x8F23 INDEX_ARRAY_ADDRESS_NV = 0x8F24 TEXTURE_COORD_ARRAY_ADDRESS_NV = 0x8F25 EDGE_FLAG_ARRAY_ADDRESS_NV = 0x8F26 SECONDARY_COLOR_ARRAY_ADDRESS_NV = 0x8F27 FOG_COORD_ARRAY_ADDRESS_NV = 0x8F28 ELEMENT_ARRAY_ADDRESS_NV = 0x8F29 VERTEX_ATTRIB_ARRAY_LENGTH_NV = 0x8F2A VERTEX_ARRAY_LENGTH_NV = 0x8F2B NORMAL_ARRAY_LENGTH_NV = 0x8F2C COLOR_ARRAY_LENGTH_NV = 0x8F2D INDEX_ARRAY_LENGTH_NV = 0x8F2E TEXTURE_COORD_ARRAY_LENGTH_NV = 0x8F2F EDGE_FLAG_ARRAY_LENGTH_NV = 0x8F30 SECONDARY_COLOR_ARRAY_LENGTH_NV = 0x8F31 FOG_COORD_ARRAY_LENGTH_NV = 0x8F32 ELEMENT_ARRAY_LENGTH_NV = 0x8F33 NV_shader_buffer_load enum: (additional; see above) GPU_ADDRESS_NV = 0x8F34 MAX_SHADER_BUFFER_ADDRESS_NV = 0x8F35 ARB_copy_buffer enum: COPY_READ_BUFFER = 0x8F36 COPY_WRITE_BUFFER = 0x8F37 VERSION_3_1 enum: use ARB_copy_buffer COPY_READ_BUFFER use ARB_copy_buffer COPY_WRITE_BUFFER # NVIDIA_future_use: 0x8F38-0x8F4F ############################################################################### # 3Dlabs: 0x8F50-0x8F5F # Assigned for Jon Kennedy (Khronos public bug 75) ############################################################################### # ARM: 0x8F60-0x8F6F # Assigned for Remi Pedersen (Khronos bug 3745) ############################################################################### # HI Corp: 0x8F70-0x8F7F # Assigned for Mark Callow (Khronos bug 4055) ############################################################################### # Zebra Imaging: 0x8F80-0x8F8F # Assigned for Mike Weiblen (Khronos public bug 91) ############################################################################### # OpenGL ARB: 0x8F90-0x8F9F (SNORM textures, 3.1 primitive restart server state) VERSION_3_1 enum: RED_SNORM = 0x8F90 # VERSION_3_1 RG_SNORM = 0x8F91 # VERSION_3_1 RGB_SNORM = 0x8F92 # VERSION_3_1 RGBA_SNORM = 0x8F93 # VERSION_3_1 R8_SNORM = 0x8F94 # VERSION_3_1 RG8_SNORM = 0x8F95 # VERSION_3_1 RGB8_SNORM = 0x8F96 # VERSION_3_1 RGBA8_SNORM = 0x8F97 # VERSION_3_1 R16_SNORM = 0x8F98 # VERSION_3_1 RG16_SNORM = 0x8F99 # VERSION_3_1 RGB16_SNORM = 0x8F9A # VERSION_3_1 RGBA16_SNORM = 0x8F9B # VERSION_3_1 SIGNED_NORMALIZED = 0x8F9C # VERSION_3_1 PRIMITIVE_RESTART = 0x8F9D # Different from NV_primitive_restart value PRIMITIVE_RESTART_INDEX = 0x8F9E # Different from NV_primitive_restart value ARB_texture_gather enum: (additional; see above) MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS = 0x8F9F ############################################################################### # Qualcomm: 0x8FA0-0x8FBF # Assigned for Maurice Ribble (Khronos bug 4512) QCOM_driver_control enum: (OpenGL ES only) PERFMON_GLOBAL_MODE_QCOM = 0x8FA0 # QCOM_future_use: 0x8FA1-0x8FBF ############################################################################### # Vivante: 0x8FC0-0x8FDF # Assigned for Frido Garritsen (Khronos bug 4526) ############################################################################### # NVIDIA: 0x8FE0-0x8FFF # Assigned for Pat Brown (Khronos bug 4935) # NV_future_use: 0x8FE0-0x8FFF ############################################################################### # AMD: 0x9000-0x901F # Assigned for Bill Licea-Kane AMD_vertex_shader_tesselator enum: SAMPLER_BUFFER_AMD = 0x9001 INT_SAMPLER_BUFFER_AMD = 0x9002 UNSIGNED_INT_SAMPLER_BUFFER_AMD = 0x9003 TESSELLATION_MODE_AMD = 0x9004 TESSELLATION_FACTOR_AMD = 0x9005 DISCRETE_AMD = 0x9006 CONTINUOUS_AMD = 0x9007 # AMD_future_use: 0x9008 ARB_texture_cube_map_array enum: TEXTURE_CUBE_MAP_ARRAY = 0x9009 TEXTURE_BINDING_CUBE_MAP_ARRAY = 0x900A PROXY_TEXTURE_CUBE_MAP_ARRAY = 0x900B SAMPLER_CUBE_MAP_ARRAY = 0x900C SAMPLER_CUBE_MAP_ARRAY_SHADOW = 0x900D INT_SAMPLER_CUBE_MAP_ARRAY = 0x900E UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900F EXT_texture_snorm enum: ALPHA_SNORM = 0x9010 LUMINANCE_SNORM = 0x9011 LUMINANCE_ALPHA_SNORM = 0x9012 INTENSITY_SNORM = 0x9013 ALPHA8_SNORM = 0x9014 LUMINANCE8_SNORM = 0x9015 LUMINANCE8_ALPHA8_SNORM = 0x9016 INTENSITY8_SNORM = 0x9017 ALPHA16_SNORM = 0x9018 LUMINANCE16_SNORM = 0x9019 LUMINANCE16_ALPHA16_SNORM = 0x901A INTENSITY16_SNORM = 0x901B # AMD_future_use: 0x901C-0x901F ############################################################################### # NVIDIA: 0x9020-0x90FF # Assigned for Pat Brown (Khronos bug 4935) NV_video_capture enum: VIDEO_BUFFER_NV = 0x9020 VIDEO_BUFFER_BINDING_NV = 0x9021 FIELD_UPPER_NV = 0x9022 FIELD_LOWER_NV = 0x9023 NUM_VIDEO_CAPTURE_STREAMS_NV = 0x9024 NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV = 0x9025 VIDEO_CAPTURE_TO_422_SUPPORTED_NV = 0x9026 LAST_VIDEO_CAPTURE_STATUS_NV = 0x9027 VIDEO_BUFFER_PITCH_NV = 0x9028 VIDEO_COLOR_CONVERSION_MATRIX_NV = 0x9029 VIDEO_COLOR_CONVERSION_MAX_NV = 0x902A VIDEO_COLOR_CONVERSION_MIN_NV = 0x902B VIDEO_COLOR_CONVERSION_OFFSET_NV = 0x902C VIDEO_BUFFER_INTERNAL_FORMAT_NV = 0x902D PARTIAL_SUCCESS_NV = 0x902E SUCCESS_NV = 0x902F FAILURE_NV = 0x9030 YCBYCR8_422_NV = 0x9031 YCBAYCR8A_4224_NV = 0x9032 Z6Y10Z6CB10Z6Y10Z6CR10_422_NV = 0x9033 Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV = 0x9034 Z4Y12Z4CB12Z4Y12Z4CR12_422_NV = 0x9035 Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV = 0x9036 Z4Y12Z4CB12Z4CR12_444_NV = 0x9037 VIDEO_CAPTURE_FRAME_WIDTH_NV = 0x9038 VIDEO_CAPTURE_FRAME_HEIGHT_NV = 0x9039 VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV = 0x903A VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV = 0x903B VIDEO_CAPTURE_SURFACE_ORIGIN_NV = 0x903C # NV_future_use: 0x903D-0x90FF ############################################################################### # OpenGL ARB: 0x9100-0x912F VERSION_3_2 enum: use ARB_texture_multisample TEXTURE_2D_MULTISAMPLE use ARB_texture_multisample PROXY_TEXTURE_2D_MULTISAMPLE use ARB_texture_multisample TEXTURE_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample TEXTURE_BINDING_2D_MULTISAMPLE use ARB_texture_multisample TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample TEXTURE_SAMPLES use ARB_texture_multisample TEXTURE_FIXED_SAMPLE_LOCATIONS use ARB_texture_multisample SAMPLER_2D_MULTISAMPLE use ARB_texture_multisample INT_SAMPLER_2D_MULTISAMPLE use ARB_texture_multisample UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE use ARB_texture_multisample SAMPLER_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample INT_SAMPLER_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample MAX_COLOR_TEXTURE_SAMPLES use ARB_texture_multisample MAX_DEPTH_TEXTURE_SAMPLES use ARB_texture_multisample MAX_INTEGER_SAMPLES ARB_texture_multisample enum: TEXTURE_2D_MULTISAMPLE = 0x9100 PROXY_TEXTURE_2D_MULTISAMPLE = 0x9101 TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102 PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9103 TEXTURE_BINDING_2D_MULTISAMPLE = 0x9104 TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 0x9105 TEXTURE_SAMPLES = 0x9106 TEXTURE_FIXED_SAMPLE_LOCATIONS = 0x9107 SAMPLER_2D_MULTISAMPLE = 0x9108 INT_SAMPLER_2D_MULTISAMPLE = 0x9109 UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 0x910A SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D MAX_COLOR_TEXTURE_SAMPLES = 0x910E MAX_DEPTH_TEXTURE_SAMPLES = 0x910F MAX_INTEGER_SAMPLES = 0x9110 VERSION_3_2 enum: use ARB_sync MAX_SERVER_WAIT_TIMEOUT use ARB_sync OBJECT_TYPE use ARB_sync SYNC_CONDITION use ARB_sync SYNC_STATUS use ARB_sync SYNC_FLAGS use ARB_sync SYNC_FENCE use ARB_sync SYNC_GPU_COMMANDS_COMPLETE use ARB_sync UNSIGNALED use ARB_sync SIGNALED use ARB_sync ALREADY_SIGNALED use ARB_sync TIMEOUT_EXPIRED use ARB_sync CONDITION_SATISFIED use ARB_sync WAIT_FAILED use ARB_sync TIMEOUT_IGNORED use ARB_sync SYNC_FLUSH_COMMANDS_BIT use ARB_sync TIMEOUT_IGNORED ARB_sync enum: MAX_SERVER_WAIT_TIMEOUT = 0x9111 OBJECT_TYPE = 0x9112 SYNC_CONDITION = 0x9113 SYNC_STATUS = 0x9114 SYNC_FLAGS = 0x9115 SYNC_FENCE = 0x9116 SYNC_GPU_COMMANDS_COMPLETE = 0x9117 UNSIGNALED = 0x9118 SIGNALED = 0x9119 ALREADY_SIGNALED = 0x911A TIMEOUT_EXPIRED = 0x911B CONDITION_SATISFIED = 0x911C WAIT_FAILED = 0x911D SYNC_FLUSH_COMMANDS_BIT = 0x00000001 TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFull VERSION_3_0 enum: BUFFER_ACCESS_FLAGS = 0x911F BUFFER_MAP_LENGTH = 0x9120 BUFFER_MAP_OFFSET = 0x9121 VERSION_3_2 enum: MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122 MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123 MAX_GEOMETRY_OUTPUT_COMPONENTS = 0x9124 MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125 VERSION_3_2 enum: CONTEXT_CORE_PROFILE_BIT = 0x00000001 CONTEXT_COMPATIBILITY_PROFILE_BIT = 0x00000002 CONTEXT_PROFILE_MASK = 0x9126 # ARB_future_use: 0x9127-0x912F ############################################################################### # Imagination Tech.: 0x9130-0x913F (Khronos bug 882) IMG_program_binary: (OpenGL ES only) SGX_PROGRAM_BINARY_IMG = 0x9130 # IMG_future_use: 0x9131-0x913F ############################################################################### # AMD: 0x9140-0x91BF (Khronos bugs 5899, 6004) # AMD_future_use: 0x9140-0x91BF # AMD_future_use: 0x91C0-0x923F ############################################################################### ### Please remember that new enumerant allocations must be obtained by request ### to the Khronos API registrar (see comments at the top of this file) ### File requests in the Khronos Bugzilla, OpenGL project, Registry component. ############################################################################### # Any_vendor_future_use: 0x9140-0xFFFF # # This range must be the last range in the file. To generate a new # range, allocate multiples of 16 from the beginning of the # Any_vendor_future_use range and update enum.spec # (NOTE: first fill the gap from 0x8FE0-0x8FFF before proceeding here) ############################################################################### # ARB: 100000-100999 (GLU enumerants only) # ARB: 101000-101999 (Conformance tests only) ############################################################################### # IBM: 103000-103999 # CULL_VERTEX_IBM = 103050 # VERTEX_ARRAY_LIST_IBM = 103070 # NORMAL_ARRAY_LIST_IBM = 103071 # COLOR_ARRAY_LIST_IBM = 103072 # INDEX_ARRAY_LIST_IBM = 103073 # TEXTURE_COORD_ARRAY_LIST_IBM = 103074 # EDGE_FLAG_ARRAY_LIST_IBM = 103075 # FOG_COORDINATE_ARRAY_LIST_IBM = 103076 # SECONDARY_COLOR_ARRAY_LIST_IBM = 103077 # VERTEX_ARRAY_LIST_STRIDE_IBM = 103080 # NORMAL_ARRAY_LIST_STRIDE_IBM = 103081 # COLOR_ARRAY_LIST_STRIDE_IBM = 103082 # INDEX_ARRAY_LIST_STRIDE_IBM = 103083 # TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084 # EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085 # FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086 # SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087 ############################################################################### # NEC: 104000-104999 # Compaq: 105000-105999 (Compaq was acquired by HP) # KPC: 106000-106999 (Kubota is out of business) # PGI: 107000-107999 (Portable was acquired by Template Graphics) # E&S: 108000-108999 ############################################################################### ================================================ FILE: k3dsdk/gl/enumext.spec ================================================ # enumext.spec - list of GL enumerants for glext.h header # # $Revision: 10796 $ on $Date: 2010-03-19 17:31:10 -0700 (Fri, 19 Mar 2010) $ # This is derived from the master GL enumerant registry (enum.spec). # # Unlike enum.spec, enumext.spec is # (1) Grouped by GL core version or extension number # (2) While it includes all extension and core enumerants, the # generator scripts for glext.h leave out VERSION_1_1 # tokens since it's assumed all today support at least # OpenGL 1.1 # (3) Has no 'Extensions' section, since enums are always # conditionally protected against multiple definition # by glextenum.pl. # (4) Is processed by glextenum.pl, which has evolved # from enum.pl - should merge back into one script. # The release number encoded into glext.h is now defined in # glextrelease.txt. ############################################################################### # # OpenGL 1.0/1.1 enums (there is no VERSION_1_0 token) # ############################################################################### VERSION_1_1 enum: passthru: /* AttribMask */ DEPTH_BUFFER_BIT = 0x00000100 # AttribMask STENCIL_BUFFER_BIT = 0x00000400 # AttribMask COLOR_BUFFER_BIT = 0x00004000 # AttribMask passthru: /* Boolean */ FALSE = 0 # Boolean TRUE = 1 # Boolean passthru: /* BeginMode */ POINTS = 0x0000 # BeginMode LINES = 0x0001 # BeginMode LINE_LOOP = 0x0002 # BeginMode LINE_STRIP = 0x0003 # BeginMode TRIANGLES = 0x0004 # BeginMode TRIANGLE_STRIP = 0x0005 # BeginMode TRIANGLE_FAN = 0x0006 # BeginMode passthru: /* AlphaFunction */ NEVER = 0x0200 # AlphaFunction LESS = 0x0201 # AlphaFunction EQUAL = 0x0202 # AlphaFunction LEQUAL = 0x0203 # AlphaFunction GREATER = 0x0204 # AlphaFunction NOTEQUAL = 0x0205 # AlphaFunction GEQUAL = 0x0206 # AlphaFunction ALWAYS = 0x0207 # AlphaFunction passthru: /* BlendingFactorDest */ ZERO = 0 # BlendingFactorDest ONE = 1 # BlendingFactorDest SRC_COLOR = 0x0300 # BlendingFactorDest ONE_MINUS_SRC_COLOR = 0x0301 # BlendingFactorDest SRC_ALPHA = 0x0302 # BlendingFactorDest ONE_MINUS_SRC_ALPHA = 0x0303 # BlendingFactorDest DST_ALPHA = 0x0304 # BlendingFactorDest ONE_MINUS_DST_ALPHA = 0x0305 # BlendingFactorDest passthru: /* BlendingFactorSrc */ DST_COLOR = 0x0306 # BlendingFactorSrc ONE_MINUS_DST_COLOR = 0x0307 # BlendingFactorSrc SRC_ALPHA_SATURATE = 0x0308 # BlendingFactorSrc passthru: /* DrawBufferMode */ NONE = 0 # DrawBufferMode FRONT_LEFT = 0x0400 # DrawBufferMode FRONT_RIGHT = 0x0401 # DrawBufferMode BACK_LEFT = 0x0402 # DrawBufferMode BACK_RIGHT = 0x0403 # DrawBufferMode FRONT = 0x0404 # DrawBufferMode BACK = 0x0405 # DrawBufferMode LEFT = 0x0406 # DrawBufferMode RIGHT = 0x0407 # DrawBufferMode FRONT_AND_BACK = 0x0408 # DrawBufferMode passthru: /* ErrorCode */ NO_ERROR = 0 # ErrorCode INVALID_ENUM = 0x0500 # ErrorCode INVALID_VALUE = 0x0501 # ErrorCode INVALID_OPERATION = 0x0502 # ErrorCode OUT_OF_MEMORY = 0x0505 # ErrorCode passthru: /* FrontFaceDirection */ CW = 0x0900 # FrontFaceDirection CCW = 0x0901 # FrontFaceDirection passthru: /* GetPName */ POINT_SIZE = 0x0B11 # 1 F # GetPName POINT_SIZE_RANGE = 0x0B12 # 2 F # GetPName POINT_SIZE_GRANULARITY = 0x0B13 # 1 F # GetPName LINE_SMOOTH = 0x0B20 # 1 I # GetPName LINE_WIDTH = 0x0B21 # 1 F # GetPName LINE_WIDTH_RANGE = 0x0B22 # 2 F # GetPName LINE_WIDTH_GRANULARITY = 0x0B23 # 1 F # GetPName POLYGON_SMOOTH = 0x0B41 # 1 I # GetPName CULL_FACE = 0x0B44 # 1 I # GetPName CULL_FACE_MODE = 0x0B45 # 1 I # GetPName FRONT_FACE = 0x0B46 # 1 I # GetPName DEPTH_RANGE = 0x0B70 # 2 F # GetPName DEPTH_TEST = 0x0B71 # 1 I # GetPName DEPTH_WRITEMASK = 0x0B72 # 1 I # GetPName DEPTH_CLEAR_VALUE = 0x0B73 # 1 F # GetPName DEPTH_FUNC = 0x0B74 # 1 I # GetPName STENCIL_TEST = 0x0B90 # 1 I # GetPName STENCIL_CLEAR_VALUE = 0x0B91 # 1 I # GetPName STENCIL_FUNC = 0x0B92 # 1 I # GetPName STENCIL_VALUE_MASK = 0x0B93 # 1 I # GetPName STENCIL_FAIL = 0x0B94 # 1 I # GetPName STENCIL_PASS_DEPTH_FAIL = 0x0B95 # 1 I # GetPName STENCIL_PASS_DEPTH_PASS = 0x0B96 # 1 I # GetPName STENCIL_REF = 0x0B97 # 1 I # GetPName STENCIL_WRITEMASK = 0x0B98 # 1 I # GetPName VIEWPORT = 0x0BA2 # 4 I # GetPName DITHER = 0x0BD0 # 1 I # GetPName BLEND_DST = 0x0BE0 # 1 I # GetPName BLEND_SRC = 0x0BE1 # 1 I # GetPName BLEND = 0x0BE2 # 1 I # GetPName LOGIC_OP_MODE = 0x0BF0 # 1 I # GetPName COLOR_LOGIC_OP = 0x0BF2 # 1 I # GetPName DRAW_BUFFER = 0x0C01 # 1 I # GetPName READ_BUFFER = 0x0C02 # 1 I # GetPName SCISSOR_BOX = 0x0C10 # 4 I # GetPName SCISSOR_TEST = 0x0C11 # 1 I # GetPName COLOR_CLEAR_VALUE = 0x0C22 # 4 F # GetPName COLOR_WRITEMASK = 0x0C23 # 4 I # GetPName DOUBLEBUFFER = 0x0C32 # 1 I # GetPName STEREO = 0x0C33 # 1 I # GetPName LINE_SMOOTH_HINT = 0x0C52 # 1 I # GetPName POLYGON_SMOOTH_HINT = 0x0C53 # 1 I # GetPName UNPACK_SWAP_BYTES = 0x0CF0 # 1 I # GetPName UNPACK_LSB_FIRST = 0x0CF1 # 1 I # GetPName UNPACK_ROW_LENGTH = 0x0CF2 # 1 I # GetPName UNPACK_SKIP_ROWS = 0x0CF3 # 1 I # GetPName UNPACK_SKIP_PIXELS = 0x0CF4 # 1 I # GetPName UNPACK_ALIGNMENT = 0x0CF5 # 1 I # GetPName PACK_SWAP_BYTES = 0x0D00 # 1 I # GetPName PACK_LSB_FIRST = 0x0D01 # 1 I # GetPName PACK_ROW_LENGTH = 0x0D02 # 1 I # GetPName PACK_SKIP_ROWS = 0x0D03 # 1 I # GetPName PACK_SKIP_PIXELS = 0x0D04 # 1 I # GetPName PACK_ALIGNMENT = 0x0D05 # 1 I # GetPName MAX_TEXTURE_SIZE = 0x0D33 # 1 I # GetPName MAX_VIEWPORT_DIMS = 0x0D3A # 2 F # GetPName SUBPIXEL_BITS = 0x0D50 # 1 I # GetPName TEXTURE_1D = 0x0DE0 # 1 I # GetPName TEXTURE_2D = 0x0DE1 # 1 I # GetPName POLYGON_OFFSET_UNITS = 0x2A00 # 1 F # GetPName POLYGON_OFFSET_POINT = 0x2A01 # 1 I # GetPName POLYGON_OFFSET_LINE = 0x2A02 # 1 I # GetPName POLYGON_OFFSET_FILL = 0x8037 # 1 I # GetPName POLYGON_OFFSET_FACTOR = 0x8038 # 1 F # GetPName TEXTURE_BINDING_1D = 0x8068 # 1 I # GetPName TEXTURE_BINDING_2D = 0x8069 # 1 I # GetPName passthru: /* GetTextureParameter */ TEXTURE_WIDTH = 0x1000 # GetTextureParameter TEXTURE_HEIGHT = 0x1001 # GetTextureParameter TEXTURE_INTERNAL_FORMAT = 0x1003 # GetTextureParameter TEXTURE_BORDER_COLOR = 0x1004 # GetTextureParameter TEXTURE_RED_SIZE = 0x805C # GetTextureParameter TEXTURE_GREEN_SIZE = 0x805D # GetTextureParameter TEXTURE_BLUE_SIZE = 0x805E # GetTextureParameter TEXTURE_ALPHA_SIZE = 0x805F # GetTextureParameter passthru: /* HintMode */ DONT_CARE = 0x1100 # HintMode FASTEST = 0x1101 # HintMode NICEST = 0x1102 # HintMode passthru: /* DataType */ BYTE = 0x1400 # DataType UNSIGNED_BYTE = 0x1401 # DataType SHORT = 0x1402 # DataType UNSIGNED_SHORT = 0x1403 # DataType INT = 0x1404 # DataType UNSIGNED_INT = 0x1405 # DataType FLOAT = 0x1406 # DataType DOUBLE = 0x140A # DataType passthru: /* LogicOp */ CLEAR = 0x1500 # LogicOp AND = 0x1501 # LogicOp AND_REVERSE = 0x1502 # LogicOp COPY = 0x1503 # LogicOp AND_INVERTED = 0x1504 # LogicOp NOOP = 0x1505 # LogicOp XOR = 0x1506 # LogicOp OR = 0x1507 # LogicOp NOR = 0x1508 # LogicOp EQUIV = 0x1509 # LogicOp INVERT = 0x150A # LogicOp OR_REVERSE = 0x150B # LogicOp COPY_INVERTED = 0x150C # LogicOp OR_INVERTED = 0x150D # LogicOp NAND = 0x150E # LogicOp SET = 0x150F # LogicOp passthru: /* MatrixMode (for gl3.h, FBO attachment type) */ TEXTURE = 0x1702 # MatrixMode passthru: /* PixelCopyType */ COLOR = 0x1800 # PixelCopyType DEPTH = 0x1801 # PixelCopyType STENCIL = 0x1802 # PixelCopyType passthru: /* PixelFormat */ STENCIL_INDEX = 0x1901 # PixelFormat DEPTH_COMPONENT = 0x1902 # PixelFormat RED = 0x1903 # PixelFormat GREEN = 0x1904 # PixelFormat BLUE = 0x1905 # PixelFormat ALPHA = 0x1906 # PixelFormat RGB = 0x1907 # PixelFormat RGBA = 0x1908 # PixelFormat passthru: /* PolygonMode */ POINT = 0x1B00 # PolygonMode LINE = 0x1B01 # PolygonMode FILL = 0x1B02 # PolygonMode passthru: /* StencilOp */ KEEP = 0x1E00 # StencilOp REPLACE = 0x1E01 # StencilOp INCR = 0x1E02 # StencilOp DECR = 0x1E03 # StencilOp passthru: /* StringName */ VENDOR = 0x1F00 # StringName RENDERER = 0x1F01 # StringName VERSION = 0x1F02 # StringName EXTENSIONS = 0x1F03 # StringName passthru: /* TextureMagFilter */ NEAREST = 0x2600 # TextureMagFilter LINEAR = 0x2601 # TextureMagFilter passthru: /* TextureMinFilter */ NEAREST_MIPMAP_NEAREST = 0x2700 # TextureMinFilter LINEAR_MIPMAP_NEAREST = 0x2701 # TextureMinFilter NEAREST_MIPMAP_LINEAR = 0x2702 # TextureMinFilter LINEAR_MIPMAP_LINEAR = 0x2703 # TextureMinFilter passthru: /* TextureParameterName */ TEXTURE_MAG_FILTER = 0x2800 # TextureParameterName TEXTURE_MIN_FILTER = 0x2801 # TextureParameterName TEXTURE_WRAP_S = 0x2802 # TextureParameterName TEXTURE_WRAP_T = 0x2803 # TextureParameterName passthru: /* TextureTarget */ PROXY_TEXTURE_1D = 0x8063 # TextureTarget PROXY_TEXTURE_2D = 0x8064 # TextureTarget passthru: /* TextureWrapMode */ REPEAT = 0x2901 # TextureWrapMode passthru: /* PixelInternalFormat */ R3_G3_B2 = 0x2A10 # PixelInternalFormat RGB4 = 0x804F # PixelInternalFormat RGB5 = 0x8050 # PixelInternalFormat RGB8 = 0x8051 # PixelInternalFormat RGB10 = 0x8052 # PixelInternalFormat RGB12 = 0x8053 # PixelInternalFormat RGB16 = 0x8054 # PixelInternalFormat RGBA2 = 0x8055 # PixelInternalFormat RGBA4 = 0x8056 # PixelInternalFormat RGB5_A1 = 0x8057 # PixelInternalFormat RGBA8 = 0x8058 # PixelInternalFormat RGB10_A2 = 0x8059 # PixelInternalFormat RGBA12 = 0x805A # PixelInternalFormat RGBA16 = 0x805B # PixelInternalFormat VERSION_1_1_DEPRECATED enum: passthru: /* AttribMask */ CURRENT_BIT = 0x00000001 # AttribMask POINT_BIT = 0x00000002 # AttribMask LINE_BIT = 0x00000004 # AttribMask POLYGON_BIT = 0x00000008 # AttribMask POLYGON_STIPPLE_BIT = 0x00000010 # AttribMask PIXEL_MODE_BIT = 0x00000020 # AttribMask LIGHTING_BIT = 0x00000040 # AttribMask FOG_BIT = 0x00000080 # AttribMask ACCUM_BUFFER_BIT = 0x00000200 # AttribMask VIEWPORT_BIT = 0x00000800 # AttribMask TRANSFORM_BIT = 0x00001000 # AttribMask ENABLE_BIT = 0x00002000 # AttribMask HINT_BIT = 0x00008000 # AttribMask EVAL_BIT = 0x00010000 # AttribMask LIST_BIT = 0x00020000 # AttribMask TEXTURE_BIT = 0x00040000 # AttribMask SCISSOR_BIT = 0x00080000 # AttribMask ALL_ATTRIB_BITS = 0xFFFFFFFF # AttribMask passthru: /* ClientAttribMask */ CLIENT_PIXEL_STORE_BIT = 0x00000001 # ClientAttribMask CLIENT_VERTEX_ARRAY_BIT = 0x00000002 # ClientAttribMask CLIENT_ALL_ATTRIB_BITS = 0xFFFFFFFF # ClientAttribMask passthru: /* BeginMode */ QUADS = 0x0007 # BeginMode QUAD_STRIP = 0x0008 # BeginMode POLYGON = 0x0009 # BeginMode passthru: /* AccumOp */ ACCUM = 0x0100 # AccumOp LOAD = 0x0101 # AccumOp RETURN = 0x0102 # AccumOp MULT = 0x0103 # AccumOp ADD = 0x0104 # AccumOp passthru: /* DrawBufferMode */ AUX0 = 0x0409 # DrawBufferMode AUX1 = 0x040A # DrawBufferMode AUX2 = 0x040B # DrawBufferMode AUX3 = 0x040C # DrawBufferMode passthru: /* ErrorCode */ STACK_OVERFLOW = 0x0503 # ErrorCode STACK_UNDERFLOW = 0x0504 # ErrorCode passthru: /* FeedbackType */ 2D = 0x0600 # FeedbackType 3D = 0x0601 # FeedbackType 3D_COLOR = 0x0602 # FeedbackType 3D_COLOR_TEXTURE = 0x0603 # FeedbackType 4D_COLOR_TEXTURE = 0x0604 # FeedbackType passthru: /* FeedBackToken */ PASS_THROUGH_TOKEN = 0x0700 # FeedBackToken POINT_TOKEN = 0x0701 # FeedBackToken LINE_TOKEN = 0x0702 # FeedBackToken POLYGON_TOKEN = 0x0703 # FeedBackToken BITMAP_TOKEN = 0x0704 # FeedBackToken DRAW_PIXEL_TOKEN = 0x0705 # FeedBackToken COPY_PIXEL_TOKEN = 0x0706 # FeedBackToken LINE_RESET_TOKEN = 0x0707 # FeedBackToken passthru: /* FogMode */ EXP = 0x0800 # FogMode EXP2 = 0x0801 # FogMode passthru: /* GetMapQuery */ COEFF = 0x0A00 # GetMapQuery ORDER = 0x0A01 # GetMapQuery DOMAIN = 0x0A02 # GetMapQuery passthru: /* GetPixelMap */ PIXEL_MAP_I_TO_I = 0x0C70 # GetPixelMap PIXEL_MAP_S_TO_S = 0x0C71 # GetPixelMap PIXEL_MAP_I_TO_R = 0x0C72 # GetPixelMap PIXEL_MAP_I_TO_G = 0x0C73 # GetPixelMap PIXEL_MAP_I_TO_B = 0x0C74 # GetPixelMap PIXEL_MAP_I_TO_A = 0x0C75 # GetPixelMap PIXEL_MAP_R_TO_R = 0x0C76 # GetPixelMap PIXEL_MAP_G_TO_G = 0x0C77 # GetPixelMap PIXEL_MAP_B_TO_B = 0x0C78 # GetPixelMap PIXEL_MAP_A_TO_A = 0x0C79 # GetPixelMap passthru: /* GetPointervPName */ VERTEX_ARRAY_POINTER = 0x808E # GetPointervPName NORMAL_ARRAY_POINTER = 0x808F # GetPointervPName COLOR_ARRAY_POINTER = 0x8090 # GetPointervPName INDEX_ARRAY_POINTER = 0x8091 # GetPointervPName TEXTURE_COORD_ARRAY_POINTER = 0x8092 # GetPointervPName EDGE_FLAG_ARRAY_POINTER = 0x8093 # GetPointervPName FEEDBACK_BUFFER_POINTER = 0x0DF0 # GetPointervPName SELECTION_BUFFER_POINTER = 0x0DF3 # GetPointervPName passthru: /* GetPName */ CURRENT_COLOR = 0x0B00 # 4 F # GetPName CURRENT_INDEX = 0x0B01 # 1 F # GetPName CURRENT_NORMAL = 0x0B02 # 3 F # GetPName CURRENT_TEXTURE_COORDS = 0x0B03 # 4 F # GetPName CURRENT_RASTER_COLOR = 0x0B04 # 4 F # GetPName CURRENT_RASTER_INDEX = 0x0B05 # 1 F # GetPName CURRENT_RASTER_TEXTURE_COORDS = 0x0B06 # 4 F # GetPName CURRENT_RASTER_POSITION = 0x0B07 # 4 F # GetPName CURRENT_RASTER_POSITION_VALID = 0x0B08 # 1 I # GetPName CURRENT_RASTER_DISTANCE = 0x0B09 # 1 F # GetPName POINT_SMOOTH = 0x0B10 # 1 I # GetPName LINE_STIPPLE = 0x0B24 # 1 I # GetPName LINE_STIPPLE_PATTERN = 0x0B25 # 1 I # GetPName LINE_STIPPLE_REPEAT = 0x0B26 # 1 I # GetPName LIST_MODE = 0x0B30 # 1 I # GetPName MAX_LIST_NESTING = 0x0B31 # 1 I # GetPName LIST_BASE = 0x0B32 # 1 I # GetPName LIST_INDEX = 0x0B33 # 1 I # GetPName POLYGON_MODE = 0x0B40 # 2 I # GetPName POLYGON_STIPPLE = 0x0B42 # 1 I # GetPName EDGE_FLAG = 0x0B43 # 1 I # GetPName LIGHTING = 0x0B50 # 1 I # GetPName LIGHT_MODEL_LOCAL_VIEWER = 0x0B51 # 1 I # GetPName LIGHT_MODEL_TWO_SIDE = 0x0B52 # 1 I # GetPName LIGHT_MODEL_AMBIENT = 0x0B53 # 4 F # GetPName SHADE_MODEL = 0x0B54 # 1 I # GetPName COLOR_MATERIAL_FACE = 0x0B55 # 1 I # GetPName COLOR_MATERIAL_PARAMETER = 0x0B56 # 1 I # GetPName COLOR_MATERIAL = 0x0B57 # 1 I # GetPName FOG = 0x0B60 # 1 I # GetPName FOG_INDEX = 0x0B61 # 1 I # GetPName FOG_DENSITY = 0x0B62 # 1 F # GetPName FOG_START = 0x0B63 # 1 F # GetPName FOG_END = 0x0B64 # 1 F # GetPName FOG_MODE = 0x0B65 # 1 I # GetPName FOG_COLOR = 0x0B66 # 4 F # GetPName ACCUM_CLEAR_VALUE = 0x0B80 # 4 F # GetPName MATRIX_MODE = 0x0BA0 # 1 I # GetPName NORMALIZE = 0x0BA1 # 1 I # GetPName MODELVIEW_STACK_DEPTH = 0x0BA3 # 1 I # GetPName PROJECTION_STACK_DEPTH = 0x0BA4 # 1 I # GetPName TEXTURE_STACK_DEPTH = 0x0BA5 # 1 I # GetPName MODELVIEW_MATRIX = 0x0BA6 # 16 F # GetPName PROJECTION_MATRIX = 0x0BA7 # 16 F # GetPName TEXTURE_MATRIX = 0x0BA8 # 16 F # GetPName ATTRIB_STACK_DEPTH = 0x0BB0 # 1 I # GetPName CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1 # 1 I # GetPName ALPHA_TEST = 0x0BC0 # 1 I # GetPName ALPHA_TEST_FUNC = 0x0BC1 # 1 I # GetPName ALPHA_TEST_REF = 0x0BC2 # 1 F # GetPName INDEX_LOGIC_OP = 0x0BF1 # 1 I # GetPName LOGIC_OP = 0x0BF1 # 1 I # GetPName AUX_BUFFERS = 0x0C00 # 1 I # GetPName INDEX_CLEAR_VALUE = 0x0C20 # 1 I # GetPName INDEX_WRITEMASK = 0x0C21 # 1 I # GetPName INDEX_MODE = 0x0C30 # 1 I # GetPName RGBA_MODE = 0x0C31 # 1 I # GetPName RENDER_MODE = 0x0C40 # 1 I # GetPName PERSPECTIVE_CORRECTION_HINT = 0x0C50 # 1 I # GetPName POINT_SMOOTH_HINT = 0x0C51 # 1 I # GetPName FOG_HINT = 0x0C54 # 1 I # GetPName TEXTURE_GEN_S = 0x0C60 # 1 I # GetPName TEXTURE_GEN_T = 0x0C61 # 1 I # GetPName TEXTURE_GEN_R = 0x0C62 # 1 I # GetPName TEXTURE_GEN_Q = 0x0C63 # 1 I # GetPName PIXEL_MAP_I_TO_I_SIZE = 0x0CB0 # 1 I # GetPName PIXEL_MAP_S_TO_S_SIZE = 0x0CB1 # 1 I # GetPName PIXEL_MAP_I_TO_R_SIZE = 0x0CB2 # 1 I # GetPName PIXEL_MAP_I_TO_G_SIZE = 0x0CB3 # 1 I # GetPName PIXEL_MAP_I_TO_B_SIZE = 0x0CB4 # 1 I # GetPName PIXEL_MAP_I_TO_A_SIZE = 0x0CB5 # 1 I # GetPName PIXEL_MAP_R_TO_R_SIZE = 0x0CB6 # 1 I # GetPName PIXEL_MAP_G_TO_G_SIZE = 0x0CB7 # 1 I # GetPName PIXEL_MAP_B_TO_B_SIZE = 0x0CB8 # 1 I # GetPName PIXEL_MAP_A_TO_A_SIZE = 0x0CB9 # 1 I # GetPName MAP_COLOR = 0x0D10 # 1 I # GetPName MAP_STENCIL = 0x0D11 # 1 I # GetPName INDEX_SHIFT = 0x0D12 # 1 I # GetPName INDEX_OFFSET = 0x0D13 # 1 I # GetPName RED_SCALE = 0x0D14 # 1 F # GetPName RED_BIAS = 0x0D15 # 1 F # GetPName ZOOM_X = 0x0D16 # 1 F # GetPName ZOOM_Y = 0x0D17 # 1 F # GetPName GREEN_SCALE = 0x0D18 # 1 F # GetPName GREEN_BIAS = 0x0D19 # 1 F # GetPName BLUE_SCALE = 0x0D1A # 1 F # GetPName BLUE_BIAS = 0x0D1B # 1 F # GetPName ALPHA_SCALE = 0x0D1C # 1 F # GetPName ALPHA_BIAS = 0x0D1D # 1 F # GetPName DEPTH_SCALE = 0x0D1E # 1 F # GetPName DEPTH_BIAS = 0x0D1F # 1 F # GetPName MAX_EVAL_ORDER = 0x0D30 # 1 I # GetPName MAX_LIGHTS = 0x0D31 # 1 I # GetPName MAX_CLIP_PLANES = 0x0D32 # 1 I # GetPName MAX_PIXEL_MAP_TABLE = 0x0D34 # 1 I # GetPName MAX_ATTRIB_STACK_DEPTH = 0x0D35 # 1 I # GetPName MAX_MODELVIEW_STACK_DEPTH = 0x0D36 # 1 I # GetPName MAX_NAME_STACK_DEPTH = 0x0D37 # 1 I # GetPName MAX_PROJECTION_STACK_DEPTH = 0x0D38 # 1 I # GetPName MAX_TEXTURE_STACK_DEPTH = 0x0D39 # 1 I # GetPName MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B # 1 I # GetPName INDEX_BITS = 0x0D51 # 1 I # GetPName RED_BITS = 0x0D52 # 1 I # GetPName GREEN_BITS = 0x0D53 # 1 I # GetPName BLUE_BITS = 0x0D54 # 1 I # GetPName ALPHA_BITS = 0x0D55 # 1 I # GetPName DEPTH_BITS = 0x0D56 # 1 I # GetPName STENCIL_BITS = 0x0D57 # 1 I # GetPName ACCUM_RED_BITS = 0x0D58 # 1 I # GetPName ACCUM_GREEN_BITS = 0x0D59 # 1 I # GetPName ACCUM_BLUE_BITS = 0x0D5A # 1 I # GetPName ACCUM_ALPHA_BITS = 0x0D5B # 1 I # GetPName NAME_STACK_DEPTH = 0x0D70 # 1 I # GetPName AUTO_NORMAL = 0x0D80 # 1 I # GetPName MAP1_COLOR_4 = 0x0D90 # 1 I # GetPName MAP1_INDEX = 0x0D91 # 1 I # GetPName MAP1_NORMAL = 0x0D92 # 1 I # GetPName MAP1_TEXTURE_COORD_1 = 0x0D93 # 1 I # GetPName MAP1_TEXTURE_COORD_2 = 0x0D94 # 1 I # GetPName MAP1_TEXTURE_COORD_3 = 0x0D95 # 1 I # GetPName MAP1_TEXTURE_COORD_4 = 0x0D96 # 1 I # GetPName MAP1_VERTEX_3 = 0x0D97 # 1 I # GetPName MAP1_VERTEX_4 = 0x0D98 # 1 I # GetPName MAP2_COLOR_4 = 0x0DB0 # 1 I # GetPName MAP2_INDEX = 0x0DB1 # 1 I # GetPName MAP2_NORMAL = 0x0DB2 # 1 I # GetPName MAP2_TEXTURE_COORD_1 = 0x0DB3 # 1 I # GetPName MAP2_TEXTURE_COORD_2 = 0x0DB4 # 1 I # GetPName MAP2_TEXTURE_COORD_3 = 0x0DB5 # 1 I # GetPName MAP2_TEXTURE_COORD_4 = 0x0DB6 # 1 I # GetPName MAP2_VERTEX_3 = 0x0DB7 # 1 I # GetPName MAP2_VERTEX_4 = 0x0DB8 # 1 I # GetPName MAP1_GRID_DOMAIN = 0x0DD0 # 2 F # GetPName MAP1_GRID_SEGMENTS = 0x0DD1 # 1 I # GetPName MAP2_GRID_DOMAIN = 0x0DD2 # 4 F # GetPName MAP2_GRID_SEGMENTS = 0x0DD3 # 2 I # GetPName FEEDBACK_BUFFER_SIZE = 0x0DF1 # 1 I # GetPName FEEDBACK_BUFFER_TYPE = 0x0DF2 # 1 I # GetPName SELECTION_BUFFER_SIZE = 0x0DF4 # 1 I # GetPName VERTEX_ARRAY = 0x8074 # 1 I # GetPName NORMAL_ARRAY = 0x8075 # 1 I # GetPName COLOR_ARRAY = 0x8076 # 1 I # GetPName INDEX_ARRAY = 0x8077 # 1 I # GetPName TEXTURE_COORD_ARRAY = 0x8078 # 1 I # GetPName EDGE_FLAG_ARRAY = 0x8079 # 1 I # GetPName VERTEX_ARRAY_SIZE = 0x807A # 1 I # GetPName VERTEX_ARRAY_TYPE = 0x807B # 1 I # GetPName VERTEX_ARRAY_STRIDE = 0x807C # 1 I # GetPName NORMAL_ARRAY_TYPE = 0x807E # 1 I # GetPName NORMAL_ARRAY_STRIDE = 0x807F # 1 I # GetPName COLOR_ARRAY_SIZE = 0x8081 # 1 I # GetPName COLOR_ARRAY_TYPE = 0x8082 # 1 I # GetPName COLOR_ARRAY_STRIDE = 0x8083 # 1 I # GetPName INDEX_ARRAY_TYPE = 0x8085 # 1 I # GetPName INDEX_ARRAY_STRIDE = 0x8086 # 1 I # GetPName TEXTURE_COORD_ARRAY_SIZE = 0x8088 # 1 I # GetPName TEXTURE_COORD_ARRAY_TYPE = 0x8089 # 1 I # GetPName TEXTURE_COORD_ARRAY_STRIDE = 0x808A # 1 I # GetPName EDGE_FLAG_ARRAY_STRIDE = 0x808C # 1 I # GetPName passthru: /* GetTextureParameter */ TEXTURE_COMPONENTS = 0x1003 # GetTextureParameter TEXTURE_BORDER = 0x1005 # GetTextureParameter TEXTURE_LUMINANCE_SIZE = 0x8060 # GetTextureParameter TEXTURE_INTENSITY_SIZE = 0x8061 # GetTextureParameter TEXTURE_PRIORITY = 0x8066 # GetTextureParameter TEXTURE_RESIDENT = 0x8067 # GetTextureParameter passthru: /* LightParameter */ AMBIENT = 0x1200 # LightParameter DIFFUSE = 0x1201 # LightParameter SPECULAR = 0x1202 # LightParameter POSITION = 0x1203 # LightParameter SPOT_DIRECTION = 0x1204 # LightParameter SPOT_EXPONENT = 0x1205 # LightParameter SPOT_CUTOFF = 0x1206 # LightParameter CONSTANT_ATTENUATION = 0x1207 # LightParameter LINEAR_ATTENUATION = 0x1208 # LightParameter QUADRATIC_ATTENUATION = 0x1209 # LightParameter passthru: /* ListMode */ COMPILE = 0x1300 # ListMode COMPILE_AND_EXECUTE = 0x1301 # ListMode passthru: /* DataType */ 2_BYTES = 0x1407 # DataType 3_BYTES = 0x1408 # DataType 4_BYTES = 0x1409 # DataType passthru: /* MaterialParameter */ EMISSION = 0x1600 # MaterialParameter SHININESS = 0x1601 # MaterialParameter AMBIENT_AND_DIFFUSE = 0x1602 # MaterialParameter COLOR_INDEXES = 0x1603 # MaterialParameter passthru: /* MatrixMode */ MODELVIEW = 0x1700 # MatrixMode PROJECTION = 0x1701 # MatrixMode passthru: /* PixelFormat */ COLOR_INDEX = 0x1900 # PixelFormat LUMINANCE = 0x1909 # PixelFormat LUMINANCE_ALPHA = 0x190A # PixelFormat passthru: /* PixelType */ BITMAP = 0x1A00 # PixelType passthru: /* RenderingMode */ RENDER = 0x1C00 # RenderingMode FEEDBACK = 0x1C01 # RenderingMode SELECT = 0x1C02 # RenderingMode passthru: /* ShadingModel */ FLAT = 0x1D00 # ShadingModel SMOOTH = 0x1D01 # ShadingModel passthru: /* TextureCoordName */ S = 0x2000 # TextureCoordName T = 0x2001 # TextureCoordName R = 0x2002 # TextureCoordName Q = 0x2003 # TextureCoordName passthru: /* TextureEnvMode */ MODULATE = 0x2100 # TextureEnvMode DECAL = 0x2101 # TextureEnvMode passthru: /* TextureEnvParameter */ TEXTURE_ENV_MODE = 0x2200 # TextureEnvParameter TEXTURE_ENV_COLOR = 0x2201 # TextureEnvParameter passthru: /* TextureEnvTarget */ TEXTURE_ENV = 0x2300 # TextureEnvTarget passthru: /* TextureGenMode */ EYE_LINEAR = 0x2400 # TextureGenMode OBJECT_LINEAR = 0x2401 # TextureGenMode SPHERE_MAP = 0x2402 # TextureGenMode passthru: /* TextureGenParameter */ TEXTURE_GEN_MODE = 0x2500 # TextureGenParameter OBJECT_PLANE = 0x2501 # TextureGenParameter EYE_PLANE = 0x2502 # TextureGenParameter passthru: /* TextureWrapMode */ CLAMP = 0x2900 # TextureWrapMode passthru: /* PixelInternalFormat */ ALPHA4 = 0x803B # PixelInternalFormat ALPHA8 = 0x803C # PixelInternalFormat ALPHA12 = 0x803D # PixelInternalFormat ALPHA16 = 0x803E # PixelInternalFormat LUMINANCE4 = 0x803F # PixelInternalFormat LUMINANCE8 = 0x8040 # PixelInternalFormat LUMINANCE12 = 0x8041 # PixelInternalFormat LUMINANCE16 = 0x8042 # PixelInternalFormat LUMINANCE4_ALPHA4 = 0x8043 # PixelInternalFormat LUMINANCE6_ALPHA2 = 0x8044 # PixelInternalFormat LUMINANCE8_ALPHA8 = 0x8045 # PixelInternalFormat LUMINANCE12_ALPHA4 = 0x8046 # PixelInternalFormat LUMINANCE12_ALPHA12 = 0x8047 # PixelInternalFormat LUMINANCE16_ALPHA16 = 0x8048 # PixelInternalFormat INTENSITY = 0x8049 # PixelInternalFormat INTENSITY4 = 0x804A # PixelInternalFormat INTENSITY8 = 0x804B # PixelInternalFormat INTENSITY12 = 0x804C # PixelInternalFormat INTENSITY16 = 0x804D # PixelInternalFormat passthru: /* InterleavedArrayFormat */ V2F = 0x2A20 # InterleavedArrayFormat V3F = 0x2A21 # InterleavedArrayFormat C4UB_V2F = 0x2A22 # InterleavedArrayFormat C4UB_V3F = 0x2A23 # InterleavedArrayFormat C3F_V3F = 0x2A24 # InterleavedArrayFormat N3F_V3F = 0x2A25 # InterleavedArrayFormat C4F_N3F_V3F = 0x2A26 # InterleavedArrayFormat T2F_V3F = 0x2A27 # InterleavedArrayFormat T4F_V4F = 0x2A28 # InterleavedArrayFormat T2F_C4UB_V3F = 0x2A29 # InterleavedArrayFormat T2F_C3F_V3F = 0x2A2A # InterleavedArrayFormat T2F_N3F_V3F = 0x2A2B # InterleavedArrayFormat T2F_C4F_N3F_V3F = 0x2A2C # InterleavedArrayFormat T4F_C4F_N3F_V4F = 0x2A2D # InterleavedArrayFormat passthru: /* ClipPlaneName */ CLIP_PLANE0 = 0x3000 # 1 I # ClipPlaneName CLIP_PLANE1 = 0x3001 # 1 I # ClipPlaneName CLIP_PLANE2 = 0x3002 # 1 I # ClipPlaneName CLIP_PLANE3 = 0x3003 # 1 I # ClipPlaneName CLIP_PLANE4 = 0x3004 # 1 I # ClipPlaneName CLIP_PLANE5 = 0x3005 # 1 I # ClipPlaneName passthru: /* LightName */ LIGHT0 = 0x4000 # 1 I # LightName LIGHT1 = 0x4001 # 1 I # LightName LIGHT2 = 0x4002 # 1 I # LightName LIGHT3 = 0x4003 # 1 I # LightName LIGHT4 = 0x4004 # 1 I # LightName LIGHT5 = 0x4005 # 1 I # LightName LIGHT6 = 0x4006 # 1 I # LightName LIGHT7 = 0x4007 # 1 I # LightName ############################################################################### # # OpenGL 1.2 enums # ############################################################################### VERSION_1_2 enum: UNSIGNED_BYTE_3_3_2 = 0x8032 # Equivalent to EXT_packed_pixels UNSIGNED_SHORT_4_4_4_4 = 0x8033 UNSIGNED_SHORT_5_5_5_1 = 0x8034 UNSIGNED_INT_8_8_8_8 = 0x8035 UNSIGNED_INT_10_10_10_2 = 0x8036 TEXTURE_BINDING_3D = 0x806A # 1 I PACK_SKIP_IMAGES = 0x806B # 1 I PACK_IMAGE_HEIGHT = 0x806C # 1 F UNPACK_SKIP_IMAGES = 0x806D # 1 I UNPACK_IMAGE_HEIGHT = 0x806E # 1 F TEXTURE_3D = 0x806F # 1 I PROXY_TEXTURE_3D = 0x8070 TEXTURE_DEPTH = 0x8071 TEXTURE_WRAP_R = 0x8072 MAX_3D_TEXTURE_SIZE = 0x8073 # 1 I UNSIGNED_BYTE_2_3_3_REV = 0x8362 # New for OpenGL 1.2 UNSIGNED_SHORT_5_6_5 = 0x8363 UNSIGNED_SHORT_5_6_5_REV = 0x8364 UNSIGNED_SHORT_4_4_4_4_REV = 0x8365 UNSIGNED_SHORT_1_5_5_5_REV = 0x8366 UNSIGNED_INT_8_8_8_8_REV = 0x8367 UNSIGNED_INT_2_10_10_10_REV = 0x8368 BGR = 0x80E0 BGRA = 0x80E1 MAX_ELEMENTS_VERTICES = 0x80E8 MAX_ELEMENTS_INDICES = 0x80E9 CLAMP_TO_EDGE = 0x812F # Equivalent to SGIS_texture_edge_clamp TEXTURE_MIN_LOD = 0x813A # Equivalent to SGIS_texture_lod TEXTURE_MAX_LOD = 0x813B TEXTURE_BASE_LEVEL = 0x813C TEXTURE_MAX_LEVEL = 0x813D SMOOTH_POINT_SIZE_RANGE = 0x0B12 # 2 F SMOOTH_POINT_SIZE_GRANULARITY = 0x0B13 # 1 F SMOOTH_LINE_WIDTH_RANGE = 0x0B22 # 2 F SMOOTH_LINE_WIDTH_GRANULARITY = 0x0B23 # 1 F ALIASED_LINE_WIDTH_RANGE = 0x846E # 2 F VERSION_1_2_DEPRECATED enum: RESCALE_NORMAL = 0x803A # 1 I # Equivalent to EXT_rescale_normal LIGHT_MODEL_COLOR_CONTROL = 0x81F8 # 1 I SINGLE_COLOR = 0x81F9 SEPARATE_SPECULAR_COLOR = 0x81FA ALIASED_POINT_SIZE_RANGE = 0x846D # 2 F ARB_imaging enum: CONSTANT_COLOR = 0x8001 # Equivalent to EXT_blend_color ONE_MINUS_CONSTANT_COLOR = 0x8002 CONSTANT_ALPHA = 0x8003 ONE_MINUS_CONSTANT_ALPHA = 0x8004 BLEND_COLOR = 0x8005 # 4 F FUNC_ADD = 0x8006 # Equivalent to EXT_blend_minmax MIN = 0x8007 MAX = 0x8008 BLEND_EQUATION = 0x8009 # 1 I FUNC_SUBTRACT = 0x800A # Equivalent to EXT_blend_subtract FUNC_REVERSE_SUBTRACT = 0x800B ARB_imaging_DEPRECATED enum: CONVOLUTION_1D = 0x8010 # 1 I # Equivalent to EXT_convolution CONVOLUTION_2D = 0x8011 # 1 I SEPARABLE_2D = 0x8012 # 1 I CONVOLUTION_BORDER_MODE = 0x8013 CONVOLUTION_FILTER_SCALE = 0x8014 CONVOLUTION_FILTER_BIAS = 0x8015 REDUCE = 0x8016 CONVOLUTION_FORMAT = 0x8017 CONVOLUTION_WIDTH = 0x8018 CONVOLUTION_HEIGHT = 0x8019 MAX_CONVOLUTION_WIDTH = 0x801A MAX_CONVOLUTION_HEIGHT = 0x801B POST_CONVOLUTION_RED_SCALE = 0x801C # 1 F POST_CONVOLUTION_GREEN_SCALE = 0x801D # 1 F POST_CONVOLUTION_BLUE_SCALE = 0x801E # 1 F POST_CONVOLUTION_ALPHA_SCALE = 0x801F # 1 F POST_CONVOLUTION_RED_BIAS = 0x8020 # 1 F POST_CONVOLUTION_GREEN_BIAS = 0x8021 # 1 F POST_CONVOLUTION_BLUE_BIAS = 0x8022 # 1 F POST_CONVOLUTION_ALPHA_BIAS = 0x8023 # 1 F HISTOGRAM = 0x8024 # 1 I # Equivalent to EXT_histogram PROXY_HISTOGRAM = 0x8025 HISTOGRAM_WIDTH = 0x8026 HISTOGRAM_FORMAT = 0x8027 HISTOGRAM_RED_SIZE = 0x8028 HISTOGRAM_GREEN_SIZE = 0x8029 HISTOGRAM_BLUE_SIZE = 0x802A HISTOGRAM_ALPHA_SIZE = 0x802B HISTOGRAM_LUMINANCE_SIZE = 0x802C HISTOGRAM_SINK = 0x802D MINMAX = 0x802E # 1 I MINMAX_FORMAT = 0x802F MINMAX_SINK = 0x8030 TABLE_TOO_LARGE = 0x8031 COLOR_MATRIX = 0x80B1 # 16 F # Equivalent to SGI_color_matrix COLOR_MATRIX_STACK_DEPTH = 0x80B2 # 1 I MAX_COLOR_MATRIX_STACK_DEPTH = 0x80B3 # 1 I POST_COLOR_MATRIX_RED_SCALE = 0x80B4 # 1 F POST_COLOR_MATRIX_GREEN_SCALE = 0x80B5 # 1 F POST_COLOR_MATRIX_BLUE_SCALE = 0x80B6 # 1 F POST_COLOR_MATRIX_ALPHA_SCALE = 0x80B7 # 1 F POST_COLOR_MATRIX_RED_BIAS = 0x80B8 # 1 F POST_COLOR_MATRIX_GREEN_BIAS = 0x80B9 # 1 F POST_COLOR_MATRIX_BLUE_BIAS = 0x80BA # 1 F POST_COLOR_MATRIX_ALPHA_BIAS = 0x80BB # 1 F COLOR_TABLE = 0x80D0 # 1 I # Equivalent to SGI_color_table POST_CONVOLUTION_COLOR_TABLE = 0x80D1 # 1 I POST_COLOR_MATRIX_COLOR_TABLE = 0x80D2 # 1 I PROXY_COLOR_TABLE = 0x80D3 PROXY_POST_CONVOLUTION_COLOR_TABLE = 0x80D4 PROXY_POST_COLOR_MATRIX_COLOR_TABLE = 0x80D5 COLOR_TABLE_SCALE = 0x80D6 COLOR_TABLE_BIAS = 0x80D7 COLOR_TABLE_FORMAT = 0x80D8 COLOR_TABLE_WIDTH = 0x80D9 COLOR_TABLE_RED_SIZE = 0x80DA COLOR_TABLE_GREEN_SIZE = 0x80DB COLOR_TABLE_BLUE_SIZE = 0x80DC COLOR_TABLE_ALPHA_SIZE = 0x80DD COLOR_TABLE_LUMINANCE_SIZE = 0x80DE COLOR_TABLE_INTENSITY_SIZE = 0x80DF CONSTANT_BORDER = 0x8151 REPLICATE_BORDER = 0x8153 CONVOLUTION_BORDER_COLOR = 0x8154 ############################################################################### # # OpenGL 1.3 enums # ############################################################################### VERSION_1_3 enum: TEXTURE0 = 0x84C0 # Promoted from ARB_multitexture TEXTURE1 = 0x84C1 TEXTURE2 = 0x84C2 TEXTURE3 = 0x84C3 TEXTURE4 = 0x84C4 TEXTURE5 = 0x84C5 TEXTURE6 = 0x84C6 TEXTURE7 = 0x84C7 TEXTURE8 = 0x84C8 TEXTURE9 = 0x84C9 TEXTURE10 = 0x84CA TEXTURE11 = 0x84CB TEXTURE12 = 0x84CC TEXTURE13 = 0x84CD TEXTURE14 = 0x84CE TEXTURE15 = 0x84CF TEXTURE16 = 0x84D0 TEXTURE17 = 0x84D1 TEXTURE18 = 0x84D2 TEXTURE19 = 0x84D3 TEXTURE20 = 0x84D4 TEXTURE21 = 0x84D5 TEXTURE22 = 0x84D6 TEXTURE23 = 0x84D7 TEXTURE24 = 0x84D8 TEXTURE25 = 0x84D9 TEXTURE26 = 0x84DA TEXTURE27 = 0x84DB TEXTURE28 = 0x84DC TEXTURE29 = 0x84DD TEXTURE30 = 0x84DE TEXTURE31 = 0x84DF ACTIVE_TEXTURE = 0x84E0 # 1 I MULTISAMPLE = 0x809D # Promoted from ARB_multisample SAMPLE_ALPHA_TO_COVERAGE = 0x809E SAMPLE_ALPHA_TO_ONE = 0x809F SAMPLE_COVERAGE = 0x80A0 SAMPLE_BUFFERS = 0x80A8 SAMPLES = 0x80A9 SAMPLE_COVERAGE_VALUE = 0x80AA SAMPLE_COVERAGE_INVERT = 0x80AB TEXTURE_CUBE_MAP = 0x8513 TEXTURE_BINDING_CUBE_MAP = 0x8514 TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515 TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516 TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517 TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518 TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519 TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A PROXY_TEXTURE_CUBE_MAP = 0x851B MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C COMPRESSED_RGB = 0x84ED COMPRESSED_RGBA = 0x84EE TEXTURE_COMPRESSION_HINT = 0x84EF TEXTURE_COMPRESSED_IMAGE_SIZE = 0x86A0 TEXTURE_COMPRESSED = 0x86A1 NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2 COMPRESSED_TEXTURE_FORMATS = 0x86A3 CLAMP_TO_BORDER = 0x812D # Promoted from ARB_texture_border_clamp VERSION_1_3_DEPRECATED enum: CLIENT_ACTIVE_TEXTURE = 0x84E1 # 1 I MAX_TEXTURE_UNITS = 0x84E2 # 1 I TRANSPOSE_MODELVIEW_MATRIX = 0x84E3 # 16 F # Promoted from ARB_transpose_matrix TRANSPOSE_PROJECTION_MATRIX = 0x84E4 # 16 F TRANSPOSE_TEXTURE_MATRIX = 0x84E5 # 16 F TRANSPOSE_COLOR_MATRIX = 0x84E6 # 16 F MULTISAMPLE_BIT = 0x20000000 NORMAL_MAP = 0x8511 # Promoted from ARB_texture_cube_map REFLECTION_MAP = 0x8512 COMPRESSED_ALPHA = 0x84E9 # Promoted from ARB_texture_compression COMPRESSED_LUMINANCE = 0x84EA COMPRESSED_LUMINANCE_ALPHA = 0x84EB COMPRESSED_INTENSITY = 0x84EC COMBINE = 0x8570 # Promoted from ARB_texture_env_combine COMBINE_RGB = 0x8571 COMBINE_ALPHA = 0x8572 SOURCE0_RGB = 0x8580 SOURCE1_RGB = 0x8581 SOURCE2_RGB = 0x8582 SOURCE0_ALPHA = 0x8588 SOURCE1_ALPHA = 0x8589 SOURCE2_ALPHA = 0x858A OPERAND0_RGB = 0x8590 OPERAND1_RGB = 0x8591 OPERAND2_RGB = 0x8592 OPERAND0_ALPHA = 0x8598 OPERAND1_ALPHA = 0x8599 OPERAND2_ALPHA = 0x859A RGB_SCALE = 0x8573 ADD_SIGNED = 0x8574 INTERPOLATE = 0x8575 SUBTRACT = 0x84E7 CONSTANT = 0x8576 PRIMARY_COLOR = 0x8577 PREVIOUS = 0x8578 DOT3_RGB = 0x86AE # Promoted from ARB_texture_env_dot3 DOT3_RGBA = 0x86AF ############################################################################### # # OpenGL 1.4 enums # ############################################################################### VERSION_1_4 enum: BLEND_DST_RGB = 0x80C8 BLEND_SRC_RGB = 0x80C9 BLEND_DST_ALPHA = 0x80CA BLEND_SRC_ALPHA = 0x80CB POINT_FADE_THRESHOLD_SIZE = 0x8128 # 1 F DEPTH_COMPONENT16 = 0x81A5 DEPTH_COMPONENT24 = 0x81A6 DEPTH_COMPONENT32 = 0x81A7 MIRRORED_REPEAT = 0x8370 MAX_TEXTURE_LOD_BIAS = 0x84FD TEXTURE_LOD_BIAS = 0x8501 INCR_WRAP = 0x8507 DECR_WRAP = 0x8508 TEXTURE_DEPTH_SIZE = 0x884A TEXTURE_COMPARE_MODE = 0x884C TEXTURE_COMPARE_FUNC = 0x884D VERSION_1_4_DEPRECATED enum: POINT_SIZE_MIN = 0x8126 # 1 F POINT_SIZE_MAX = 0x8127 # 1 F POINT_DISTANCE_ATTENUATION = 0x8129 # 3 F GENERATE_MIPMAP = 0x8191 GENERATE_MIPMAP_HINT = 0x8192 # 1 I FOG_COORDINATE_SOURCE = 0x8450 # 1 I FOG_COORDINATE = 0x8451 FRAGMENT_DEPTH = 0x8452 CURRENT_FOG_COORDINATE = 0x8453 # 1 F FOG_COORDINATE_ARRAY_TYPE = 0x8454 # 1 I FOG_COORDINATE_ARRAY_STRIDE = 0x8455 # 1 I FOG_COORDINATE_ARRAY_POINTER = 0x8456 FOG_COORDINATE_ARRAY = 0x8457 # 1 I COLOR_SUM = 0x8458 # 1 I CURRENT_SECONDARY_COLOR = 0x8459 # 3 F SECONDARY_COLOR_ARRAY_SIZE = 0x845A # 1 I SECONDARY_COLOR_ARRAY_TYPE = 0x845B # 1 I SECONDARY_COLOR_ARRAY_STRIDE = 0x845C # 1 I SECONDARY_COLOR_ARRAY_POINTER = 0x845D SECONDARY_COLOR_ARRAY = 0x845E # 1 I TEXTURE_FILTER_CONTROL = 0x8500 DEPTH_TEXTURE_MODE = 0x884B COMPARE_R_TO_TEXTURE = 0x884E ############################################################################### # # OpenGL 1.5 enums # ############################################################################### VERSION_1_5 enum: BUFFER_SIZE = 0x8764 # ARB_vertex_buffer_object BUFFER_USAGE = 0x8765 # ARB_vertex_buffer_object QUERY_COUNTER_BITS = 0x8864 # ARB_occlusion_query CURRENT_QUERY = 0x8865 # ARB_occlusion_query QUERY_RESULT = 0x8866 # ARB_occlusion_query QUERY_RESULT_AVAILABLE = 0x8867 # ARB_occlusion_query ARRAY_BUFFER = 0x8892 # ARB_vertex_buffer_object ELEMENT_ARRAY_BUFFER = 0x8893 # ARB_vertex_buffer_object ARRAY_BUFFER_BINDING = 0x8894 # ARB_vertex_buffer_object ELEMENT_ARRAY_BUFFER_BINDING = 0x8895 # ARB_vertex_buffer_object VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F # ARB_vertex_buffer_object READ_ONLY = 0x88B8 # ARB_vertex_buffer_object WRITE_ONLY = 0x88B9 # ARB_vertex_buffer_object READ_WRITE = 0x88BA # ARB_vertex_buffer_object BUFFER_ACCESS = 0x88BB # ARB_vertex_buffer_object BUFFER_MAPPED = 0x88BC # ARB_vertex_buffer_object BUFFER_MAP_POINTER = 0x88BD # ARB_vertex_buffer_object STREAM_DRAW = 0x88E0 # ARB_vertex_buffer_object STREAM_READ = 0x88E1 # ARB_vertex_buffer_object STREAM_COPY = 0x88E2 # ARB_vertex_buffer_object STATIC_DRAW = 0x88E4 # ARB_vertex_buffer_object STATIC_READ = 0x88E5 # ARB_vertex_buffer_object STATIC_COPY = 0x88E6 # ARB_vertex_buffer_object DYNAMIC_DRAW = 0x88E8 # ARB_vertex_buffer_object DYNAMIC_READ = 0x88E9 # ARB_vertex_buffer_object DYNAMIC_COPY = 0x88EA # ARB_vertex_buffer_object SAMPLES_PASSED = 0x8914 # ARB_occlusion_query VERSION_1_5_DEPRECATED enum: VERTEX_ARRAY_BUFFER_BINDING = 0x8896 # ARB_vertex_buffer_object NORMAL_ARRAY_BUFFER_BINDING = 0x8897 # ARB_vertex_buffer_object COLOR_ARRAY_BUFFER_BINDING = 0x8898 # ARB_vertex_buffer_object INDEX_ARRAY_BUFFER_BINDING = 0x8899 # ARB_vertex_buffer_object TEXTURE_COORD_ARRAY_BUFFER_BINDING = 0x889A # ARB_vertex_buffer_object EDGE_FLAG_ARRAY_BUFFER_BINDING = 0x889B # ARB_vertex_buffer_object SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 0x889C # ARB_vertex_buffer_object FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889D # ARB_vertex_buffer_object WEIGHT_ARRAY_BUFFER_BINDING = 0x889E # ARB_vertex_buffer_object FOG_COORD_SRC = 0x8450 # alias GL_FOG_COORDINATE_SOURCE FOG_COORD = 0x8451 # alias GL_FOG_COORDINATE CURRENT_FOG_COORD = 0x8453 # alias GL_CURRENT_FOG_COORDINATE FOG_COORD_ARRAY_TYPE = 0x8454 # alias GL_FOG_COORDINATE_ARRAY_TYPE FOG_COORD_ARRAY_STRIDE = 0x8455 # alias GL_FOG_COORDINATE_ARRAY_STRIDE FOG_COORD_ARRAY_POINTER = 0x8456 # alias GL_FOG_COORDINATE_ARRAY_POINTER FOG_COORD_ARRAY = 0x8457 # alias GL_FOG_COORDINATE_ARRAY FOG_COORD_ARRAY_BUFFER_BINDING = 0x889D # alias GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING # New naming scheme SRC0_RGB = 0x8580 # alias GL_SOURCE0_RGB SRC1_RGB = 0x8581 # alias GL_SOURCE1_RGB SRC2_RGB = 0x8582 # alias GL_SOURCE2_RGB SRC0_ALPHA = 0x8588 # alias GL_SOURCE0_ALPHA SRC1_ALPHA = 0x8589 # alias GL_SOURCE1_ALPHA SRC2_ALPHA = 0x858A # alias GL_SOURCE2_ALPHA ############################################################################### # # OpenGL 2.0 enums # ############################################################################### VERSION_2_0 enum: BLEND_EQUATION_RGB = 0x8009 # EXT_blend_equation_separate # alias GL_BLEND_EQUATION VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622 # ARB_vertex_shader VERTEX_ATTRIB_ARRAY_SIZE = 0x8623 # ARB_vertex_shader VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624 # ARB_vertex_shader VERTEX_ATTRIB_ARRAY_TYPE = 0x8625 # ARB_vertex_shader CURRENT_VERTEX_ATTRIB = 0x8626 # ARB_vertex_shader VERTEX_PROGRAM_POINT_SIZE = 0x8642 # ARB_vertex_shader VERTEX_ATTRIB_ARRAY_POINTER = 0x8645 # ARB_vertex_shader STENCIL_BACK_FUNC = 0x8800 # ARB_stencil_two_side STENCIL_BACK_FAIL = 0x8801 # ARB_stencil_two_side STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802 # ARB_stencil_two_side STENCIL_BACK_PASS_DEPTH_PASS = 0x8803 # ARB_stencil_two_side MAX_DRAW_BUFFERS = 0x8824 # ARB_draw_buffers DRAW_BUFFER0 = 0x8825 # ARB_draw_buffers DRAW_BUFFER1 = 0x8826 # ARB_draw_buffers DRAW_BUFFER2 = 0x8827 # ARB_draw_buffers DRAW_BUFFER3 = 0x8828 # ARB_draw_buffers DRAW_BUFFER4 = 0x8829 # ARB_draw_buffers DRAW_BUFFER5 = 0x882A # ARB_draw_buffers DRAW_BUFFER6 = 0x882B # ARB_draw_buffers DRAW_BUFFER7 = 0x882C # ARB_draw_buffers DRAW_BUFFER8 = 0x882D # ARB_draw_buffers DRAW_BUFFER9 = 0x882E # ARB_draw_buffers DRAW_BUFFER10 = 0x882F # ARB_draw_buffers DRAW_BUFFER11 = 0x8830 # ARB_draw_buffers DRAW_BUFFER12 = 0x8831 # ARB_draw_buffers DRAW_BUFFER13 = 0x8832 # ARB_draw_buffers DRAW_BUFFER14 = 0x8833 # ARB_draw_buffers DRAW_BUFFER15 = 0x8834 # ARB_draw_buffers BLEND_EQUATION_ALPHA = 0x883D # EXT_blend_equation_separate MAX_VERTEX_ATTRIBS = 0x8869 # ARB_vertex_shader VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A # ARB_vertex_shader MAX_TEXTURE_IMAGE_UNITS = 0x8872 # ARB_vertex_shader, ARB_fragment_shader FRAGMENT_SHADER = 0x8B30 # ARB_fragment_shader VERTEX_SHADER = 0x8B31 # ARB_vertex_shader MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49 # ARB_fragment_shader MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A # ARB_vertex_shader MAX_VARYING_FLOATS = 0x8B4B # ARB_vertex_shader MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C # ARB_vertex_shader MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D # ARB_vertex_shader SHADER_TYPE = 0x8B4F # ARB_shader_objects FLOAT_VEC2 = 0x8B50 # ARB_shader_objects FLOAT_VEC3 = 0x8B51 # ARB_shader_objects FLOAT_VEC4 = 0x8B52 # ARB_shader_objects INT_VEC2 = 0x8B53 # ARB_shader_objects INT_VEC3 = 0x8B54 # ARB_shader_objects INT_VEC4 = 0x8B55 # ARB_shader_objects BOOL = 0x8B56 # ARB_shader_objects BOOL_VEC2 = 0x8B57 # ARB_shader_objects BOOL_VEC3 = 0x8B58 # ARB_shader_objects BOOL_VEC4 = 0x8B59 # ARB_shader_objects FLOAT_MAT2 = 0x8B5A # ARB_shader_objects FLOAT_MAT3 = 0x8B5B # ARB_shader_objects FLOAT_MAT4 = 0x8B5C # ARB_shader_objects SAMPLER_1D = 0x8B5D # ARB_shader_objects SAMPLER_2D = 0x8B5E # ARB_shader_objects SAMPLER_3D = 0x8B5F # ARB_shader_objects SAMPLER_CUBE = 0x8B60 # ARB_shader_objects SAMPLER_1D_SHADOW = 0x8B61 # ARB_shader_objects SAMPLER_2D_SHADOW = 0x8B62 # ARB_shader_objects DELETE_STATUS = 0x8B80 # ARB_shader_objects COMPILE_STATUS = 0x8B81 # ARB_shader_objects LINK_STATUS = 0x8B82 # ARB_shader_objects VALIDATE_STATUS = 0x8B83 # ARB_shader_objects INFO_LOG_LENGTH = 0x8B84 # ARB_shader_objects ATTACHED_SHADERS = 0x8B85 # ARB_shader_objects ACTIVE_UNIFORMS = 0x8B86 # ARB_shader_objects ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87 # ARB_shader_objects SHADER_SOURCE_LENGTH = 0x8B88 # ARB_shader_objects ACTIVE_ATTRIBUTES = 0x8B89 # ARB_vertex_shader ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A # ARB_vertex_shader FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B # ARB_fragment_shader SHADING_LANGUAGE_VERSION = 0x8B8C # ARB_shading_language_100 CURRENT_PROGRAM = 0x8B8D # ARB_shader_objects (added for 2.0) POINT_SPRITE_COORD_ORIGIN = 0x8CA0 # ARB_point_sprite (added for 2.0) LOWER_LEFT = 0x8CA1 # ARB_point_sprite (added for 2.0) UPPER_LEFT = 0x8CA2 # ARB_point_sprite (added for 2.0) STENCIL_BACK_REF = 0x8CA3 # ARB_stencil_two_side STENCIL_BACK_VALUE_MASK = 0x8CA4 # ARB_stencil_two_side STENCIL_BACK_WRITEMASK = 0x8CA5 # ARB_stencil_two_side VERSION_2_0_DEPRECATED enum: VERTEX_PROGRAM_TWO_SIDE = 0x8643 # ARB_vertex_shader POINT_SPRITE = 0x8861 # ARB_point_sprite COORD_REPLACE = 0x8862 # ARB_point_sprite MAX_TEXTURE_COORDS = 0x8871 # ARB_vertex_shader, ARB_fragment_shader ############################################################################### # # OpenGL 2.1 enums # ############################################################################### VERSION_2_1 enum: PIXEL_PACK_BUFFER = 0x88EB # ARB_pixel_buffer_object PIXEL_UNPACK_BUFFER = 0x88EC # ARB_pixel_buffer_object PIXEL_PACK_BUFFER_BINDING = 0x88ED # ARB_pixel_buffer_object PIXEL_UNPACK_BUFFER_BINDING = 0x88EF # ARB_pixel_buffer_object FLOAT_MAT2x3 = 0x8B65 # New for 2.1 FLOAT_MAT2x4 = 0x8B66 # New for 2.1 FLOAT_MAT3x2 = 0x8B67 # New for 2.1 FLOAT_MAT3x4 = 0x8B68 # New for 2.1 FLOAT_MAT4x2 = 0x8B69 # New for 2.1 FLOAT_MAT4x3 = 0x8B6A # New for 2.1 SRGB = 0x8C40 # EXT_texture_sRGB SRGB8 = 0x8C41 # EXT_texture_sRGB SRGB_ALPHA = 0x8C42 # EXT_texture_sRGB SRGB8_ALPHA8 = 0x8C43 # EXT_texture_sRGB COMPRESSED_SRGB = 0x8C48 # EXT_texture_sRGB COMPRESSED_SRGB_ALPHA = 0x8C49 # EXT_texture_sRGB VERSION_2_1_DEPRECATED enum: CURRENT_RASTER_SECONDARY_COLOR = 0x845F # New for 2.1 SLUMINANCE_ALPHA = 0x8C44 # EXT_texture_sRGB SLUMINANCE8_ALPHA8 = 0x8C45 # EXT_texture_sRGB SLUMINANCE = 0x8C46 # EXT_texture_sRGB SLUMINANCE8 = 0x8C47 # EXT_texture_sRGB COMPRESSED_SLUMINANCE = 0x8C4A # EXT_texture_sRGB COMPRESSED_SLUMINANCE_ALPHA = 0x8C4B # EXT_texture_sRGB ############################################################################### # # OpenGL 3.0 enums # ############################################################################### VERSION_3_0 enum: COMPARE_REF_TO_TEXTURE = 0x884E # alias GL_COMPARE_R_TO_TEXTURE_ARB CLIP_DISTANCE0 = 0x3000 # alias GL_CLIP_PLANE0 CLIP_DISTANCE1 = 0x3001 # alias GL_CLIP_PLANE1 CLIP_DISTANCE2 = 0x3002 # alias GL_CLIP_PLANE2 CLIP_DISTANCE3 = 0x3003 # alias GL_CLIP_PLANE3 CLIP_DISTANCE4 = 0x3004 # alias GL_CLIP_PLANE4 CLIP_DISTANCE5 = 0x3005 # alias GL_CLIP_PLANE5 CLIP_DISTANCE6 = 0x3006 CLIP_DISTANCE7 = 0x3007 MAX_CLIP_DISTANCES = 0x0D32 # alias GL_MAX_CLIP_PLANES MAJOR_VERSION = 0x821B MINOR_VERSION = 0x821C NUM_EXTENSIONS = 0x821D CONTEXT_FLAGS = 0x821E DEPTH_BUFFER = 0x8223 STENCIL_BUFFER = 0x8224 COMPRESSED_RED = 0x8225 COMPRESSED_RG = 0x8226 CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x0001 RGBA32F = 0x8814 RGB32F = 0x8815 RGBA16F = 0x881A RGB16F = 0x881B VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD MAX_ARRAY_TEXTURE_LAYERS = 0x88FF MIN_PROGRAM_TEXEL_OFFSET = 0x8904 MAX_PROGRAM_TEXEL_OFFSET = 0x8905 CLAMP_READ_COLOR = 0x891C FIXED_ONLY = 0x891D MAX_VARYING_COMPONENTS = 0x8B4B # alias GL_MAX_VARYING_FLOATS TEXTURE_1D_ARRAY = 0x8C18 PROXY_TEXTURE_1D_ARRAY = 0x8C19 TEXTURE_2D_ARRAY = 0x8C1A PROXY_TEXTURE_2D_ARRAY = 0x8C1B TEXTURE_BINDING_1D_ARRAY = 0x8C1C TEXTURE_BINDING_2D_ARRAY = 0x8C1D R11F_G11F_B10F = 0x8C3A UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B RGB9_E5 = 0x8C3D UNSIGNED_INT_5_9_9_9_REV = 0x8C3E TEXTURE_SHARED_SIZE = 0x8C3F TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76 TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80 TRANSFORM_FEEDBACK_VARYINGS = 0x8C83 TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84 TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85 PRIMITIVES_GENERATED = 0x8C87 TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88 RASTERIZER_DISCARD = 0x8C89 MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B INTERLEAVED_ATTRIBS = 0x8C8C SEPARATE_ATTRIBS = 0x8C8D TRANSFORM_FEEDBACK_BUFFER = 0x8C8E TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F RGBA32UI = 0x8D70 RGB32UI = 0x8D71 RGBA16UI = 0x8D76 RGB16UI = 0x8D77 RGBA8UI = 0x8D7C RGB8UI = 0x8D7D RGBA32I = 0x8D82 RGB32I = 0x8D83 RGBA16I = 0x8D88 RGB16I = 0x8D89 RGBA8I = 0x8D8E RGB8I = 0x8D8F RED_INTEGER = 0x8D94 GREEN_INTEGER = 0x8D95 BLUE_INTEGER = 0x8D96 RGB_INTEGER = 0x8D98 RGBA_INTEGER = 0x8D99 BGR_INTEGER = 0x8D9A BGRA_INTEGER = 0x8D9B SAMPLER_1D_ARRAY = 0x8DC0 SAMPLER_2D_ARRAY = 0x8DC1 SAMPLER_1D_ARRAY_SHADOW = 0x8DC3 SAMPLER_2D_ARRAY_SHADOW = 0x8DC4 SAMPLER_CUBE_SHADOW = 0x8DC5 UNSIGNED_INT_VEC2 = 0x8DC6 UNSIGNED_INT_VEC3 = 0x8DC7 UNSIGNED_INT_VEC4 = 0x8DC8 INT_SAMPLER_1D = 0x8DC9 INT_SAMPLER_2D = 0x8DCA INT_SAMPLER_3D = 0x8DCB INT_SAMPLER_CUBE = 0x8DCC INT_SAMPLER_1D_ARRAY = 0x8DCE INT_SAMPLER_2D_ARRAY = 0x8DCF UNSIGNED_INT_SAMPLER_1D = 0x8DD1 UNSIGNED_INT_SAMPLER_2D = 0x8DD2 UNSIGNED_INT_SAMPLER_3D = 0x8DD3 UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4 UNSIGNED_INT_SAMPLER_1D_ARRAY = 0x8DD6 UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7 QUERY_WAIT = 0x8E13 QUERY_NO_WAIT = 0x8E14 QUERY_BY_REGION_WAIT = 0x8E15 QUERY_BY_REGION_NO_WAIT = 0x8E16 BUFFER_ACCESS_FLAGS = 0x911F BUFFER_MAP_LENGTH = 0x9120 BUFFER_MAP_OFFSET = 0x9121 passthru: /* Reuse tokens from ARB_depth_buffer_float */ use ARB_depth_buffer_float DEPTH_COMPONENT32F use ARB_depth_buffer_float DEPTH32F_STENCIL8 use ARB_depth_buffer_float FLOAT_32_UNSIGNED_INT_24_8_REV passthru: /* Reuse tokens from ARB_framebuffer_object */ use ARB_framebuffer_object INVALID_FRAMEBUFFER_OPERATION use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_RED_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_GREEN_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_BLUE_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE use ARB_framebuffer_object FRAMEBUFFER_DEFAULT use ARB_framebuffer_object FRAMEBUFFER_UNDEFINED use ARB_framebuffer_object DEPTH_STENCIL_ATTACHMENT use ARB_framebuffer_object INDEX use ARB_framebuffer_object MAX_RENDERBUFFER_SIZE use ARB_framebuffer_object DEPTH_STENCIL use ARB_framebuffer_object UNSIGNED_INT_24_8 use ARB_framebuffer_object DEPTH24_STENCIL8 use ARB_framebuffer_object TEXTURE_STENCIL_SIZE use ARB_framebuffer_object TEXTURE_RED_TYPE use ARB_framebuffer_object TEXTURE_GREEN_TYPE use ARB_framebuffer_object TEXTURE_BLUE_TYPE use ARB_framebuffer_object TEXTURE_ALPHA_TYPE use ARB_framebuffer_object TEXTURE_DEPTH_TYPE use ARB_framebuffer_object UNSIGNED_NORMALIZED use ARB_framebuffer_object FRAMEBUFFER_BINDING use ARB_framebuffer_object DRAW_FRAMEBUFFER_BINDING use ARB_framebuffer_object RENDERBUFFER_BINDING use ARB_framebuffer_object READ_FRAMEBUFFER use ARB_framebuffer_object DRAW_FRAMEBUFFER use ARB_framebuffer_object READ_FRAMEBUFFER_BINDING use ARB_framebuffer_object RENDERBUFFER_SAMPLES use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_OBJECT_NAME use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER use ARB_framebuffer_object FRAMEBUFFER_COMPLETE use ARB_framebuffer_object FRAMEBUFFER_INCOMPLETE_ATTACHMENT use ARB_framebuffer_object FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT use ARB_framebuffer_object FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER use ARB_framebuffer_object FRAMEBUFFER_INCOMPLETE_READ_BUFFER use ARB_framebuffer_object FRAMEBUFFER_UNSUPPORTED use ARB_framebuffer_object MAX_COLOR_ATTACHMENTS use ARB_framebuffer_object COLOR_ATTACHMENT0 use ARB_framebuffer_object COLOR_ATTACHMENT1 use ARB_framebuffer_object COLOR_ATTACHMENT2 use ARB_framebuffer_object COLOR_ATTACHMENT3 use ARB_framebuffer_object COLOR_ATTACHMENT4 use ARB_framebuffer_object COLOR_ATTACHMENT5 use ARB_framebuffer_object COLOR_ATTACHMENT6 use ARB_framebuffer_object COLOR_ATTACHMENT7 use ARB_framebuffer_object COLOR_ATTACHMENT8 use ARB_framebuffer_object COLOR_ATTACHMENT9 use ARB_framebuffer_object COLOR_ATTACHMENT10 use ARB_framebuffer_object COLOR_ATTACHMENT11 use ARB_framebuffer_object COLOR_ATTACHMENT12 use ARB_framebuffer_object COLOR_ATTACHMENT13 use ARB_framebuffer_object COLOR_ATTACHMENT14 use ARB_framebuffer_object COLOR_ATTACHMENT15 use ARB_framebuffer_object DEPTH_ATTACHMENT use ARB_framebuffer_object STENCIL_ATTACHMENT use ARB_framebuffer_object FRAMEBUFFER use ARB_framebuffer_object RENDERBUFFER use ARB_framebuffer_object RENDERBUFFER_WIDTH use ARB_framebuffer_object RENDERBUFFER_HEIGHT use ARB_framebuffer_object RENDERBUFFER_INTERNAL_FORMAT use ARB_framebuffer_object STENCIL_INDEX1 use ARB_framebuffer_object STENCIL_INDEX4 use ARB_framebuffer_object STENCIL_INDEX8 use ARB_framebuffer_object STENCIL_INDEX16 use ARB_framebuffer_object RENDERBUFFER_RED_SIZE use ARB_framebuffer_object RENDERBUFFER_GREEN_SIZE use ARB_framebuffer_object RENDERBUFFER_BLUE_SIZE use ARB_framebuffer_object RENDERBUFFER_ALPHA_SIZE use ARB_framebuffer_object RENDERBUFFER_DEPTH_SIZE use ARB_framebuffer_object RENDERBUFFER_STENCIL_SIZE use ARB_framebuffer_object FRAMEBUFFER_INCOMPLETE_MULTISAMPLE use ARB_framebuffer_object MAX_SAMPLES passthru: /* Reuse tokens from ARB_framebuffer_sRGB */ use ARB_framebuffer_sRGB FRAMEBUFFER_SRGB passthru: /* Reuse tokens from ARB_half_float_vertex */ use ARB_half_float_vertex HALF_FLOAT passthru: /* Reuse tokens from ARB_map_buffer_range */ use ARB_map_buffer_range MAP_READ_BIT use ARB_map_buffer_range MAP_WRITE_BIT use ARB_map_buffer_range MAP_INVALIDATE_RANGE_BIT use ARB_map_buffer_range MAP_INVALIDATE_BUFFER_BIT use ARB_map_buffer_range MAP_FLUSH_EXPLICIT_BIT use ARB_map_buffer_range MAP_UNSYNCHRONIZED_BIT passthru: /* Reuse tokens from ARB_texture_compression_rgtc */ use ARB_texture_compression_rgtc COMPRESSED_RED_RGTC1 use ARB_texture_compression_rgtc COMPRESSED_SIGNED_RED_RGTC1 use ARB_texture_compression_rgtc COMPRESSED_RG_RGTC2 use ARB_texture_compression_rgtc COMPRESSED_SIGNED_RG_RGTC2 passthru: /* Reuse tokens from ARB_texture_rg */ use ARB_texture_rg RG use ARB_texture_rg RG_INTEGER use ARB_texture_rg R8 use ARB_texture_rg R16 use ARB_texture_rg RG8 use ARB_texture_rg RG16 use ARB_texture_rg R16F use ARB_texture_rg R32F use ARB_texture_rg RG16F use ARB_texture_rg RG32F use ARB_texture_rg R8I use ARB_texture_rg R8UI use ARB_texture_rg R16I use ARB_texture_rg R16UI use ARB_texture_rg R32I use ARB_texture_rg R32UI use ARB_texture_rg RG8I use ARB_texture_rg RG8UI use ARB_texture_rg RG16I use ARB_texture_rg RG16UI use ARB_texture_rg RG32I use ARB_texture_rg RG32UI passthru: /* Reuse tokens from ARB_vertex_array_object */ use ARB_vertex_array_object VERTEX_ARRAY_BINDING VERSION_3_0_DEPRECATED enum: CLAMP_VERTEX_COLOR = 0x891A CLAMP_FRAGMENT_COLOR = 0x891B ALPHA_INTEGER = 0x8D97 passthru: /* Reuse tokens from ARB_framebuffer_object */ use ARB_framebuffer_object TEXTURE_LUMINANCE_TYPE use ARB_framebuffer_object TEXTURE_INTENSITY_TYPE ############################################################################### # # OpenGL 3.1 enums # ############################################################################### VERSION_3_1 enum: SAMPLER_2D_RECT = 0x8B63 # ARB_shader_objects + ARB_texture_rectangle SAMPLER_2D_RECT_SHADOW = 0x8B64 # ARB_shader_objects + ARB_texture_rectangle SAMPLER_BUFFER = 0x8DC2 # EXT_gpu_shader4 + ARB_texture_buffer_object INT_SAMPLER_2D_RECT = 0x8DCD # EXT_gpu_shader4 + ARB_texture_rectangle INT_SAMPLER_BUFFER = 0x8DD0 # EXT_gpu_shader4 + ARB_texture_buffer_object UNSIGNED_INT_SAMPLER_2D_RECT = 0x8DD5 # EXT_gpu_shader4 + ARB_texture_rectangle UNSIGNED_INT_SAMPLER_BUFFER = 0x8DD8 # EXT_gpu_shader4 + ARB_texture_buffer_object TEXTURE_BUFFER = 0x8C2A # ARB_texture_buffer_object MAX_TEXTURE_BUFFER_SIZE = 0x8C2B # ARB_texture_buffer_object TEXTURE_BINDING_BUFFER = 0x8C2C # ARB_texture_buffer_object TEXTURE_BUFFER_DATA_STORE_BINDING = 0x8C2D # ARB_texture_buffer_object TEXTURE_BUFFER_FORMAT = 0x8C2E # ARB_texture_buffer_object TEXTURE_RECTANGLE = 0x84F5 # ARB_texture_rectangle TEXTURE_BINDING_RECTANGLE = 0x84F6 # ARB_texture_rectangle PROXY_TEXTURE_RECTANGLE = 0x84F7 # ARB_texture_rectangle MAX_RECTANGLE_TEXTURE_SIZE = 0x84F8 # ARB_texture_rectangle RED_SNORM = 0x8F90 # 3.1 RG_SNORM = 0x8F91 # 3.1 RGB_SNORM = 0x8F92 # 3.1 RGBA_SNORM = 0x8F93 # 3.1 R8_SNORM = 0x8F94 # 3.1 RG8_SNORM = 0x8F95 # 3.1 RGB8_SNORM = 0x8F96 # 3.1 RGBA8_SNORM = 0x8F97 # 3.1 R16_SNORM = 0x8F98 # 3.1 RG16_SNORM = 0x8F99 # 3.1 RGB16_SNORM = 0x8F9A # 3.1 RGBA16_SNORM = 0x8F9B # 3.1 SIGNED_NORMALIZED = 0x8F9C # 3.1 PRIMITIVE_RESTART = 0x8F9D # 3.1 (different from NV_primitive_restart) PRIMITIVE_RESTART_INDEX = 0x8F9E # 3.1 (different from NV_primitive_restart) passthru: /* Reuse tokens from ARB_copy_buffer */ use ARB_copy_buffer COPY_READ_BUFFER use ARB_copy_buffer COPY_WRITE_BUFFER passthru: /* Would reuse tokens from ARB_draw_instanced, but it has none */ passthru: /* Reuse tokens from ARB_uniform_buffer_object */ use ARB_uniform_buffer_object UNIFORM_BUFFER use ARB_uniform_buffer_object UNIFORM_BUFFER_BINDING use ARB_uniform_buffer_object UNIFORM_BUFFER_START use ARB_uniform_buffer_object UNIFORM_BUFFER_SIZE use ARB_uniform_buffer_object MAX_VERTEX_UNIFORM_BLOCKS use ARB_uniform_buffer_object MAX_FRAGMENT_UNIFORM_BLOCKS use ARB_uniform_buffer_object MAX_COMBINED_UNIFORM_BLOCKS use ARB_uniform_buffer_object MAX_UNIFORM_BUFFER_BINDINGS use ARB_uniform_buffer_object MAX_UNIFORM_BLOCK_SIZE use ARB_uniform_buffer_object MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS use ARB_uniform_buffer_object MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS use ARB_uniform_buffer_object UNIFORM_BUFFER_OFFSET_ALIGNMENT use ARB_uniform_buffer_object ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH use ARB_uniform_buffer_object ACTIVE_UNIFORM_BLOCKS use ARB_uniform_buffer_object UNIFORM_TYPE use ARB_uniform_buffer_object UNIFORM_SIZE use ARB_uniform_buffer_object UNIFORM_NAME_LENGTH use ARB_uniform_buffer_object UNIFORM_BLOCK_INDEX use ARB_uniform_buffer_object UNIFORM_OFFSET use ARB_uniform_buffer_object UNIFORM_ARRAY_STRIDE use ARB_uniform_buffer_object UNIFORM_MATRIX_STRIDE use ARB_uniform_buffer_object UNIFORM_IS_ROW_MAJOR use ARB_uniform_buffer_object UNIFORM_BLOCK_BINDING use ARB_uniform_buffer_object UNIFORM_BLOCK_DATA_SIZE use ARB_uniform_buffer_object UNIFORM_BLOCK_NAME_LENGTH use ARB_uniform_buffer_object UNIFORM_BLOCK_ACTIVE_UNIFORMS use ARB_uniform_buffer_object UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES use ARB_uniform_buffer_object UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER use ARB_uniform_buffer_object UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER use ARB_uniform_buffer_object INVALID_INDEX ############################################################################### # # OpenGL 3.2 enums # ############################################################################### VERSION_3_2 enum: CONTEXT_CORE_PROFILE_BIT = 0x00000001 CONTEXT_COMPATIBILITY_PROFILE_BIT = 0x00000002 LINES_ADJACENCY = 0x000A LINE_STRIP_ADJACENCY = 0x000B TRIANGLES_ADJACENCY = 0x000C TRIANGLE_STRIP_ADJACENCY = 0x000D PROGRAM_POINT_SIZE = 0x8642 MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 0x8C29 FRAMEBUFFER_ATTACHMENT_LAYERED = 0x8DA7 FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0x8DA8 GEOMETRY_SHADER = 0x8DD9 GEOMETRY_VERTICES_OUT = 0x8916 GEOMETRY_INPUT_TYPE = 0x8917 GEOMETRY_OUTPUT_TYPE = 0x8918 MAX_GEOMETRY_UNIFORM_COMPONENTS = 0x8DDF MAX_GEOMETRY_OUTPUT_VERTICES = 0x8DE0 MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 0x8DE1 MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122 MAX_GEOMETRY_INPUT_COMPONENTS = 0x9123 MAX_GEOMETRY_OUTPUT_COMPONENTS = 0x9124 MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125 CONTEXT_PROFILE_MASK = 0x9126 use VERSION_3_0 MAX_VARYING_COMPONENTS use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER passthru: /* Reuse tokens from ARB_depth_clamp */ use ARB_depth_clamp DEPTH_CLAMP passthru: /* Would reuse tokens from ARB_draw_elements_base_vertex, but it has none */ passthru: /* Would reuse tokens from ARB_fragment_coord_conventions, but it has none */ passthru: /* Reuse tokens from ARB_provoking_vertex */ use ARB_provoking_vertex QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION use ARB_provoking_vertex FIRST_VERTEX_CONVENTION use ARB_provoking_vertex LAST_VERTEX_CONVENTION use ARB_provoking_vertex PROVOKING_VERTEX passthru: /* Reuse tokens from ARB_seamless_cube_map */ use ARB_seamless_cube_map TEXTURE_CUBE_MAP_SEAMLESS passthru: /* Reuse tokens from ARB_sync */ use ARB_sync MAX_SERVER_WAIT_TIMEOUT use ARB_sync OBJECT_TYPE use ARB_sync SYNC_CONDITION use ARB_sync SYNC_STATUS use ARB_sync SYNC_FLAGS use ARB_sync SYNC_FENCE use ARB_sync SYNC_GPU_COMMANDS_COMPLETE use ARB_sync UNSIGNALED use ARB_sync SIGNALED use ARB_sync ALREADY_SIGNALED use ARB_sync TIMEOUT_EXPIRED use ARB_sync CONDITION_SATISFIED use ARB_sync WAIT_FAILED use ARB_sync TIMEOUT_IGNORED use ARB_sync SYNC_FLUSH_COMMANDS_BIT use ARB_sync TIMEOUT_IGNORED passthru: /* Reuse tokens from ARB_texture_multisample */ use ARB_texture_multisample SAMPLE_POSITION use ARB_texture_multisample SAMPLE_MASK use ARB_texture_multisample SAMPLE_MASK_VALUE use ARB_texture_multisample MAX_SAMPLE_MASK_WORDS use ARB_texture_multisample TEXTURE_2D_MULTISAMPLE use ARB_texture_multisample PROXY_TEXTURE_2D_MULTISAMPLE use ARB_texture_multisample TEXTURE_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample TEXTURE_BINDING_2D_MULTISAMPLE use ARB_texture_multisample TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample TEXTURE_SAMPLES use ARB_texture_multisample TEXTURE_FIXED_SAMPLE_LOCATIONS use ARB_texture_multisample SAMPLER_2D_MULTISAMPLE use ARB_texture_multisample INT_SAMPLER_2D_MULTISAMPLE use ARB_texture_multisample UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE use ARB_texture_multisample SAMPLER_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample INT_SAMPLER_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY use ARB_texture_multisample MAX_COLOR_TEXTURE_SAMPLES use ARB_texture_multisample MAX_DEPTH_TEXTURE_SAMPLES use ARB_texture_multisample MAX_INTEGER_SAMPLES passthru: /* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */ ############################################################################### # # OpenGL 3.3 enums # ############################################################################### VERSION_3_3 enum: passthru: /* Reuse tokens from ARB_blend_func_extended */ use ARB_blend_func_extended SRC1_COLOR use ARB_blend_func_extended ONE_MINUS_SRC1_COLOR use ARB_blend_func_extended ONE_MINUS_SRC1_ALPHA use ARB_blend_func_extended MAX_DUAL_SOURCE_DRAW_BUFFERS passthru: /* Would reuse tokens from ARB_explicit_attrib_location, but it has none */ passthru: /* Reuse tokens from ARB_occlusion_query2 */ use ARB_occlusion_query2 ANY_SAMPLES_PASSED passthru: /* Reuse tokens from ARB_sampler_objects */ use ARB_sampler_objects SAMPLER_BINDING passthru: /* Would reuse tokens from ARB_shader_bit_encoding, but it has none */ passthru: /* Reuse tokens from ARB_texture_rgb10_a2ui */ use ARB_texture_rgb10_a2ui RGB10_A2UI passthru: /* Reuse tokens from ARB_texture_swizzle */ use ARB_texture_swizzle TEXTURE_SWIZZLE_R use ARB_texture_swizzle TEXTURE_SWIZZLE_G use ARB_texture_swizzle TEXTURE_SWIZZLE_B use ARB_texture_swizzle TEXTURE_SWIZZLE_A use ARB_texture_swizzle TEXTURE_SWIZZLE_RGBA passthru: /* Reuse tokens from ARB_timer_query */ use ARB_timer_query TIME_ELAPSED use ARB_timer_query TIMESTAMP passthru: /* Reuse tokens from ARB_vertex_type_2_10_10_10_rev */ use ARB_vertex_type_2_10_10_10_rev INT_2_10_10_10_REV ############################################################################### # # OpenGL 4.0 enums # ############################################################################### VERSION_4_0 enum: passthru: /* Reuse tokens from ARB_draw_indirect */ use ARB_draw_indirect DRAW_INDIRECT_BUFFER use ARB_draw_indirect DRAW_INDIRECT_BUFFER_BINDING passthru: /* Reuse tokens from ARB_gpu_shader5 */ use ARB_gpu_shader5 GEOMETRY_SHADER_INVOCATIONS use ARB_gpu_shader5 MAX_GEOMETRY_SHADER_INVOCATIONS use ARB_gpu_shader5 MIN_FRAGMENT_INTERPOLATION_OFFSET use ARB_gpu_shader5 MAX_FRAGMENT_INTERPOLATION_OFFSET use ARB_gpu_shader5 FRAGMENT_INTERPOLATION_OFFSET_BITS use ARB_gpu_shader5 MAX_VERTEX_STREAMS passthru: /* Reuse tokens from ARB_gpu_shader_fp64 */ use ARB_gpu_shader_fp64 DOUBLE_VEC2 use ARB_gpu_shader_fp64 DOUBLE_VEC3 use ARB_gpu_shader_fp64 DOUBLE_VEC4 use ARB_gpu_shader_fp64 DOUBLE_MAT2 use ARB_gpu_shader_fp64 DOUBLE_MAT3 use ARB_gpu_shader_fp64 DOUBLE_MAT4 use ARB_gpu_shader_fp64 DOUBLE_MAT2x3 use ARB_gpu_shader_fp64 DOUBLE_MAT2x4 use ARB_gpu_shader_fp64 DOUBLE_MAT3x2 use ARB_gpu_shader_fp64 DOUBLE_MAT3x4 use ARB_gpu_shader_fp64 DOUBLE_MAT4x2 use ARB_gpu_shader_fp64 DOUBLE_MAT4x3 passthru: /* Reuse tokens from ARB_shader_subroutine */ use ARB_shader_subroutine ACTIVE_SUBROUTINES use ARB_shader_subroutine ACTIVE_SUBROUTINE_UNIFORMS use ARB_shader_subroutine ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS use ARB_shader_subroutine ACTIVE_SUBROUTINE_MAX_LENGTH use ARB_shader_subroutine ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH use ARB_shader_subroutine MAX_SUBROUTINES use ARB_shader_subroutine MAX_SUBROUTINE_UNIFORM_LOCATIONS use ARB_shader_subroutine NUM_COMPATIBLE_SUBROUTINES use ARB_shader_subroutine COMPATIBLE_SUBROUTINES passthru: /* Reuse tokens from ARB_tessellation_shader */ use ARB_tessellation_shader PATCHES use ARB_tessellation_shader PATCH_VERTICES use ARB_tessellation_shader PATCH_DEFAULT_INNER_LEVEL use ARB_tessellation_shader PATCH_DEFAULT_OUTER_LEVEL use ARB_tessellation_shader TESS_CONTROL_OUTPUT_VERTICES use ARB_tessellation_shader TESS_GEN_MODE use ARB_tessellation_shader TESS_GEN_SPACING use ARB_tessellation_shader TESS_GEN_VERTEX_ORDER use ARB_tessellation_shader TESS_GEN_POINT_MODE use ARB_tessellation_shader ISOLINES use ARB_tessellation_shader FRACTIONAL_ODD use ARB_tessellation_shader FRACTIONAL_EVEN use ARB_tessellation_shader MAX_PATCH_VERTICES use ARB_tessellation_shader MAX_TESS_GEN_LEVEL use ARB_tessellation_shader MAX_TESS_CONTROL_UNIFORM_COMPONENTS use ARB_tessellation_shader MAX_TESS_EVALUATION_UNIFORM_COMPONENTS use ARB_tessellation_shader MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS use ARB_tessellation_shader MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS use ARB_tessellation_shader MAX_TESS_CONTROL_OUTPUT_COMPONENTS use ARB_tessellation_shader MAX_TESS_PATCH_COMPONENTS use ARB_tessellation_shader MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS use ARB_tessellation_shader MAX_TESS_EVALUATION_OUTPUT_COMPONENTS use ARB_tessellation_shader MAX_TESS_CONTROL_UNIFORM_BLOCKS use ARB_tessellation_shader MAX_TESS_EVALUATION_UNIFORM_BLOCKS use ARB_tessellation_shader MAX_TESS_CONTROL_INPUT_COMPONENTS use ARB_tessellation_shader MAX_TESS_EVALUATION_INPUT_COMPONENTS use ARB_tessellation_shader MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS use ARB_tessellation_shader MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS use ARB_tessellation_shader UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER use ARB_tessellation_shader UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER use ARB_tessellation_shader TESS_EVALUATION_SHADER use ARB_tessellation_shader TESS_CONTROL_SHADER passthru: /* Would reuse tokens from ARB_texture_buffer_object_rgb32, but it has none */ passthru: /* Reuse tokens from ARB_transform_feedback2 */ use ARB_tessellation_shader TRANSFORM_FEEDBACK use ARB_tessellation_shader TRANSFORM_FEEDBACK_BUFFER_PAUSED use ARB_tessellation_shader TRANSFORM_FEEDBACK_BUFFER_ACTIVE use ARB_tessellation_shader TRANSFORM_FEEDBACK_BINDING passthru: /* Reuse tokens from ARB_transform_feedback3 */ use ARB_tessellation_shader MAX_TRANSFORM_FEEDBACK_BUFFERS use ARB_tessellation_shader MAX_VERTEX_STREAMS ############################################################################### # # ARB extensions, in ARB extension order # ############################################################################### ############################################################################### # ARB Extension #1 ARB_multitexture enum: TEXTURE0_ARB = 0x84C0 TEXTURE1_ARB = 0x84C1 TEXTURE2_ARB = 0x84C2 TEXTURE3_ARB = 0x84C3 TEXTURE4_ARB = 0x84C4 TEXTURE5_ARB = 0x84C5 TEXTURE6_ARB = 0x84C6 TEXTURE7_ARB = 0x84C7 TEXTURE8_ARB = 0x84C8 TEXTURE9_ARB = 0x84C9 TEXTURE10_ARB = 0x84CA TEXTURE11_ARB = 0x84CB TEXTURE12_ARB = 0x84CC TEXTURE13_ARB = 0x84CD TEXTURE14_ARB = 0x84CE TEXTURE15_ARB = 0x84CF TEXTURE16_ARB = 0x84D0 TEXTURE17_ARB = 0x84D1 TEXTURE18_ARB = 0x84D2 TEXTURE19_ARB = 0x84D3 TEXTURE20_ARB = 0x84D4 TEXTURE21_ARB = 0x84D5 TEXTURE22_ARB = 0x84D6 TEXTURE23_ARB = 0x84D7 TEXTURE24_ARB = 0x84D8 TEXTURE25_ARB = 0x84D9 TEXTURE26_ARB = 0x84DA TEXTURE27_ARB = 0x84DB TEXTURE28_ARB = 0x84DC TEXTURE29_ARB = 0x84DD TEXTURE30_ARB = 0x84DE TEXTURE31_ARB = 0x84DF ACTIVE_TEXTURE_ARB = 0x84E0 # 1 I CLIENT_ACTIVE_TEXTURE_ARB = 0x84E1 # 1 I MAX_TEXTURE_UNITS_ARB = 0x84E2 # 1 I ############################################################################### # No new tokens # ARB Extension #2 - GLX_ARB_get_proc_address ############################################################################### # ARB Extension #3 ARB_transpose_matrix enum: TRANSPOSE_MODELVIEW_MATRIX_ARB = 0x84E3 # 16 F TRANSPOSE_PROJECTION_MATRIX_ARB = 0x84E4 # 16 F TRANSPOSE_TEXTURE_MATRIX_ARB = 0x84E5 # 16 F TRANSPOSE_COLOR_MATRIX_ARB = 0x84E6 # 16 F ############################################################################### # No new tokens # ARB Extension #4 - WGL_ARB_buffer_region ############################################################################### # ARB Extension #5 ARB_multisample enum: MULTISAMPLE_ARB = 0x809D SAMPLE_ALPHA_TO_COVERAGE_ARB = 0x809E SAMPLE_ALPHA_TO_ONE_ARB = 0x809F SAMPLE_COVERAGE_ARB = 0x80A0 SAMPLE_BUFFERS_ARB = 0x80A8 SAMPLES_ARB = 0x80A9 SAMPLE_COVERAGE_VALUE_ARB = 0x80AA SAMPLE_COVERAGE_INVERT_ARB = 0x80AB MULTISAMPLE_BIT_ARB = 0x20000000 ############################################################################### # No new tokens # ARB Extension #6 ARB_texture_env_add enum: ############################################################################### # ARB Extension #7 ARB_texture_cube_map enum: NORMAL_MAP_ARB = 0x8511 REFLECTION_MAP_ARB = 0x8512 TEXTURE_CUBE_MAP_ARB = 0x8513 TEXTURE_BINDING_CUBE_MAP_ARB = 0x8514 TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 0x8515 TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 0x8516 TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 0x8517 TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 0x8518 TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 0x8519 TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 0x851A PROXY_TEXTURE_CUBE_MAP_ARB = 0x851B MAX_CUBE_MAP_TEXTURE_SIZE_ARB = 0x851C ############################################################################### # No new tokens # ARB Extension #8 - WGL_ARB_extensions_string # ARB Extension #9 - WGL_ARB_pixel_format # ARB Extension #10 - WGL_ARB_make_current_read # ARB Extension #11 - WGL_ARB_pbuffer ############################################################################### # ARB Extension #12 ARB_texture_compression enum: COMPRESSED_ALPHA_ARB = 0x84E9 COMPRESSED_LUMINANCE_ARB = 0x84EA COMPRESSED_LUMINANCE_ALPHA_ARB = 0x84EB COMPRESSED_INTENSITY_ARB = 0x84EC COMPRESSED_RGB_ARB = 0x84ED COMPRESSED_RGBA_ARB = 0x84EE TEXTURE_COMPRESSION_HINT_ARB = 0x84EF TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = 0x86A0 TEXTURE_COMPRESSED_ARB = 0x86A1 NUM_COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A2 COMPRESSED_TEXTURE_FORMATS_ARB = 0x86A3 ############################################################################### # ARB Extension #13 # Promoted from #36 SGIS_texture_border_clamp ARB_texture_border_clamp enum: CLAMP_TO_BORDER_ARB = 0x812D ############################################################################### # ARB Extension #14 - promoted from #54 EXT_point_parameters # Promoted from #54 {SGIS,EXT}_point_parameters ARB_point_parameters enum: POINT_SIZE_MIN_ARB = 0x8126 # 1 F POINT_SIZE_MAX_ARB = 0x8127 # 1 F POINT_FADE_THRESHOLD_SIZE_ARB = 0x8128 # 1 F POINT_DISTANCE_ATTENUATION_ARB = 0x8129 # 3 F ############################################################################### # ARB Extension #15 ARB_vertex_blend enum: MAX_VERTEX_UNITS_ARB = 0x86A4 ACTIVE_VERTEX_UNITS_ARB = 0x86A5 WEIGHT_SUM_UNITY_ARB = 0x86A6 VERTEX_BLEND_ARB = 0x86A7 CURRENT_WEIGHT_ARB = 0x86A8 WEIGHT_ARRAY_TYPE_ARB = 0x86A9 WEIGHT_ARRAY_STRIDE_ARB = 0x86AA WEIGHT_ARRAY_SIZE_ARB = 0x86AB WEIGHT_ARRAY_POINTER_ARB = 0x86AC WEIGHT_ARRAY_ARB = 0x86AD MODELVIEW0_ARB = 0x1700 MODELVIEW1_ARB = 0x850A MODELVIEW2_ARB = 0x8722 MODELVIEW3_ARB = 0x8723 MODELVIEW4_ARB = 0x8724 MODELVIEW5_ARB = 0x8725 MODELVIEW6_ARB = 0x8726 MODELVIEW7_ARB = 0x8727 MODELVIEW8_ARB = 0x8728 MODELVIEW9_ARB = 0x8729 MODELVIEW10_ARB = 0x872A MODELVIEW11_ARB = 0x872B MODELVIEW12_ARB = 0x872C MODELVIEW13_ARB = 0x872D MODELVIEW14_ARB = 0x872E MODELVIEW15_ARB = 0x872F MODELVIEW16_ARB = 0x8730 MODELVIEW17_ARB = 0x8731 MODELVIEW18_ARB = 0x8732 MODELVIEW19_ARB = 0x8733 MODELVIEW20_ARB = 0x8734 MODELVIEW21_ARB = 0x8735 MODELVIEW22_ARB = 0x8736 MODELVIEW23_ARB = 0x8737 MODELVIEW24_ARB = 0x8738 MODELVIEW25_ARB = 0x8739 MODELVIEW26_ARB = 0x873A MODELVIEW27_ARB = 0x873B MODELVIEW28_ARB = 0x873C MODELVIEW29_ARB = 0x873D MODELVIEW30_ARB = 0x873E MODELVIEW31_ARB = 0x873F ############################################################################### # ARB Extension #16 ARB_matrix_palette enum: MATRIX_PALETTE_ARB = 0x8840 MAX_MATRIX_PALETTE_STACK_DEPTH_ARB = 0x8841 MAX_PALETTE_MATRICES_ARB = 0x8842 CURRENT_PALETTE_MATRIX_ARB = 0x8843 MATRIX_INDEX_ARRAY_ARB = 0x8844 CURRENT_MATRIX_INDEX_ARB = 0x8845 MATRIX_INDEX_ARRAY_SIZE_ARB = 0x8846 MATRIX_INDEX_ARRAY_TYPE_ARB = 0x8847 MATRIX_INDEX_ARRAY_STRIDE_ARB = 0x8848 MATRIX_INDEX_ARRAY_POINTER_ARB = 0x8849 ############################################################################### # ARB Extension #17 # Shares enum values with EXT_texture_env_combine ARB_texture_env_combine enum: COMBINE_ARB = 0x8570 COMBINE_RGB_ARB = 0x8571 COMBINE_ALPHA_ARB = 0x8572 SOURCE0_RGB_ARB = 0x8580 SOURCE1_RGB_ARB = 0x8581 SOURCE2_RGB_ARB = 0x8582 SOURCE0_ALPHA_ARB = 0x8588 SOURCE1_ALPHA_ARB = 0x8589 SOURCE2_ALPHA_ARB = 0x858A OPERAND0_RGB_ARB = 0x8590 OPERAND1_RGB_ARB = 0x8591 OPERAND2_RGB_ARB = 0x8592 OPERAND0_ALPHA_ARB = 0x8598 OPERAND1_ALPHA_ARB = 0x8599 OPERAND2_ALPHA_ARB = 0x859A RGB_SCALE_ARB = 0x8573 ADD_SIGNED_ARB = 0x8574 INTERPOLATE_ARB = 0x8575 SUBTRACT_ARB = 0x84E7 CONSTANT_ARB = 0x8576 PRIMARY_COLOR_ARB = 0x8577 PREVIOUS_ARB = 0x8578 ############################################################################### # No new tokens # ARB Extension #18 ARB_texture_env_crossbar enum: ############################################################################### # ARB Extension #19 # Promoted from #220 EXT_texture_env_dot3; enum values changed ARB_texture_env_dot3 enum: DOT3_RGB_ARB = 0x86AE DOT3_RGBA_ARB = 0x86AF ############################################################################### # No new tokens # ARB Extension #20 - WGL_ARB_render_texture ############################################################################### # ARB Extension #21 ARB_texture_mirrored_repeat enum: MIRRORED_REPEAT_ARB = 0x8370 ############################################################################### # ARB Extension #22 ARB_depth_texture enum: DEPTH_COMPONENT16_ARB = 0x81A5 DEPTH_COMPONENT24_ARB = 0x81A6 DEPTH_COMPONENT32_ARB = 0x81A7 TEXTURE_DEPTH_SIZE_ARB = 0x884A DEPTH_TEXTURE_MODE_ARB = 0x884B ############################################################################### # ARB Extension #23 ARB_shadow enum: TEXTURE_COMPARE_MODE_ARB = 0x884C TEXTURE_COMPARE_FUNC_ARB = 0x884D COMPARE_R_TO_TEXTURE_ARB = 0x884E ############################################################################### # ARB Extension #24 ARB_shadow_ambient enum: TEXTURE_COMPARE_FAIL_VALUE_ARB = 0x80BF ############################################################################### # No new tokens # ARB Extension #25 ARB_window_pos enum: ############################################################################### # ARB Extension #26 # ARB_vertex_program enums are shared by ARB_fragment_program are so marked. # Unfortunately, PROGRAM_BINDING_ARB does accidentally reuse 0x8677 - # this was a spec editing typo that's now uncorrectable. ARB_vertex_program enum: COLOR_SUM_ARB = 0x8458 VERTEX_PROGRAM_ARB = 0x8620 VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622 VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623 VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624 VERTEX_ATTRIB_ARRAY_TYPE_ARB = 0x8625 CURRENT_VERTEX_ATTRIB_ARB = 0x8626 PROGRAM_LENGTH_ARB = 0x8627 # shared PROGRAM_STRING_ARB = 0x8628 # shared MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = 0x862E # shared MAX_PROGRAM_MATRICES_ARB = 0x862F # shared CURRENT_MATRIX_STACK_DEPTH_ARB = 0x8640 # shared CURRENT_MATRIX_ARB = 0x8641 # shared VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642 VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643 VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645 PROGRAM_ERROR_POSITION_ARB = 0x864B # shared PROGRAM_BINDING_ARB = 0x8677 # shared MAX_VERTEX_ATTRIBS_ARB = 0x8869 VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A PROGRAM_ERROR_STRING_ARB = 0x8874 # shared PROGRAM_FORMAT_ASCII_ARB = 0x8875 # shared PROGRAM_FORMAT_ARB = 0x8876 # shared PROGRAM_INSTRUCTIONS_ARB = 0x88A0 # shared MAX_PROGRAM_INSTRUCTIONS_ARB = 0x88A1 # shared PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A2 # shared MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A3 # shared PROGRAM_TEMPORARIES_ARB = 0x88A4 # shared MAX_PROGRAM_TEMPORARIES_ARB = 0x88A5 # shared PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A6 # shared MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A7 # shared PROGRAM_PARAMETERS_ARB = 0x88A8 # shared MAX_PROGRAM_PARAMETERS_ARB = 0x88A9 # shared PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AA # shared MAX_PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AB # shared PROGRAM_ATTRIBS_ARB = 0x88AC # shared MAX_PROGRAM_ATTRIBS_ARB = 0x88AD # shared PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AE # shared MAX_PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AF # shared PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B0 # shared MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B1 # shared PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B2 # shared MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B3 # shared MAX_PROGRAM_LOCAL_PARAMETERS_ARB = 0x88B4 # shared MAX_PROGRAM_ENV_PARAMETERS_ARB = 0x88B5 # shared PROGRAM_UNDER_NATIVE_LIMITS_ARB = 0x88B6 # shared TRANSPOSE_CURRENT_MATRIX_ARB = 0x88B7 # shared MATRIX0_ARB = 0x88C0 # shared MATRIX1_ARB = 0x88C1 # shared MATRIX2_ARB = 0x88C2 # shared MATRIX3_ARB = 0x88C3 # shared MATRIX4_ARB = 0x88C4 # shared MATRIX5_ARB = 0x88C5 # shared MATRIX6_ARB = 0x88C6 # shared MATRIX7_ARB = 0x88C7 # shared MATRIX8_ARB = 0x88C8 # shared MATRIX9_ARB = 0x88C9 # shared MATRIX10_ARB = 0x88CA # shared MATRIX11_ARB = 0x88CB # shared MATRIX12_ARB = 0x88CC # shared MATRIX13_ARB = 0x88CD # shared MATRIX14_ARB = 0x88CE # shared MATRIX15_ARB = 0x88CF # shared MATRIX16_ARB = 0x88D0 # shared MATRIX17_ARB = 0x88D1 # shared MATRIX18_ARB = 0x88D2 # shared MATRIX19_ARB = 0x88D3 # shared MATRIX20_ARB = 0x88D4 # shared MATRIX21_ARB = 0x88D5 # shared MATRIX22_ARB = 0x88D6 # shared MATRIX23_ARB = 0x88D7 # shared MATRIX24_ARB = 0x88D8 # shared MATRIX25_ARB = 0x88D9 # shared MATRIX26_ARB = 0x88DA # shared MATRIX27_ARB = 0x88DB # shared MATRIX28_ARB = 0x88DC # shared MATRIX29_ARB = 0x88DD # shared MATRIX30_ARB = 0x88DE # shared MATRIX31_ARB = 0x88DF # shared ############################################################################### # ARB Extension #27 # Some ARB_fragment_program enums are shared with ARB_vertex_program, # and are only included in that #define block, for now. ARB_fragment_program enum: # PROGRAM_LENGTH_ARB = 0x8627 # shared # PROGRAM_STRING_ARB = 0x8628 # shared # MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB = 0x862E # shared # MAX_PROGRAM_MATRICES_ARB = 0x862F # shared # CURRENT_MATRIX_STACK_DEPTH_ARB = 0x8640 # shared # CURRENT_MATRIX_ARB = 0x8641 # shared # PROGRAM_ERROR_POSITION_ARB = 0x864B # shared # PROGRAM_BINDING_ARB = 0x8677 # shared FRAGMENT_PROGRAM_ARB = 0x8804 PROGRAM_ALU_INSTRUCTIONS_ARB = 0x8805 PROGRAM_TEX_INSTRUCTIONS_ARB = 0x8806 PROGRAM_TEX_INDIRECTIONS_ARB = 0x8807 PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 0x8808 PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 0x8809 PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 0x880A MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = 0x880B MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = 0x880C MAX_PROGRAM_TEX_INDIRECTIONS_ARB = 0x880D MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = 0x880E MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = 0x880F MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = 0x8810 MAX_TEXTURE_COORDS_ARB = 0x8871 MAX_TEXTURE_IMAGE_UNITS_ARB = 0x8872 # PROGRAM_ERROR_STRING_ARB = 0x8874 # shared # PROGRAM_FORMAT_ASCII_ARB = 0x8875 # shared # PROGRAM_FORMAT_ARB = 0x8876 # shared # PROGRAM_INSTRUCTIONS_ARB = 0x88A0 # shared # MAX_PROGRAM_INSTRUCTIONS_ARB = 0x88A1 # shared # PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A2 # shared # MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB = 0x88A3 # shared # PROGRAM_TEMPORARIES_ARB = 0x88A4 # shared # MAX_PROGRAM_TEMPORARIES_ARB = 0x88A5 # shared # PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A6 # shared # MAX_PROGRAM_NATIVE_TEMPORARIES_ARB = 0x88A7 # shared # PROGRAM_PARAMETERS_ARB = 0x88A8 # shared # MAX_PROGRAM_PARAMETERS_ARB = 0x88A9 # shared # PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AA # shared # MAX_PROGRAM_NATIVE_PARAMETERS_ARB = 0x88AB # shared # PROGRAM_ATTRIBS_ARB = 0x88AC # shared # MAX_PROGRAM_ATTRIBS_ARB = 0x88AD # shared # PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AE # shared # MAX_PROGRAM_NATIVE_ATTRIBS_ARB = 0x88AF # shared # PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B0 # shared # MAX_PROGRAM_ADDRESS_REGISTERS_ARB = 0x88B1 # shared # PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B2 # shared # MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB = 0x88B3 # shared # MAX_PROGRAM_LOCAL_PARAMETERS_ARB = 0x88B4 # shared # MAX_PROGRAM_ENV_PARAMETERS_ARB = 0x88B5 # shared # PROGRAM_UNDER_NATIVE_LIMITS_ARB = 0x88B6 # shared # TRANSPOSE_CURRENT_MATRIX_ARB = 0x88B7 # shared # MATRIX0_ARB = 0x88C0 # shared # MATRIX1_ARB = 0x88C1 # shared # MATRIX2_ARB = 0x88C2 # shared # MATRIX3_ARB = 0x88C3 # shared # MATRIX4_ARB = 0x88C4 # shared # MATRIX5_ARB = 0x88C5 # shared # MATRIX6_ARB = 0x88C6 # shared # MATRIX7_ARB = 0x88C7 # shared # MATRIX8_ARB = 0x88C8 # shared # MATRIX9_ARB = 0x88C9 # shared # MATRIX10_ARB = 0x88CA # shared # MATRIX11_ARB = 0x88CB # shared # MATRIX12_ARB = 0x88CC # shared # MATRIX13_ARB = 0x88CD # shared # MATRIX14_ARB = 0x88CE # shared # MATRIX15_ARB = 0x88CF # shared # MATRIX16_ARB = 0x88D0 # shared # MATRIX17_ARB = 0x88D1 # shared # MATRIX18_ARB = 0x88D2 # shared # MATRIX19_ARB = 0x88D3 # shared # MATRIX20_ARB = 0x88D4 # shared # MATRIX21_ARB = 0x88D5 # shared # MATRIX22_ARB = 0x88D6 # shared # MATRIX23_ARB = 0x88D7 # shared # MATRIX24_ARB = 0x88D8 # shared # MATRIX25_ARB = 0x88D9 # shared # MATRIX26_ARB = 0x88DA # shared # MATRIX27_ARB = 0x88DB # shared # MATRIX28_ARB = 0x88DC # shared # MATRIX29_ARB = 0x88DD # shared # MATRIX30_ARB = 0x88DE # shared # MATRIX31_ARB = 0x88DF # shared ############################################################################### # ARB Extension #28 ARB_vertex_buffer_object enum: BUFFER_SIZE_ARB = 0x8764 BUFFER_USAGE_ARB = 0x8765 ARRAY_BUFFER_ARB = 0x8892 ELEMENT_ARRAY_BUFFER_ARB = 0x8893 ARRAY_BUFFER_BINDING_ARB = 0x8894 ELEMENT_ARRAY_BUFFER_BINDING_ARB = 0x8895 VERTEX_ARRAY_BUFFER_BINDING_ARB = 0x8896 NORMAL_ARRAY_BUFFER_BINDING_ARB = 0x8897 COLOR_ARRAY_BUFFER_BINDING_ARB = 0x8898 INDEX_ARRAY_BUFFER_BINDING_ARB = 0x8899 TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB = 0x889A EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB = 0x889B SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB = 0x889C FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB = 0x889D WEIGHT_ARRAY_BUFFER_BINDING_ARB = 0x889E VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB = 0x889F READ_ONLY_ARB = 0x88B8 WRITE_ONLY_ARB = 0x88B9 READ_WRITE_ARB = 0x88BA BUFFER_ACCESS_ARB = 0x88BB BUFFER_MAPPED_ARB = 0x88BC BUFFER_MAP_POINTER_ARB = 0x88BD STREAM_DRAW_ARB = 0x88E0 STREAM_READ_ARB = 0x88E1 STREAM_COPY_ARB = 0x88E2 STATIC_DRAW_ARB = 0x88E4 STATIC_READ_ARB = 0x88E5 STATIC_COPY_ARB = 0x88E6 DYNAMIC_DRAW_ARB = 0x88E8 DYNAMIC_READ_ARB = 0x88E9 DYNAMIC_COPY_ARB = 0x88EA ############################################################################### # ARB Extension #29 ARB_occlusion_query enum: QUERY_COUNTER_BITS_ARB = 0x8864 CURRENT_QUERY_ARB = 0x8865 QUERY_RESULT_ARB = 0x8866 QUERY_RESULT_AVAILABLE_ARB = 0x8867 SAMPLES_PASSED_ARB = 0x8914 ############################################################################### # ARB Extension #30 ARB_shader_objects enum: PROGRAM_OBJECT_ARB = 0x8B40 SHADER_OBJECT_ARB = 0x8B48 OBJECT_TYPE_ARB = 0x8B4E OBJECT_SUBTYPE_ARB = 0x8B4F FLOAT_VEC2_ARB = 0x8B50 FLOAT_VEC3_ARB = 0x8B51 FLOAT_VEC4_ARB = 0x8B52 INT_VEC2_ARB = 0x8B53 INT_VEC3_ARB = 0x8B54 INT_VEC4_ARB = 0x8B55 BOOL_ARB = 0x8B56 BOOL_VEC2_ARB = 0x8B57 BOOL_VEC3_ARB = 0x8B58 BOOL_VEC4_ARB = 0x8B59 FLOAT_MAT2_ARB = 0x8B5A FLOAT_MAT3_ARB = 0x8B5B FLOAT_MAT4_ARB = 0x8B5C SAMPLER_1D_ARB = 0x8B5D SAMPLER_2D_ARB = 0x8B5E SAMPLER_3D_ARB = 0x8B5F SAMPLER_CUBE_ARB = 0x8B60 SAMPLER_1D_SHADOW_ARB = 0x8B61 SAMPLER_2D_SHADOW_ARB = 0x8B62 SAMPLER_2D_RECT_ARB = 0x8B63 SAMPLER_2D_RECT_SHADOW_ARB = 0x8B64 OBJECT_DELETE_STATUS_ARB = 0x8B80 OBJECT_COMPILE_STATUS_ARB = 0x8B81 OBJECT_LINK_STATUS_ARB = 0x8B82 OBJECT_VALIDATE_STATUS_ARB = 0x8B83 OBJECT_INFO_LOG_LENGTH_ARB = 0x8B84 OBJECT_ATTACHED_OBJECTS_ARB = 0x8B85 OBJECT_ACTIVE_UNIFORMS_ARB = 0x8B86 OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB = 0x8B87 OBJECT_SHADER_SOURCE_LENGTH_ARB = 0x8B88 ############################################################################### # ARB Extension #31 # Additional enums are reused from ARB_vertex/fragment_program and ARB_shader_objects ARB_vertex_shader enum: VERTEX_SHADER_ARB = 0x8B31 MAX_VERTEX_UNIFORM_COMPONENTS_ARB = 0x8B4A MAX_VARYING_FLOATS_ARB = 0x8B4B MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB = 0x8B4C MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB = 0x8B4D OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89 OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A ############################################################################### # ARB Extension #32 # Additional enums are reused from ARB_fragment_program and ARB_shader_objects ARB_fragment_shader enum: FRAGMENT_SHADER_ARB = 0x8B30 MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB = 0x8B49 FRAGMENT_SHADER_DERIVATIVE_HINT_ARB = 0x8B8B ############################################################################### # ARB Extension #33 ARB_shading_language_100 enum: SHADING_LANGUAGE_VERSION_ARB = 0x8B8C ############################################################################### # ARB Extension #34 # No new tokens ARB_texture_non_power_of_two enum: ############################################################################### # ARB Extension #35 ARB_point_sprite enum: POINT_SPRITE_ARB = 0x8861 COORD_REPLACE_ARB = 0x8862 ############################################################################### # ARB Extension #36 # No new tokens ARB_fragment_program_shadow enum: ############################################################################### # ARB Extension #37 ARB_draw_buffers enum: MAX_DRAW_BUFFERS_ARB = 0x8824 DRAW_BUFFER0_ARB = 0x8825 DRAW_BUFFER1_ARB = 0x8826 DRAW_BUFFER2_ARB = 0x8827 DRAW_BUFFER3_ARB = 0x8828 DRAW_BUFFER4_ARB = 0x8829 DRAW_BUFFER5_ARB = 0x882A DRAW_BUFFER6_ARB = 0x882B DRAW_BUFFER7_ARB = 0x882C DRAW_BUFFER8_ARB = 0x882D DRAW_BUFFER9_ARB = 0x882E DRAW_BUFFER10_ARB = 0x882F DRAW_BUFFER11_ARB = 0x8830 DRAW_BUFFER12_ARB = 0x8831 DRAW_BUFFER13_ARB = 0x8832 DRAW_BUFFER14_ARB = 0x8833 DRAW_BUFFER15_ARB = 0x8834 ############################################################################### # ARB Extension #38 ARB_texture_rectangle enum: TEXTURE_RECTANGLE_ARB = 0x84F5 TEXTURE_BINDING_RECTANGLE_ARB = 0x84F6 PROXY_TEXTURE_RECTANGLE_ARB = 0x84F7 MAX_RECTANGLE_TEXTURE_SIZE_ARB = 0x84F8 ############################################################################### # ARB Extension #39 ARB_color_buffer_float enum: RGBA_FLOAT_MODE_ARB = 0x8820 CLAMP_VERTEX_COLOR_ARB = 0x891A CLAMP_FRAGMENT_COLOR_ARB = 0x891B CLAMP_READ_COLOR_ARB = 0x891C FIXED_ONLY_ARB = 0x891D ############################################################################### # ARB Extension #40 ARB_half_float_pixel enum: HALF_FLOAT_ARB = 0x140B ############################################################################### # ARB Extension #41 ARB_texture_float enum: TEXTURE_RED_TYPE_ARB = 0x8C10 TEXTURE_GREEN_TYPE_ARB = 0x8C11 TEXTURE_BLUE_TYPE_ARB = 0x8C12 TEXTURE_ALPHA_TYPE_ARB = 0x8C13 TEXTURE_LUMINANCE_TYPE_ARB = 0x8C14 TEXTURE_INTENSITY_TYPE_ARB = 0x8C15 TEXTURE_DEPTH_TYPE_ARB = 0x8C16 UNSIGNED_NORMALIZED_ARB = 0x8C17 RGBA32F_ARB = 0x8814 RGB32F_ARB = 0x8815 ALPHA32F_ARB = 0x8816 INTENSITY32F_ARB = 0x8817 LUMINANCE32F_ARB = 0x8818 LUMINANCE_ALPHA32F_ARB = 0x8819 RGBA16F_ARB = 0x881A RGB16F_ARB = 0x881B ALPHA16F_ARB = 0x881C INTENSITY16F_ARB = 0x881D LUMINANCE16F_ARB = 0x881E LUMINANCE_ALPHA16F_ARB = 0x881F ############################################################################### # ARB Extension #42 ARB_pixel_buffer_object enum: PIXEL_PACK_BUFFER_ARB = 0x88EB PIXEL_UNPACK_BUFFER_ARB = 0x88EC PIXEL_PACK_BUFFER_BINDING_ARB = 0x88ED PIXEL_UNPACK_BUFFER_BINDING_ARB = 0x88EF ############################################################################### # ARB Extension #43 ARB_depth_buffer_float enum: DEPTH_COMPONENT32F = 0x8CAC DEPTH32F_STENCIL8 = 0x8CAD FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD ############################################################################### # ARB Extension #44 # No new tokens ARB_draw_instanced enum: ############################################################################### # ARB Extension #45 ARB_framebuffer_object enum: INVALID_FRAMEBUFFER_OPERATION = 0x0506 FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210 FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211 FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212 FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213 FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214 FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215 FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216 FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217 FRAMEBUFFER_DEFAULT = 0x8218 FRAMEBUFFER_UNDEFINED = 0x8219 DEPTH_STENCIL_ATTACHMENT = 0x821A MAX_RENDERBUFFER_SIZE = 0x84E8 DEPTH_STENCIL = 0x84F9 UNSIGNED_INT_24_8 = 0x84FA DEPTH24_STENCIL8 = 0x88F0 TEXTURE_STENCIL_SIZE = 0x88F1 TEXTURE_RED_TYPE = 0x8C10 TEXTURE_GREEN_TYPE = 0x8C11 TEXTURE_BLUE_TYPE = 0x8C12 TEXTURE_ALPHA_TYPE = 0x8C13 TEXTURE_DEPTH_TYPE = 0x8C16 UNSIGNED_NORMALIZED = 0x8C17 FRAMEBUFFER_BINDING = 0x8CA6 DRAW_FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING RENDERBUFFER_BINDING = 0x8CA7 READ_FRAMEBUFFER = 0x8CA8 DRAW_FRAMEBUFFER = 0x8CA9 READ_FRAMEBUFFER_BINDING = 0x8CAA RENDERBUFFER_SAMPLES = 0x8CAB FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0 FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1 FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2 FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3 FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4 FRAMEBUFFER_COMPLETE = 0x8CD5 FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6 FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7 FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC FRAMEBUFFER_UNSUPPORTED = 0x8CDD MAX_COLOR_ATTACHMENTS = 0x8CDF COLOR_ATTACHMENT0 = 0x8CE0 COLOR_ATTACHMENT1 = 0x8CE1 COLOR_ATTACHMENT2 = 0x8CE2 COLOR_ATTACHMENT3 = 0x8CE3 COLOR_ATTACHMENT4 = 0x8CE4 COLOR_ATTACHMENT5 = 0x8CE5 COLOR_ATTACHMENT6 = 0x8CE6 COLOR_ATTACHMENT7 = 0x8CE7 COLOR_ATTACHMENT8 = 0x8CE8 COLOR_ATTACHMENT9 = 0x8CE9 COLOR_ATTACHMENT10 = 0x8CEA COLOR_ATTACHMENT11 = 0x8CEB COLOR_ATTACHMENT12 = 0x8CEC COLOR_ATTACHMENT13 = 0x8CED COLOR_ATTACHMENT14 = 0x8CEE COLOR_ATTACHMENT15 = 0x8CEF DEPTH_ATTACHMENT = 0x8D00 STENCIL_ATTACHMENT = 0x8D20 FRAMEBUFFER = 0x8D40 RENDERBUFFER = 0x8D41 RENDERBUFFER_WIDTH = 0x8D42 RENDERBUFFER_HEIGHT = 0x8D43 RENDERBUFFER_INTERNAL_FORMAT = 0x8D44 STENCIL_INDEX1 = 0x8D46 STENCIL_INDEX4 = 0x8D47 STENCIL_INDEX8 = 0x8D48 STENCIL_INDEX16 = 0x8D49 RENDERBUFFER_RED_SIZE = 0x8D50 RENDERBUFFER_GREEN_SIZE = 0x8D51 RENDERBUFFER_BLUE_SIZE = 0x8D52 RENDERBUFFER_ALPHA_SIZE = 0x8D53 RENDERBUFFER_DEPTH_SIZE = 0x8D54 RENDERBUFFER_STENCIL_SIZE = 0x8D55 FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56 MAX_SAMPLES = 0x8D57 ARB_framebuffer_object_DEPRECATED enum: INDEX = 0x8222 TEXTURE_LUMINANCE_TYPE = 0x8C14 TEXTURE_INTENSITY_TYPE = 0x8C15 ############################################################################### # ARB Extension #46 ARB_framebuffer_sRGB enum: FRAMEBUFFER_SRGB = 0x8DB9 ############################################################################### # ARB Extension #47 ARB_geometry_shader4 enum: LINES_ADJACENCY_ARB = 0x000A LINE_STRIP_ADJACENCY_ARB = 0x000B TRIANGLES_ADJACENCY_ARB = 0x000C TRIANGLE_STRIP_ADJACENCY_ARB = 0x000D PROGRAM_POINT_SIZE_ARB = 0x8642 MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB = 0x8C29 FRAMEBUFFER_ATTACHMENT_LAYERED_ARB = 0x8DA7 FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB = 0x8DA8 FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB = 0x8DA9 GEOMETRY_SHADER_ARB = 0x8DD9 GEOMETRY_VERTICES_OUT_ARB = 0x8DDA GEOMETRY_INPUT_TYPE_ARB = 0x8DDB GEOMETRY_OUTPUT_TYPE_ARB = 0x8DDC MAX_GEOMETRY_VARYING_COMPONENTS_ARB = 0x8DDD MAX_VERTEX_VARYING_COMPONENTS_ARB = 0x8DDE MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB = 0x8DDF MAX_GEOMETRY_OUTPUT_VERTICES_ARB = 0x8DE0 MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB = 0x8DE1 use VERSION_3_0 MAX_VARYING_COMPONENTS use ARB_framebuffer_object FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER ############################################################################### # ARB Extension #48 ARB_half_float_vertex enum: HALF_FLOAT = 0x140B ############################################################################### # ARB Extension #49 ARB_instanced_arrays enum: VERTEX_ATTRIB_ARRAY_DIVISOR_ARB = 0x88FE ############################################################################### # ARB Extension #50 ARB_map_buffer_range enum: MAP_READ_BIT = 0x0001 MAP_WRITE_BIT = 0x0002 MAP_INVALIDATE_RANGE_BIT = 0x0004 MAP_INVALIDATE_BUFFER_BIT = 0x0008 MAP_FLUSH_EXPLICIT_BIT = 0x0010 MAP_UNSYNCHRONIZED_BIT = 0x0020 ############################################################################### # ARB Extension #51 ARB_texture_buffer_object enum: TEXTURE_BUFFER_ARB = 0x8C2A MAX_TEXTURE_BUFFER_SIZE_ARB = 0x8C2B TEXTURE_BINDING_BUFFER_ARB = 0x8C2C TEXTURE_BUFFER_DATA_STORE_BINDING_ARB = 0x8C2D TEXTURE_BUFFER_FORMAT_ARB = 0x8C2E ############################################################################### # ARB Extension #52 ARB_texture_compression_rgtc enum: COMPRESSED_RED_RGTC1 = 0x8DBB COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC COMPRESSED_RG_RGTC2 = 0x8DBD COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE ############################################################################### # ARB Extension #53 ARB_texture_rg enum: RG = 0x8227 RG_INTEGER = 0x8228 R8 = 0x8229 R16 = 0x822A RG8 = 0x822B RG16 = 0x822C R16F = 0x822D R32F = 0x822E RG16F = 0x822F RG32F = 0x8230 R8I = 0x8231 R8UI = 0x8232 R16I = 0x8233 R16UI = 0x8234 R32I = 0x8235 R32UI = 0x8236 RG8I = 0x8237 RG8UI = 0x8238 RG16I = 0x8239 RG16UI = 0x823A RG32I = 0x823B RG32UI = 0x823C ############################################################################### # ARB Extension #54 ARB_vertex_array_object enum: VERTEX_ARRAY_BINDING = 0x85B5 ############################################################################### # No new tokens # ARB Extension #55 - WGL_ARB_create_context # ARB Extension #56 - GLX_ARB_create_context ############################################################################### # ARB Extension #57 ARB_uniform_buffer_object enum: UNIFORM_BUFFER = 0x8A11 UNIFORM_BUFFER_BINDING = 0x8A28 UNIFORM_BUFFER_START = 0x8A29 UNIFORM_BUFFER_SIZE = 0x8A2A MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B MAX_GEOMETRY_UNIFORM_BLOCKS = 0x8A2C MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F MAX_UNIFORM_BLOCK_SIZE = 0x8A30 MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31 MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 0x8A32 MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33 UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34 ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35 ACTIVE_UNIFORM_BLOCKS = 0x8A36 UNIFORM_TYPE = 0x8A37 UNIFORM_SIZE = 0x8A38 UNIFORM_NAME_LENGTH = 0x8A39 UNIFORM_BLOCK_INDEX = 0x8A3A UNIFORM_OFFSET = 0x8A3B UNIFORM_ARRAY_STRIDE = 0x8A3C UNIFORM_MATRIX_STRIDE = 0x8A3D UNIFORM_IS_ROW_MAJOR = 0x8A3E UNIFORM_BLOCK_BINDING = 0x8A3F UNIFORM_BLOCK_DATA_SIZE = 0x8A40 UNIFORM_BLOCK_NAME_LENGTH = 0x8A41 UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42 UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43 UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44 UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 0x8A45 UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46 INVALID_INDEX = 0xFFFFFFFFu ############################################################################### # ARB Extension #58 # No new tokens ARB_compatibility enum: passthru: /* ARB_compatibility just defines tokens from core 3.0 */ ############################################################################### # ARB Extension #59 ARB_copy_buffer enum: COPY_READ_BUFFER = 0x8F36 COPY_WRITE_BUFFER = 0x8F37 ############################################################################### # ARB Extension #60 # No new tokens ARB_shader_texture_lod enum: ############################################################################### # ARB Extension #61 ARB_depth_clamp enum: DEPTH_CLAMP = 0x864F ############################################################################### # No new tokens # ARB Extension #62 ARB_draw_elements_base_vertex enum: ############################################################################### # No new tokens # ARB Extension #63 ARB_fragment_coord_conventions enum: ############################################################################### # ARB Extension #64 ARB_provoking_vertex enum: QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 0x8E4C FIRST_VERTEX_CONVENTION = 0x8E4D LAST_VERTEX_CONVENTION = 0x8E4E PROVOKING_VERTEX = 0x8E4F ############################################################################### # ARB Extension #65 ARB_seamless_cube_map enum: TEXTURE_CUBE_MAP_SEAMLESS = 0x884F ############################################################################### # ARB Extension #66 ARB_sync enum: MAX_SERVER_WAIT_TIMEOUT = 0x9111 OBJECT_TYPE = 0x9112 SYNC_CONDITION = 0x9113 SYNC_STATUS = 0x9114 SYNC_FLAGS = 0x9115 SYNC_FENCE = 0x9116 SYNC_GPU_COMMANDS_COMPLETE = 0x9117 UNSIGNALED = 0x9118 SIGNALED = 0x9119 ALREADY_SIGNALED = 0x911A TIMEOUT_EXPIRED = 0x911B CONDITION_SATISFIED = 0x911C WAIT_FAILED = 0x911D SYNC_FLUSH_COMMANDS_BIT = 0x00000001 TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFull ############################################################################### # ARB Extension #67 ARB_texture_multisample enum: SAMPLE_POSITION = 0x8E50 SAMPLE_MASK = 0x8E51 SAMPLE_MASK_VALUE = 0x8E52 MAX_SAMPLE_MASK_WORDS = 0x8E59 TEXTURE_2D_MULTISAMPLE = 0x9100 PROXY_TEXTURE_2D_MULTISAMPLE = 0x9101 TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9102 PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY = 0x9103 TEXTURE_BINDING_2D_MULTISAMPLE = 0x9104 TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 0x9105 TEXTURE_SAMPLES = 0x9106 TEXTURE_FIXED_SAMPLE_LOCATIONS = 0x9107 SAMPLER_2D_MULTISAMPLE = 0x9108 INT_SAMPLER_2D_MULTISAMPLE = 0x9109 UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 0x910A SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910B INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D MAX_COLOR_TEXTURE_SAMPLES = 0x910E MAX_DEPTH_TEXTURE_SAMPLES = 0x910F MAX_INTEGER_SAMPLES = 0x9110 ############################################################################### # ARB Extension #68 ARB_vertex_array_bgra enum: use VERSION_1_2 BGRA ############################################################################### # No new tokens # ARB Extension #69 ARB_draw_buffers_blend enum: #@@@ Add ARB suffixes here & functions! ############################################################################### # ARB Extension #70 #@@@ Add ARB suffixes here & functions! ARB_sample_shading enum: SAMPLE_SHADING = 0x8C36 MIN_SAMPLE_SHADING_VALUE = 0x8C37 ############################################################################### # ARB Extension #71 #@@@ Add ARB suffixes here & functions! ARB_texture_cube_map_array enum: TEXTURE_CUBE_MAP_ARRAY = 0x9009 TEXTURE_BINDING_CUBE_MAP_ARRAY = 0x900A PROXY_TEXTURE_CUBE_MAP_ARRAY = 0x900B SAMPLER_CUBE_MAP_ARRAY = 0x900C SAMPLER_CUBE_MAP_ARRAY_SHADOW = 0x900D INT_SAMPLER_CUBE_MAP_ARRAY = 0x900E UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 0x900F ############################################################################### # ARB Extension #72 #@@@ Add ARB suffixes here & functions! ARB_texture_gather enum: MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB = 0x8E5E MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB = 0x8E5F ############################################################################### # No new tokens # ARB Extension #73 ARB_texture_query_lod enum: ############################################################################### # No new tokens # ARB Extension #74 - WGL_ARB_create_context_profile # ARB Extension #75 - GLX_ARB_create_context_profile ############################################################################### # ARB Extension #76 ARB_shading_language_include enum: SHADER_INCLUDE_ARB = 0x8DAE NAMED_STRING_LENGTH_ARB = 0x8DE9 NAMED_STRING_TYPE_ARB = 0x8DEA ############################################################################### # ARB Extension #77 ARB_texture_compression_bptc enum: COMPRESSED_RGBA_BPTC_UNORM_ARB = 0x8E8C COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB = 0x8E8D COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB = 0x8E8E COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB = 0x8E8F ############################################################################### # ARB Extension #78 ARB_blend_func_extended enum: SRC1_COLOR = 0x88F9 use VERSION_1_5_DEPRECATED SRC1_ALPHA ONE_MINUS_SRC1_COLOR = 0x88FA ONE_MINUS_SRC1_ALPHA = 0x88FB MAX_DUAL_SOURCE_DRAW_BUFFERS = 0x88FC ############################################################################### # No new tokens # ARB Extension #79 ARB_explicit_attrib_location enum: ############################################################################### # ARB Extension #80 ARB_occlusion_query2 enum: ANY_SAMPLES_PASSED = 0x8C2F ############################################################################### # ARB Extension #81 ARB_sampler_objects enum: SAMPLER_BINDING = 0x8919 ############################################################################### # No new tokens # ARB Extension #82 ARB_shader_bit_encoding enum: ############################################################################### # ARB Extension #83 ARB_texture_rgb10_a2ui enum: RGB10_A2UI = 0x906F ############################################################################### # ARB Extension #84 ARB_texture_swizzle enum: TEXTURE_SWIZZLE_R = 0x8E42 TEXTURE_SWIZZLE_G = 0x8E43 TEXTURE_SWIZZLE_B = 0x8E44 TEXTURE_SWIZZLE_A = 0x8E45 TEXTURE_SWIZZLE_RGBA = 0x8E46 ############################################################################### # ARB Extension #85 ARB_timer_query enum: TIME_ELAPSED = 0x88BF TIMESTAMP = 0x8E28 ############################################################################### # ARB Extension #86 ARB_vertex_type_2_10_10_10_rev enum: use VERSION_1_2 UNSIGNED_INT_2_10_10_10_REV INT_2_10_10_10_REV = 0x8D9F ############################################################################### # ARB Extension #87 ARB_draw_indirect enum: DRAW_INDIRECT_BUFFER = 0x8F3F DRAW_INDIRECT_BUFFER_BINDING = 0x8F43 ############################################################################### # ARB Extension #88 ARB_gpu_shader5 enum: GEOMETRY_SHADER_INVOCATIONS = 0x887F MAX_GEOMETRY_SHADER_INVOCATIONS = 0x8E5A MIN_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5B MAX_FRAGMENT_INTERPOLATION_OFFSET = 0x8E5C FRAGMENT_INTERPOLATION_OFFSET_BITS = 0x8E5D MAX_VERTEX_STREAMS = 0x8E71 ############################################################################### # ARB Extension #89 ARB_gpu_shader_fp64 enum: use VERSION_1_1 DOUBLE DOUBLE_VEC2 = 0x8FFC DOUBLE_VEC3 = 0x8FFD DOUBLE_VEC4 = 0x8FFE DOUBLE_MAT2 = 0x8F46 DOUBLE_MAT3 = 0x8F47 DOUBLE_MAT4 = 0x8F48 DOUBLE_MAT2x3 = 0x8F49 DOUBLE_MAT2x4 = 0x8F4A DOUBLE_MAT3x2 = 0x8F4B DOUBLE_MAT3x4 = 0x8F4C DOUBLE_MAT4x2 = 0x8F4D DOUBLE_MAT4x3 = 0x8F4E ############################################################################### # ARB Extension #90 ARB_shader_subroutine enum: ACTIVE_SUBROUTINES = 0x8DE5 ACTIVE_SUBROUTINE_UNIFORMS = 0x8DE6 ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 0x8E47 ACTIVE_SUBROUTINE_MAX_LENGTH = 0x8E48 ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 0x8E49 MAX_SUBROUTINES = 0x8DE7 MAX_SUBROUTINE_UNIFORM_LOCATIONS = 0x8DE8 NUM_COMPATIBLE_SUBROUTINES = 0x8E4A COMPATIBLE_SUBROUTINES = 0x8E4B use ARB_uniform_buffer_object UNIFORM_SIZE use ARB_uniform_buffer_object UNIFORM_NAME_LENGTH ############################################################################### # ARB Extension #91 ARB_tessellation_shader enum: PATCHES = 0x000E PATCH_VERTICES = 0x8E72 PATCH_DEFAULT_INNER_LEVEL = 0x8E73 PATCH_DEFAULT_OUTER_LEVEL = 0x8E74 TESS_CONTROL_OUTPUT_VERTICES = 0x8E75 TESS_GEN_MODE = 0x8E76 TESS_GEN_SPACING = 0x8E77 TESS_GEN_VERTEX_ORDER = 0x8E78 TESS_GEN_POINT_MODE = 0x8E79 use VERSION_1_1 TRIANGLES use VERSION_1_1 QUADS ISOLINES = 0x8E7A use VERSION_1_1 EQUAL FRACTIONAL_ODD = 0x8E7B FRACTIONAL_EVEN = 0x8E7C use VERSION_1_1 CCW use VERSION_1_1 CW MAX_PATCH_VERTICES = 0x8E7D MAX_TESS_GEN_LEVEL = 0x8E7E MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E7F MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E80 MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 0x8E81 MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 0x8E82 MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 0x8E83 MAX_TESS_PATCH_COMPONENTS = 0x8E84 MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 0x8E85 MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 0x8E86 MAX_TESS_CONTROL_UNIFORM_BLOCKS = 0x8E89 MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 0x8E8A MAX_TESS_CONTROL_INPUT_COMPONENTS = 0x886C MAX_TESS_EVALUATION_INPUT_COMPONENTS = 0x886D MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 0x8E1E MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 0x8E1F UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER = 0x84F0 UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER = 0x84F1 TESS_EVALUATION_SHADER = 0x8E87 TESS_CONTROL_SHADER = 0x8E88 ############################################################################### # ARB Extension #92 ARB_texture_buffer_object_rgb32 enum: use VERSION_3_0 RGB32F use VERSION_3_0 RGB32UI use VERSION_3_0 RGB32I ############################################################################### # ARB Extension #93 ARB_transform_feedback2 enum: TRANSFORM_FEEDBACK = 0x8E22 TRANSFORM_FEEDBACK_BUFFER_PAUSED = 0x8E23 TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 0x8E24 TRANSFORM_FEEDBACK_BINDING = 0x8E25 ############################################################################### # ARB Extension #94 ARB_transform_feedback3 enum: MAX_TRANSFORM_FEEDBACK_BUFFERS = 0x8E70 MAX_VERTEX_STREAMS = 0x8E71 ############################################################################### # # non-ARB extensions follow, in registry order # ############################################################################### ############################################################################### # Extension #1 EXT_abgr enum: ABGR_EXT = 0x8000 ############################################################################### # Extension #2 EXT_blend_color enum: CONSTANT_COLOR_EXT = 0x8001 ONE_MINUS_CONSTANT_COLOR_EXT = 0x8002 CONSTANT_ALPHA_EXT = 0x8003 ONE_MINUS_CONSTANT_ALPHA_EXT = 0x8004 BLEND_COLOR_EXT = 0x8005 # 4 F ############################################################################### # Extension #3 EXT_polygon_offset enum: POLYGON_OFFSET_EXT = 0x8037 POLYGON_OFFSET_FACTOR_EXT = 0x8038 POLYGON_OFFSET_BIAS_EXT = 0x8039 # 1 F ############################################################################### # Extension #4 EXT_texture enum: ALPHA4_EXT = 0x803B ALPHA8_EXT = 0x803C ALPHA12_EXT = 0x803D ALPHA16_EXT = 0x803E LUMINANCE4_EXT = 0x803F LUMINANCE8_EXT = 0x8040 LUMINANCE12_EXT = 0x8041 LUMINANCE16_EXT = 0x8042 LUMINANCE4_ALPHA4_EXT = 0x8043 LUMINANCE6_ALPHA2_EXT = 0x8044 LUMINANCE8_ALPHA8_EXT = 0x8045 LUMINANCE12_ALPHA4_EXT = 0x8046 LUMINANCE12_ALPHA12_EXT = 0x8047 LUMINANCE16_ALPHA16_EXT = 0x8048 INTENSITY_EXT = 0x8049 INTENSITY4_EXT = 0x804A INTENSITY8_EXT = 0x804B INTENSITY12_EXT = 0x804C INTENSITY16_EXT = 0x804D RGB2_EXT = 0x804E RGB4_EXT = 0x804F RGB5_EXT = 0x8050 RGB8_EXT = 0x8051 RGB10_EXT = 0x8052 RGB12_EXT = 0x8053 RGB16_EXT = 0x8054 RGBA2_EXT = 0x8055 RGBA4_EXT = 0x8056 RGB5_A1_EXT = 0x8057 RGBA8_EXT = 0x8058 RGB10_A2_EXT = 0x8059 RGBA12_EXT = 0x805A RGBA16_EXT = 0x805B TEXTURE_RED_SIZE_EXT = 0x805C TEXTURE_GREEN_SIZE_EXT = 0x805D TEXTURE_BLUE_SIZE_EXT = 0x805E TEXTURE_ALPHA_SIZE_EXT = 0x805F TEXTURE_LUMINANCE_SIZE_EXT = 0x8060 TEXTURE_INTENSITY_SIZE_EXT = 0x8061 REPLACE_EXT = 0x8062 PROXY_TEXTURE_1D_EXT = 0x8063 PROXY_TEXTURE_2D_EXT = 0x8064 TEXTURE_TOO_LARGE_EXT = 0x8065 ############################################################################### # Extension #5 - skipped ############################################################################### # Extension #6 EXT_texture3D enum: PACK_SKIP_IMAGES_EXT = 0x806B # 1 I PACK_IMAGE_HEIGHT_EXT = 0x806C # 1 F UNPACK_SKIP_IMAGES_EXT = 0x806D # 1 I UNPACK_IMAGE_HEIGHT_EXT = 0x806E # 1 F TEXTURE_3D_EXT = 0x806F # 1 I PROXY_TEXTURE_3D_EXT = 0x8070 TEXTURE_DEPTH_EXT = 0x8071 TEXTURE_WRAP_R_EXT = 0x8072 MAX_3D_TEXTURE_SIZE_EXT = 0x8073 # 1 I ############################################################################### # Extension #7 SGIS_texture_filter4 enum: FILTER4_SGIS = 0x8146 TEXTURE_FILTER4_SIZE_SGIS = 0x8147 ############################################################################### # Extension #8 - skipped ############################################################################### # No new tokens # Extension #9 EXT_subtexture enum: ############################################################################### # No new tokens # Extension #10 EXT_copy_texture enum: ############################################################################### # Extension #11 EXT_histogram enum: HISTOGRAM_EXT = 0x8024 # 1 I PROXY_HISTOGRAM_EXT = 0x8025 HISTOGRAM_WIDTH_EXT = 0x8026 HISTOGRAM_FORMAT_EXT = 0x8027 HISTOGRAM_RED_SIZE_EXT = 0x8028 HISTOGRAM_GREEN_SIZE_EXT = 0x8029 HISTOGRAM_BLUE_SIZE_EXT = 0x802A HISTOGRAM_ALPHA_SIZE_EXT = 0x802B HISTOGRAM_LUMINANCE_SIZE_EXT = 0x802C HISTOGRAM_SINK_EXT = 0x802D MINMAX_EXT = 0x802E # 1 I MINMAX_FORMAT_EXT = 0x802F MINMAX_SINK_EXT = 0x8030 TABLE_TOO_LARGE_EXT = 0x8031 ############################################################################### # Extension #12 EXT_convolution enum: CONVOLUTION_1D_EXT = 0x8010 # 1 I CONVOLUTION_2D_EXT = 0x8011 # 1 I SEPARABLE_2D_EXT = 0x8012 # 1 I CONVOLUTION_BORDER_MODE_EXT = 0x8013 CONVOLUTION_FILTER_SCALE_EXT = 0x8014 CONVOLUTION_FILTER_BIAS_EXT = 0x8015 REDUCE_EXT = 0x8016 CONVOLUTION_FORMAT_EXT = 0x8017 CONVOLUTION_WIDTH_EXT = 0x8018 CONVOLUTION_HEIGHT_EXT = 0x8019 MAX_CONVOLUTION_WIDTH_EXT = 0x801A MAX_CONVOLUTION_HEIGHT_EXT = 0x801B POST_CONVOLUTION_RED_SCALE_EXT = 0x801C # 1 F POST_CONVOLUTION_GREEN_SCALE_EXT = 0x801D # 1 F POST_CONVOLUTION_BLUE_SCALE_EXT = 0x801E # 1 F POST_CONVOLUTION_ALPHA_SCALE_EXT = 0x801F # 1 F POST_CONVOLUTION_RED_BIAS_EXT = 0x8020 # 1 F POST_CONVOLUTION_GREEN_BIAS_EXT = 0x8021 # 1 F POST_CONVOLUTION_BLUE_BIAS_EXT = 0x8022 # 1 F POST_CONVOLUTION_ALPHA_BIAS_EXT = 0x8023 # 1 F ############################################################################### # Extension #13 SGI_color_matrix enum: COLOR_MATRIX_SGI = 0x80B1 # 16 F COLOR_MATRIX_STACK_DEPTH_SGI = 0x80B2 # 1 I MAX_COLOR_MATRIX_STACK_DEPTH_SGI = 0x80B3 # 1 I POST_COLOR_MATRIX_RED_SCALE_SGI = 0x80B4 # 1 F POST_COLOR_MATRIX_GREEN_SCALE_SGI = 0x80B5 # 1 F POST_COLOR_MATRIX_BLUE_SCALE_SGI = 0x80B6 # 1 F POST_COLOR_MATRIX_ALPHA_SCALE_SGI = 0x80B7 # 1 F POST_COLOR_MATRIX_RED_BIAS_SGI = 0x80B8 # 1 F POST_COLOR_MATRIX_GREEN_BIAS_SGI = 0x80B9 # 1 F POST_COLOR_MATRIX_BLUE_BIAS_SGI = 0x80BA # 1 F POST_COLOR_MATRIX_ALPHA_BIAS_SGI = 0x80BB # 1 F ############################################################################### # Extension #14 SGI_color_table enum: COLOR_TABLE_SGI = 0x80D0 # 1 I POST_CONVOLUTION_COLOR_TABLE_SGI = 0x80D1 # 1 I POST_COLOR_MATRIX_COLOR_TABLE_SGI = 0x80D2 # 1 I PROXY_COLOR_TABLE_SGI = 0x80D3 PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI = 0x80D4 PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI = 0x80D5 COLOR_TABLE_SCALE_SGI = 0x80D6 COLOR_TABLE_BIAS_SGI = 0x80D7 COLOR_TABLE_FORMAT_SGI = 0x80D8 COLOR_TABLE_WIDTH_SGI = 0x80D9 COLOR_TABLE_RED_SIZE_SGI = 0x80DA COLOR_TABLE_GREEN_SIZE_SGI = 0x80DB COLOR_TABLE_BLUE_SIZE_SGI = 0x80DC COLOR_TABLE_ALPHA_SIZE_SGI = 0x80DD COLOR_TABLE_LUMINANCE_SIZE_SGI = 0x80DE COLOR_TABLE_INTENSITY_SIZE_SGI = 0x80DF ############################################################################### # Extension #15 SGIS_pixel_texture enum: PIXEL_TEXTURE_SGIS = 0x8353 # 1 I PIXEL_FRAGMENT_RGB_SOURCE_SGIS = 0x8354 # 1 I PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS = 0x8355 # 1 I PIXEL_GROUP_COLOR_SGIS = 0x8356 # 1 I ############################################################################### # Extension #15a SGIX_pixel_texture enum: PIXEL_TEX_GEN_SGIX = 0x8139 # 1 I PIXEL_TEX_GEN_MODE_SGIX = 0x832B # 1 I ############################################################################### # Extension #16 SGIS_texture4D enum: PACK_SKIP_VOLUMES_SGIS = 0x8130 # 1 I PACK_IMAGE_DEPTH_SGIS = 0x8131 # 1 I UNPACK_SKIP_VOLUMES_SGIS = 0x8132 # 1 I UNPACK_IMAGE_DEPTH_SGIS = 0x8133 # 1 I TEXTURE_4D_SGIS = 0x8134 # 1 I PROXY_TEXTURE_4D_SGIS = 0x8135 TEXTURE_4DSIZE_SGIS = 0x8136 TEXTURE_WRAP_Q_SGIS = 0x8137 MAX_4D_TEXTURE_SIZE_SGIS = 0x8138 # 1 I TEXTURE_4D_BINDING_SGIS = 0x814F # 1 I ############################################################################### # Extension #17 SGI_texture_color_table enum: TEXTURE_COLOR_TABLE_SGI = 0x80BC # 1 I PROXY_TEXTURE_COLOR_TABLE_SGI = 0x80BD ############################################################################### # Extension #18 EXT_cmyka enum: CMYK_EXT = 0x800C CMYKA_EXT = 0x800D PACK_CMYK_HINT_EXT = 0x800E # 1 I UNPACK_CMYK_HINT_EXT = 0x800F # 1 I ############################################################################### # Extension #19 - skipped ############################################################################### # Extension #20 EXT_texture_object enum: TEXTURE_PRIORITY_EXT = 0x8066 TEXTURE_RESIDENT_EXT = 0x8067 TEXTURE_1D_BINDING_EXT = 0x8068 TEXTURE_2D_BINDING_EXT = 0x8069 TEXTURE_3D_BINDING_EXT = 0x806A # 1 I ############################################################################### # Extension #21 SGIS_detail_texture enum: DETAIL_TEXTURE_2D_SGIS = 0x8095 DETAIL_TEXTURE_2D_BINDING_SGIS = 0x8096 # 1 I LINEAR_DETAIL_SGIS = 0x8097 LINEAR_DETAIL_ALPHA_SGIS = 0x8098 LINEAR_DETAIL_COLOR_SGIS = 0x8099 DETAIL_TEXTURE_LEVEL_SGIS = 0x809A DETAIL_TEXTURE_MODE_SGIS = 0x809B DETAIL_TEXTURE_FUNC_POINTS_SGIS = 0x809C ############################################################################### # Extension #22 SGIS_sharpen_texture enum: LINEAR_SHARPEN_SGIS = 0x80AD LINEAR_SHARPEN_ALPHA_SGIS = 0x80AE LINEAR_SHARPEN_COLOR_SGIS = 0x80AF SHARPEN_TEXTURE_FUNC_POINTS_SGIS = 0x80B0 ############################################################################### # Extension #23 EXT_packed_pixels enum: UNSIGNED_BYTE_3_3_2_EXT = 0x8032 UNSIGNED_SHORT_4_4_4_4_EXT = 0x8033 UNSIGNED_SHORT_5_5_5_1_EXT = 0x8034 UNSIGNED_INT_8_8_8_8_EXT = 0x8035 UNSIGNED_INT_10_10_10_2_EXT = 0x8036 ############################################################################### # Extension #24 SGIS_texture_lod enum: TEXTURE_MIN_LOD_SGIS = 0x813A TEXTURE_MAX_LOD_SGIS = 0x813B TEXTURE_BASE_LEVEL_SGIS = 0x813C TEXTURE_MAX_LEVEL_SGIS = 0x813D ############################################################################### # Extension #25 SGIS_multisample enum: MULTISAMPLE_SGIS = 0x809D # 1 I SAMPLE_ALPHA_TO_MASK_SGIS = 0x809E # 1 I SAMPLE_ALPHA_TO_ONE_SGIS = 0x809F # 1 I SAMPLE_MASK_SGIS = 0x80A0 # 1 I 1PASS_SGIS = 0x80A1 2PASS_0_SGIS = 0x80A2 2PASS_1_SGIS = 0x80A3 4PASS_0_SGIS = 0x80A4 4PASS_1_SGIS = 0x80A5 4PASS_2_SGIS = 0x80A6 4PASS_3_SGIS = 0x80A7 SAMPLE_BUFFERS_SGIS = 0x80A8 # 1 I SAMPLES_SGIS = 0x80A9 # 1 I SAMPLE_MASK_VALUE_SGIS = 0x80AA # 1 F SAMPLE_MASK_INVERT_SGIS = 0x80AB # 1 I SAMPLE_PATTERN_SGIS = 0x80AC # 1 I ############################################################################### # Extension #26 - no specification? # SGIS_premultiply_blend enum: ############################################################################## # Extension #27 # Diamond ships an otherwise identical IBM_rescale_normal extension; # Dan Brokenshire says this is deprecated and should not be advertised. EXT_rescale_normal enum: RESCALE_NORMAL_EXT = 0x803A # 1 I ############################################################################### # Extension #28 - GLX_EXT_visual_info ############################################################################### # Extension #29 - skipped ############################################################################### # Extension #30 EXT_vertex_array enum: VERTEX_ARRAY_EXT = 0x8074 NORMAL_ARRAY_EXT = 0x8075 COLOR_ARRAY_EXT = 0x8076 INDEX_ARRAY_EXT = 0x8077 TEXTURE_COORD_ARRAY_EXT = 0x8078 EDGE_FLAG_ARRAY_EXT = 0x8079 VERTEX_ARRAY_SIZE_EXT = 0x807A VERTEX_ARRAY_TYPE_EXT = 0x807B VERTEX_ARRAY_STRIDE_EXT = 0x807C VERTEX_ARRAY_COUNT_EXT = 0x807D # 1 I NORMAL_ARRAY_TYPE_EXT = 0x807E NORMAL_ARRAY_STRIDE_EXT = 0x807F NORMAL_ARRAY_COUNT_EXT = 0x8080 # 1 I COLOR_ARRAY_SIZE_EXT = 0x8081 COLOR_ARRAY_TYPE_EXT = 0x8082 COLOR_ARRAY_STRIDE_EXT = 0x8083 COLOR_ARRAY_COUNT_EXT = 0x8084 # 1 I INDEX_ARRAY_TYPE_EXT = 0x8085 INDEX_ARRAY_STRIDE_EXT = 0x8086 INDEX_ARRAY_COUNT_EXT = 0x8087 # 1 I TEXTURE_COORD_ARRAY_SIZE_EXT = 0x8088 TEXTURE_COORD_ARRAY_TYPE_EXT = 0x8089 TEXTURE_COORD_ARRAY_STRIDE_EXT = 0x808A TEXTURE_COORD_ARRAY_COUNT_EXT = 0x808B # 1 I EDGE_FLAG_ARRAY_STRIDE_EXT = 0x808C EDGE_FLAG_ARRAY_COUNT_EXT = 0x808D # 1 I VERTEX_ARRAY_POINTER_EXT = 0x808E NORMAL_ARRAY_POINTER_EXT = 0x808F COLOR_ARRAY_POINTER_EXT = 0x8090 INDEX_ARRAY_POINTER_EXT = 0x8091 TEXTURE_COORD_ARRAY_POINTER_EXT = 0x8092 EDGE_FLAG_ARRAY_POINTER_EXT = 0x8093 ############################################################################### # Extension #31 EXT_misc_attribute enum: # MISC_BIT = 0x???? ############################################################################### # Extension #32 SGIS_generate_mipmap enum: GENERATE_MIPMAP_SGIS = 0x8191 GENERATE_MIPMAP_HINT_SGIS = 0x8192 # 1 I ############################################################################### # Extension #33 SGIX_clipmap enum: LINEAR_CLIPMAP_LINEAR_SGIX = 0x8170 TEXTURE_CLIPMAP_CENTER_SGIX = 0x8171 TEXTURE_CLIPMAP_FRAME_SGIX = 0x8172 TEXTURE_CLIPMAP_OFFSET_SGIX = 0x8173 TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX = 0x8174 TEXTURE_CLIPMAP_LOD_OFFSET_SGIX = 0x8175 TEXTURE_CLIPMAP_DEPTH_SGIX = 0x8176 MAX_CLIPMAP_DEPTH_SGIX = 0x8177 # 1 I MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX = 0x8178 # 1 I NEAREST_CLIPMAP_NEAREST_SGIX = 0x844D NEAREST_CLIPMAP_LINEAR_SGIX = 0x844E LINEAR_CLIPMAP_NEAREST_SGIX = 0x844F ############################################################################### # Extension #34 SGIX_shadow enum: TEXTURE_COMPARE_SGIX = 0x819A TEXTURE_COMPARE_OPERATOR_SGIX = 0x819B TEXTURE_LEQUAL_R_SGIX = 0x819C TEXTURE_GEQUAL_R_SGIX = 0x819D ############################################################################### # Extension #35 SGIS_texture_edge_clamp enum: CLAMP_TO_EDGE_SGIS = 0x812F ############################################################################### # Extension #36 # Promoted to ARB_texture_border_clamp SGIS_texture_border_clamp enum: CLAMP_TO_BORDER_SGIS = 0x812D ############################################################################### # Extension #37 EXT_blend_minmax enum: FUNC_ADD_EXT = 0x8006 MIN_EXT = 0x8007 MAX_EXT = 0x8008 BLEND_EQUATION_EXT = 0x8009 # 1 I ############################################################################### # Extension #38 EXT_blend_subtract enum: FUNC_SUBTRACT_EXT = 0x800A FUNC_REVERSE_SUBTRACT_EXT = 0x800B ############################################################################### # No new tokens # Extension #39 EXT_blend_logic_op enum: ############################################################################### # Extension #40 - GLX_SGI_swap_control # Extension #41 - GLX_SGI_video_sync # Extension #42 - GLX_SGI_make_current_read # Extension #43 - GLX_SGIX_video_source # Extension #44 - GLX_EXT_visual_rating ############################################################################### # Extension #45 SGIX_interlace enum: INTERLACE_SGIX = 0x8094 # 1 I ############################################################################### # Extension #46 SGIX_pixel_tiles enum: PIXEL_TILE_BEST_ALIGNMENT_SGIX = 0x813E # 1 I PIXEL_TILE_CACHE_INCREMENT_SGIX = 0x813F # 1 I PIXEL_TILE_WIDTH_SGIX = 0x8140 # 1 I PIXEL_TILE_HEIGHT_SGIX = 0x8141 # 1 I PIXEL_TILE_GRID_WIDTH_SGIX = 0x8142 # 1 I PIXEL_TILE_GRID_HEIGHT_SGIX = 0x8143 # 1 I PIXEL_TILE_GRID_DEPTH_SGIX = 0x8144 # 1 I PIXEL_TILE_CACHE_SIZE_SGIX = 0x8145 # 1 I ############################################################################### # Extension #47 - GLX_EXT_import_context ############################################################################### # Extension #48 - skipped ############################################################################### # Extension #49 - GLX_SGIX_fbconfig # Extension #50 - GLX_SGIX_pbuffer ############################################################################### # Extension #51 SGIS_texture_select enum: DUAL_ALPHA4_SGIS = 0x8110 DUAL_ALPHA8_SGIS = 0x8111 DUAL_ALPHA12_SGIS = 0x8112 DUAL_ALPHA16_SGIS = 0x8113 DUAL_LUMINANCE4_SGIS = 0x8114 DUAL_LUMINANCE8_SGIS = 0x8115 DUAL_LUMINANCE12_SGIS = 0x8116 DUAL_LUMINANCE16_SGIS = 0x8117 DUAL_INTENSITY4_SGIS = 0x8118 DUAL_INTENSITY8_SGIS = 0x8119 DUAL_INTENSITY12_SGIS = 0x811A DUAL_INTENSITY16_SGIS = 0x811B DUAL_LUMINANCE_ALPHA4_SGIS = 0x811C DUAL_LUMINANCE_ALPHA8_SGIS = 0x811D QUAD_ALPHA4_SGIS = 0x811E QUAD_ALPHA8_SGIS = 0x811F QUAD_LUMINANCE4_SGIS = 0x8120 QUAD_LUMINANCE8_SGIS = 0x8121 QUAD_INTENSITY4_SGIS = 0x8122 QUAD_INTENSITY8_SGIS = 0x8123 DUAL_TEXTURE_SELECT_SGIS = 0x8124 QUAD_TEXTURE_SELECT_SGIS = 0x8125 ############################################################################### # Extension #52 SGIX_sprite enum: SPRITE_SGIX = 0x8148 # 1 I SPRITE_MODE_SGIX = 0x8149 # 1 I SPRITE_AXIS_SGIX = 0x814A # 3 F SPRITE_TRANSLATION_SGIX = 0x814B # 3 F SPRITE_AXIAL_SGIX = 0x814C SPRITE_OBJECT_ALIGNED_SGIX = 0x814D SPRITE_EYE_ALIGNED_SGIX = 0x814E ############################################################################### # Extension #53 SGIX_texture_multi_buffer enum: TEXTURE_MULTI_BUFFER_HINT_SGIX = 0x812E ############################################################################### # Extension #54 # EXT form promoted from SGIS form; both are included EXT_point_parameters enum: POINT_SIZE_MIN_EXT = 0x8126 # 1 F POINT_SIZE_MAX_EXT = 0x8127 # 1 F POINT_FADE_THRESHOLD_SIZE_EXT = 0x8128 # 1 F DISTANCE_ATTENUATION_EXT = 0x8129 # 3 F SGIS_point_parameters enum: POINT_SIZE_MIN_SGIS = 0x8126 # 1 F POINT_SIZE_MAX_SGIS = 0x8127 # 1 F POINT_FADE_THRESHOLD_SIZE_SGIS = 0x8128 # 1 F DISTANCE_ATTENUATION_SGIS = 0x8129 # 3 F ############################################################################### # Extension #55 SGIX_instruments enum: INSTRUMENT_BUFFER_POINTER_SGIX = 0x8180 INSTRUMENT_MEASUREMENTS_SGIX = 0x8181 # 1 I ############################################################################### # Extension #56 SGIX_texture_scale_bias enum: POST_TEXTURE_FILTER_BIAS_SGIX = 0x8179 POST_TEXTURE_FILTER_SCALE_SGIX = 0x817A POST_TEXTURE_FILTER_BIAS_RANGE_SGIX = 0x817B # 2 F POST_TEXTURE_FILTER_SCALE_RANGE_SGIX = 0x817C # 2 F ############################################################################### # Extension #57 SGIX_framezoom enum: FRAMEZOOM_SGIX = 0x818B # 1 I FRAMEZOOM_FACTOR_SGIX = 0x818C # 1 I MAX_FRAMEZOOM_FACTOR_SGIX = 0x818D # 1 I ############################################################################### # No new tokens # Extension #58 SGIX_tag_sample_buffer enum: ############################################################################### # Extension #59 FfdMaskSGIX enum: TEXTURE_DEFORMATION_BIT_SGIX = 0x00000001 GEOMETRY_DEFORMATION_BIT_SGIX = 0x00000002 SGIX_polynomial_ffd enum: GEOMETRY_DEFORMATION_SGIX = 0x8194 TEXTURE_DEFORMATION_SGIX = 0x8195 DEFORMATIONS_MASK_SGIX = 0x8196 # 1 I MAX_DEFORMATION_ORDER_SGIX = 0x8197 ############################################################################### # Extension #60 SGIX_reference_plane enum: REFERENCE_PLANE_SGIX = 0x817D # 1 I REFERENCE_PLANE_EQUATION_SGIX = 0x817E # 4 F ############################################################################### # No new tokens # Extension #61 SGIX_flush_raster enum: ############################################################################### # Extension #62 - GLX_SGIX_cushion ############################################################################### # Extension #63 SGIX_depth_texture enum: DEPTH_COMPONENT16_SGIX = 0x81A5 DEPTH_COMPONENT24_SGIX = 0x81A6 DEPTH_COMPONENT32_SGIX = 0x81A7 ############################################################################### # Extension #64 SGIS_fog_function enum: FOG_FUNC_SGIS = 0x812A FOG_FUNC_POINTS_SGIS = 0x812B # 1 I MAX_FOG_FUNC_POINTS_SGIS = 0x812C # 1 I ############################################################################### # Extension #65 SGIX_fog_offset enum: FOG_OFFSET_SGIX = 0x8198 # 1 I FOG_OFFSET_VALUE_SGIX = 0x8199 # 4 F ############################################################################### # Extension #66 HP_image_transform enum: IMAGE_SCALE_X_HP = 0x8155 IMAGE_SCALE_Y_HP = 0x8156 IMAGE_TRANSLATE_X_HP = 0x8157 IMAGE_TRANSLATE_Y_HP = 0x8158 IMAGE_ROTATE_ANGLE_HP = 0x8159 IMAGE_ROTATE_ORIGIN_X_HP = 0x815A IMAGE_ROTATE_ORIGIN_Y_HP = 0x815B IMAGE_MAG_FILTER_HP = 0x815C IMAGE_MIN_FILTER_HP = 0x815D IMAGE_CUBIC_WEIGHT_HP = 0x815E CUBIC_HP = 0x815F AVERAGE_HP = 0x8160 IMAGE_TRANSFORM_2D_HP = 0x8161 POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = 0x8162 PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP = 0x8163 ############################################################################### # Extension #67 HP_convolution_border_modes enum: IGNORE_BORDER_HP = 0x8150 CONSTANT_BORDER_HP = 0x8151 REPLICATE_BORDER_HP = 0x8153 CONVOLUTION_BORDER_COLOR_HP = 0x8154 ############################################################################### # Extension #68 # (Unknown token values???) INGR_palette_buffer enum: ############################################################################### # Extension #69 SGIX_texture_add_env enum: TEXTURE_ENV_BIAS_SGIX = 0x80BE ############################################################################### # Extension #70 - skipped # Extension #71 - skipped # Extension #72 - skipped # Extension #73 - skipped ############################################################################### # No new tokens # Extension #74 EXT_color_subtable enum: ############################################################################### # Extension #75 - GLU_EXT_object_space_tess ############################################################################### # Extension #76 PGI_vertex_hints enum: VERTEX_DATA_HINT_PGI = 0x1A22A VERTEX_CONSISTENT_HINT_PGI = 0x1A22B MATERIAL_SIDE_HINT_PGI = 0x1A22C MAX_VERTEX_HINT_PGI = 0x1A22D COLOR3_BIT_PGI = 0x00010000 COLOR4_BIT_PGI = 0x00020000 EDGEFLAG_BIT_PGI = 0x00040000 INDEX_BIT_PGI = 0x00080000 MAT_AMBIENT_BIT_PGI = 0x00100000 MAT_AMBIENT_AND_DIFFUSE_BIT_PGI = 0x00200000 MAT_DIFFUSE_BIT_PGI = 0x00400000 MAT_EMISSION_BIT_PGI = 0x00800000 MAT_COLOR_INDEXES_BIT_PGI = 0x01000000 MAT_SHININESS_BIT_PGI = 0x02000000 MAT_SPECULAR_BIT_PGI = 0x04000000 NORMAL_BIT_PGI = 0x08000000 TEXCOORD1_BIT_PGI = 0x10000000 TEXCOORD2_BIT_PGI = 0x20000000 TEXCOORD3_BIT_PGI = 0x40000000 TEXCOORD4_BIT_PGI = 0x80000000 VERTEX23_BIT_PGI = 0x00000004 VERTEX4_BIT_PGI = 0x00000008 ############################################################################### # Extension #77 PGI_misc_hints enum: PREFER_DOUBLEBUFFER_HINT_PGI = 0x1A1F8 CONSERVE_MEMORY_HINT_PGI = 0x1A1FD RECLAIM_MEMORY_HINT_PGI = 0x1A1FE NATIVE_GRAPHICS_HANDLE_PGI = 0x1A202 NATIVE_GRAPHICS_BEGIN_HINT_PGI = 0x1A203 NATIVE_GRAPHICS_END_HINT_PGI = 0x1A204 ALWAYS_FAST_HINT_PGI = 0x1A20C ALWAYS_SOFT_HINT_PGI = 0x1A20D ALLOW_DRAW_OBJ_HINT_PGI = 0x1A20E ALLOW_DRAW_WIN_HINT_PGI = 0x1A20F ALLOW_DRAW_FRG_HINT_PGI = 0x1A210 ALLOW_DRAW_MEM_HINT_PGI = 0x1A211 STRICT_DEPTHFUNC_HINT_PGI = 0x1A216 STRICT_LIGHTING_HINT_PGI = 0x1A217 STRICT_SCISSOR_HINT_PGI = 0x1A218 FULL_STIPPLE_HINT_PGI = 0x1A219 CLIP_NEAR_HINT_PGI = 0x1A220 CLIP_FAR_HINT_PGI = 0x1A221 WIDE_LINE_HINT_PGI = 0x1A222 BACK_NORMALS_HINT_PGI = 0x1A223 ############################################################################### # Extension #78 EXT_paletted_texture enum: COLOR_INDEX1_EXT = 0x80E2 COLOR_INDEX2_EXT = 0x80E3 COLOR_INDEX4_EXT = 0x80E4 COLOR_INDEX8_EXT = 0x80E5 COLOR_INDEX12_EXT = 0x80E6 COLOR_INDEX16_EXT = 0x80E7 TEXTURE_INDEX_SIZE_EXT = 0x80ED ############################################################################### # Extension #79 EXT_clip_volume_hint enum: CLIP_VOLUME_CLIPPING_HINT_EXT = 0x80F0 ############################################################################### # Extension #80 SGIX_list_priority enum: LIST_PRIORITY_SGIX = 0x8182 ############################################################################### # Extension #81 SGIX_ir_instrument1 enum: IR_INSTRUMENT1_SGIX = 0x817F # 1 I ############################################################################### # Extension #82 SGIX_calligraphic_fragment enum: CALLIGRAPHIC_FRAGMENT_SGIX = 0x8183 # 1 I ############################################################################### # Extension #83 - GLX_SGIX_video_resize ############################################################################### # Extension #84 SGIX_texture_lod_bias enum: TEXTURE_LOD_BIAS_S_SGIX = 0x818E TEXTURE_LOD_BIAS_T_SGIX = 0x818F TEXTURE_LOD_BIAS_R_SGIX = 0x8190 ############################################################################### # Extension #85 - skipped ############################################################################### # Extension #86 - GLX_SGIX_dmbuffer ############################################################################### # Extension #87 - skipped # Extension #88 - skipped # Extension #89 - skipped ############################################################################### # Extension #90 SGIX_shadow_ambient enum: SHADOW_AMBIENT_SGIX = 0x80BF ############################################################################### # Extension #91 - GLX_SGIX_swap_group # Extension #92 - GLX_SGIX_swap_barrier ############################################################################### # No new tokens # Extension #93 EXT_index_texture enum: ############################################################################### # Extension #94 # Promoted from SGI? EXT_index_material enum: INDEX_MATERIAL_EXT = 0x81B8 INDEX_MATERIAL_PARAMETER_EXT = 0x81B9 INDEX_MATERIAL_FACE_EXT = 0x81BA ############################################################################### # Extension #95 # Promoted from SGI? EXT_index_func enum: INDEX_TEST_EXT = 0x81B5 INDEX_TEST_FUNC_EXT = 0x81B6 INDEX_TEST_REF_EXT = 0x81B7 ############################################################################### # Extension #96 # Promoted from SGI? EXT_index_array_formats enum: IUI_V2F_EXT = 0x81AD IUI_V3F_EXT = 0x81AE IUI_N3F_V2F_EXT = 0x81AF IUI_N3F_V3F_EXT = 0x81B0 T2F_IUI_V2F_EXT = 0x81B1 T2F_IUI_V3F_EXT = 0x81B2 T2F_IUI_N3F_V2F_EXT = 0x81B3 T2F_IUI_N3F_V3F_EXT = 0x81B4 ############################################################################### # Extension #97 # Promoted from SGI? EXT_compiled_vertex_array enum: ARRAY_ELEMENT_LOCK_FIRST_EXT = 0x81A8 ARRAY_ELEMENT_LOCK_COUNT_EXT = 0x81A9 ############################################################################### # Extension #98 # Promoted from SGI? EXT_cull_vertex enum: CULL_VERTEX_EXT = 0x81AA CULL_VERTEX_EYE_POSITION_EXT = 0x81AB CULL_VERTEX_OBJECT_POSITION_EXT = 0x81AC ############################################################################### # Extension #99 - skipped ############################################################################### # Extension #100 - GLU_EXT_nurbs_tessellator ############################################################################### # Extension #101 SGIX_ycrcb enum: YCRCB_422_SGIX = 0x81BB YCRCB_444_SGIX = 0x81BC ############################################################################### # Extension #102 SGIX_fragment_lighting enum: FRAGMENT_LIGHTING_SGIX = 0x8400 # 1 I FRAGMENT_COLOR_MATERIAL_SGIX = 0x8401 # 1 I FRAGMENT_COLOR_MATERIAL_FACE_SGIX = 0x8402 # 1 I FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX = 0x8403 # 1 I MAX_FRAGMENT_LIGHTS_SGIX = 0x8404 # 1 I MAX_ACTIVE_LIGHTS_SGIX = 0x8405 # 1 I CURRENT_RASTER_NORMAL_SGIX = 0x8406 # 1 I LIGHT_ENV_MODE_SGIX = 0x8407 # 1 I FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX = 0x8408 # 1 I FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX = 0x8409 # 1 I FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX = 0x840A # 4 F FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX = 0x840B # 1 I FRAGMENT_LIGHT0_SGIX = 0x840C # 1 I FRAGMENT_LIGHT1_SGIX = 0x840D FRAGMENT_LIGHT2_SGIX = 0x840E FRAGMENT_LIGHT3_SGIX = 0x840F FRAGMENT_LIGHT4_SGIX = 0x8410 FRAGMENT_LIGHT5_SGIX = 0x8411 FRAGMENT_LIGHT6_SGIX = 0x8412 FRAGMENT_LIGHT7_SGIX = 0x8413 ############################################################################### # Extension #103 - skipped # Extension #104 - skipped # Extension #105 - skipped # Extension #106 - skipped # Extension #107 - skipped # Extension #108 - skipped # Extension #109 - skipped ############################################################################### # Extension #110 IBM_rasterpos_clip enum: RASTER_POSITION_UNCLIPPED_IBM = 0x19262 ############################################################################### # Extension #111 HP_texture_lighting enum: TEXTURE_LIGHTING_MODE_HP = 0x8167 TEXTURE_POST_SPECULAR_HP = 0x8168 TEXTURE_PRE_SPECULAR_HP = 0x8169 ############################################################################### # Extension #112 EXT_draw_range_elements enum: MAX_ELEMENTS_VERTICES_EXT = 0x80E8 MAX_ELEMENTS_INDICES_EXT = 0x80E9 ############################################################################### # Extension #113 WIN_phong_shading enum: PHONG_WIN = 0x80EA PHONG_HINT_WIN = 0x80EB ############################################################################### # Extension #114 WIN_specular_fog enum: FOG_SPECULAR_TEXTURE_WIN = 0x80EC ############################################################################### # Extension #115 - skipped # Extension #116 - skipped ############################################################################### # Extension #117 EXT_light_texture enum: FRAGMENT_MATERIAL_EXT = 0x8349 FRAGMENT_NORMAL_EXT = 0x834A FRAGMENT_COLOR_EXT = 0x834C ATTENUATION_EXT = 0x834D SHADOW_ATTENUATION_EXT = 0x834E TEXTURE_APPLICATION_MODE_EXT = 0x834F # 1 I TEXTURE_LIGHT_EXT = 0x8350 # 1 I TEXTURE_MATERIAL_FACE_EXT = 0x8351 # 1 I TEXTURE_MATERIAL_PARAMETER_EXT = 0x8352 # 1 I use EXT_fog_coord FRAGMENT_DEPTH_EXT ############################################################################### # Extension #118 - skipped ############################################################################### # Extension #119 SGIX_blend_alpha_minmax enum: ALPHA_MIN_SGIX = 0x8320 ALPHA_MAX_SGIX = 0x8321 ############################################################################### # Extension #120 - skipped # Extension #121 - skipped # Extension #122 - skipped # Extension #123 - skipped # Extension #124 - skipped # Extension #125 - skipped ############################################################################### # Extension #126 SGIX_impact_pixel_texture enum: PIXEL_TEX_GEN_Q_CEILING_SGIX = 0x8184 PIXEL_TEX_GEN_Q_ROUND_SGIX = 0x8185 PIXEL_TEX_GEN_Q_FLOOR_SGIX = 0x8186 PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX = 0x8187 PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX = 0x8188 PIXEL_TEX_GEN_ALPHA_LS_SGIX = 0x8189 PIXEL_TEX_GEN_ALPHA_MS_SGIX = 0x818A ############################################################################### # Extension #127 - skipped # Extension #128 - skipped ############################################################################### # Extension #129 EXT_bgra enum: BGR_EXT = 0x80E0 BGRA_EXT = 0x80E1 ############################################################################### # Extension #130 - skipped # Extension #131 - skipped ############################################################################### # Extension #132 SGIX_async enum: ASYNC_MARKER_SGIX = 0x8329 ############################################################################### # Extension #133 SGIX_async_pixel enum: ASYNC_TEX_IMAGE_SGIX = 0x835C ASYNC_DRAW_PIXELS_SGIX = 0x835D ASYNC_READ_PIXELS_SGIX = 0x835E MAX_ASYNC_TEX_IMAGE_SGIX = 0x835F MAX_ASYNC_DRAW_PIXELS_SGIX = 0x8360 MAX_ASYNC_READ_PIXELS_SGIX = 0x8361 ############################################################################### # Extension #134 SGIX_async_histogram enum: ASYNC_HISTOGRAM_SGIX = 0x832C MAX_ASYNC_HISTOGRAM_SGIX = 0x832D ############################################################################### # Intel has not implemented this; enums never assigned # Extension #135 INTEL_texture_scissor enum: # TEXTURE_SCISSOR_INTEL = 0x???? # TEXTURE_SCISSOR_INTEL = 0x???? # TEXTURE_SCISSOR_FUNC_INTEL = 0x???? # TEXTURE_SCISSOR_S_INTEL = 0x???? # TEXTURE_SCISSOR_T_INTEL = 0x???? # TEXTURE_SCISSOR_R_INTEL = 0x???? ############################################################################### # Extension #136 INTEL_parallel_arrays enum: PARALLEL_ARRAYS_INTEL = 0x83F4 VERTEX_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F5 NORMAL_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F6 COLOR_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F7 TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL = 0x83F8 ############################################################################### # Extension #137 HP_occlusion_test enum: OCCLUSION_TEST_HP = 0x8165 OCCLUSION_TEST_RESULT_HP = 0x8166 ############################################################################### # Extension #138 EXT_pixel_transform enum: PIXEL_TRANSFORM_2D_EXT = 0x8330 PIXEL_MAG_FILTER_EXT = 0x8331 PIXEL_MIN_FILTER_EXT = 0x8332 PIXEL_CUBIC_WEIGHT_EXT = 0x8333 CUBIC_EXT = 0x8334 AVERAGE_EXT = 0x8335 PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = 0x8336 MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT = 0x8337 PIXEL_TRANSFORM_2D_MATRIX_EXT = 0x8338 ############################################################################### # Unknown enum values # Extension #139 EXT_pixel_transform_color_table enum: # PIXEL_TRANSFORM_COLOR_TABLE_EXT # PROXY_PIXEL_TRANSFORM_COLOR_TABLE_EXT ############################################################################### # Extension #140 - skipped ############################################################################### # Extension #141 EXT_shared_texture_palette enum: SHARED_TEXTURE_PALETTE_EXT = 0x81FB ############################################################################### # Extension #142 - GLX_SGIS_blended_overlay ############################################################################### # Extension #143 - SGIS_shared_multisample # MULTISAMPLE_SUB_RECT_POSITION_SGIS = # MULTISAMPLE_SUB_RECT_DIMS_SGIS = ############################################################################### # Extension #144 EXT_separate_specular_color enum: LIGHT_MODEL_COLOR_CONTROL_EXT = 0x81F8 SINGLE_COLOR_EXT = 0x81F9 SEPARATE_SPECULAR_COLOR_EXT = 0x81FA ############################################################################### # Extension #145 EXT_secondary_color enum: COLOR_SUM_EXT = 0x8458 # 1 I CURRENT_SECONDARY_COLOR_EXT = 0x8459 # 3 F SECONDARY_COLOR_ARRAY_SIZE_EXT = 0x845A # 1 I SECONDARY_COLOR_ARRAY_TYPE_EXT = 0x845B # 1 I SECONDARY_COLOR_ARRAY_STRIDE_EXT = 0x845C # 1 I SECONDARY_COLOR_ARRAY_POINTER_EXT = 0x845D SECONDARY_COLOR_ARRAY_EXT = 0x845E # 1 I ############################################################################### # Dead extension - EXT_texture_env_combine was finished instead # Extension #146 #EXT_texture_env enum: ############################################################################### # Extension #147 EXT_texture_perturb_normal enum: PERTURB_EXT = 0x85AE TEXTURE_NORMAL_EXT = 0x85AF ############################################################################### # No new tokens # Extension #148 # Diamond ships an otherwise identical IBM_multi_draw_arrays extension; # Dan Brokenshire says this is deprecated and should not be advertised. EXT_multi_draw_arrays enum: ############################################################################### # Extension #149 EXT_fog_coord enum: FOG_COORDINATE_SOURCE_EXT = 0x8450 # 1 I FOG_COORDINATE_EXT = 0x8451 FRAGMENT_DEPTH_EXT = 0x8452 CURRENT_FOG_COORDINATE_EXT = 0x8453 # 1 F FOG_COORDINATE_ARRAY_TYPE_EXT = 0x8454 # 1 I FOG_COORDINATE_ARRAY_STRIDE_EXT = 0x8455 # 1 I FOG_COORDINATE_ARRAY_POINTER_EXT = 0x8456 FOG_COORDINATE_ARRAY_EXT = 0x8457 # 1 I ############################################################################### # Extension #150 - skipped # Extension #151 - skipped # Extension #152 - skipped # Extension #153 - skipped # Extension #154 - skipped ############################################################################### # Extension #155 REND_screen_coordinates enum: SCREEN_COORDINATES_REND = 0x8490 INVERTED_SCREEN_W_REND = 0x8491 ############################################################################### # Extension #156 EXT_coordinate_frame enum: TANGENT_ARRAY_EXT = 0x8439 BINORMAL_ARRAY_EXT = 0x843A CURRENT_TANGENT_EXT = 0x843B CURRENT_BINORMAL_EXT = 0x843C TANGENT_ARRAY_TYPE_EXT = 0x843E TANGENT_ARRAY_STRIDE_EXT = 0x843F BINORMAL_ARRAY_TYPE_EXT = 0x8440 BINORMAL_ARRAY_STRIDE_EXT = 0x8441 TANGENT_ARRAY_POINTER_EXT = 0x8442 BINORMAL_ARRAY_POINTER_EXT = 0x8443 MAP1_TANGENT_EXT = 0x8444 MAP2_TANGENT_EXT = 0x8445 MAP1_BINORMAL_EXT = 0x8446 MAP2_BINORMAL_EXT = 0x8447 ############################################################################### # Extension #157 - skipped ############################################################################### # Extension #158 EXT_texture_env_combine enum: COMBINE_EXT = 0x8570 COMBINE_RGB_EXT = 0x8571 COMBINE_ALPHA_EXT = 0x8572 RGB_SCALE_EXT = 0x8573 ADD_SIGNED_EXT = 0x8574 INTERPOLATE_EXT = 0x8575 CONSTANT_EXT = 0x8576 PRIMARY_COLOR_EXT = 0x8577 PREVIOUS_EXT = 0x8578 SOURCE0_RGB_EXT = 0x8580 SOURCE1_RGB_EXT = 0x8581 SOURCE2_RGB_EXT = 0x8582 SOURCE0_ALPHA_EXT = 0x8588 SOURCE1_ALPHA_EXT = 0x8589 SOURCE2_ALPHA_EXT = 0x858A OPERAND0_RGB_EXT = 0x8590 OPERAND1_RGB_EXT = 0x8591 OPERAND2_RGB_EXT = 0x8592 OPERAND0_ALPHA_EXT = 0x8598 OPERAND1_ALPHA_EXT = 0x8599 OPERAND2_ALPHA_EXT = 0x859A ############################################################################### # Extension #159 APPLE_specular_vector enum: LIGHT_MODEL_SPECULAR_VECTOR_APPLE = 0x85B0 ############################################################################### # Extension #160 APPLE_transform_hint enum: TRANSFORM_HINT_APPLE = 0x85B1 ############################################################################### # Extension #161 SGIX_fog_scale enum: FOG_SCALE_SGIX = 0x81FC FOG_SCALE_VALUE_SGIX = 0x81FD ############################################################################### # Extension #162 - skipped ############################################################################### # Extension #163 SUNX_constant_data enum: UNPACK_CONSTANT_DATA_SUNX = 0x81D5 TEXTURE_CONSTANT_DATA_SUNX = 0x81D6 ############################################################################### # Extension #164 SUN_global_alpha enum: GLOBAL_ALPHA_SUN = 0x81D9 GLOBAL_ALPHA_FACTOR_SUN = 0x81DA ############################################################################### # Extension #165 SUN_triangle_list enum: RESTART_SUN = 0x0001 REPLACE_MIDDLE_SUN = 0x0002 REPLACE_OLDEST_SUN = 0x0003 TRIANGLE_LIST_SUN = 0x81D7 REPLACEMENT_CODE_SUN = 0x81D8 REPLACEMENT_CODE_ARRAY_SUN = 0x85C0 REPLACEMENT_CODE_ARRAY_TYPE_SUN = 0x85C1 REPLACEMENT_CODE_ARRAY_STRIDE_SUN = 0x85C2 REPLACEMENT_CODE_ARRAY_POINTER_SUN = 0x85C3 R1UI_V3F_SUN = 0x85C4 R1UI_C4UB_V3F_SUN = 0x85C5 R1UI_C3F_V3F_SUN = 0x85C6 R1UI_N3F_V3F_SUN = 0x85C7 R1UI_C4F_N3F_V3F_SUN = 0x85C8 R1UI_T2F_V3F_SUN = 0x85C9 R1UI_T2F_N3F_V3F_SUN = 0x85CA R1UI_T2F_C4F_N3F_V3F_SUN = 0x85CB ############################################################################### # No new tokens # Extension #166 SUN_vertex enum: ############################################################################### # Extension #167 - WGL_EXT_display_color_table # Extension #168 - WGL_EXT_extensions_string # Extension #169 - WGL_EXT_make_current_read # Extension #170 - WGL_EXT_pixel_format # Extension #171 - WGL_EXT_pbuffer # Extension #172 - WGL_EXT_swap_control ############################################################################### # Extension #173 EXT_blend_func_separate enum: BLEND_DST_RGB_EXT = 0x80C8 BLEND_SRC_RGB_EXT = 0x80C9 BLEND_DST_ALPHA_EXT = 0x80CA BLEND_SRC_ALPHA_EXT = 0x80CB ############################################################################### # Extension #174 INGR_color_clamp enum: RED_MIN_CLAMP_INGR = 0x8560 GREEN_MIN_CLAMP_INGR = 0x8561 BLUE_MIN_CLAMP_INGR = 0x8562 ALPHA_MIN_CLAMP_INGR = 0x8563 RED_MAX_CLAMP_INGR = 0x8564 GREEN_MAX_CLAMP_INGR = 0x8565 BLUE_MAX_CLAMP_INGR = 0x8566 ALPHA_MAX_CLAMP_INGR = 0x8567 ############################################################################### # Extension #175 INGR_interlace_read enum: INTERLACE_READ_INGR = 0x8568 ############################################################################### # Extension #176 EXT_stencil_wrap enum: INCR_WRAP_EXT = 0x8507 DECR_WRAP_EXT = 0x8508 ############################################################################### # Extension #177 - skipped ############################################################################### # Extension #178 EXT_422_pixels enum: 422_EXT = 0x80CC 422_REV_EXT = 0x80CD 422_AVERAGE_EXT = 0x80CE 422_REV_AVERAGE_EXT = 0x80CF ############################################################################### # Extension #179 NV_texgen_reflection enum: NORMAL_MAP_NV = 0x8511 REFLECTION_MAP_NV = 0x8512 ############################################################################### # Extension #180 - skipped # Extension #181 - skipped ############################################################################### # Is this shipping? No extension number assigned. # Extension #? EXT_texture_cube_map enum: NORMAL_MAP_EXT = 0x8511 REFLECTION_MAP_EXT = 0x8512 TEXTURE_CUBE_MAP_EXT = 0x8513 TEXTURE_BINDING_CUBE_MAP_EXT = 0x8514 TEXTURE_CUBE_MAP_POSITIVE_X_EXT = 0x8515 TEXTURE_CUBE_MAP_NEGATIVE_X_EXT = 0x8516 TEXTURE_CUBE_MAP_POSITIVE_Y_EXT = 0x8517 TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT = 0x8518 TEXTURE_CUBE_MAP_POSITIVE_Z_EXT = 0x8519 TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT = 0x851A PROXY_TEXTURE_CUBE_MAP_EXT = 0x851B MAX_CUBE_MAP_TEXTURE_SIZE_EXT = 0x851C ############################################################################### # Extension #182 SUN_convolution_border_modes enum: WRAP_BORDER_SUN = 0x81D4 ############################################################################### # Extension #183 - GLX_SUN_transparent_index ############################################################################### # Extension #184 - skipped ############################################################################### # No new tokens # Extension #185 EXT_texture_env_add enum: ############################################################################### # Extension #186 EXT_texture_lod_bias enum: MAX_TEXTURE_LOD_BIAS_EXT = 0x84FD TEXTURE_FILTER_CONTROL_EXT = 0x8500 TEXTURE_LOD_BIAS_EXT = 0x8501 ############################################################################### # Extension #187 EXT_texture_filter_anisotropic enum: TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF ############################################################################### # Extension #188 EXT_vertex_weighting enum: MODELVIEW0_STACK_DEPTH_EXT = GL_MODELVIEW_STACK_DEPTH MODELVIEW1_STACK_DEPTH_EXT = 0x8502 MODELVIEW0_MATRIX_EXT = GL_MODELVIEW_MATRIX MODELVIEW1_MATRIX_EXT = 0x8506 VERTEX_WEIGHTING_EXT = 0x8509 MODELVIEW0_EXT = GL_MODELVIEW MODELVIEW1_EXT = 0x850A CURRENT_VERTEX_WEIGHT_EXT = 0x850B VERTEX_WEIGHT_ARRAY_EXT = 0x850C VERTEX_WEIGHT_ARRAY_SIZE_EXT = 0x850D VERTEX_WEIGHT_ARRAY_TYPE_EXT = 0x850E VERTEX_WEIGHT_ARRAY_STRIDE_EXT = 0x850F VERTEX_WEIGHT_ARRAY_POINTER_EXT = 0x8510 ############################################################################### # Extension #189 NV_light_max_exponent enum: MAX_SHININESS_NV = 0x8504 MAX_SPOT_EXPONENT_NV = 0x8505 ############################################################################### # Extension #190 NV_vertex_array_range enum: VERTEX_ARRAY_RANGE_NV = 0x851D VERTEX_ARRAY_RANGE_LENGTH_NV = 0x851E VERTEX_ARRAY_RANGE_VALID_NV = 0x851F MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV = 0x8520 VERTEX_ARRAY_RANGE_POINTER_NV = 0x8521 ############################################################################### # Extension #191 NV_register_combiners enum: REGISTER_COMBINERS_NV = 0x8522 VARIABLE_A_NV = 0x8523 VARIABLE_B_NV = 0x8524 VARIABLE_C_NV = 0x8525 VARIABLE_D_NV = 0x8526 VARIABLE_E_NV = 0x8527 VARIABLE_F_NV = 0x8528 VARIABLE_G_NV = 0x8529 CONSTANT_COLOR0_NV = 0x852A CONSTANT_COLOR1_NV = 0x852B PRIMARY_COLOR_NV = 0x852C SECONDARY_COLOR_NV = 0x852D SPARE0_NV = 0x852E SPARE1_NV = 0x852F DISCARD_NV = 0x8530 E_TIMES_F_NV = 0x8531 SPARE0_PLUS_SECONDARY_COLOR_NV = 0x8532 UNSIGNED_IDENTITY_NV = 0x8536 UNSIGNED_INVERT_NV = 0x8537 EXPAND_NORMAL_NV = 0x8538 EXPAND_NEGATE_NV = 0x8539 HALF_BIAS_NORMAL_NV = 0x853A HALF_BIAS_NEGATE_NV = 0x853B SIGNED_IDENTITY_NV = 0x853C SIGNED_NEGATE_NV = 0x853D SCALE_BY_TWO_NV = 0x853E SCALE_BY_FOUR_NV = 0x853F SCALE_BY_ONE_HALF_NV = 0x8540 BIAS_BY_NEGATIVE_ONE_HALF_NV = 0x8541 COMBINER_INPUT_NV = 0x8542 COMBINER_MAPPING_NV = 0x8543 COMBINER_COMPONENT_USAGE_NV = 0x8544 COMBINER_AB_DOT_PRODUCT_NV = 0x8545 COMBINER_CD_DOT_PRODUCT_NV = 0x8546 COMBINER_MUX_SUM_NV = 0x8547 COMBINER_SCALE_NV = 0x8548 COMBINER_BIAS_NV = 0x8549 COMBINER_AB_OUTPUT_NV = 0x854A COMBINER_CD_OUTPUT_NV = 0x854B COMBINER_SUM_OUTPUT_NV = 0x854C MAX_GENERAL_COMBINERS_NV = 0x854D NUM_GENERAL_COMBINERS_NV = 0x854E COLOR_SUM_CLAMP_NV = 0x854F COMBINER0_NV = 0x8550 COMBINER1_NV = 0x8551 COMBINER2_NV = 0x8552 COMBINER3_NV = 0x8553 COMBINER4_NV = 0x8554 COMBINER5_NV = 0x8555 COMBINER6_NV = 0x8556 COMBINER7_NV = 0x8557 use ARB_multitexture TEXTURE0_ARB use ARB_multitexture TEXTURE1_ARB use BlendingFactorDest ZERO use DrawBufferMode NONE use GetPName FOG ############################################################################### # Extension #192 NV_fog_distance enum: FOG_DISTANCE_MODE_NV = 0x855A EYE_RADIAL_NV = 0x855B EYE_PLANE_ABSOLUTE_NV = 0x855C use TextureGenParameter EYE_PLANE ############################################################################### # Extension #193 NV_texgen_emboss enum: EMBOSS_LIGHT_NV = 0x855D EMBOSS_CONSTANT_NV = 0x855E EMBOSS_MAP_NV = 0x855F ############################################################################### # No new tokens # Extension #194 NV_blend_square enum: ############################################################################### # Extension #195 NV_texture_env_combine4 enum: COMBINE4_NV = 0x8503 SOURCE3_RGB_NV = 0x8583 SOURCE3_ALPHA_NV = 0x858B OPERAND3_RGB_NV = 0x8593 OPERAND3_ALPHA_NV = 0x859B ############################################################################### # No new tokens # Extension #196 MESA_resize_buffers enum: ############################################################################### # No new tokens # Extension #197 MESA_window_pos enum: ############################################################################### # Extension #198 EXT_texture_compression_s3tc enum: COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0 COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1 COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2 COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3 ############################################################################### # Extension #199 IBM_cull_vertex enum: CULL_VERTEX_IBM = 103050 ############################################################################### # No new tokens # Extension #200 IBM_multimode_draw_arrays enum: ############################################################################### # Extension #201 IBM_vertex_array_lists enum: VERTEX_ARRAY_LIST_IBM = 103070 NORMAL_ARRAY_LIST_IBM = 103071 COLOR_ARRAY_LIST_IBM = 103072 INDEX_ARRAY_LIST_IBM = 103073 TEXTURE_COORD_ARRAY_LIST_IBM = 103074 EDGE_FLAG_ARRAY_LIST_IBM = 103075 FOG_COORDINATE_ARRAY_LIST_IBM = 103076 SECONDARY_COLOR_ARRAY_LIST_IBM = 103077 VERTEX_ARRAY_LIST_STRIDE_IBM = 103080 NORMAL_ARRAY_LIST_STRIDE_IBM = 103081 COLOR_ARRAY_LIST_STRIDE_IBM = 103082 INDEX_ARRAY_LIST_STRIDE_IBM = 103083 TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM = 103084 EDGE_FLAG_ARRAY_LIST_STRIDE_IBM = 103085 FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM = 103086 SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM = 103087 ############################################################################### # Extension #202 SGIX_subsample enum: PACK_SUBSAMPLE_RATE_SGIX = 0x85A0 UNPACK_SUBSAMPLE_RATE_SGIX = 0x85A1 PIXEL_SUBSAMPLE_4444_SGIX = 0x85A2 PIXEL_SUBSAMPLE_2424_SGIX = 0x85A3 PIXEL_SUBSAMPLE_4242_SGIX = 0x85A4 ############################################################################### # Extension #203 SGIX_ycrcb_subsample enum: PACK_SUBSAMPLE_RATE_SGIX = 0x85A0 UNPACK_SUBSAMPLE_RATE_SGIX = 0x85A1 PIXEL_SUBSAMPLE_4444_SGIX = 0x85A2 PIXEL_SUBSAMPLE_2424_SGIX = 0x85A3 PIXEL_SUBSAMPLE_4242_SGIX = 0x85A4 ############################################################################### # Extension #204 SGIX_ycrcba enum: YCRCB_SGIX = 0x8318 YCRCBA_SGIX = 0x8319 ############################################################################### # Extension #205 SGI_depth_pass_instrument enum: DEPTH_PASS_INSTRUMENT_SGIX = 0x8310 DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX = 0x8311 DEPTH_PASS_INSTRUMENT_MAX_SGIX = 0x8312 ############################################################################### # Extension #206 3DFX_texture_compression_FXT1 enum: COMPRESSED_RGB_FXT1_3DFX = 0x86B0 COMPRESSED_RGBA_FXT1_3DFX = 0x86B1 ############################################################################### # Extension #207 3DFX_multisample enum: MULTISAMPLE_3DFX = 0x86B2 SAMPLE_BUFFERS_3DFX = 0x86B3 SAMPLES_3DFX = 0x86B4 MULTISAMPLE_BIT_3DFX = 0x20000000 ############################################################################### # No new tokens # Extension #208 3DFX_tbuffer enum: ############################################################################### # Extension #209 EXT_multisample enum: MULTISAMPLE_EXT = 0x809D SAMPLE_ALPHA_TO_MASK_EXT = 0x809E SAMPLE_ALPHA_TO_ONE_EXT = 0x809F SAMPLE_MASK_EXT = 0x80A0 1PASS_EXT = 0x80A1 2PASS_0_EXT = 0x80A2 2PASS_1_EXT = 0x80A3 4PASS_0_EXT = 0x80A4 4PASS_1_EXT = 0x80A5 4PASS_2_EXT = 0x80A6 4PASS_3_EXT = 0x80A7 SAMPLE_BUFFERS_EXT = 0x80A8 # 1 I SAMPLES_EXT = 0x80A9 # 1 I SAMPLE_MASK_VALUE_EXT = 0x80AA # 1 F SAMPLE_MASK_INVERT_EXT = 0x80AB # 1 I SAMPLE_PATTERN_EXT = 0x80AC # 1 I MULTISAMPLE_BIT_EXT = 0x20000000 ############################################################################### # Extension #210 SGIX_vertex_preclip enum: VERTEX_PRECLIP_SGIX = 0x83EE VERTEX_PRECLIP_HINT_SGIX = 0x83EF ############################################################################### # Extension #211 SGIX_convolution_accuracy enum: CONVOLUTION_HINT_SGIX = 0x8316 # 1 I ############################################################################### # Extension #212 SGIX_resample enum: PACK_RESAMPLE_SGIX = 0x842C UNPACK_RESAMPLE_SGIX = 0x842D RESAMPLE_REPLICATE_SGIX = 0x842E RESAMPLE_ZERO_FILL_SGIX = 0x842F RESAMPLE_DECIMATE_SGIX = 0x8430 ############################################################################### # Extension #213 SGIS_point_line_texgen enum: EYE_DISTANCE_TO_POINT_SGIS = 0x81F0 OBJECT_DISTANCE_TO_POINT_SGIS = 0x81F1 EYE_DISTANCE_TO_LINE_SGIS = 0x81F2 OBJECT_DISTANCE_TO_LINE_SGIS = 0x81F3 EYE_POINT_SGIS = 0x81F4 OBJECT_POINT_SGIS = 0x81F5 EYE_LINE_SGIS = 0x81F6 OBJECT_LINE_SGIS = 0x81F7 ############################################################################### # Extension #214 SGIS_texture_color_mask enum: TEXTURE_COLOR_WRITEMASK_SGIS = 0x81EF ############################################################################### # Extension #220 # Promoted to ARB_texture_env_dot3, enum values changed EXT_texture_env_dot3 enum: DOT3_RGB_EXT = 0x8740 DOT3_RGBA_EXT = 0x8741 ############################################################################### # Extension #221 ATI_texture_mirror_once enum: MIRROR_CLAMP_ATI = 0x8742 MIRROR_CLAMP_TO_EDGE_ATI = 0x8743 ############################################################################### # Extension #222 NV_fence enum: ALL_COMPLETED_NV = 0x84F2 FENCE_STATUS_NV = 0x84F3 FENCE_CONDITION_NV = 0x84F4 ############################################################################### # Extension #224 IBM_texture_mirrored_repeat enum: MIRRORED_REPEAT_IBM = 0x8370 ############################################################################### # Extension #225 NV_evaluators enum: EVAL_2D_NV = 0x86C0 EVAL_TRIANGULAR_2D_NV = 0x86C1 MAP_TESSELLATION_NV = 0x86C2 MAP_ATTRIB_U_ORDER_NV = 0x86C3 MAP_ATTRIB_V_ORDER_NV = 0x86C4 EVAL_FRACTIONAL_TESSELLATION_NV = 0x86C5 EVAL_VERTEX_ATTRIB0_NV = 0x86C6 EVAL_VERTEX_ATTRIB1_NV = 0x86C7 EVAL_VERTEX_ATTRIB2_NV = 0x86C8 EVAL_VERTEX_ATTRIB3_NV = 0x86C9 EVAL_VERTEX_ATTRIB4_NV = 0x86CA EVAL_VERTEX_ATTRIB5_NV = 0x86CB EVAL_VERTEX_ATTRIB6_NV = 0x86CC EVAL_VERTEX_ATTRIB7_NV = 0x86CD EVAL_VERTEX_ATTRIB8_NV = 0x86CE EVAL_VERTEX_ATTRIB9_NV = 0x86CF EVAL_VERTEX_ATTRIB10_NV = 0x86D0 EVAL_VERTEX_ATTRIB11_NV = 0x86D1 EVAL_VERTEX_ATTRIB12_NV = 0x86D2 EVAL_VERTEX_ATTRIB13_NV = 0x86D3 EVAL_VERTEX_ATTRIB14_NV = 0x86D4 EVAL_VERTEX_ATTRIB15_NV = 0x86D5 MAX_MAP_TESSELLATION_NV = 0x86D6 MAX_RATIONAL_EVAL_ORDER_NV = 0x86D7 ############################################################################### # Extension #226 NV_packed_depth_stencil enum: DEPTH_STENCIL_NV = 0x84F9 UNSIGNED_INT_24_8_NV = 0x84FA ############################################################################### # Extension #227 NV_register_combiners2 enum: PER_STAGE_CONSTANTS_NV = 0x8535 ############################################################################### # No new tokens # Extension #228 NV_texture_compression_vtc enum: ############################################################################### # Extension #229 NV_texture_rectangle enum: TEXTURE_RECTANGLE_NV = 0x84F5 TEXTURE_BINDING_RECTANGLE_NV = 0x84F6 PROXY_TEXTURE_RECTANGLE_NV = 0x84F7 MAX_RECTANGLE_TEXTURE_SIZE_NV = 0x84F8 ############################################################################### # Extension #230 NV_texture_shader enum: OFFSET_TEXTURE_RECTANGLE_NV = 0x864C OFFSET_TEXTURE_RECTANGLE_SCALE_NV = 0x864D DOT_PRODUCT_TEXTURE_RECTANGLE_NV = 0x864E RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV = 0x86D9 UNSIGNED_INT_S8_S8_8_8_NV = 0x86DA UNSIGNED_INT_8_8_S8_S8_REV_NV = 0x86DB DSDT_MAG_INTENSITY_NV = 0x86DC SHADER_CONSISTENT_NV = 0x86DD TEXTURE_SHADER_NV = 0x86DE SHADER_OPERATION_NV = 0x86DF CULL_MODES_NV = 0x86E0 OFFSET_TEXTURE_MATRIX_NV = 0x86E1 OFFSET_TEXTURE_SCALE_NV = 0x86E2 OFFSET_TEXTURE_BIAS_NV = 0x86E3 OFFSET_TEXTURE_2D_MATRIX_NV = GL_OFFSET_TEXTURE_MATRIX_NV OFFSET_TEXTURE_2D_SCALE_NV = GL_OFFSET_TEXTURE_SCALE_NV OFFSET_TEXTURE_2D_BIAS_NV = GL_OFFSET_TEXTURE_BIAS_NV PREVIOUS_TEXTURE_INPUT_NV = 0x86E4 CONST_EYE_NV = 0x86E5 PASS_THROUGH_NV = 0x86E6 CULL_FRAGMENT_NV = 0x86E7 OFFSET_TEXTURE_2D_NV = 0x86E8 DEPENDENT_AR_TEXTURE_2D_NV = 0x86E9 DEPENDENT_GB_TEXTURE_2D_NV = 0x86EA DOT_PRODUCT_NV = 0x86EC DOT_PRODUCT_DEPTH_REPLACE_NV = 0x86ED DOT_PRODUCT_TEXTURE_2D_NV = 0x86EE DOT_PRODUCT_TEXTURE_CUBE_MAP_NV = 0x86F0 DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV = 0x86F1 DOT_PRODUCT_REFLECT_CUBE_MAP_NV = 0x86F2 DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV = 0x86F3 HILO_NV = 0x86F4 DSDT_NV = 0x86F5 DSDT_MAG_NV = 0x86F6 DSDT_MAG_VIB_NV = 0x86F7 HILO16_NV = 0x86F8 SIGNED_HILO_NV = 0x86F9 SIGNED_HILO16_NV = 0x86FA SIGNED_RGBA_NV = 0x86FB SIGNED_RGBA8_NV = 0x86FC SIGNED_RGB_NV = 0x86FE SIGNED_RGB8_NV = 0x86FF SIGNED_LUMINANCE_NV = 0x8701 SIGNED_LUMINANCE8_NV = 0x8702 SIGNED_LUMINANCE_ALPHA_NV = 0x8703 SIGNED_LUMINANCE8_ALPHA8_NV = 0x8704 SIGNED_ALPHA_NV = 0x8705 SIGNED_ALPHA8_NV = 0x8706 SIGNED_INTENSITY_NV = 0x8707 SIGNED_INTENSITY8_NV = 0x8708 DSDT8_NV = 0x8709 DSDT8_MAG8_NV = 0x870A DSDT8_MAG8_INTENSITY8_NV = 0x870B SIGNED_RGB_UNSIGNED_ALPHA_NV = 0x870C SIGNED_RGB8_UNSIGNED_ALPHA8_NV = 0x870D HI_SCALE_NV = 0x870E LO_SCALE_NV = 0x870F DS_SCALE_NV = 0x8710 DT_SCALE_NV = 0x8711 MAGNITUDE_SCALE_NV = 0x8712 VIBRANCE_SCALE_NV = 0x8713 HI_BIAS_NV = 0x8714 LO_BIAS_NV = 0x8715 DS_BIAS_NV = 0x8716 DT_BIAS_NV = 0x8717 MAGNITUDE_BIAS_NV = 0x8718 VIBRANCE_BIAS_NV = 0x8719 TEXTURE_BORDER_VALUES_NV = 0x871A TEXTURE_HI_SIZE_NV = 0x871B TEXTURE_LO_SIZE_NV = 0x871C TEXTURE_DS_SIZE_NV = 0x871D TEXTURE_DT_SIZE_NV = 0x871E TEXTURE_MAG_SIZE_NV = 0x871F ############################################################################### # Extension #231 NV_texture_shader2 enum: DOT_PRODUCT_TEXTURE_3D_NV = 0x86EF ############################################################################### # Extension #232 NV_vertex_array_range2 enum: VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV = 0x8533 ############################################################################### # Extension #233 NV_vertex_program enum: VERTEX_PROGRAM_NV = 0x8620 VERTEX_STATE_PROGRAM_NV = 0x8621 ATTRIB_ARRAY_SIZE_NV = 0x8623 ATTRIB_ARRAY_STRIDE_NV = 0x8624 ATTRIB_ARRAY_TYPE_NV = 0x8625 CURRENT_ATTRIB_NV = 0x8626 PROGRAM_LENGTH_NV = 0x8627 PROGRAM_STRING_NV = 0x8628 MODELVIEW_PROJECTION_NV = 0x8629 IDENTITY_NV = 0x862A INVERSE_NV = 0x862B TRANSPOSE_NV = 0x862C INVERSE_TRANSPOSE_NV = 0x862D MAX_TRACK_MATRIX_STACK_DEPTH_NV = 0x862E MAX_TRACK_MATRICES_NV = 0x862F MATRIX0_NV = 0x8630 MATRIX1_NV = 0x8631 MATRIX2_NV = 0x8632 MATRIX3_NV = 0x8633 MATRIX4_NV = 0x8634 MATRIX5_NV = 0x8635 MATRIX6_NV = 0x8636 MATRIX7_NV = 0x8637 ################## # # Reserved: # # MATRIX8_NV = 0x8638 # MATRIX9_NV = 0x8639 # MATRIX10_NV = 0x863A # MATRIX11_NV = 0x863B # MATRIX12_NV = 0x863C # MATRIX13_NV = 0x863D # MATRIX14_NV = 0x863E # MATRIX15_NV = 0x863F # ################### CURRENT_MATRIX_STACK_DEPTH_NV = 0x8640 CURRENT_MATRIX_NV = 0x8641 VERTEX_PROGRAM_POINT_SIZE_NV = 0x8642 VERTEX_PROGRAM_TWO_SIDE_NV = 0x8643 PROGRAM_PARAMETER_NV = 0x8644 ATTRIB_ARRAY_POINTER_NV = 0x8645 PROGRAM_TARGET_NV = 0x8646 PROGRAM_RESIDENT_NV = 0x8647 TRACK_MATRIX_NV = 0x8648 TRACK_MATRIX_TRANSFORM_NV = 0x8649 VERTEX_PROGRAM_BINDING_NV = 0x864A PROGRAM_ERROR_POSITION_NV = 0x864B VERTEX_ATTRIB_ARRAY0_NV = 0x8650 VERTEX_ATTRIB_ARRAY1_NV = 0x8651 VERTEX_ATTRIB_ARRAY2_NV = 0x8652 VERTEX_ATTRIB_ARRAY3_NV = 0x8653 VERTEX_ATTRIB_ARRAY4_NV = 0x8654 VERTEX_ATTRIB_ARRAY5_NV = 0x8655 VERTEX_ATTRIB_ARRAY6_NV = 0x8656 VERTEX_ATTRIB_ARRAY7_NV = 0x8657 VERTEX_ATTRIB_ARRAY8_NV = 0x8658 VERTEX_ATTRIB_ARRAY9_NV = 0x8659 VERTEX_ATTRIB_ARRAY10_NV = 0x865A VERTEX_ATTRIB_ARRAY11_NV = 0x865B VERTEX_ATTRIB_ARRAY12_NV = 0x865C VERTEX_ATTRIB_ARRAY13_NV = 0x865D VERTEX_ATTRIB_ARRAY14_NV = 0x865E VERTEX_ATTRIB_ARRAY15_NV = 0x865F MAP1_VERTEX_ATTRIB0_4_NV = 0x8660 MAP1_VERTEX_ATTRIB1_4_NV = 0x8661 MAP1_VERTEX_ATTRIB2_4_NV = 0x8662 MAP1_VERTEX_ATTRIB3_4_NV = 0x8663 MAP1_VERTEX_ATTRIB4_4_NV = 0x8664 MAP1_VERTEX_ATTRIB5_4_NV = 0x8665 MAP1_VERTEX_ATTRIB6_4_NV = 0x8666 MAP1_VERTEX_ATTRIB7_4_NV = 0x8667 MAP1_VERTEX_ATTRIB8_4_NV = 0x8668 MAP1_VERTEX_ATTRIB9_4_NV = 0x8669 MAP1_VERTEX_ATTRIB10_4_NV = 0x866A MAP1_VERTEX_ATTRIB11_4_NV = 0x866B MAP1_VERTEX_ATTRIB12_4_NV = 0x866C MAP1_VERTEX_ATTRIB13_4_NV = 0x866D MAP1_VERTEX_ATTRIB14_4_NV = 0x866E MAP1_VERTEX_ATTRIB15_4_NV = 0x866F MAP2_VERTEX_ATTRIB0_4_NV = 0x8670 MAP2_VERTEX_ATTRIB1_4_NV = 0x8671 MAP2_VERTEX_ATTRIB2_4_NV = 0x8672 MAP2_VERTEX_ATTRIB3_4_NV = 0x8673 MAP2_VERTEX_ATTRIB4_4_NV = 0x8674 MAP2_VERTEX_ATTRIB5_4_NV = 0x8675 MAP2_VERTEX_ATTRIB6_4_NV = 0x8676 MAP2_VERTEX_ATTRIB7_4_NV = 0x8677 MAP2_VERTEX_ATTRIB8_4_NV = 0x8678 MAP2_VERTEX_ATTRIB9_4_NV = 0x8679 MAP2_VERTEX_ATTRIB10_4_NV = 0x867A MAP2_VERTEX_ATTRIB11_4_NV = 0x867B MAP2_VERTEX_ATTRIB12_4_NV = 0x867C MAP2_VERTEX_ATTRIB13_4_NV = 0x867D MAP2_VERTEX_ATTRIB14_4_NV = 0x867E MAP2_VERTEX_ATTRIB15_4_NV = 0x867F ############################################################################### # Extension #235 SGIX_texture_coordinate_clamp enum: TEXTURE_MAX_CLAMP_S_SGIX = 0x8369 TEXTURE_MAX_CLAMP_T_SGIX = 0x836A TEXTURE_MAX_CLAMP_R_SGIX = 0x836B ############################################################################### # Extension #236 SGIX_scalebias_hint enum: SCALEBIAS_HINT_SGIX = 0x8322 ############################################################################### # Extension #237 - GLX_OML_swap_method # Extension #238 - GLX_OML_sync_control ############################################################################### # Extension #239 OML_interlace enum: INTERLACE_OML = 0x8980 INTERLACE_READ_OML = 0x8981 ############################################################################### # Extension #240 OML_subsample enum: FORMAT_SUBSAMPLE_24_24_OML = 0x8982 FORMAT_SUBSAMPLE_244_244_OML = 0x8983 ############################################################################### # Extension #241 OML_resample enum: PACK_RESAMPLE_OML = 0x8984 UNPACK_RESAMPLE_OML = 0x8985 RESAMPLE_REPLICATE_OML = 0x8986 RESAMPLE_ZERO_FILL_OML = 0x8987 RESAMPLE_AVERAGE_OML = 0x8988 RESAMPLE_DECIMATE_OML = 0x8989 ############################################################################### # Extension #242 - WGL_OML_sync_control ############################################################################### # Extension #243 NV_copy_depth_to_color enum: DEPTH_STENCIL_TO_RGBA_NV = 0x886E DEPTH_STENCIL_TO_BGRA_NV = 0x886F ############################################################################### # Extension #244 ATI_envmap_bumpmap enum: BUMP_ROT_MATRIX_ATI = 0x8775 BUMP_ROT_MATRIX_SIZE_ATI = 0x8776 BUMP_NUM_TEX_UNITS_ATI = 0x8777 BUMP_TEX_UNITS_ATI = 0x8778 DUDV_ATI = 0x8779 DU8DV8_ATI = 0x877A BUMP_ENVMAP_ATI = 0x877B BUMP_TARGET_ATI = 0x877C ############################################################################### # Extension #245 ATI_fragment_shader enum: FRAGMENT_SHADER_ATI = 0x8920 REG_0_ATI = 0x8921 REG_1_ATI = 0x8922 REG_2_ATI = 0x8923 REG_3_ATI = 0x8924 REG_4_ATI = 0x8925 REG_5_ATI = 0x8926 REG_6_ATI = 0x8927 REG_7_ATI = 0x8928 REG_8_ATI = 0x8929 REG_9_ATI = 0x892A REG_10_ATI = 0x892B REG_11_ATI = 0x892C REG_12_ATI = 0x892D REG_13_ATI = 0x892E REG_14_ATI = 0x892F REG_15_ATI = 0x8930 REG_16_ATI = 0x8931 REG_17_ATI = 0x8932 REG_18_ATI = 0x8933 REG_19_ATI = 0x8934 REG_20_ATI = 0x8935 REG_21_ATI = 0x8936 REG_22_ATI = 0x8937 REG_23_ATI = 0x8938 REG_24_ATI = 0x8939 REG_25_ATI = 0x893A REG_26_ATI = 0x893B REG_27_ATI = 0x893C REG_28_ATI = 0x893D REG_29_ATI = 0x893E REG_30_ATI = 0x893F REG_31_ATI = 0x8940 CON_0_ATI = 0x8941 CON_1_ATI = 0x8942 CON_2_ATI = 0x8943 CON_3_ATI = 0x8944 CON_4_ATI = 0x8945 CON_5_ATI = 0x8946 CON_6_ATI = 0x8947 CON_7_ATI = 0x8948 CON_8_ATI = 0x8949 CON_9_ATI = 0x894A CON_10_ATI = 0x894B CON_11_ATI = 0x894C CON_12_ATI = 0x894D CON_13_ATI = 0x894E CON_14_ATI = 0x894F CON_15_ATI = 0x8950 CON_16_ATI = 0x8951 CON_17_ATI = 0x8952 CON_18_ATI = 0x8953 CON_19_ATI = 0x8954 CON_20_ATI = 0x8955 CON_21_ATI = 0x8956 CON_22_ATI = 0x8957 CON_23_ATI = 0x8958 CON_24_ATI = 0x8959 CON_25_ATI = 0x895A CON_26_ATI = 0x895B CON_27_ATI = 0x895C CON_28_ATI = 0x895D CON_29_ATI = 0x895E CON_30_ATI = 0x895F CON_31_ATI = 0x8960 MOV_ATI = 0x8961 ADD_ATI = 0x8963 MUL_ATI = 0x8964 SUB_ATI = 0x8965 DOT3_ATI = 0x8966 DOT4_ATI = 0x8967 MAD_ATI = 0x8968 LERP_ATI = 0x8969 CND_ATI = 0x896A CND0_ATI = 0x896B DOT2_ADD_ATI = 0x896C SECONDARY_INTERPOLATOR_ATI = 0x896D NUM_FRAGMENT_REGISTERS_ATI = 0x896E NUM_FRAGMENT_CONSTANTS_ATI = 0x896F NUM_PASSES_ATI = 0x8970 NUM_INSTRUCTIONS_PER_PASS_ATI = 0x8971 NUM_INSTRUCTIONS_TOTAL_ATI = 0x8972 NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI = 0x8973 NUM_LOOPBACK_COMPONENTS_ATI = 0x8974 COLOR_ALPHA_PAIRING_ATI = 0x8975 SWIZZLE_STR_ATI = 0x8976 SWIZZLE_STQ_ATI = 0x8977 SWIZZLE_STR_DR_ATI = 0x8978 SWIZZLE_STQ_DQ_ATI = 0x8979 SWIZZLE_STRQ_ATI = 0x897A SWIZZLE_STRQ_DQ_ATI = 0x897B RED_BIT_ATI = 0x00000001 GREEN_BIT_ATI = 0x00000002 BLUE_BIT_ATI = 0x00000004 2X_BIT_ATI = 0x00000001 4X_BIT_ATI = 0x00000002 8X_BIT_ATI = 0x00000004 HALF_BIT_ATI = 0x00000008 QUARTER_BIT_ATI = 0x00000010 EIGHTH_BIT_ATI = 0x00000020 SATURATE_BIT_ATI = 0x00000040 2X_BIT_ATI = 0x00000001 COMP_BIT_ATI = 0x00000002 NEGATE_BIT_ATI = 0x00000004 BIAS_BIT_ATI = 0x00000008 ############################################################################### # Extension #246 ATI_pn_triangles enum: PN_TRIANGLES_ATI = 0x87F0 MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI = 0x87F1 PN_TRIANGLES_POINT_MODE_ATI = 0x87F2 PN_TRIANGLES_NORMAL_MODE_ATI = 0x87F3 PN_TRIANGLES_TESSELATION_LEVEL_ATI = 0x87F4 PN_TRIANGLES_POINT_MODE_LINEAR_ATI = 0x87F5 PN_TRIANGLES_POINT_MODE_CUBIC_ATI = 0x87F6 PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI = 0x87F7 PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI = 0x87F8 ############################################################################### # Extension #247 ATI_vertex_array_object enum: STATIC_ATI = 0x8760 DYNAMIC_ATI = 0x8761 PRESERVE_ATI = 0x8762 DISCARD_ATI = 0x8763 OBJECT_BUFFER_SIZE_ATI = 0x8764 OBJECT_BUFFER_USAGE_ATI = 0x8765 ARRAY_OBJECT_BUFFER_ATI = 0x8766 ARRAY_OBJECT_OFFSET_ATI = 0x8767 ############################################################################### # Extension #248 EXT_vertex_shader enum: VERTEX_SHADER_EXT = 0x8780 VERTEX_SHADER_BINDING_EXT = 0x8781 OP_INDEX_EXT = 0x8782 OP_NEGATE_EXT = 0x8783 OP_DOT3_EXT = 0x8784 OP_DOT4_EXT = 0x8785 OP_MUL_EXT = 0x8786 OP_ADD_EXT = 0x8787 OP_MADD_EXT = 0x8788 OP_FRAC_EXT = 0x8789 OP_MAX_EXT = 0x878A OP_MIN_EXT = 0x878B OP_SET_GE_EXT = 0x878C OP_SET_LT_EXT = 0x878D OP_CLAMP_EXT = 0x878E OP_FLOOR_EXT = 0x878F OP_ROUND_EXT = 0x8790 OP_EXP_BASE_2_EXT = 0x8791 OP_LOG_BASE_2_EXT = 0x8792 OP_POWER_EXT = 0x8793 OP_RECIP_EXT = 0x8794 OP_RECIP_SQRT_EXT = 0x8795 OP_SUB_EXT = 0x8796 OP_CROSS_PRODUCT_EXT = 0x8797 OP_MULTIPLY_MATRIX_EXT = 0x8798 OP_MOV_EXT = 0x8799 OUTPUT_VERTEX_EXT = 0x879A OUTPUT_COLOR0_EXT = 0x879B OUTPUT_COLOR1_EXT = 0x879C OUTPUT_TEXTURE_COORD0_EXT = 0x879D OUTPUT_TEXTURE_COORD1_EXT = 0x879E OUTPUT_TEXTURE_COORD2_EXT = 0x879F OUTPUT_TEXTURE_COORD3_EXT = 0x87A0 OUTPUT_TEXTURE_COORD4_EXT = 0x87A1 OUTPUT_TEXTURE_COORD5_EXT = 0x87A2 OUTPUT_TEXTURE_COORD6_EXT = 0x87A3 OUTPUT_TEXTURE_COORD7_EXT = 0x87A4 OUTPUT_TEXTURE_COORD8_EXT = 0x87A5 OUTPUT_TEXTURE_COORD9_EXT = 0x87A6 OUTPUT_TEXTURE_COORD10_EXT = 0x87A7 OUTPUT_TEXTURE_COORD11_EXT = 0x87A8 OUTPUT_TEXTURE_COORD12_EXT = 0x87A9 OUTPUT_TEXTURE_COORD13_EXT = 0x87AA OUTPUT_TEXTURE_COORD14_EXT = 0x87AB OUTPUT_TEXTURE_COORD15_EXT = 0x87AC OUTPUT_TEXTURE_COORD16_EXT = 0x87AD OUTPUT_TEXTURE_COORD17_EXT = 0x87AE OUTPUT_TEXTURE_COORD18_EXT = 0x87AF OUTPUT_TEXTURE_COORD19_EXT = 0x87B0 OUTPUT_TEXTURE_COORD20_EXT = 0x87B1 OUTPUT_TEXTURE_COORD21_EXT = 0x87B2 OUTPUT_TEXTURE_COORD22_EXT = 0x87B3 OUTPUT_TEXTURE_COORD23_EXT = 0x87B4 OUTPUT_TEXTURE_COORD24_EXT = 0x87B5 OUTPUT_TEXTURE_COORD25_EXT = 0x87B6 OUTPUT_TEXTURE_COORD26_EXT = 0x87B7 OUTPUT_TEXTURE_COORD27_EXT = 0x87B8 OUTPUT_TEXTURE_COORD28_EXT = 0x87B9 OUTPUT_TEXTURE_COORD29_EXT = 0x87BA OUTPUT_TEXTURE_COORD30_EXT = 0x87BB OUTPUT_TEXTURE_COORD31_EXT = 0x87BC OUTPUT_FOG_EXT = 0x87BD SCALAR_EXT = 0x87BE VECTOR_EXT = 0x87BF MATRIX_EXT = 0x87C0 VARIANT_EXT = 0x87C1 INVARIANT_EXT = 0x87C2 LOCAL_CONSTANT_EXT = 0x87C3 LOCAL_EXT = 0x87C4 MAX_VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87C5 MAX_VERTEX_SHADER_VARIANTS_EXT = 0x87C6 MAX_VERTEX_SHADER_INVARIANTS_EXT = 0x87C7 MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87C8 MAX_VERTEX_SHADER_LOCALS_EXT = 0x87C9 MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87CA MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT = 0x87CB MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87CC MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT = 0x87CD MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT = 0x87CE VERTEX_SHADER_INSTRUCTIONS_EXT = 0x87CF VERTEX_SHADER_VARIANTS_EXT = 0x87D0 VERTEX_SHADER_INVARIANTS_EXT = 0x87D1 VERTEX_SHADER_LOCAL_CONSTANTS_EXT = 0x87D2 VERTEX_SHADER_LOCALS_EXT = 0x87D3 VERTEX_SHADER_OPTIMIZED_EXT = 0x87D4 X_EXT = 0x87D5 Y_EXT = 0x87D6 Z_EXT = 0x87D7 W_EXT = 0x87D8 NEGATIVE_X_EXT = 0x87D9 NEGATIVE_Y_EXT = 0x87DA NEGATIVE_Z_EXT = 0x87DB NEGATIVE_W_EXT = 0x87DC ZERO_EXT = 0x87DD ONE_EXT = 0x87DE NEGATIVE_ONE_EXT = 0x87DF NORMALIZED_RANGE_EXT = 0x87E0 FULL_RANGE_EXT = 0x87E1 CURRENT_VERTEX_EXT = 0x87E2 MVP_MATRIX_EXT = 0x87E3 VARIANT_VALUE_EXT = 0x87E4 VARIANT_DATATYPE_EXT = 0x87E5 VARIANT_ARRAY_STRIDE_EXT = 0x87E6 VARIANT_ARRAY_TYPE_EXT = 0x87E7 VARIANT_ARRAY_EXT = 0x87E8 VARIANT_ARRAY_POINTER_EXT = 0x87E9 INVARIANT_VALUE_EXT = 0x87EA INVARIANT_DATATYPE_EXT = 0x87EB LOCAL_CONSTANT_VALUE_EXT = 0x87EC LOCAL_CONSTANT_DATATYPE_EXT = 0x87ED ############################################################################### # Extension #249 ATI_vertex_streams enum: MAX_VERTEX_STREAMS_ATI = 0x876B VERTEX_STREAM0_ATI = 0x876C VERTEX_STREAM1_ATI = 0x876D VERTEX_STREAM2_ATI = 0x876E VERTEX_STREAM3_ATI = 0x876F VERTEX_STREAM4_ATI = 0x8770 VERTEX_STREAM5_ATI = 0x8771 VERTEX_STREAM6_ATI = 0x8772 VERTEX_STREAM7_ATI = 0x8773 VERTEX_SOURCE_ATI = 0x8774 ############################################################################### # Extension #250 - WGL_I3D_digital_video_control # Extension #251 - WGL_I3D_gamma # Extension #252 - WGL_I3D_genlock # Extension #253 - WGL_I3D_image_buffer # Extension #254 - WGL_I3D_swap_frame_lock # Extension #255 - WGL_I3D_swap_frame_usage ############################################################################### # Extension #256 ATI_element_array enum: ELEMENT_ARRAY_ATI = 0x8768 ELEMENT_ARRAY_TYPE_ATI = 0x8769 ELEMENT_ARRAY_POINTER_ATI = 0x876A ############################################################################### # Extension #257 SUN_mesh_array enum: QUAD_MESH_SUN = 0x8614 TRIANGLE_MESH_SUN = 0x8615 ############################################################################### # Extension #258 SUN_slice_accum enum: SLICE_ACCUM_SUN = 0x85CC ############################################################################### # Extension #259 NV_multisample_filter_hint enum: MULTISAMPLE_FILTER_HINT_NV = 0x8534 ############################################################################### # Extension #260 NV_depth_clamp enum: DEPTH_CLAMP_NV = 0x864F ############################################################################### # Extension #261 NV_occlusion_query enum: PIXEL_COUNTER_BITS_NV = 0x8864 CURRENT_OCCLUSION_QUERY_ID_NV = 0x8865 PIXEL_COUNT_NV = 0x8866 PIXEL_COUNT_AVAILABLE_NV = 0x8867 ############################################################################### # Extension #262 NV_point_sprite enum: POINT_SPRITE_NV = 0x8861 COORD_REPLACE_NV = 0x8862 POINT_SPRITE_R_MODE_NV = 0x8863 ############################################################################### # Extension #263 - WGL_NV_render_depth_texture # Extension #264 - WGL_NV_render_texture_rectangle ############################################################################### # Extension #265 NV_texture_shader3 enum: OFFSET_PROJECTIVE_TEXTURE_2D_NV = 0x8850 OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV = 0x8851 OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV = 0x8852 OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV = 0x8853 OFFSET_HILO_TEXTURE_2D_NV = 0x8854 OFFSET_HILO_TEXTURE_RECTANGLE_NV = 0x8855 OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV = 0x8856 OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV = 0x8857 DEPENDENT_HILO_TEXTURE_2D_NV = 0x8858 DEPENDENT_RGB_TEXTURE_3D_NV = 0x8859 DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV = 0x885A DOT_PRODUCT_PASS_THROUGH_NV = 0x885B DOT_PRODUCT_TEXTURE_1D_NV = 0x885C DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV = 0x885D HILO8_NV = 0x885E SIGNED_HILO8_NV = 0x885F FORCE_BLUE_TO_ONE_NV = 0x8860 ############################################################################### # No new tokens # Extension #266 NV_vertex_program1_1 enum: ############################################################################### # No new tokens # Extension #267 EXT_shadow_funcs enum: ############################################################################### # Extension #268 EXT_stencil_two_side enum: STENCIL_TEST_TWO_SIDE_EXT = 0x8910 ACTIVE_STENCIL_FACE_EXT = 0x8911 ############################################################################### # Extension #269 ATI_text_fragment_shader enum: TEXT_FRAGMENT_SHADER_ATI = 0x8200 ############################################################################### # Extension #270 APPLE_client_storage enum: UNPACK_CLIENT_STORAGE_APPLE = 0x85B2 ############################################################################### # Extension #271 # (extends ATI_element_array???) APPLE_element_array enum: ELEMENT_ARRAY_APPLE = 0x8768 ELEMENT_ARRAY_TYPE_APPLE = 0x8769 ELEMENT_ARRAY_POINTER_APPLE = 0x876A ############################################################################### # Extension #272 # ??? BUFFER_OBJECT_APPLE appears to be part of the shipping extension, # but is not in the spec in the registry. Also appears in # APPLE_object_purgeable below. APPLE_fence enum: DRAW_PIXELS_APPLE = 0x8A0A FENCE_APPLE = 0x8A0B ############################################################################### # Extension #273 APPLE_vertex_array_object enum: VERTEX_ARRAY_BINDING_APPLE = 0x85B5 ############################################################################### # Extension #274 # (How does this interact with NV_vertex_array_range???) APPLE_vertex_array_range enum: VERTEX_ARRAY_RANGE_APPLE = 0x851D VERTEX_ARRAY_RANGE_LENGTH_APPLE = 0x851E VERTEX_ARRAY_STORAGE_HINT_APPLE = 0x851F VERTEX_ARRAY_RANGE_POINTER_APPLE = 0x8521 STORAGE_CACHED_APPLE = 0x85BE STORAGE_SHARED_APPLE = 0x85BF ############################################################################### # Extension #275 APPLE_ycbcr_422 enum: YCBCR_422_APPLE = 0x85B9 UNSIGNED_SHORT_8_8_APPLE = 0x85BA UNSIGNED_SHORT_8_8_REV_APPLE = 0x85BB ############################################################################### # Extension #276 S3_s3tc enum: RGB_S3TC = 0x83A0 RGB4_S3TC = 0x83A1 RGBA_S3TC = 0x83A2 RGBA4_S3TC = 0x83A3 ############################################################################### # Extension #277 ATI_draw_buffers enum: MAX_DRAW_BUFFERS_ATI = 0x8824 DRAW_BUFFER0_ATI = 0x8825 DRAW_BUFFER1_ATI = 0x8826 DRAW_BUFFER2_ATI = 0x8827 DRAW_BUFFER3_ATI = 0x8828 DRAW_BUFFER4_ATI = 0x8829 DRAW_BUFFER5_ATI = 0x882A DRAW_BUFFER6_ATI = 0x882B DRAW_BUFFER7_ATI = 0x882C DRAW_BUFFER8_ATI = 0x882D DRAW_BUFFER9_ATI = 0x882E DRAW_BUFFER10_ATI = 0x882F DRAW_BUFFER11_ATI = 0x8830 DRAW_BUFFER12_ATI = 0x8831 DRAW_BUFFER13_ATI = 0x8832 DRAW_BUFFER14_ATI = 0x8833 DRAW_BUFFER15_ATI = 0x8834 ############################################################################### # Extension #278 # This is really a WGL extension, but if defined there are # some associated GL enumerants. ATI_pixel_format_float enum: TYPE_RGBA_FLOAT_ATI = 0x8820 COLOR_CLEAR_UNCLAMPED_VALUE_ATI = 0x8835 ############################################################################### # Extension #279 ATI_texture_env_combine3 enum: MODULATE_ADD_ATI = 0x8744 MODULATE_SIGNED_ADD_ATI = 0x8745 MODULATE_SUBTRACT_ATI = 0x8746 ############################################################################### # Extension #280 ATI_texture_float enum: RGBA_FLOAT32_ATI = 0x8814 RGB_FLOAT32_ATI = 0x8815 ALPHA_FLOAT32_ATI = 0x8816 INTENSITY_FLOAT32_ATI = 0x8817 LUMINANCE_FLOAT32_ATI = 0x8818 LUMINANCE_ALPHA_FLOAT32_ATI = 0x8819 RGBA_FLOAT16_ATI = 0x881A RGB_FLOAT16_ATI = 0x881B ALPHA_FLOAT16_ATI = 0x881C INTENSITY_FLOAT16_ATI = 0x881D LUMINANCE_FLOAT16_ATI = 0x881E LUMINANCE_ALPHA_FLOAT16_ATI = 0x881F ############################################################################### # Extension #281 (also WGL_NV_float_buffer) NV_float_buffer enum: FLOAT_R_NV = 0x8880 FLOAT_RG_NV = 0x8881 FLOAT_RGB_NV = 0x8882 FLOAT_RGBA_NV = 0x8883 FLOAT_R16_NV = 0x8884 FLOAT_R32_NV = 0x8885 FLOAT_RG16_NV = 0x8886 FLOAT_RG32_NV = 0x8887 FLOAT_RGB16_NV = 0x8888 FLOAT_RGB32_NV = 0x8889 FLOAT_RGBA16_NV = 0x888A FLOAT_RGBA32_NV = 0x888B TEXTURE_FLOAT_COMPONENTS_NV = 0x888C FLOAT_CLEAR_COLOR_VALUE_NV = 0x888D FLOAT_RGBA_MODE_NV = 0x888E ############################################################################### # Extension #282 NV_fragment_program enum: MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = 0x8868 FRAGMENT_PROGRAM_NV = 0x8870 MAX_TEXTURE_COORDS_NV = 0x8871 MAX_TEXTURE_IMAGE_UNITS_NV = 0x8872 FRAGMENT_PROGRAM_BINDING_NV = 0x8873 PROGRAM_ERROR_STRING_NV = 0x8874 ############################################################################### # Extension #283 NV_half_float enum: HALF_FLOAT_NV = 0x140B ############################################################################### # Extension #284 NV_pixel_data_range enum: WRITE_PIXEL_DATA_RANGE_NV = 0x8878 READ_PIXEL_DATA_RANGE_NV = 0x8879 WRITE_PIXEL_DATA_RANGE_LENGTH_NV = 0x887A READ_PIXEL_DATA_RANGE_LENGTH_NV = 0x887B WRITE_PIXEL_DATA_RANGE_POINTER_NV = 0x887C READ_PIXEL_DATA_RANGE_POINTER_NV = 0x887D ############################################################################### # Extension #285 NV_primitive_restart enum: PRIMITIVE_RESTART_NV = 0x8558 PRIMITIVE_RESTART_INDEX_NV = 0x8559 ############################################################################### # Extension #286 NV_texture_expand_normal enum: TEXTURE_UNSIGNED_REMAP_MODE_NV = 0x888F ############################################################################### # No new tokens # Extension #287 NV_vertex_program2 enum: ############################################################################### # No new tokens # Extension #288 ATI_map_object_buffer enum: ############################################################################### # Extension #289 ATI_separate_stencil enum: STENCIL_BACK_FUNC_ATI = 0x8800 STENCIL_BACK_FAIL_ATI = 0x8801 STENCIL_BACK_PASS_DEPTH_FAIL_ATI = 0x8802 STENCIL_BACK_PASS_DEPTH_PASS_ATI = 0x8803 ############################################################################### # No new tokens # Extension #290 ATI_vertex_attrib_array_object enum: ############################################################################### # No new tokens # Extension #291 - OpenGL ES only, not in glext.h # OES_byte_coordinates enum: ############################################################################### # Extension #292 - OpenGL ES only, not in glext.h # OES_fixed_point enum: # FIXED_OES = 0x140C ############################################################################### # No new tokens # Extension #293 - OpenGL ES only, not in glext.h # OES_single_precision enum: ############################################################################### # Extension #294 - OpenGL ES only, not in glext.h # OES_compressed_paletted_texture enum: # PALETTE4_RGB8_OES = 0x8B90 # PALETTE4_RGBA8_OES = 0x8B91 # PALETTE4_R5_G6_B5_OES = 0x8B92 # PALETTE4_RGBA4_OES = 0x8B93 # PALETTE4_RGB5_A1_OES = 0x8B94 # PALETTE8_RGB8_OES = 0x8B95 # PALETTE8_RGBA8_OES = 0x8B96 # PALETTE8_R5_G6_B5_OES = 0x8B97 # PALETTE8_RGBA4_OES = 0x8B98 # PALETTE8_RGB5_A1_OES = 0x8B99 ############################################################################### # Extension #295 - This is an OpenGL ES extension, but also implemented in Mesa OES_read_format enum: IMPLEMENTATION_COLOR_READ_TYPE_OES = 0x8B9A IMPLEMENTATION_COLOR_READ_FORMAT_OES = 0x8B9B ############################################################################### # No new tokens # Extension #296 - OpenGL ES only, not in glext.h # OES_query_matrix enum: ############################################################################### # Extension #297 EXT_depth_bounds_test enum: DEPTH_BOUNDS_TEST_EXT = 0x8890 DEPTH_BOUNDS_EXT = 0x8891 ############################################################################### # Extension #298 EXT_texture_mirror_clamp enum: MIRROR_CLAMP_EXT = 0x8742 MIRROR_CLAMP_TO_EDGE_EXT = 0x8743 MIRROR_CLAMP_TO_BORDER_EXT = 0x8912 ############################################################################### # Extension #299 EXT_blend_equation_separate enum: BLEND_EQUATION_RGB_EXT = 0x8009 # alias GL_BLEND_EQUATION_EXT BLEND_EQUATION_ALPHA_EXT = 0x883D ############################################################################### # Extension #300 MESA_pack_invert enum: PACK_INVERT_MESA = 0x8758 ############################################################################### # Extension #301 MESA_ycbcr_texture enum: UNSIGNED_SHORT_8_8_MESA = 0x85BA UNSIGNED_SHORT_8_8_REV_MESA = 0x85BB YCBCR_MESA = 0x8757 ############################################################################### # Extension #302 EXT_pixel_buffer_object enum: PIXEL_PACK_BUFFER_EXT = 0x88EB PIXEL_UNPACK_BUFFER_EXT = 0x88EC PIXEL_PACK_BUFFER_BINDING_EXT = 0x88ED PIXEL_UNPACK_BUFFER_BINDING_EXT = 0x88EF ############################################################################### # No new tokens # Extension #303 NV_fragment_program_option enum: ############################################################################### # Extension #304 NV_fragment_program2 enum: MAX_PROGRAM_EXEC_INSTRUCTIONS_NV = 0x88F4 MAX_PROGRAM_CALL_DEPTH_NV = 0x88F5 MAX_PROGRAM_IF_DEPTH_NV = 0x88F6 MAX_PROGRAM_LOOP_DEPTH_NV = 0x88F7 MAX_PROGRAM_LOOP_COUNT_NV = 0x88F8 ############################################################################### # Extension #305 NV_vertex_program2_option enum: use NV_fragment_program2 MAX_PROGRAM_EXEC_INSTRUCTIONS_NV use NV_fragment_program2 MAX_PROGRAM_CALL_DEPTH_NV ############################################################################### # Extension #306 NV_vertex_program3 enum: use ARB_vertex_shader MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB ############################################################################### # Extension #307 - GLX_SGIX_hyperpipe # Extension #308 - GLX_MESA_agp_offset # Extension #309 - GL_EXT_texture_compression_dxt1 (OpenGL ES only, subset of _s3tc version) ############################################################################### # Extension #310 EXT_framebuffer_object enum: INVALID_FRAMEBUFFER_OPERATION_EXT = 0x0506 MAX_RENDERBUFFER_SIZE_EXT = 0x84E8 FRAMEBUFFER_BINDING_EXT = 0x8CA6 RENDERBUFFER_BINDING_EXT = 0x8CA7 FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = 0x8CD0 FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = 0x8CD1 FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = 0x8CD2 FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = 0x8CD3 FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = 0x8CD4 FRAMEBUFFER_COMPLETE_EXT = 0x8CD5 FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = 0x8CD6 FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = 0x8CD7 ## Removed 2005/09/26 in revision #117 of the extension: ## FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT = 0x8CD8 FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = 0x8CD9 FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = 0x8CDA FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = 0x8CDB FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = 0x8CDC FRAMEBUFFER_UNSUPPORTED_EXT = 0x8CDD ## Removed 2005/05/31 in revision #113 of the extension: ## FRAMEBUFFER_STATUS_ERROR_EXT = 0x8CDE MAX_COLOR_ATTACHMENTS_EXT = 0x8CDF COLOR_ATTACHMENT0_EXT = 0x8CE0 COLOR_ATTACHMENT1_EXT = 0x8CE1 COLOR_ATTACHMENT2_EXT = 0x8CE2 COLOR_ATTACHMENT3_EXT = 0x8CE3 COLOR_ATTACHMENT4_EXT = 0x8CE4 COLOR_ATTACHMENT5_EXT = 0x8CE5 COLOR_ATTACHMENT6_EXT = 0x8CE6 COLOR_ATTACHMENT7_EXT = 0x8CE7 COLOR_ATTACHMENT8_EXT = 0x8CE8 COLOR_ATTACHMENT9_EXT = 0x8CE9 COLOR_ATTACHMENT10_EXT = 0x8CEA COLOR_ATTACHMENT11_EXT = 0x8CEB COLOR_ATTACHMENT12_EXT = 0x8CEC COLOR_ATTACHMENT13_EXT = 0x8CED COLOR_ATTACHMENT14_EXT = 0x8CEE COLOR_ATTACHMENT15_EXT = 0x8CEF DEPTH_ATTACHMENT_EXT = 0x8D00 STENCIL_ATTACHMENT_EXT = 0x8D20 FRAMEBUFFER_EXT = 0x8D40 RENDERBUFFER_EXT = 0x8D41 RENDERBUFFER_WIDTH_EXT = 0x8D42 RENDERBUFFER_HEIGHT_EXT = 0x8D43 RENDERBUFFER_INTERNAL_FORMAT_EXT = 0x8D44 # removed STENCIL_INDEX_EXT = 0x8D45 in rev. #114 of the spec STENCIL_INDEX1_EXT = 0x8D46 STENCIL_INDEX4_EXT = 0x8D47 STENCIL_INDEX8_EXT = 0x8D48 STENCIL_INDEX16_EXT = 0x8D49 RENDERBUFFER_RED_SIZE_EXT = 0x8D50 RENDERBUFFER_GREEN_SIZE_EXT = 0x8D51 RENDERBUFFER_BLUE_SIZE_EXT = 0x8D52 RENDERBUFFER_ALPHA_SIZE_EXT = 0x8D53 RENDERBUFFER_DEPTH_SIZE_EXT = 0x8D54 RENDERBUFFER_STENCIL_SIZE_EXT = 0x8D55 ############################################################################### # No new tokens # Extension #311 GREMEDY_string_marker enum: ############################################################################### # Extension #312 EXT_packed_depth_stencil enum: DEPTH_STENCIL_EXT = 0x84F9 UNSIGNED_INT_24_8_EXT = 0x84FA DEPTH24_STENCIL8_EXT = 0x88F0 TEXTURE_STENCIL_SIZE_EXT = 0x88F1 ############################################################################### # Extension #313 - WGL_3DL_stereo_control ############################################################################### # Extension #314 EXT_stencil_clear_tag enum: STENCIL_TAG_BITS_EXT = 0x88F2 STENCIL_CLEAR_TAG_VALUE_EXT = 0x88F3 ############################################################################### # Extension #315 EXT_texture_sRGB enum: SRGB_EXT = 0x8C40 SRGB8_EXT = 0x8C41 SRGB_ALPHA_EXT = 0x8C42 SRGB8_ALPHA8_EXT = 0x8C43 SLUMINANCE_ALPHA_EXT = 0x8C44 SLUMINANCE8_ALPHA8_EXT = 0x8C45 SLUMINANCE_EXT = 0x8C46 SLUMINANCE8_EXT = 0x8C47 COMPRESSED_SRGB_EXT = 0x8C48 COMPRESSED_SRGB_ALPHA_EXT = 0x8C49 COMPRESSED_SLUMINANCE_EXT = 0x8C4A COMPRESSED_SLUMINANCE_ALPHA_EXT = 0x8C4B COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F ############################################################################### # Extension #316 EXT_framebuffer_blit enum: READ_FRAMEBUFFER_EXT = 0x8CA8 DRAW_FRAMEBUFFER_EXT = 0x8CA9 DRAW_FRAMEBUFFER_BINDING_EXT = GL_FRAMEBUFFER_BINDING_EXT READ_FRAMEBUFFER_BINDING_EXT = 0x8CAA ############################################################################### # Extension #317 EXT_framebuffer_multisample enum: RENDERBUFFER_SAMPLES_EXT = 0x8CAB FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 0x8D56 MAX_SAMPLES_EXT = 0x8D57 ############################################################################### # Extension #318 MESAX_texture_stack enum: TEXTURE_1D_STACK_MESAX = 0x8759 TEXTURE_2D_STACK_MESAX = 0x875A PROXY_TEXTURE_1D_STACK_MESAX = 0x875B PROXY_TEXTURE_2D_STACK_MESAX = 0x875C TEXTURE_1D_STACK_BINDING_MESAX = 0x875D TEXTURE_2D_STACK_BINDING_MESAX = 0x875E ############################################################################### # Extension #319 EXT_timer_query enum: TIME_ELAPSED_EXT = 0x88BF ############################################################################### # No new tokens # Extension #320 EXT_gpu_program_parameters enum: ############################################################################### # Extension #321 APPLE_flush_buffer_range enum: BUFFER_SERIALIZED_MODIFY_APPLE = 0x8A12 BUFFER_FLUSHING_UNMAP_APPLE = 0x8A13 ############################################################################### # Extension #322 NV_gpu_program4 enum: MIN_PROGRAM_TEXEL_OFFSET_NV = 0x8904 MAX_PROGRAM_TEXEL_OFFSET_NV = 0x8905 PROGRAM_ATTRIB_COMPONENTS_NV = 0x8906 PROGRAM_RESULT_COMPONENTS_NV = 0x8907 MAX_PROGRAM_ATTRIB_COMPONENTS_NV = 0x8908 MAX_PROGRAM_RESULT_COMPONENTS_NV = 0x8909 MAX_PROGRAM_GENERIC_ATTRIBS_NV = 0x8DA5 MAX_PROGRAM_GENERIC_RESULTS_NV = 0x8DA6 ############################################################################### # Extension #323 NV_geometry_program4 enum: LINES_ADJACENCY_EXT = 0x000A LINE_STRIP_ADJACENCY_EXT = 0x000B TRIANGLES_ADJACENCY_EXT = 0x000C TRIANGLE_STRIP_ADJACENCY_EXT = 0x000D GEOMETRY_PROGRAM_NV = 0x8C26 MAX_PROGRAM_OUTPUT_VERTICES_NV = 0x8C27 MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV = 0x8C28 GEOMETRY_VERTICES_OUT_EXT = 0x8DDA GEOMETRY_INPUT_TYPE_EXT = 0x8DDB GEOMETRY_OUTPUT_TYPE_EXT = 0x8DDC MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = 0x8C29 FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = 0x8DA7 FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = 0x8DA8 FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT = 0x8DA9 FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT = 0x8CD4 PROGRAM_POINT_SIZE_EXT = 0x8642 ############################################################################### # Extension #324 EXT_geometry_shader4 enum: GEOMETRY_SHADER_EXT = 0x8DD9 use NV_geometry_program4 GEOMETRY_VERTICES_OUT_EXT use NV_geometry_program4 GEOMETRY_INPUT_TYPE_EXT use NV_geometry_program4 GEOMETRY_OUTPUT_TYPE_EXT use NV_geometry_program4 MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT MAX_GEOMETRY_VARYING_COMPONENTS_EXT = 0x8DDD MAX_VERTEX_VARYING_COMPONENTS_EXT = 0x8DDE MAX_VARYING_COMPONENTS_EXT = 0x8B4B MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT = 0x8DDF MAX_GEOMETRY_OUTPUT_VERTICES_EXT = 0x8DE0 MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT = 0x8DE1 use NV_geometry_program4 LINES_ADJACENCY_EXT use NV_geometry_program4 LINE_STRIP_ADJACENCY_EXT use NV_geometry_program4 TRIANGLES_ADJACENCY_EXT use NV_geometry_program4 TRIANGLE_STRIP_ADJACENCY_EXT use NV_geometry_program4 FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT use NV_geometry_program4 FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT use NV_geometry_program4 FRAMEBUFFER_ATTACHMENT_LAYERED_EXT use NV_geometry_program4 FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT use NV_geometry_program4 PROGRAM_POINT_SIZE_EXT ############################################################################### # Extension #325 NV_vertex_program4 enum: VERTEX_ATTRIB_ARRAY_INTEGER_NV = 0x88FD ############################################################################### # Extension #326 EXT_gpu_shader4 enum: SAMPLER_1D_ARRAY_EXT = 0x8DC0 SAMPLER_2D_ARRAY_EXT = 0x8DC1 SAMPLER_BUFFER_EXT = 0x8DC2 SAMPLER_1D_ARRAY_SHADOW_EXT = 0x8DC3 SAMPLER_2D_ARRAY_SHADOW_EXT = 0x8DC4 SAMPLER_CUBE_SHADOW_EXT = 0x8DC5 UNSIGNED_INT_VEC2_EXT = 0x8DC6 UNSIGNED_INT_VEC3_EXT = 0x8DC7 UNSIGNED_INT_VEC4_EXT = 0x8DC8 INT_SAMPLER_1D_EXT = 0x8DC9 INT_SAMPLER_2D_EXT = 0x8DCA INT_SAMPLER_3D_EXT = 0x8DCB INT_SAMPLER_CUBE_EXT = 0x8DCC INT_SAMPLER_2D_RECT_EXT = 0x8DCD INT_SAMPLER_1D_ARRAY_EXT = 0x8DCE INT_SAMPLER_2D_ARRAY_EXT = 0x8DCF INT_SAMPLER_BUFFER_EXT = 0x8DD0 UNSIGNED_INT_SAMPLER_1D_EXT = 0x8DD1 UNSIGNED_INT_SAMPLER_2D_EXT = 0x8DD2 UNSIGNED_INT_SAMPLER_3D_EXT = 0x8DD3 UNSIGNED_INT_SAMPLER_CUBE_EXT = 0x8DD4 UNSIGNED_INT_SAMPLER_2D_RECT_EXT = 0x8DD5 UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT = 0x8DD6 UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT = 0x8DD7 UNSIGNED_INT_SAMPLER_BUFFER_EXT = 0x8DD8 ############################################################################### # No new tokens # Extension #327 EXT_draw_instanced enum: ############################################################################### # Extension #328 EXT_packed_float enum: R11F_G11F_B10F_EXT = 0x8C3A UNSIGNED_INT_10F_11F_11F_REV_EXT = 0x8C3B RGBA_SIGNED_COMPONENTS_EXT = 0x8C3C ############################################################################### # Extension #329 EXT_texture_array enum: TEXTURE_1D_ARRAY_EXT = 0x8C18 PROXY_TEXTURE_1D_ARRAY_EXT = 0x8C19 TEXTURE_2D_ARRAY_EXT = 0x8C1A PROXY_TEXTURE_2D_ARRAY_EXT = 0x8C1B TEXTURE_BINDING_1D_ARRAY_EXT = 0x8C1C TEXTURE_BINDING_2D_ARRAY_EXT = 0x8C1D MAX_ARRAY_TEXTURE_LAYERS_EXT = 0x88FF COMPARE_REF_DEPTH_TO_TEXTURE_EXT = 0x884E use NV_geometry_program4 FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT ############################################################################### # Extension #330 EXT_texture_buffer_object enum: TEXTURE_BUFFER_EXT = 0x8C2A MAX_TEXTURE_BUFFER_SIZE_EXT = 0x8C2B TEXTURE_BINDING_BUFFER_EXT = 0x8C2C TEXTURE_BUFFER_DATA_STORE_BINDING_EXT = 0x8C2D TEXTURE_BUFFER_FORMAT_EXT = 0x8C2E ############################################################################### # Extension #331 EXT_texture_compression_latc enum: COMPRESSED_LUMINANCE_LATC1_EXT = 0x8C70 COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT = 0x8C71 COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C72 COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT = 0x8C73 ############################################################################### # Extension #332 EXT_texture_compression_rgtc enum: COMPRESSED_RED_RGTC1_EXT = 0x8DBB COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE ############################################################################### # Extension #333 EXT_texture_shared_exponent enum: RGB9_E5_EXT = 0x8C3D UNSIGNED_INT_5_9_9_9_REV_EXT = 0x8C3E TEXTURE_SHARED_SIZE_EXT = 0x8C3F ############################################################################### # Extension #334 NV_depth_buffer_float enum: DEPTH_COMPONENT32F_NV = 0x8DAB DEPTH32F_STENCIL8_NV = 0x8DAC FLOAT_32_UNSIGNED_INT_24_8_REV_NV = 0x8DAD DEPTH_BUFFER_FLOAT_MODE_NV = 0x8DAF ############################################################################### # No new tokens # Extension #335 NV_fragment_program4 enum: ############################################################################### # Extension #336 NV_framebuffer_multisample_coverage enum: RENDERBUFFER_COVERAGE_SAMPLES_NV = 0x8CAB RENDERBUFFER_COLOR_SAMPLES_NV = 0x8E10 MAX_MULTISAMPLE_COVERAGE_MODES_NV = 0x8E11 MULTISAMPLE_COVERAGE_MODES_NV = 0x8E12 ############################################################################### # Extension #337 # ??? Also WGL/GLX extensions ??? EXT_framebuffer_sRGB enum: FRAMEBUFFER_SRGB_EXT = 0x8DB9 FRAMEBUFFER_SRGB_CAPABLE_EXT = 0x8DBA ############################################################################### # No new tokens # Extension #338 NV_geometry_shader4 enum: ############################################################################### # Extension #339 NV_parameter_buffer_object enum: MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV = 0x8DA0 MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV = 0x8DA1 VERTEX_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA2 GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA3 FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV = 0x8DA4 ############################################################################### # No new tokens # Extension #340 EXT_draw_buffers2 enum: ############################################################################### # Extension #341 NV_transform_feedback enum: BACK_PRIMARY_COLOR_NV = 0x8C77 BACK_SECONDARY_COLOR_NV = 0x8C78 TEXTURE_COORD_NV = 0x8C79 CLIP_DISTANCE_NV = 0x8C7A VERTEX_ID_NV = 0x8C7B PRIMITIVE_ID_NV = 0x8C7C GENERIC_ATTRIB_NV = 0x8C7D TRANSFORM_FEEDBACK_ATTRIBS_NV = 0x8C7E TRANSFORM_FEEDBACK_BUFFER_MODE_NV = 0x8C7F MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV = 0x8C80 ACTIVE_VARYINGS_NV = 0x8C81 ACTIVE_VARYING_MAX_LENGTH_NV = 0x8C82 TRANSFORM_FEEDBACK_VARYINGS_NV = 0x8C83 TRANSFORM_FEEDBACK_BUFFER_START_NV = 0x8C84 TRANSFORM_FEEDBACK_BUFFER_SIZE_NV = 0x8C85 TRANSFORM_FEEDBACK_RECORD_NV = 0x8C86 PRIMITIVES_GENERATED_NV = 0x8C87 TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV = 0x8C88 RASTERIZER_DISCARD_NV = 0x8C89 MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV = 0x8C8A MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV = 0x8C8B INTERLEAVED_ATTRIBS_NV = 0x8C8C SEPARATE_ATTRIBS_NV = 0x8C8D TRANSFORM_FEEDBACK_BUFFER_NV = 0x8C8E TRANSFORM_FEEDBACK_BUFFER_BINDING_NV = 0x8C8F ############################################################################### # Extension #342 EXT_bindable_uniform enum: MAX_VERTEX_BINDABLE_UNIFORMS_EXT = 0x8DE2 MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT = 0x8DE3 MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT = 0x8DE4 MAX_BINDABLE_UNIFORM_SIZE_EXT = 0x8DED UNIFORM_BUFFER_EXT = 0x8DEE UNIFORM_BUFFER_BINDING_EXT = 0x8DEF ############################################################################### # Extension #343 EXT_texture_integer enum: RGBA32UI_EXT = 0x8D70 RGB32UI_EXT = 0x8D71 ALPHA32UI_EXT = 0x8D72 INTENSITY32UI_EXT = 0x8D73 LUMINANCE32UI_EXT = 0x8D74 LUMINANCE_ALPHA32UI_EXT = 0x8D75 RGBA16UI_EXT = 0x8D76 RGB16UI_EXT = 0x8D77 ALPHA16UI_EXT = 0x8D78 INTENSITY16UI_EXT = 0x8D79 LUMINANCE16UI_EXT = 0x8D7A LUMINANCE_ALPHA16UI_EXT = 0x8D7B RGBA8UI_EXT = 0x8D7C RGB8UI_EXT = 0x8D7D ALPHA8UI_EXT = 0x8D7E INTENSITY8UI_EXT = 0x8D7F LUMINANCE8UI_EXT = 0x8D80 LUMINANCE_ALPHA8UI_EXT = 0x8D81 RGBA32I_EXT = 0x8D82 RGB32I_EXT = 0x8D83 ALPHA32I_EXT = 0x8D84 INTENSITY32I_EXT = 0x8D85 LUMINANCE32I_EXT = 0x8D86 LUMINANCE_ALPHA32I_EXT = 0x8D87 RGBA16I_EXT = 0x8D88 RGB16I_EXT = 0x8D89 ALPHA16I_EXT = 0x8D8A INTENSITY16I_EXT = 0x8D8B LUMINANCE16I_EXT = 0x8D8C LUMINANCE_ALPHA16I_EXT = 0x8D8D RGBA8I_EXT = 0x8D8E RGB8I_EXT = 0x8D8F ALPHA8I_EXT = 0x8D90 INTENSITY8I_EXT = 0x8D91 LUMINANCE8I_EXT = 0x8D92 LUMINANCE_ALPHA8I_EXT = 0x8D93 RED_INTEGER_EXT = 0x8D94 GREEN_INTEGER_EXT = 0x8D95 BLUE_INTEGER_EXT = 0x8D96 ALPHA_INTEGER_EXT = 0x8D97 RGB_INTEGER_EXT = 0x8D98 RGBA_INTEGER_EXT = 0x8D99 BGR_INTEGER_EXT = 0x8D9A BGRA_INTEGER_EXT = 0x8D9B LUMINANCE_INTEGER_EXT = 0x8D9C LUMINANCE_ALPHA_INTEGER_EXT = 0x8D9D RGBA_INTEGER_MODE_EXT = 0x8D9E ############################################################################### # Extension #344 - GLX_EXT_texture_from_pixmap ############################################################################### # No new tokens # Extension #345 GREMEDY_frame_terminator enum: ############################################################################### # Extension #346 NV_conditional_render enum: QUERY_WAIT_NV = 0x8E13 QUERY_NO_WAIT_NV = 0x8E14 QUERY_BY_REGION_WAIT_NV = 0x8E15 QUERY_BY_REGION_NO_WAIT_NV = 0x8E16 ############################################################################### # Extension #347 NV_present_video enum: FRAME_NV = 0x8E26 FIELDS_NV = 0x8E27 CURRENT_TIME_NV = 0x8E28 NUM_FILL_STREAMS_NV = 0x8E29 PRESENT_TIME_NV = 0x8E2A PRESENT_DURATION_NV = 0x8E2B ############################################################################### # Extension #348 - GLX_NV_video_out # Extension #349 - WGL_NV_video_out # Extension #350 - GLX_NV_swap_group # Extension #351 - WGL_NV_swap_group ############################################################################### # Extension #352 EXT_transform_feedback enum: TRANSFORM_FEEDBACK_BUFFER_EXT = 0x8C8E TRANSFORM_FEEDBACK_BUFFER_START_EXT = 0x8C84 TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT = 0x8C85 TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT = 0x8C8F INTERLEAVED_ATTRIBS_EXT = 0x8C8C SEPARATE_ATTRIBS_EXT = 0x8C8D PRIMITIVES_GENERATED_EXT = 0x8C87 TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT = 0x8C88 RASTERIZER_DISCARD_EXT = 0x8C89 MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT = 0x8C8A MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT = 0x8C8B MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT = 0x8C80 TRANSFORM_FEEDBACK_VARYINGS_EXT = 0x8C83 TRANSFORM_FEEDBACK_BUFFER_MODE_EXT = 0x8C7F TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT = 0x8C76 ############################################################################### # Extension #353 EXT_direct_state_access enum: PROGRAM_MATRIX_EXT = 0x8E2D TRANSPOSE_PROGRAM_MATRIX_EXT = 0x8E2E PROGRAM_MATRIX_STACK_DEPTH_EXT = 0x8E2F ############################################################################### # Extension #354 EXT_vertex_array_bgra enum: use VERSION_1_2 BGRA ############################################################################### # Extension #355 - WGL_NV_gpu_affinity ############################################################################### # Extension #356 EXT_texture_swizzle enum: TEXTURE_SWIZZLE_R_EXT = 0x8E42 TEXTURE_SWIZZLE_G_EXT = 0x8E43 TEXTURE_SWIZZLE_B_EXT = 0x8E44 TEXTURE_SWIZZLE_A_EXT = 0x8E45 TEXTURE_SWIZZLE_RGBA_EXT = 0x8E46 ############################################################################### # Extension #357 NV_explicit_multisample enum: SAMPLE_POSITION_NV = 0x8E50 SAMPLE_MASK_NV = 0x8E51 SAMPLE_MASK_VALUE_NV = 0x8E52 TEXTURE_BINDING_RENDERBUFFER_NV = 0x8E53 TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV = 0x8E54 TEXTURE_RENDERBUFFER_NV = 0x8E55 SAMPLER_RENDERBUFFER_NV = 0x8E56 INT_SAMPLER_RENDERBUFFER_NV = 0x8E57 UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV = 0x8E58 MAX_SAMPLE_MASK_WORDS_NV = 0x8E59 ############################################################################### # Extension #358 NV_transform_feedback2 enum: TRANSFORM_FEEDBACK_NV = 0x8E22 TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV = 0x8E23 TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV = 0x8E24 TRANSFORM_FEEDBACK_BINDING_NV = 0x8E25 ############################################################################### # Extension #359 ATI_meminfo enum: VBO_FREE_MEMORY_ATI = 0x87FB TEXTURE_FREE_MEMORY_ATI = 0x87FC RENDERBUFFER_FREE_MEMORY_ATI = 0x87FD ############################################################################### # Extension #360 AMD_performance_monitor enum: COUNTER_TYPE_AMD = 0x8BC0 COUNTER_RANGE_AMD = 0x8BC1 UNSIGNED_INT64_AMD = 0x8BC2 PERCENTAGE_AMD = 0x8BC3 PERFMON_RESULT_AVAILABLE_AMD = 0x8BC4 PERFMON_RESULT_SIZE_AMD = 0x8BC5 PERFMON_RESULT_AMD = 0x8BC6 ############################################################################### # Extension #361 - WGL_AMD_gpu_association ############################################################################### # No new tokens # Extension #362 AMD_texture_texture4 enum: ############################################################################### # Extension #363 AMD_vertex_shader_tesselator enum: SAMPLER_BUFFER_AMD = 0x9001 INT_SAMPLER_BUFFER_AMD = 0x9002 UNSIGNED_INT_SAMPLER_BUFFER_AMD = 0x9003 TESSELLATION_MODE_AMD = 0x9004 TESSELLATION_FACTOR_AMD = 0x9005 DISCRETE_AMD = 0x9006 CONTINUOUS_AMD = 0x9007 ############################################################################### # Extension #364 EXT_provoking_vertex enum: QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT = 0x8E4C FIRST_VERTEX_CONVENTION_EXT = 0x8E4D LAST_VERTEX_CONVENTION_EXT = 0x8E4E PROVOKING_VERTEX_EXT = 0x8E4F ############################################################################### # Extension #365 EXT_texture_snorm enum: ALPHA_SNORM = 0x9010 LUMINANCE_SNORM = 0x9011 LUMINANCE_ALPHA_SNORM = 0x9012 INTENSITY_SNORM = 0x9013 ALPHA8_SNORM = 0x9014 LUMINANCE8_SNORM = 0x9015 LUMINANCE8_ALPHA8_SNORM = 0x9016 INTENSITY8_SNORM = 0x9017 ALPHA16_SNORM = 0x9018 LUMINANCE16_SNORM = 0x9019 LUMINANCE16_ALPHA16_SNORM = 0x901A INTENSITY16_SNORM = 0x901B use VERSION_3_1 RED_SNORM use VERSION_3_1 RG_SNORM use VERSION_3_1 RGB_SNORM use VERSION_3_1 RGBA_SNORM use VERSION_3_1 R8_SNORM use VERSION_3_1 RG8_SNORM use VERSION_3_1 RGB8_SNORM use VERSION_3_1 RGBA8_SNORM use VERSION_3_1 R16_SNORM use VERSION_3_1 RG16_SNORM use VERSION_3_1 RGB16_SNORM use VERSION_3_1 RGBA16_SNORM use VERSION_3_1 SIGNED_NORMALIZED ############################################################################### # No new tokens # Extension #366 AMD_draw_buffers_blend enum: ############################################################################### # Extension #367 APPLE_texture_range enum: TEXTURE_RANGE_LENGTH_APPLE = 0x85B7 TEXTURE_RANGE_POINTER_APPLE = 0x85B8 TEXTURE_STORAGE_HINT_APPLE = 0x85BC STORAGE_PRIVATE_APPLE = 0x85BD use APPLE_vertex_array_range STORAGE_CACHED_APPLE use APPLE_vertex_array_range STORAGE_SHARED_APPLE ############################################################################### # Extension #368 APPLE_float_pixels enum: HALF_APPLE = 0x140B RGBA_FLOAT32_APPLE = 0x8814 RGB_FLOAT32_APPLE = 0x8815 ALPHA_FLOAT32_APPLE = 0x8816 INTENSITY_FLOAT32_APPLE = 0x8817 LUMINANCE_FLOAT32_APPLE = 0x8818 LUMINANCE_ALPHA_FLOAT32_APPLE = 0x8819 RGBA_FLOAT16_APPLE = 0x881A RGB_FLOAT16_APPLE = 0x881B ALPHA_FLOAT16_APPLE = 0x881C INTENSITY_FLOAT16_APPLE = 0x881D LUMINANCE_FLOAT16_APPLE = 0x881E LUMINANCE_ALPHA_FLOAT16_APPLE = 0x881F COLOR_FLOAT_APPLE = 0x8A0F ############################################################################### # Extension #369 APPLE_vertex_program_evaluators enum: VERTEX_ATTRIB_MAP1_APPLE = 0x8A00 VERTEX_ATTRIB_MAP2_APPLE = 0x8A01 VERTEX_ATTRIB_MAP1_SIZE_APPLE = 0x8A02 VERTEX_ATTRIB_MAP1_COEFF_APPLE = 0x8A03 VERTEX_ATTRIB_MAP1_ORDER_APPLE = 0x8A04 VERTEX_ATTRIB_MAP1_DOMAIN_APPLE = 0x8A05 VERTEX_ATTRIB_MAP2_SIZE_APPLE = 0x8A06 VERTEX_ATTRIB_MAP2_COEFF_APPLE = 0x8A07 VERTEX_ATTRIB_MAP2_ORDER_APPLE = 0x8A08 VERTEX_ATTRIB_MAP2_DOMAIN_APPLE = 0x8A09 ############################################################################### # Extension #370 APPLE_aux_depth_stencil enum: AUX_DEPTH_STENCIL_APPLE = 0x8A14 ############################################################################### # Extension #371 APPLE_object_purgeable enum: BUFFER_OBJECT_APPLE = 0x85B3 RELEASED_APPLE = 0x8A19 VOLATILE_APPLE = 0x8A1A RETAINED_APPLE = 0x8A1B UNDEFINED_APPLE = 0x8A1C PURGEABLE_APPLE = 0x8A1D ############################################################################### # Extension #372 APPLE_row_bytes enum: PACK_ROW_BYTES_APPLE = 0x8A15 UNPACK_ROW_BYTES_APPLE = 0x8A16 ############################################################################### # Extension #373 APPLE_rgb_422 enum: RGB_422_APPLE = 0x8A1F use APPLE_ycbcr_422 UNSIGNED_SHORT_8_8_APPLE use APPLE_ycbcr_422 UNSIGNED_SHORT_8_8_REV_APPLE ############################################################################### # Extension #374 NV_video_capture enum: VIDEO_BUFFER_NV = 0x9020 VIDEO_BUFFER_BINDING_NV = 0x9021 FIELD_UPPER_NV = 0x9022 FIELD_LOWER_NV = 0x9023 NUM_VIDEO_CAPTURE_STREAMS_NV = 0x9024 NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV = 0x9025 VIDEO_CAPTURE_TO_422_SUPPORTED_NV = 0x9026 LAST_VIDEO_CAPTURE_STATUS_NV = 0x9027 VIDEO_BUFFER_PITCH_NV = 0x9028 VIDEO_COLOR_CONVERSION_MATRIX_NV = 0x9029 VIDEO_COLOR_CONVERSION_MAX_NV = 0x902A VIDEO_COLOR_CONVERSION_MIN_NV = 0x902B VIDEO_COLOR_CONVERSION_OFFSET_NV = 0x902C VIDEO_BUFFER_INTERNAL_FORMAT_NV = 0x902D PARTIAL_SUCCESS_NV = 0x902E SUCCESS_NV = 0x902F FAILURE_NV = 0x9030 YCBYCR8_422_NV = 0x9031 YCBAYCR8A_4224_NV = 0x9032 Z6Y10Z6CB10Z6Y10Z6CR10_422_NV = 0x9033 Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV = 0x9034 Z4Y12Z4CB12Z4Y12Z4CR12_422_NV = 0x9035 Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV = 0x9036 Z4Y12Z4CB12Z4CR12_444_NV = 0x9037 VIDEO_CAPTURE_FRAME_WIDTH_NV = 0x9038 VIDEO_CAPTURE_FRAME_HEIGHT_NV = 0x9039 VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV = 0x903A VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV = 0x903B VIDEO_CAPTURE_SURFACE_ORIGIN_NV = 0x903C ############################################################################### # Extension #375 - GLX_EXT_swap_control ############################################################################### # No new tokens # Extension #376 - also GLX_NV_copy_image, WGL_NV_copy_image NV_copy_image enum: ############################################################################### # Extension #377 EXT_separate_shader_objects enum: ACTIVE_PROGRAM_EXT = 0x8B8D ############################################################################### # No new tokens # Extension #378 NV_parameter_buffer_object2 enum: ############################################################################### # Extension #379 NV_shader_buffer_load enum: BUFFER_GPU_ADDRESS_NV = 0x8F1D GPU_ADDRESS_NV = 0x8F34 MAX_SHADER_BUFFER_ADDRESS_NV = 0x8F35 ############################################################################### # Extension #380 NV_vertex_buffer_unified_memory enum: VERTEX_ATTRIB_ARRAY_UNIFIED_NV = 0x8F1E ELEMENT_ARRAY_UNIFIED_NV = 0x8F1F VERTEX_ATTRIB_ARRAY_ADDRESS_NV = 0x8F20 VERTEX_ARRAY_ADDRESS_NV = 0x8F21 NORMAL_ARRAY_ADDRESS_NV = 0x8F22 COLOR_ARRAY_ADDRESS_NV = 0x8F23 INDEX_ARRAY_ADDRESS_NV = 0x8F24 TEXTURE_COORD_ARRAY_ADDRESS_NV = 0x8F25 EDGE_FLAG_ARRAY_ADDRESS_NV = 0x8F26 SECONDARY_COLOR_ARRAY_ADDRESS_NV = 0x8F27 FOG_COORD_ARRAY_ADDRESS_NV = 0x8F28 ELEMENT_ARRAY_ADDRESS_NV = 0x8F29 VERTEX_ATTRIB_ARRAY_LENGTH_NV = 0x8F2A VERTEX_ARRAY_LENGTH_NV = 0x8F2B NORMAL_ARRAY_LENGTH_NV = 0x8F2C COLOR_ARRAY_LENGTH_NV = 0x8F2D INDEX_ARRAY_LENGTH_NV = 0x8F2E TEXTURE_COORD_ARRAY_LENGTH_NV = 0x8F2F EDGE_FLAG_ARRAY_LENGTH_NV = 0x8F30 SECONDARY_COLOR_ARRAY_LENGTH_NV = 0x8F31 FOG_COORD_ARRAY_LENGTH_NV = 0x8F32 ELEMENT_ARRAY_LENGTH_NV = 0x8F33 ############################################################################### # No new tokens # Extension #381 NV_texture_barrier enum: ############################################################################### # No new tokens # Extension #382 AMD_shader_stencil_export enum: ############################################################################### # Extension #383 AMD_seamless_cubemap_per_texture enum: use ARB_seamless_cube_map TEXTURE_CUBE_MAP_SEAMLESS_ARB ############################################################################### # Extension #384 - GLX_INTEL_swap_event ================================================ FILE: k3dsdk/gl/extension.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { namespace gl { namespace extension { /// Returns the set of explicitly-disabled extensions static std::set& disabled() { static std::set results; return results; } /// Returns the set of explicitly-enabled extensions static std::set& enabled() { static std::set results; return results; } /// Returns the set of available extensions reported by OpenGL static std::set& extensions() { static std::set results; static bool initialized = false; if(!context::current()) { log() << error << "Cannot retrieve OpenGL extensions without a current OpenGL context." << std::endl; return results; } if(!initialized) { initialized = true; const char* const extension_c_string = reinterpret_cast(glGetString(GL_EXTENSIONS)); if(!extension_c_string) { log() << warning << "GL extension query executed before context creation" << std::endl; return results; } const string_t extension_string = extension_c_string; boost::char_separator separator(" "); boost::tokenizer > tokenizer(extension_string, separator); std::copy(tokenizer.begin(), tokenizer.end(), std::inserter(results, results.end())); } return results; } const std::set list() { return extensions(); } void disable(const string_t& Extension) { enabled().erase(Extension); disabled().insert(Extension); } void enable(const string_t& Extension) { disabled().erase(Extension); enabled().insert(Extension); } bool_t query(const string_t& Extension) { if(disabled().count(Extension)) return false; if(enabled().count(Extension)) return true; return extensions().count(Extension) ? true : false; } bool_t query_vbo() { return query("GL_ARB_vertex_buffer_object"); } } // namespace extension } // namespace gl } // namespace k3d ================================================ FILE: k3dsdk/gl/extension.h ================================================ #ifndef K3DSDK_GL_EXTENSION_H #define K3DSDK_GL_EXTENSION_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace gl { namespace extension { /// "Disables" an OpenGL extension, so that query() will always return false (regardless of the underlying hardware) void disable(const k3d::string_t& Extension); /// "Enables" an OpenGL extension, so that query() will always return true (regardless of the underlying hardware) void enable(const k3d::string_t& Extension); /// Returns the list of OpenGL extensions supported by underlying hardware const std::set list(); /// Returns true iff the requested OpenGL extension is available bool_t query(const k3d::string_t& Extension); /// Convenience function that returns true iff the VBO extension is supported bool_t query_vbo(); } // namespace extension } // namespace gl } // namespace k3d #endif // !K3DSDK_GL_EXTENSION_H ================================================ FILE: k3dsdk/gl/gl.spec ================================================ # gl.spec file # DON'T REMOVE PREVIOUS LINE!!! libspec depends on it! # # Copyright (c) 1991-2005 Silicon Graphics, Inc. All Rights Reserved. # Copyright (c) 2006-2010 The Khronos Group Inc. # # This document is licensed under the SGI Free Software B License Version # 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . # # $Revision: 10796 $ on $Date: 2010-03-19 17:31:10 -0700 (Fri, 19 Mar 2010) $ required-props: # Description of a parameter param: retval retained # Display list flags dlflags: notlistable handcode # GLX implementation flags glxflags: client-intercept client-handcode server-handcode EXT SGI ignore ARB # Vector ('v') equivalent form of a command taking 1-4 explicit xyzw/rgba arguments vectorequiv: * # Category this function falls in. While there are many categories for # early GL 1.0 functions, later functions just have a core version # (e.g. VERSION_major_minor) or extension name for the category. category: display-list drawing drawing-control feedback framebuf misc modeling pixel-op pixel-rw state-req xform VERSION_1_0 VERSION_1_0_DEPRECATED VERSION_1_1 VERSION_1_1_DEPRECATED VERSION_1_2 VERSION_1_2_DEPRECATED VERSION_1_3 VERSION_1_3_DEPRECATED VERSION_1_4 VERSION_1_4_DEPRECATED VERSION_1_5 VERSION_2_0 VERSION_2_1 VERSION_3_0 VERSION_3_0_DEPRECATED VERSION_3_1 VERSION_3_2 VERSION_3_3 VERSION_4_0 ATI_element_array ATI_envmap_bumpmap ATI_fragment_shader ATI_pn_triangles ATI_vertex_array_object ATI_vertex_streams EXT_blend_color EXT_blend_minmax EXT_convolution EXT_copy_texture EXT_histogram EXT_polygon_offset EXT_subtexture EXT_texture3D EXT_texture_object EXT_vertex_array EXT_vertex_shader SGIS_detail_texture SGIS_multisample SGIS_pixel_texture ARB_point_parameters EXT_point_parameters SGIS_point_parameters SGIS_sharpen_texture SGIS_texture4D SGIS_texture_filter4 SGIX_async SGIX_flush_raster SGIX_fragment_lighting SGIX_framezoom SGIX_igloo_interface SGIX_instruments SGIX_list_priority SGIX_pixel_texture SGIX_polynomial_ffd SGIX_reference_plane SGIX_sprite SGIX_tag_sample_buffer SGI_color_table ARB_multitexture ARB_multisample ARB_texture_compression ARB_transpose_matrix ARB_vertex_blend ARB_matrix_palette EXT_compiled_vertex_array EXT_cull_vertex EXT_index_func EXT_index_material EXT_draw_range_elements EXT_vertex_weighting INGR_blend_func_separate NV_evaluators NV_fence NV_occlusion_query NV_point_sprite NV_register_combiners NV_register_combiners2 NV_vertex_array_range NV_vertex_program NV_vertex_program1_1_dcc MESA_resize_buffers MESA_window_pos PGI_misc_hints EXT_fog_coord EXT_blend_func_separate EXT_color_subtable EXT_coordinate_frame EXT_light_texture EXT_multi_draw_arrays EXT_paletted_texture EXT_pixel_transform EXT_secondary_color EXT_texture_perturb_normal HP_image_transform IBM_multimode_draw_arrays IBM_vertex_array_lists INTEL_parallel_arrays SUNX_constant_data SUN_global_alpha SUN_mesh_array SUN_triangle_list SUN_vertex 3DFX_tbuffer EXT_multisample SGIS_fog_function SGIS_texture_color_mask ARB_window_pos EXT_stencil_two_side EXT_depth_bounds_test EXT_blend_equation_separate ARB_vertex_program ARB_fragment_program ARB_vertex_buffer_object ARB_occlusion_query ARB_shader_objects ARB_vertex_shader ARB_fragment_shader S3_s3tc ATI_draw_buffers ATI_texture_env_combine3 ATI_texture_float NV_float_buffer NV_fragment_program NV_half_float NV_pixel_data_range NV_primitive_restart NV_texture_expand_normal NV_texture_expand_normal NV_vertex_program2 APPLE_element_array APPLE_fence APPLE_vertex_array_object APPLE_vertex_array_range ATI_draw_buffers NV_fragment_program NV_half_float NV_pixel_data_range NV_primitive_restart ATI_map_object_buffer ATI_separate_stencil ATI_vertex_attrib_array_object ARB_draw_buffers ARB_texture_rectangle ARB_color_buffer_float EXT_framebuffer_object GREMEDY_string_marker EXT_stencil_clear_tag EXT_framebuffer_blit EXT_framebuffer_multisample MESAX_texture_stack EXT_timer_query EXT_gpu_program_parameters APPLE_flush_buffer_range NV_gpu_program4 NV_geometry_program4 EXT_geometry_shader4 NV_vertex_program4 EXT_gpu_shader4 EXT_draw_instanced EXT_texture_buffer_object NV_depth_buffer_float NV_framebuffer_multisample_coverage NV_parameter_buffer_object EXT_draw_buffers2 NV_transform_feedback EXT_bindable_uniform EXT_texture_integer GREMEDY_frame_terminator NV_conditional_render NV_present_video EXT_transform_feedback ARB_depth_buffer_float ARB_draw_instanced ARB_framebuffer_object ARB_framebuffer_sRGB ARB_geometry_shader4 ARB_half_float_vertex ARB_instanced_arrays ARB_map_buffer_range ARB_texture_buffer_object ARB_texture_compression_rgtc ARB_texture_rg ARB_vertex_array_object EXT_direct_state_access EXT_vertex_array_bgra EXT_texture_swizzle NV_explicit_multisample NV_transform_feedback2 ATI_meminfo AMD_performance_monitor AMD_vertex_shader_tesselator EXT_provoking_vertex ARB_uniform_buffer_object ARB_copy_buffer EXT_texture_snorm AMD_draw_buffers_blend APPLE_texture_range APPLE_float_pixels APPLE_vertex_program_evaluators APPLE_aux_depth_stencil APPLE_object_purgeable APPLE_row_bytes ARB_draw_elements_base_vertex ARB_provoking_vertex ARB_sync ARB_texture_multisample ARB_draw_buffers_blend ARB_sample_shading NV_video_capture NV_copy_image EXT_separate_shader_objects NV_parameter_buffer_object2 NV_shader_buffer_load NV_vertex_buffer_unified_memory NV_texture_barrier ARB_shading_language_include ARB_blend_func_extended ARB_sampler_objects ARB_timer_query ARB_vertex_type_2_10_10_10_rev ARB_draw_indirect ARB_gpu_shader_fp64 ARB_shader_subroutine ARB_tessellation_shader ARB_transform_feedback2 ARB_transform_feedback3 # Categories for extensions with no functions - need not be included now # ARB_texture_env_add ARB_texture_cube_map ARB_texture_border_clamp # ARB_shading_language_100 ARB_texture_non_power_of_two ARB_point_sprite # ARB_half_float_pixel ARB_texture_float ARB_pixel_buffer_object EXT_abgr # EXT_texture SGI_color_matrix SGI_texture_color_table EXT_cmyka # EXT_packed_pixels SGIS_texture_lod EXT_rescale_normal EXT_misc_attribute # SGIS_generate_mipmap SGIX_clipmap SGIX_shadow SGIS_texture_edge_clamp # SGIS_texture_border_clamp EXT_blend_subtract EXT_blend_logic_op # SGIX_async_histogram SGIX_async_pixel SGIX_interlace SGIX_pixel_tiles # SGIX_texture_select SGIX_texture_multi_buffer SGIX_texture_scale_bias # SGIX_depth_texture SGIX_fog_offset HP_convolution_border_modes # SGIX_texture_add_env PGI_vertex_hints EXT_clip_volume_hint # SGIX_ir_instrument1 SGIX_calligraphic_fragment SGIX_texture_lod_bias # SGIX_shadow_ambient EXT_index_texture EXT_index_array_formats SGIX_ycrcb # IBM_rasterpos_clip HP_texture_lighting WIN_phong_shading # WIN_specular_fog SGIX_blend_alpha_minmax EXT_bgra HP_occlusion_test # EXT_pixel_transform_color_table EXT_shared_texture_palette # EXT_separate_specular_color EXT_texture_env REND_screen_coordinates # EXT_texture_env_combine APPLE_specular_vector APPLE_transform_hint # SGIX_fog_scale INGR_color_clamp INGR_interlace_read EXT_stencil_wrap # EXT_422_pixels NV_texgen_reflection SUN_convolution_border_modes # SUN_slice_accum EXT_texture_env_add EXT_texture_lod_bias # EXT_texture_filter_anisotropic NV_light_max_exponent NV_fog_distance # NV_texgen_emboss NV_blend_square NV_texture_env_combine4 # NV_packed_depth_stencil NV_texture_compression_vtc NV_texture_rectangle # NV_texture_shader NV_texture_shader2 NV_vertex_array_range2 # IBM_cull_vertex SGIX_subsample SGIX_ycrcba SGIX_ycrcb_subsample # SGIX_depth_pass_instrument 3DFX_texture_compression_FXT1 # 3DFX_multisample SGIX_vertex_preclip SGIX_convolution_accuracy # SGIX_resample SGIX_scalebias_hint SGIX_texture_coordinate_clamp # EXT_shadow_funcs MESA_pack_invert MESA_ycbcr_texture EXT_packed_float # EXT_texture_array EXT_texture_compression_latc # EXT_texture_compression_rgtc EXT_texture_shared_exponent # NV_fragment_program4 EXT_framebuffer_sRGB NV_geometry_shader4 # EXT_vertex_array_bgra ARB_depth_clamp ARB_fragment_coord_conventions # ARB_seamless_cube_map ARB_vertex_array_bgra ARB_texture_cube_map_array # ARB_texture_gather ARB_texture_query_lod # AMD_shader_stencil_export AMD_seamless_cubemap_per_texture # Core version in which a function was introduced, or against # which an extension can be implemented version: 1.0 1.1 1.2 1.3 1.4 1.5 2.0 2.1 3.0 3.1 3.2 3.3 4.0 # Core version in which a function was removed deprecated: 3.1 # GLX Single, Rendering, or Vendor Private opcode glxsingle: * glxropcode: * glxvendorpriv: * # WGL implementation flags (incomplete) wglflags: client-handcode server-handcode small-data batchable # Drivers in which this is implemented (very incomplete) extension: future not_implemented soft WINSOFT NV10 NV20 NV50 # Function this aliases (indistinguishable to the GL) alias: * # Mesa dispatch table offset (incomplete) offset: * # These properties are picked up from NVIDIA .spec files, we don't use them glfflags: * beginend: * glxvectorequiv: * subcategory: * glextmask: * ############################################################################### # # glxsingle, glxropcode, and other GLX allocations to vendors # are used here, but the master registry for GLX is in # /ogl/trunk/doc/registry/extensions.reserved # # XFree86 dispatch offsets: 0-645 # 578-641 NV_vertex_program # GLS opcodes: 0x0030-0x0269 # ############################################################################### ############################################################################### # # things to remember when adding an extension command # # - append new ARB and non-ARB extensions to the appropriate portion of # the spec file, in extension number order. # - use tabs, not spaces # - set glxflags to "ignore" until GLX is updated to support the new command # - add new data types to typemaps/spec2wire.map # - add extension name in alphabetical order to category list # - add commands within an extension in spec order # - use existing command entries as a model (where possible) # - when reserving new glxropcodes, update # gfx/lib/opengl/doc/glspec/extensions.reserved to indicate this # ############################################################################### # New type declarations passthru: #include passthru: #ifndef GL_VERSION_2_0 passthru: /* GL type for program/shader text */ passthru: typedef char GLchar; passthru: #endif passthru: passthru: #ifndef GL_VERSION_1_5 passthru: /* GL types for handling large vertex buffer objects */ passthru: typedef ptrdiff_t GLintptr; passthru: typedef ptrdiff_t GLsizeiptr; passthru: #endif passthru: passthru: #ifndef GL_ARB_vertex_buffer_object passthru: /* GL types for handling large vertex buffer objects */ passthru: typedef ptrdiff_t GLintptrARB; passthru: typedef ptrdiff_t GLsizeiptrARB; passthru: #endif passthru: passthru: #ifndef GL_ARB_shader_objects passthru: /* GL types for program/shader text and shader object handles */ passthru: typedef char GLcharARB; passthru: typedef unsigned int GLhandleARB; passthru: #endif passthru: passthru: /* GL type for "half" precision (s10e5) float data in host memory */ passthru: #ifndef GL_ARB_half_float_pixel passthru: typedef unsigned short GLhalfARB; passthru: #endif passthru: passthru: #ifndef GL_NV_half_float passthru: typedef unsigned short GLhalfNV; passthru: #endif passthru: passthru: #ifndef GLEXT_64_TYPES_DEFINED passthru: /* This code block is duplicated in glxext.h, so must be protected */ passthru: #define GLEXT_64_TYPES_DEFINED passthru: /* Define int32_t, int64_t, and uint64_t types for UST/MSC */ passthru: /* (as used in the GL_EXT_timer_query extension). */ passthru: #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L passthru: #include passthru: #elif defined(__sun__) || defined(__digital__) passthru: #include passthru: #if defined(__STDC__) passthru: #if defined(__arch64__) || defined(_LP64) passthru: typedef long int int64_t; passthru: typedef unsigned long int uint64_t; passthru: #else passthru: typedef long long int int64_t; passthru: typedef unsigned long long int uint64_t; passthru: #endif /* __arch64__ */ passthru: #endif /* __STDC__ */ passthru: #elif defined( __VMS ) || defined(__sgi) passthru: #include passthru: #elif defined(__SCO__) || defined(__USLC__) passthru: #include passthru: #elif defined(__UNIXOS2__) || defined(__SOL64__) passthru: typedef long int int32_t; passthru: typedef long long int int64_t; passthru: typedef unsigned long long int uint64_t; passthru: #elif defined(_WIN32) && defined(__GNUC__) passthru: #include passthru: #elif defined(_WIN32) passthru: typedef __int32 int32_t; passthru: typedef __int64 int64_t; passthru: typedef unsigned __int64 uint64_t; passthru: #else passthru: /* Fallback if nothing above works */ passthru: #include passthru: #endif passthru: #endif passthru: passthru: #ifndef GL_EXT_timer_query passthru: typedef int64_t GLint64EXT; passthru: typedef uint64_t GLuint64EXT; passthru: #endif passthru: passthru: #ifndef ARB_sync passthru: typedef int64_t GLint64; passthru: typedef uint64_t GLuint64; passthru: typedef struct __GLsync *GLsync; passthru: #endif passthru: ############################################################################### ############################################################################### # # OpenGL 1.0 commands # ############################################################################### ############################################################################### ############################################################################### # # drawing-control commands # ############################################################################### CullFace(mode) return void param mode CullFaceMode in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 79 offset 152 FrontFace(mode) return void param mode FrontFaceDirection in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 84 offset 157 Hint(target, mode) return void param target HintTarget in value param mode HintMode in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 85 offset 158 LineWidth(width) return void param width CheckedFloat32 in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 95 offset 168 PointSize(size) return void param size CheckedFloat32 in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 100 offset 173 PolygonMode(face, mode) return void param face MaterialFace in value param mode PolygonMode in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 101 offset 174 Scissor(x, y, width, height) return void param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 103 offset 176 TexParameterf(target, pname, param) return void param target TextureTarget in value param pname TextureParameterName in value param param CheckedFloat32 in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 105 wglflags small-data offset 178 TexParameterfv(target, pname, params) return void param target TextureTarget in value param pname TextureParameterName in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 106 wglflags small-data offset 179 TexParameteri(target, pname, param) return void param target TextureTarget in value param pname TextureParameterName in value param param CheckedInt32 in value category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 107 wglflags small-data offset 180 TexParameteriv(target, pname, params) return void param target TextureTarget in value param pname TextureParameterName in value param params CheckedInt32 in array [COMPSIZE(pname)] category VERSION_1_0 # old: drawing-control version 1.0 glxropcode 108 wglflags small-data offset 181 TexImage1D(target, level, internalformat, width, border, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureComponentCount in value param width SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width)] category VERSION_1_0 # old: drawing-control dlflags handcode glxflags client-handcode server-handcode version 1.0 glxropcode 109 wglflags client-handcode server-handcode offset 182 TexImage2D(target, level, internalformat, width, height, border, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureComponentCount in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height)] category VERSION_1_0 # old: drawing-control dlflags handcode glxflags client-handcode server-handcode version 1.0 glxropcode 110 wglflags client-handcode server-handcode offset 183 ############################################################################### # # framebuf commands # ############################################################################### DrawBuffer(mode) return void param mode DrawBufferMode in value category VERSION_1_0 # old: framebuf version 1.0 glxropcode 126 offset 202 Clear(mask) return void param mask ClearBufferMask in value category VERSION_1_0 # old: framebuf version 1.0 glxropcode 127 offset 203 ClearColor(red, green, blue, alpha) return void param red ClampedColorF in value param green ClampedColorF in value param blue ClampedColorF in value param alpha ClampedColorF in value category VERSION_1_0 # old: framebuf version 1.0 glxropcode 130 offset 206 ClearStencil(s) return void param s StencilValue in value category VERSION_1_0 # old: framebuf version 1.0 glxropcode 131 offset 207 ClearDepth(depth) return void param depth ClampedFloat64 in value category VERSION_1_0 # old: framebuf version 1.0 glxropcode 132 offset 208 StencilMask(mask) return void param mask MaskedStencilValue in value category VERSION_1_0 # old: framebuf version 1.0 glxropcode 133 offset 209 ColorMask(red, green, blue, alpha) return void param red Boolean in value param green Boolean in value param blue Boolean in value param alpha Boolean in value category VERSION_1_0 # old: framebuf version 1.0 glxropcode 134 offset 210 DepthMask(flag) return void param flag Boolean in value category VERSION_1_0 # old: framebuf version 1.0 glxropcode 135 offset 211 ############################################################################### # # misc commands # ############################################################################### Disable(cap) return void param cap EnableCap in value category VERSION_1_0 # old: misc version 1.0 dlflags handcode glxflags client-handcode client-intercept glxropcode 138 offset 214 Enable(cap) return void param cap EnableCap in value category VERSION_1_0 # old: misc version 1.0 dlflags handcode glxflags client-handcode client-intercept glxropcode 139 offset 215 Finish() return void dlflags notlistable glxflags client-handcode server-handcode category VERSION_1_0 # old: misc version 1.0 glxsingle 108 offset 216 Flush() return void dlflags notlistable glxflags client-handcode client-intercept server-handcode category VERSION_1_0 # old: misc version 1.0 glxsingle 142 offset 217 ############################################################################### # # pixel-op commands # ############################################################################### BlendFunc(sfactor, dfactor) return void param sfactor BlendingFactorSrc in value param dfactor BlendingFactorDest in value category VERSION_1_0 # old: pixel-op version 1.0 glxropcode 160 offset 241 LogicOp(opcode) return void param opcode LogicOp in value category VERSION_1_0 # old: pixel-op version 1.0 glxropcode 161 offset 242 StencilFunc(func, ref, mask) return void param func StencilFunction in value param ref ClampedStencilValue in value param mask MaskedStencilValue in value category VERSION_1_0 # old: pixel-op version 1.0 glxropcode 162 offset 243 StencilOp(fail, zfail, zpass) return void param fail StencilOp in value param zfail StencilOp in value param zpass StencilOp in value category VERSION_1_0 # old: pixel-op version 1.0 glxropcode 163 offset 244 DepthFunc(func) return void param func DepthFunction in value category VERSION_1_0 # old: pixel-op version 1.0 glxropcode 164 offset 245 ############################################################################### # # pixel-rw commands # ############################################################################### PixelStoref(pname, param) return void param pname PixelStoreParameter in value param param CheckedFloat32 in value dlflags notlistable glxflags client-handcode category VERSION_1_0 # old: pixel-rw version 1.0 glxsingle 109 wglflags batchable offset 249 PixelStorei(pname, param) return void param pname PixelStoreParameter in value param param CheckedInt32 in value dlflags notlistable glxflags client-handcode category VERSION_1_0 # old: pixel-rw version 1.0 glxsingle 110 wglflags batchable offset 250 ReadBuffer(mode) return void param mode ReadBufferMode in value category VERSION_1_0 # old: pixel-rw version 1.0 glxropcode 171 offset 254 ReadPixels(x, y, width, height, format, type, pixels) return void param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void out array [COMPSIZE(format/type/width/height)] category VERSION_1_0 # old: pixel-rw dlflags notlistable glxflags client-handcode server-handcode version 1.0 glxsingle 111 wglflags client-handcode server-handcode offset 256 ############################################################################### # # state-req commands # ############################################################################### GetBooleanv(pname, params) return void param pname GetPName in value param params Boolean out array [COMPSIZE(pname)] category VERSION_1_0 # old: state-req dlflags notlistable glxflags client-handcode version 1.0 glxsingle 112 wglflags small-data offset 258 GetDoublev(pname, params) return void param pname GetPName in value param params Float64 out array [COMPSIZE(pname)] category VERSION_1_0 # old: state-req dlflags notlistable glxflags client-handcode version 1.0 glxsingle 114 wglflags small-data offset 260 GetError() return ErrorCode category VERSION_1_0 # old: state-req dlflags notlistable glxflags client-handcode version 1.0 glxsingle 115 offset 261 GetFloatv(pname, params) return void param pname GetPName in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_0 # old: state-req dlflags notlistable glxflags client-handcode version 1.0 glxsingle 116 wglflags small-data offset 262 GetIntegerv(pname, params) return void param pname GetPName in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_0 # old: state-req dlflags notlistable glxflags client-handcode version 1.0 glxsingle 117 wglflags small-data offset 263 GetString(name) return String param name StringName in value category VERSION_1_0 # old: state-req dlflags notlistable glxflags client-handcode server-handcode version 1.0 glxsingle 129 wglflags client-handcode server-handcode offset 275 GetTexImage(target, level, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void out array [COMPSIZE(target/level/format/type)] category VERSION_1_0 # old: state-req dlflags notlistable glxflags client-handcode server-handcode version 1.0 glxsingle 135 wglflags client-handcode server-handcode offset 281 GetTexParameterfv(target, pname, params) return void param target TextureTarget in value param pname GetTextureParameter in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_0 # old: state-req dlflags notlistable version 1.0 glxsingle 136 wglflags small-data offset 282 GetTexParameteriv(target, pname, params) return void param target TextureTarget in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_0 # old: state-req dlflags notlistable version 1.0 glxsingle 137 wglflags small-data offset 283 GetTexLevelParameterfv(target, level, pname, params) return void param target TextureTarget in value param level CheckedInt32 in value param pname GetTextureParameter in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_0 # old: state-req dlflags notlistable version 1.0 glxsingle 138 wglflags small-data offset 284 GetTexLevelParameteriv(target, level, pname, params) return void param target TextureTarget in value param level CheckedInt32 in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_0 # old: state-req dlflags notlistable version 1.0 glxsingle 139 wglflags small-data offset 285 IsEnabled(cap) return Boolean param cap EnableCap in value category VERSION_1_0 # old: state-req dlflags notlistable version 1.0 glxflags client-handcode client-intercept glxsingle 140 offset 286 ############################################################################### # # xform commands # ############################################################################### DepthRange(near, far) return void param near ClampedFloat64 in value param far ClampedFloat64 in value category VERSION_1_0 # old: xform version 1.0 glxropcode 174 offset 288 Viewport(x, y, width, height) return void param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category VERSION_1_0 # old: xform version 1.0 glxropcode 191 offset 305 ############################################################################### ############################################################################### # # OpenGL 1.0 deprecated commands # ############################################################################### ############################################################################### # display-list commands NewList(list, mode) return void param list List in value param mode ListMode in value dlflags notlistable category VERSION_1_0_DEPRECATED # old: display-list version 1.0 deprecated 3.1 glxsingle 101 wglflags batchable offset 0 EndList() return void dlflags notlistable category VERSION_1_0_DEPRECATED # old: display-list version 1.0 deprecated 3.1 glxsingle 102 wglflags batchable offset 1 CallList(list) return void param list List in value category VERSION_1_0_DEPRECATED # old: display-list version 1.0 deprecated 3.1 glxropcode 1 offset 2 CallLists(n, type, lists) return void param n SizeI in value param type ListNameType in value param lists Void in array [COMPSIZE(n/type)] category VERSION_1_0_DEPRECATED # old: display-list glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxropcode 2 offset 3 DeleteLists(list, range) return void param list List in value param range SizeI in value dlflags notlistable category VERSION_1_0_DEPRECATED # old: display-list version 1.0 deprecated 3.1 glxsingle 103 wglflags batchable offset 4 GenLists(range) return List param range SizeI in value dlflags notlistable category VERSION_1_0_DEPRECATED # old: display-list version 1.0 deprecated 3.1 glxsingle 104 offset 5 ListBase(base) return void param base List in value category VERSION_1_0_DEPRECATED # old: display-list version 1.0 deprecated 3.1 glxropcode 3 offset 6 # drawing commands Begin(mode) return void param mode BeginMode in value category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 4 offset 7 Bitmap(width, height, xorig, yorig, xmove, ymove, bitmap) return void param width SizeI in value param height SizeI in value param xorig CoordF in value param yorig CoordF in value param xmove CoordF in value param ymove CoordF in value param bitmap UInt8 in array [COMPSIZE(width/height)] category VERSION_1_0_DEPRECATED # old: drawing dlflags handcode glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxropcode 5 wglflags client-handcode server-handcode offset 8 Color3b(red, green, blue) return void param red ColorB in value param green ColorB in value param blue ColorB in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color3bv version 1.0 deprecated 3.1 offset 9 Color3bv(v) return void param v ColorB in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 6 offset 10 Color3d(red, green, blue) return void param red ColorD in value param green ColorD in value param blue ColorD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color3dv version 1.0 deprecated 3.1 offset 11 Color3dv(v) return void param v ColorD in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 7 offset 12 Color3f(red, green, blue) return void param red ColorF in value param green ColorF in value param blue ColorF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color3fv version 1.0 deprecated 3.1 offset 13 Color3fv(v) return void param v ColorF in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 8 offset 14 Color3i(red, green, blue) return void param red ColorI in value param green ColorI in value param blue ColorI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color3iv version 1.0 deprecated 3.1 offset 15 Color3iv(v) return void param v ColorI in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 9 offset 16 Color3s(red, green, blue) return void param red ColorS in value param green ColorS in value param blue ColorS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color3sv version 1.0 deprecated 3.1 offset 17 Color3sv(v) return void param v ColorS in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 10 offset 18 Color3ub(red, green, blue) return void param red ColorUB in value param green ColorUB in value param blue ColorUB in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color3ubv version 1.0 deprecated 3.1 offset 19 Color3ubv(v) return void param v ColorUB in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 11 offset 20 Color3ui(red, green, blue) return void param red ColorUI in value param green ColorUI in value param blue ColorUI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color3uiv version 1.0 deprecated 3.1 offset 21 Color3uiv(v) return void param v ColorUI in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 12 offset 22 Color3us(red, green, blue) return void param red ColorUS in value param green ColorUS in value param blue ColorUS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color3usv version 1.0 deprecated 3.1 offset 23 Color3usv(v) return void param v ColorUS in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 13 offset 24 Color4b(red, green, blue, alpha) return void param red ColorB in value param green ColorB in value param blue ColorB in value param alpha ColorB in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color4bv version 1.0 deprecated 3.1 offset 25 Color4bv(v) return void param v ColorB in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 14 offset 26 Color4d(red, green, blue, alpha) return void param red ColorD in value param green ColorD in value param blue ColorD in value param alpha ColorD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color4dv version 1.0 deprecated 3.1 offset 27 Color4dv(v) return void param v ColorD in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 15 offset 28 Color4f(red, green, blue, alpha) return void param red ColorF in value param green ColorF in value param blue ColorF in value param alpha ColorF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color4fv version 1.0 deprecated 3.1 offset 29 Color4fv(v) return void param v ColorF in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 16 offset 30 Color4i(red, green, blue, alpha) return void param red ColorI in value param green ColorI in value param blue ColorI in value param alpha ColorI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color4iv version 1.0 deprecated 3.1 offset 31 Color4iv(v) return void param v ColorI in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 17 offset 32 Color4s(red, green, blue, alpha) return void param red ColorS in value param green ColorS in value param blue ColorS in value param alpha ColorS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color4sv version 1.0 deprecated 3.1 offset 33 Color4sv(v) return void param v ColorS in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 18 offset 34 Color4ub(red, green, blue, alpha) return void param red ColorUB in value param green ColorUB in value param blue ColorUB in value param alpha ColorUB in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color4ubv version 1.0 deprecated 3.1 offset 35 Color4ubv(v) return void param v ColorUB in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 19 offset 36 Color4ui(red, green, blue, alpha) return void param red ColorUI in value param green ColorUI in value param blue ColorUI in value param alpha ColorUI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color4uiv version 1.0 deprecated 3.1 offset 37 Color4uiv(v) return void param v ColorUI in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 20 offset 38 Color4us(red, green, blue, alpha) return void param red ColorUS in value param green ColorUS in value param blue ColorUS in value param alpha ColorUS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Color4usv version 1.0 deprecated 3.1 offset 39 Color4usv(v) return void param v ColorUS in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 21 offset 40 EdgeFlag(flag) return void param flag Boolean in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv EdgeFlagv version 1.0 deprecated 3.1 offset 41 EdgeFlagv(flag) return void param flag Boolean in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 22 offset 42 End() return void category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 23 offset 43 Indexd(c) return void param c ColorIndexValueD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Indexdv version 1.0 deprecated 3.1 offset 44 Indexdv(c) return void param c ColorIndexValueD in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 24 offset 45 Indexf(c) return void param c ColorIndexValueF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Indexfv version 1.0 deprecated 3.1 offset 46 Indexfv(c) return void param c ColorIndexValueF in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 25 offset 47 Indexi(c) return void param c ColorIndexValueI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Indexiv version 1.0 deprecated 3.1 offset 48 Indexiv(c) return void param c ColorIndexValueI in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 26 offset 49 Indexs(c) return void param c ColorIndexValueS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Indexsv version 1.0 deprecated 3.1 offset 50 Indexsv(c) return void param c ColorIndexValueS in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 27 offset 51 Normal3b(nx, ny, nz) return void param nx Int8 in value param ny Int8 in value param nz Int8 in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Normal3bv version 1.0 deprecated 3.1 offset 52 Normal3bv(v) return void param v Int8 in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 28 offset 53 Normal3d(nx, ny, nz) return void param nx CoordD in value param ny CoordD in value param nz CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Normal3dv version 1.0 deprecated 3.1 offset 54 Normal3dv(v) return void param v CoordD in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 29 offset 55 Normal3f(nx, ny, nz) return void param nx CoordF in value param ny CoordF in value param nz CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Normal3fv version 1.0 deprecated 3.1 offset 56 Normal3fv(v) return void param v CoordF in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 30 offset 57 Normal3i(nx, ny, nz) return void param nx Int32 in value param ny Int32 in value param nz Int32 in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Normal3iv version 1.0 deprecated 3.1 offset 58 Normal3iv(v) return void param v Int32 in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 31 offset 59 Normal3s(nx, ny, nz) return void param nx Int16 in value param ny Int16 in value param nz Int16 in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Normal3sv version 1.0 deprecated 3.1 offset 60 Normal3sv(v) return void param v Int16 in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 32 offset 61 RasterPos2d(x, y) return void param x CoordD in value param y CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos2dv version 1.0 deprecated 3.1 offset 62 RasterPos2dv(v) return void param v CoordD in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 33 offset 63 RasterPos2f(x, y) return void param x CoordF in value param y CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos2fv version 1.0 deprecated 3.1 offset 64 RasterPos2fv(v) return void param v CoordF in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 34 offset 65 RasterPos2i(x, y) return void param x CoordI in value param y CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos2iv version 1.0 deprecated 3.1 offset 66 RasterPos2iv(v) return void param v CoordI in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 35 offset 67 RasterPos2s(x, y) return void param x CoordS in value param y CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos2sv version 1.0 deprecated 3.1 offset 68 RasterPos2sv(v) return void param v CoordS in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 36 offset 69 RasterPos3d(x, y, z) return void param x CoordD in value param y CoordD in value param z CoordD in value vectorequiv RasterPos3dv category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 offset 70 RasterPos3dv(v) return void param v CoordD in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 37 offset 71 RasterPos3f(x, y, z) return void param x CoordF in value param y CoordF in value param z CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos3fv version 1.0 deprecated 3.1 offset 72 RasterPos3fv(v) return void param v CoordF in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 38 offset 73 RasterPos3i(x, y, z) return void param x CoordI in value param y CoordI in value param z CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos3iv version 1.0 deprecated 3.1 offset 74 RasterPos3iv(v) return void param v CoordI in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 39 offset 75 RasterPos3s(x, y, z) return void param x CoordS in value param y CoordS in value param z CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos3sv version 1.0 deprecated 3.1 offset 76 RasterPos3sv(v) return void param v CoordS in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 40 offset 77 RasterPos4d(x, y, z, w) return void param x CoordD in value param y CoordD in value param z CoordD in value param w CoordD in value vectorequiv RasterPos4dv category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 offset 78 RasterPos4dv(v) return void param v CoordD in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 41 offset 79 RasterPos4f(x, y, z, w) return void param x CoordF in value param y CoordF in value param z CoordF in value param w CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos4fv version 1.0 deprecated 3.1 offset 80 RasterPos4fv(v) return void param v CoordF in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 42 offset 81 RasterPos4i(x, y, z, w) return void param x CoordI in value param y CoordI in value param z CoordI in value param w CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos4iv version 1.0 deprecated 3.1 offset 82 RasterPos4iv(v) return void param v CoordI in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 43 offset 83 RasterPos4s(x, y, z, w) return void param x CoordS in value param y CoordS in value param z CoordS in value param w CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv RasterPos4sv version 1.0 deprecated 3.1 offset 84 RasterPos4sv(v) return void param v CoordS in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 44 offset 85 Rectd(x1, y1, x2, y2) return void param x1 CoordD in value param y1 CoordD in value param x2 CoordD in value param y2 CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Rectdv version 1.0 deprecated 3.1 offset 86 Rectdv(v1, v2) return void param v1 CoordD in array [2] param v2 CoordD in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 45 offset 87 Rectf(x1, y1, x2, y2) return void param x1 CoordF in value param y1 CoordF in value param x2 CoordF in value param y2 CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Rectfv version 1.0 deprecated 3.1 offset 88 Rectfv(v1, v2) return void param v1 CoordF in array [2] param v2 CoordF in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 46 offset 89 Recti(x1, y1, x2, y2) return void param x1 CoordI in value param y1 CoordI in value param x2 CoordI in value param y2 CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Rectiv version 1.0 deprecated 3.1 offset 90 Rectiv(v1, v2) return void param v1 CoordI in array [2] param v2 CoordI in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 47 offset 91 Rects(x1, y1, x2, y2) return void param x1 CoordS in value param y1 CoordS in value param x2 CoordS in value param y2 CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Rectsv version 1.0 deprecated 3.1 offset 92 Rectsv(v1, v2) return void param v1 CoordS in array [2] param v2 CoordS in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 48 offset 93 TexCoord1d(s) return void param s CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord1dv version 1.0 deprecated 3.1 offset 94 TexCoord1dv(v) return void param v CoordD in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 49 offset 95 TexCoord1f(s) return void param s CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord1fv version 1.0 deprecated 3.1 offset 96 TexCoord1fv(v) return void param v CoordF in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 50 offset 97 TexCoord1i(s) return void param s CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord1iv version 1.0 deprecated 3.1 offset 98 TexCoord1iv(v) return void param v CoordI in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 51 offset 99 TexCoord1s(s) return void param s CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord1sv version 1.0 deprecated 3.1 offset 100 TexCoord1sv(v) return void param v CoordS in array [1] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 52 offset 101 TexCoord2d(s, t) return void param s CoordD in value param t CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord2dv version 1.0 deprecated 3.1 offset 102 TexCoord2dv(v) return void param v CoordD in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 53 offset 103 TexCoord2f(s, t) return void param s CoordF in value param t CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord2fv version 1.0 deprecated 3.1 offset 104 TexCoord2fv(v) return void param v CoordF in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 54 offset 105 TexCoord2i(s, t) return void param s CoordI in value param t CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord2iv version 1.0 deprecated 3.1 offset 106 TexCoord2iv(v) return void param v CoordI in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 55 offset 107 TexCoord2s(s, t) return void param s CoordS in value param t CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord2sv version 1.0 deprecated 3.1 offset 108 TexCoord2sv(v) return void param v CoordS in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 56 offset 109 TexCoord3d(s, t, r) return void param s CoordD in value param t CoordD in value param r CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord3dv version 1.0 deprecated 3.1 offset 110 TexCoord3dv(v) return void param v CoordD in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 57 offset 111 TexCoord3f(s, t, r) return void param s CoordF in value param t CoordF in value param r CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord3fv version 1.0 deprecated 3.1 offset 112 TexCoord3fv(v) return void param v CoordF in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 58 offset 113 TexCoord3i(s, t, r) return void param s CoordI in value param t CoordI in value param r CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord3iv version 1.0 deprecated 3.1 offset 114 TexCoord3iv(v) return void param v CoordI in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 59 offset 115 TexCoord3s(s, t, r) return void param s CoordS in value param t CoordS in value param r CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord3sv version 1.0 deprecated 3.1 offset 116 TexCoord3sv(v) return void param v CoordS in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 60 offset 117 TexCoord4d(s, t, r, q) return void param s CoordD in value param t CoordD in value param r CoordD in value param q CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord4dv version 1.0 deprecated 3.1 offset 118 TexCoord4dv(v) return void param v CoordD in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 61 offset 119 TexCoord4f(s, t, r, q) return void param s CoordF in value param t CoordF in value param r CoordF in value param q CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord4fv version 1.0 deprecated 3.1 offset 120 TexCoord4fv(v) return void param v CoordF in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 62 offset 121 TexCoord4i(s, t, r, q) return void param s CoordI in value param t CoordI in value param r CoordI in value param q CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord4iv version 1.0 deprecated 3.1 offset 122 TexCoord4iv(v) return void param v CoordI in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 63 offset 123 TexCoord4s(s, t, r, q) return void param s CoordS in value param t CoordS in value param r CoordS in value param q CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv TexCoord4sv version 1.0 deprecated 3.1 offset 124 TexCoord4sv(v) return void param v CoordS in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 64 offset 125 Vertex2d(x, y) return void param x CoordD in value param y CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex2dv version 1.0 deprecated 3.1 offset 126 Vertex2dv(v) return void param v CoordD in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 65 offset 127 Vertex2f(x, y) return void param x CoordF in value param y CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex2fv version 1.0 deprecated 3.1 offset 128 Vertex2fv(v) return void param v CoordF in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 66 offset 129 Vertex2i(x, y) return void param x CoordI in value param y CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex2iv version 1.0 deprecated 3.1 offset 130 Vertex2iv(v) return void param v CoordI in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 67 offset 131 Vertex2s(x, y) return void param x CoordS in value param y CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex2sv version 1.0 deprecated 3.1 offset 132 Vertex2sv(v) return void param v CoordS in array [2] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 68 offset 133 Vertex3d(x, y, z) return void param x CoordD in value param y CoordD in value param z CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex3dv version 1.0 deprecated 3.1 offset 134 Vertex3dv(v) return void param v CoordD in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 69 offset 135 Vertex3f(x, y, z) return void param x CoordF in value param y CoordF in value param z CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex3fv version 1.0 deprecated 3.1 offset 136 Vertex3fv(v) return void param v CoordF in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 70 offset 137 Vertex3i(x, y, z) return void param x CoordI in value param y CoordI in value param z CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex3iv version 1.0 deprecated 3.1 offset 138 Vertex3iv(v) return void param v CoordI in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 71 offset 139 Vertex3s(x, y, z) return void param x CoordS in value param y CoordS in value param z CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex3sv version 1.0 deprecated 3.1 offset 140 Vertex3sv(v) return void param v CoordS in array [3] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 72 offset 141 Vertex4d(x, y, z, w) return void param x CoordD in value param y CoordD in value param z CoordD in value param w CoordD in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex4dv version 1.0 deprecated 3.1 offset 142 Vertex4dv(v) return void param v CoordD in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 73 offset 143 Vertex4f(x, y, z, w) return void param x CoordF in value param y CoordF in value param z CoordF in value param w CoordF in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex4fv version 1.0 deprecated 3.1 offset 144 Vertex4fv(v) return void param v CoordF in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 74 offset 145 Vertex4i(x, y, z, w) return void param x CoordI in value param y CoordI in value param z CoordI in value param w CoordI in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex4iv version 1.0 deprecated 3.1 offset 146 Vertex4iv(v) return void param v CoordI in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 75 offset 147 Vertex4s(x, y, z, w) return void param x CoordS in value param y CoordS in value param z CoordS in value param w CoordS in value category VERSION_1_0_DEPRECATED # old: drawing vectorequiv Vertex4sv version 1.0 deprecated 3.1 offset 148 Vertex4sv(v) return void param v CoordS in array [4] category VERSION_1_0_DEPRECATED # old: drawing version 1.0 deprecated 3.1 glxropcode 76 offset 149 ClipPlane(plane, equation) return void param plane ClipPlaneName in value param equation Float64 in array [4] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 77 offset 150 ColorMaterial(face, mode) return void param face MaterialFace in value param mode ColorMaterialParameter in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 78 offset 151 Fogf(pname, param) return void param pname FogParameter in value param param CheckedFloat32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 80 wglflags small-data offset 153 Fogfv(pname, params) return void param pname FogParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 81 wglflags small-data offset 154 Fogi(pname, param) return void param pname FogParameter in value param param CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 82 wglflags small-data offset 155 Fogiv(pname, params) return void param pname FogParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 83 wglflags small-data offset 156 Lightf(light, pname, param) return void param light LightName in value param pname LightParameter in value param param CheckedFloat32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 86 wglflags small-data offset 159 Lightfv(light, pname, params) return void param light LightName in value param pname LightParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 87 wglflags small-data offset 160 Lighti(light, pname, param) return void param light LightName in value param pname LightParameter in value param param CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 88 wglflags small-data offset 161 Lightiv(light, pname, params) return void param light LightName in value param pname LightParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 89 wglflags small-data offset 162 LightModelf(pname, param) return void param pname LightModelParameter in value param param Float32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 90 wglflags small-data offset 163 LightModelfv(pname, params) return void param pname LightModelParameter in value param params Float32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 91 wglflags small-data offset 164 LightModeli(pname, param) return void param pname LightModelParameter in value param param Int32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 92 wglflags small-data offset 165 LightModeliv(pname, params) return void param pname LightModelParameter in value param params Int32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 93 wglflags small-data offset 166 LineStipple(factor, pattern) return void param factor CheckedInt32 in value param pattern LineStipple in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 94 offset 167 Materialf(face, pname, param) return void param face MaterialFace in value param pname MaterialParameter in value param param CheckedFloat32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 96 wglflags small-data offset 169 Materialfv(face, pname, params) return void param face MaterialFace in value param pname MaterialParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 97 wglflags small-data offset 170 Materiali(face, pname, param) return void param face MaterialFace in value param pname MaterialParameter in value param param CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 98 wglflags small-data offset 171 Materialiv(face, pname, params) return void param face MaterialFace in value param pname MaterialParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 99 wglflags small-data offset 172 PolygonStipple(mask) return void param mask UInt8 in array [COMPSIZE()] category VERSION_1_0_DEPRECATED # old: drawing-control dlflags handcode glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxropcode 102 wglflags client-handcode server-handcode offset 175 ShadeModel(mode) return void param mode ShadingModel in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 104 offset 177 TexEnvf(target, pname, param) return void param target TextureEnvTarget in value param pname TextureEnvParameter in value param param CheckedFloat32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 111 wglflags small-data offset 184 TexEnvfv(target, pname, params) return void param target TextureEnvTarget in value param pname TextureEnvParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 112 wglflags small-data offset 185 TexEnvi(target, pname, param) return void param target TextureEnvTarget in value param pname TextureEnvParameter in value param param CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 113 wglflags small-data offset 186 TexEnviv(target, pname, params) return void param target TextureEnvTarget in value param pname TextureEnvParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 114 wglflags small-data offset 187 TexGend(coord, pname, param) return void param coord TextureCoordName in value param pname TextureGenParameter in value param param Float64 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 115 wglflags small-data offset 188 TexGendv(coord, pname, params) return void param coord TextureCoordName in value param pname TextureGenParameter in value param params Float64 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 116 wglflags small-data offset 189 TexGenf(coord, pname, param) return void param coord TextureCoordName in value param pname TextureGenParameter in value param param CheckedFloat32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 117 wglflags small-data offset 190 TexGenfv(coord, pname, params) return void param coord TextureCoordName in value param pname TextureGenParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 118 wglflags small-data offset 191 TexGeni(coord, pname, param) return void param coord TextureCoordName in value param pname TextureGenParameter in value param param CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 119 wglflags small-data offset 192 TexGeniv(coord, pname, params) return void param coord TextureCoordName in value param pname TextureGenParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: drawing-control version 1.0 deprecated 3.1 glxropcode 120 wglflags small-data offset 193 # feedback commands FeedbackBuffer(size, type, buffer) return void param size SizeI in value param type FeedbackType in value param buffer FeedbackElement out array [size] retained dlflags notlistable glxflags client-handcode server-handcode category VERSION_1_0_DEPRECATED # old: feedback version 1.0 deprecated 3.1 glxsingle 105 wglflags client-handcode server-handcode batchable offset 194 SelectBuffer(size, buffer) return void param size SizeI in value param buffer SelectName out array [size] retained dlflags notlistable glxflags client-handcode server-handcode category VERSION_1_0_DEPRECATED # old: feedback version 1.0 deprecated 3.1 glxsingle 106 wglflags client-handcode server-handcode batchable offset 195 RenderMode(mode) return Int32 param mode RenderingMode in value category VERSION_1_0_DEPRECATED # old: feedback dlflags notlistable glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxsingle 107 wglflags client-handcode server-handcode offset 196 InitNames() return void category VERSION_1_0_DEPRECATED # old: feedback version 1.0 deprecated 3.1 glxropcode 121 offset 197 LoadName(name) return void param name SelectName in value category VERSION_1_0_DEPRECATED # old: feedback version 1.0 deprecated 3.1 glxropcode 122 offset 198 PassThrough(token) return void param token FeedbackElement in value category VERSION_1_0_DEPRECATED # old: feedback version 1.0 deprecated 3.1 glxropcode 123 offset 199 PopName() return void category VERSION_1_0_DEPRECATED # old: feedback version 1.0 deprecated 3.1 glxropcode 124 offset 200 PushName(name) return void param name SelectName in value category VERSION_1_0_DEPRECATED # old: feedback version 1.0 deprecated 3.1 glxropcode 125 offset 201 ClearAccum(red, green, blue, alpha) return void param red Float32 in value param green Float32 in value param blue Float32 in value param alpha Float32 in value category VERSION_1_0_DEPRECATED # old: framebuf version 1.0 deprecated 3.1 glxropcode 128 offset 204 ClearIndex(c) return void param c MaskedColorIndexValueF in value category VERSION_1_0_DEPRECATED # old: framebuf version 1.0 deprecated 3.1 glxropcode 129 offset 205 IndexMask(mask) return void param mask MaskedColorIndexValueI in value category VERSION_1_0_DEPRECATED # old: framebuf version 1.0 deprecated 3.1 glxropcode 136 offset 212 Accum(op, value) return void param op AccumOp in value param value CoordF in value category VERSION_1_0_DEPRECATED # old: misc version 1.0 deprecated 3.1 glxropcode 137 offset 213 PopAttrib() return void category VERSION_1_0_DEPRECATED # old: misc version 1.0 deprecated 3.1 glxropcode 141 offset 218 PushAttrib(mask) return void param mask AttribMask in value category VERSION_1_0_DEPRECATED # old: misc version 1.0 deprecated 3.1 glxropcode 142 offset 219 # modeling commands Map1d(target, u1, u2, stride, order, points) return void param target MapTarget in value param u1 CoordD in value param u2 CoordD in value param stride Int32 in value param order CheckedInt32 in value param points CoordD in array [COMPSIZE(target/stride/order)] category VERSION_1_0_DEPRECATED # old: modeling dlflags handcode glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxropcode 143 wglflags client-handcode server-handcode offset 220 Map1f(target, u1, u2, stride, order, points) return void param target MapTarget in value param u1 CoordF in value param u2 CoordF in value param stride Int32 in value param order CheckedInt32 in value param points CoordF in array [COMPSIZE(target/stride/order)] category VERSION_1_0_DEPRECATED # old: modeling dlflags handcode glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxropcode 144 wglflags client-handcode server-handcode offset 221 Map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points) return void param target MapTarget in value param u1 CoordD in value param u2 CoordD in value param ustride Int32 in value param uorder CheckedInt32 in value param v1 CoordD in value param v2 CoordD in value param vstride Int32 in value param vorder CheckedInt32 in value param points CoordD in array [COMPSIZE(target/ustride/uorder/vstride/vorder)] category VERSION_1_0_DEPRECATED # old: modeling dlflags handcode glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxropcode 145 wglflags client-handcode server-handcode offset 222 Map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points) return void param target MapTarget in value param u1 CoordF in value param u2 CoordF in value param ustride Int32 in value param uorder CheckedInt32 in value param v1 CoordF in value param v2 CoordF in value param vstride Int32 in value param vorder CheckedInt32 in value param points CoordF in array [COMPSIZE(target/ustride/uorder/vstride/vorder)] category VERSION_1_0_DEPRECATED # old: modeling dlflags handcode glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxropcode 146 wglflags client-handcode server-handcode offset 223 MapGrid1d(un, u1, u2) return void param un Int32 in value param u1 CoordD in value param u2 CoordD in value category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 147 offset 224 MapGrid1f(un, u1, u2) return void param un Int32 in value param u1 CoordF in value param u2 CoordF in value category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 148 offset 225 MapGrid2d(un, u1, u2, vn, v1, v2) return void param un Int32 in value param u1 CoordD in value param u2 CoordD in value param vn Int32 in value param v1 CoordD in value param v2 CoordD in value category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 149 offset 226 MapGrid2f(un, u1, u2, vn, v1, v2) return void param un Int32 in value param u1 CoordF in value param u2 CoordF in value param vn Int32 in value param v1 CoordF in value param v2 CoordF in value category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 150 offset 227 EvalCoord1d(u) return void param u CoordD in value category VERSION_1_0_DEPRECATED # old: modeling vectorequiv EvalCoord1dv version 1.0 deprecated 3.1 offset 228 EvalCoord1dv(u) return void param u CoordD in array [1] category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 151 offset 229 EvalCoord1f(u) return void param u CoordF in value category VERSION_1_0_DEPRECATED # old: modeling vectorequiv EvalCoord1fv version 1.0 deprecated 3.1 offset 230 EvalCoord1fv(u) return void param u CoordF in array [1] category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 152 offset 231 EvalCoord2d(u, v) return void param u CoordD in value param v CoordD in value category VERSION_1_0_DEPRECATED # old: modeling vectorequiv EvalCoord2dv version 1.0 deprecated 3.1 offset 232 EvalCoord2dv(u) return void param u CoordD in array [2] category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 153 offset 233 EvalCoord2f(u, v) return void param u CoordF in value param v CoordF in value category VERSION_1_0_DEPRECATED # old: modeling vectorequiv EvalCoord2fv version 1.0 deprecated 3.1 offset 234 EvalCoord2fv(u) return void param u CoordF in array [2] category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 154 offset 235 EvalMesh1(mode, i1, i2) return void param mode MeshMode1 in value param i1 CheckedInt32 in value param i2 CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 155 offset 236 EvalPoint1(i) return void param i Int32 in value category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 156 offset 237 EvalMesh2(mode, i1, i2, j1, j2) return void param mode MeshMode2 in value param i1 CheckedInt32 in value param i2 CheckedInt32 in value param j1 CheckedInt32 in value param j2 CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 157 offset 238 EvalPoint2(i, j) return void param i CheckedInt32 in value param j CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: modeling version 1.0 deprecated 3.1 glxropcode 158 offset 239 AlphaFunc(func, ref) return void param func AlphaFunction in value param ref ClampedFloat32 in value category VERSION_1_0_DEPRECATED # old: pixel-op version 1.0 deprecated 3.1 glxropcode 159 offset 240 PixelZoom(xfactor, yfactor) return void param xfactor Float32 in value param yfactor Float32 in value category VERSION_1_0_DEPRECATED # old: pixel-rw version 1.0 deprecated 3.1 glxropcode 165 offset 246 PixelTransferf(pname, param) return void param pname PixelTransferParameter in value param param CheckedFloat32 in value category VERSION_1_0_DEPRECATED # old: pixel-rw version 1.0 deprecated 3.1 glxropcode 166 offset 247 PixelTransferi(pname, param) return void param pname PixelTransferParameter in value param param CheckedInt32 in value category VERSION_1_0_DEPRECATED # old: pixel-rw version 1.0 deprecated 3.1 glxropcode 167 offset 248 PixelMapfv(map, mapsize, values) return void param map PixelMap in value param mapsize CheckedInt32 in value param values Float32 in array [mapsize] category VERSION_1_0_DEPRECATED # old: pixel-rw glxflags client-handcode version 1.0 deprecated 3.1 glxropcode 168 offset 251 PixelMapuiv(map, mapsize, values) return void param map PixelMap in value param mapsize CheckedInt32 in value param values UInt32 in array [mapsize] category VERSION_1_0_DEPRECATED # old: pixel-rw glxflags client-handcode version 1.0 deprecated 3.1 glxropcode 169 offset 252 PixelMapusv(map, mapsize, values) return void param map PixelMap in value param mapsize CheckedInt32 in value param values UInt16 in array [mapsize] category VERSION_1_0_DEPRECATED # old: pixel-rw glxflags client-handcode version 1.0 deprecated 3.1 glxropcode 170 offset 253 CopyPixels(x, y, width, height, type) return void param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value param type PixelCopyType in value category VERSION_1_0_DEPRECATED # old: pixel-rw version 1.0 deprecated 3.1 glxropcode 172 offset 255 DrawPixels(width, height, format, type, pixels) return void param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height)] category VERSION_1_0_DEPRECATED # old: pixel-rw dlflags handcode glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxropcode 173 wglflags client-handcode server-handcode offset 257 GetClipPlane(plane, equation) return void param plane ClipPlaneName in value param equation Float64 out array [4] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 113 glxflags client-handcode server-handcode offset 259 GetLightfv(light, pname, params) return void param light LightName in value param pname LightParameter in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 118 wglflags small-data offset 264 GetLightiv(light, pname, params) return void param light LightName in value param pname LightParameter in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 119 wglflags small-data offset 265 GetMapdv(target, query, v) return void param target MapTarget in value param query GetMapQuery in value param v Float64 out array [COMPSIZE(target/query)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 120 offset 266 GetMapfv(target, query, v) return void param target MapTarget in value param query GetMapQuery in value param v Float32 out array [COMPSIZE(target/query)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 121 offset 267 GetMapiv(target, query, v) return void param target MapTarget in value param query GetMapQuery in value param v Int32 out array [COMPSIZE(target/query)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 122 offset 268 GetMaterialfv(face, pname, params) return void param face MaterialFace in value param pname MaterialParameter in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 123 wglflags small-data offset 269 GetMaterialiv(face, pname, params) return void param face MaterialFace in value param pname MaterialParameter in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 124 wglflags small-data offset 270 GetPixelMapfv(map, values) return void param map PixelMap in value param values Float32 out array [COMPSIZE(map)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 125 offset 271 GetPixelMapuiv(map, values) return void param map PixelMap in value param values UInt32 out array [COMPSIZE(map)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 126 offset 272 GetPixelMapusv(map, values) return void param map PixelMap in value param values UInt16 out array [COMPSIZE(map)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 127 offset 273 GetPolygonStipple(mask) return void param mask UInt8 out array [COMPSIZE()] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable glxflags client-handcode server-handcode version 1.0 deprecated 3.1 glxsingle 128 wglflags client-handcode server-handcode offset 274 GetTexEnvfv(target, pname, params) return void param target TextureEnvTarget in value param pname TextureEnvParameter in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 130 wglflags small-data offset 276 GetTexEnviv(target, pname, params) return void param target TextureEnvTarget in value param pname TextureEnvParameter in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 131 wglflags small-data offset 277 GetTexGendv(coord, pname, params) return void param coord TextureCoordName in value param pname TextureGenParameter in value param params Float64 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 132 wglflags small-data offset 278 GetTexGenfv(coord, pname, params) return void param coord TextureCoordName in value param pname TextureGenParameter in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 133 wglflags small-data offset 279 GetTexGeniv(coord, pname, params) return void param coord TextureCoordName in value param pname TextureGenParameter in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 134 wglflags small-data offset 280 IsList(list) return Boolean param list List in value category VERSION_1_0_DEPRECATED # old: state-req dlflags notlistable version 1.0 deprecated 3.1 glxsingle 141 offset 287 Frustum(left, right, bottom, top, zNear, zFar) return void param left Float64 in value param right Float64 in value param bottom Float64 in value param top Float64 in value param zNear Float64 in value param zFar Float64 in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 175 offset 289 LoadIdentity() return void category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 176 offset 290 LoadMatrixf(m) return void param m Float32 in array [16] category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 177 offset 291 LoadMatrixd(m) return void param m Float64 in array [16] category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 178 offset 292 MatrixMode(mode) return void param mode MatrixMode in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 179 offset 293 MultMatrixf(m) return void param m Float32 in array [16] category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 180 offset 294 MultMatrixd(m) return void param m Float64 in array [16] category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 181 offset 295 Ortho(left, right, bottom, top, zNear, zFar) return void param left Float64 in value param right Float64 in value param bottom Float64 in value param top Float64 in value param zNear Float64 in value param zFar Float64 in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 182 offset 296 PopMatrix() return void category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 183 offset 297 PushMatrix() return void category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 184 offset 298 Rotated(angle, x, y, z) return void param angle Float64 in value param x Float64 in value param y Float64 in value param z Float64 in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 185 offset 299 Rotatef(angle, x, y, z) return void param angle Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 186 offset 300 Scaled(x, y, z) return void param x Float64 in value param y Float64 in value param z Float64 in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 187 offset 301 Scalef(x, y, z) return void param x Float32 in value param y Float32 in value param z Float32 in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 188 offset 302 Translated(x, y, z) return void param x Float64 in value param y Float64 in value param z Float64 in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 189 offset 303 Translatef(x, y, z) return void param x Float32 in value param y Float32 in value param z Float32 in value category VERSION_1_0_DEPRECATED # old: xform version 1.0 deprecated 3.1 glxropcode 190 offset 304 ############################################################################### ############################################################################### # # OpenGL 1.1 commands # ############################################################################### ############################################################################### DrawArrays(mode, first, count) return void param mode BeginMode in value param first Int32 in value param count SizeI in value category VERSION_1_1 dlflags handcode glxflags client-handcode client-intercept server-handcode version 1.1 glxropcode 193 offset 310 DrawElements(mode, count, type, indices) return void param mode BeginMode in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] category VERSION_1_1 dlflags handcode glxflags client-handcode client-intercept server-handcode version 1.1 offset 311 GetPointerv(pname, params) return void param pname GetPointervPName in value param params VoidPointer out array [1] category VERSION_1_1 dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 offset 329 PolygonOffset(factor, units) return void param factor Float32 in value param units Float32 in value category VERSION_1_1 version 1.1 glxropcode 192 offset 319 # Arguably TexelInternalFormat, not PixelInternalFormat CopyTexImage1D(target, level, internalformat, x, y, width, border) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param border CheckedInt32 in value category VERSION_1_1 version 1.1 glxropcode 4119 glxflags EXT offset 323 # Arguably TexelInternalFormat, not PixelInternalFormat CopyTexImage2D(target, level, internalformat, x, y, width, height, border) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value category VERSION_1_1 version 1.1 glxropcode 4120 glxflags EXT offset 324 CopyTexSubImage1D(target, level, xoffset, x, y, width) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value category VERSION_1_1 version 1.1 glxropcode 4121 glxflags EXT offset 325 CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category VERSION_1_1 version 1.1 glxropcode 4122 glxflags EXT offset 326 TexSubImage1D(target, level, xoffset, width, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param width SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width)] category VERSION_1_1 dlflags handcode glxflags EXT client-handcode server-handcode version 1.1 glxropcode 4099 offset 332 TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height)] category VERSION_1_1 dlflags handcode glxflags EXT client-handcode server-handcode version 1.1 glxropcode 4100 offset 333 BindTexture(target, texture) return void param target TextureTarget in value param texture Texture in value category VERSION_1_1 version 1.1 glxropcode 4117 glxflags EXT offset 307 DeleteTextures(n, textures) return void param n SizeI in value param textures Texture in array [n] category VERSION_1_1 dlflags notlistable version 1.1 glxsingle 144 offset 327 GenTextures(n, textures) return void param n SizeI in value param textures Texture out array [n] category VERSION_1_1 dlflags notlistable version 1.1 glxsingle 145 offset 328 IsTexture(texture) return Boolean param texture Texture in value category VERSION_1_1 dlflags notlistable version 1.1 glxsingle 146 offset 330 ############################################################################### ############################################################################### # # OpenGL 1.1 deprecated commands # ############################################################################### ############################################################################### ArrayElement(i) return void param i Int32 in value category VERSION_1_1_DEPRECATED dlflags handcode glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 306 ColorPointer(size, type, stride, pointer) return void param size Int32 in value param type ColorPointerType in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained category VERSION_1_1_DEPRECATED dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 308 DisableClientState(array) return void param array EnableCap in value category VERSION_1_1_DEPRECATED version 1.1 deprecated 3.1 dlflags notlistable glxflags client-handcode client-intercept server-handcode offset 309 EdgeFlagPointer(stride, pointer) return void param stride SizeI in value param pointer Void in array [COMPSIZE(stride)] retained category VERSION_1_1_DEPRECATED dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 312 EnableClientState(array) return void param array EnableCap in value category VERSION_1_1_DEPRECATED dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 313 IndexPointer(type, stride, pointer) return void param type IndexPointerType in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category VERSION_1_1_DEPRECATED dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 314 InterleavedArrays(format, stride, pointer) return void param format InterleavedArrayFormat in value param stride SizeI in value param pointer Void in array [COMPSIZE(format/stride)] retained category VERSION_1_1_DEPRECATED dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 317 NormalPointer(type, stride, pointer) return void param type NormalPointerType in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category VERSION_1_1_DEPRECATED dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 318 TexCoordPointer(size, type, stride, pointer) return void param size Int32 in value param type TexCoordPointerType in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained category VERSION_1_1_DEPRECATED dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 320 VertexPointer(size, type, stride, pointer) return void param size Int32 in value param type VertexPointerType in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained category VERSION_1_1_DEPRECATED dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 deprecated 3.1 offset 321 AreTexturesResident(n, textures, residences) return Boolean param n SizeI in value param textures Texture in array [n] param residences Boolean out array [n] category VERSION_1_1_DEPRECATED glxsingle 143 dlflags notlistable version 1.1 deprecated 3.1 offset 322 PrioritizeTextures(n, textures, priorities) return void param n SizeI in value param textures Texture in array [n] param priorities ClampedFloat32 in array [n] category VERSION_1_1_DEPRECATED version 1.1 deprecated 3.1 glxropcode 4118 glxflags EXT offset 331 Indexub(c) return void param c ColorIndexValueUB in value category VERSION_1_1_DEPRECATED vectorequiv Indexubv version 1.1 offset 315 Indexubv(c) return void param c ColorIndexValueUB in array [1] category VERSION_1_1_DEPRECATED version 1.1 glxropcode 194 offset 316 PopClientAttrib() return void category VERSION_1_1_DEPRECATED version 1.1 deprecated 3.1 dlflags notlistable glxflags client-handcode client-intercept server-handcode offset 334 PushClientAttrib(mask) return void param mask ClientAttribMask in value category VERSION_1_1_DEPRECATED version 1.1 deprecated 3.1 dlflags notlistable glxflags client-handcode client-intercept server-handcode offset 335 ############################################################################### ############################################################################### # # OpenGL 1.2 commands # ############################################################################### ############################################################################### BlendColor(red, green, blue, alpha) return void param red ClampedColorF in value param green ClampedColorF in value param blue ClampedColorF in value param alpha ClampedColorF in value category VERSION_1_2 glxflags EXT version 1.2 glxropcode 4096 offset 336 BlendEquation(mode) return void param mode BlendEquationMode in value category VERSION_1_2 glxflags EXT version 1.2 glxropcode 4097 offset 337 DrawRangeElements(mode, start, end, count, type, indices) return void param mode BeginMode in value param start UInt32 in value param end UInt32 in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] category VERSION_1_2 dlflags handcode glxflags client-handcode client-intercept server-handcode version 1.2 offset 338 # OpenGL 1.2 (EXT_texture3D) commands # Arguably TexelInternalFormat, not PixelInternalFormat TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureComponentCount in value param width SizeI in value param height SizeI in value param depth SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth)] category VERSION_1_2 dlflags handcode glxflags client-handcode server-handcode EXT version 1.2 deprecated 3.1 glxropcode 4114 offset 371 TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth)] category VERSION_1_2 dlflags handcode glxflags client-handcode server-handcode EXT version 1.2 glxropcode 4115 offset 372 # OpenGL 1.2 (EXT_copy_texture) commands (specific to texture3D) CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category VERSION_1_2 glxflags EXT version 1.2 glxropcode 4123 offset 373 ############################################################################### ############################################################################### # # OpenGL 1.2 deprecated commands # ############################################################################### ############################################################################### # OpenGL 1.2 (SGI_color_table) commands ColorTable(target, internalformat, width, format, type, table) return void param target ColorTableTarget in value param internalformat PixelInternalFormat in value param width SizeI in value param format PixelFormat in value param type PixelType in value param table Void in array [COMPSIZE(format/type/width)] category VERSION_1_2_DEPRECATED dlflags handcode glxflags client-handcode server-handcode EXT version 1.2 deprecated 3.1 glxropcode 2053 offset 339 ColorTableParameterfv(target, pname, params) return void param target ColorTableTarget in value param pname ColorTableParameterPName in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 2054 offset 340 ColorTableParameteriv(target, pname, params) return void param target ColorTableTarget in value param pname ColorTableParameterPName in value param params CheckedInt32 in array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 2055 offset 341 CopyColorTable(target, internalformat, x, y, width) return void param target ColorTableTarget in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 2056 offset 342 GetColorTable(target, format, type, table) return void param target ColorTableTarget in value param format PixelFormat in value param type PixelType in value param table Void out array [COMPSIZE(target/format/type)] category VERSION_1_2_DEPRECATED dlflags notlistable glxflags client-handcode server-handcode version 1.2 deprecated 3.1 glxsingle 147 offset 343 GetColorTableParameterfv(target, pname, params) return void param target ColorTableTarget in value param pname GetColorTableParameterPName in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED dlflags notlistable version 1.2 deprecated 3.1 glxsingle 148 offset 344 GetColorTableParameteriv(target, pname, params) return void param target ColorTableTarget in value param pname GetColorTableParameterPName in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED dlflags notlistable version 1.2 deprecated 3.1 glxsingle 149 offset 345 # OpenGL 1.2 (EXT_color_subtable) commands ColorSubTable(target, start, count, format, type, data) return void param target ColorTableTarget in value param start SizeI in value param count SizeI in value param format PixelFormat in value param type PixelType in value param data Void in array [COMPSIZE(format/type/count)] category VERSION_1_2_DEPRECATED dlflags handcode glxflags client-handcode server-handcode version 1.2 deprecated 3.1 glxropcode 195 offset 346 CopyColorSubTable(target, start, x, y, width) return void param target ColorTableTarget in value param start SizeI in value param x WinCoord in value param y WinCoord in value param width SizeI in value category VERSION_1_2_DEPRECATED version 1.2 deprecated 3.1 glxropcode 196 offset 347 # OpenGL 1.2 (EXT_convolution) commands ConvolutionFilter1D(target, internalformat, width, format, type, image) return void param target ConvolutionTarget in value param internalformat PixelInternalFormat in value param width SizeI in value param format PixelFormat in value param type PixelType in value param image Void in array [COMPSIZE(format/type/width)] category VERSION_1_2_DEPRECATED dlflags handcode glxflags client-handcode server-handcode EXT version 1.2 deprecated 3.1 glxropcode 4101 offset 348 ConvolutionFilter2D(target, internalformat, width, height, format, type, image) return void param target ConvolutionTarget in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param image Void in array [COMPSIZE(format/type/width/height)] category VERSION_1_2_DEPRECATED dlflags handcode glxflags client-handcode server-handcode EXT version 1.2 deprecated 3.1 glxropcode 4102 offset 349 ConvolutionParameterf(target, pname, params) return void param target ConvolutionTarget in value param pname ConvolutionParameter in value param params CheckedFloat32 in value category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4103 offset 350 ConvolutionParameterfv(target, pname, params) return void param target ConvolutionTarget in value param pname ConvolutionParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4104 offset 351 ConvolutionParameteri(target, pname, params) return void param target ConvolutionTarget in value param pname ConvolutionParameter in value param params CheckedInt32 in value category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4105 offset 352 ConvolutionParameteriv(target, pname, params) return void param target ConvolutionTarget in value param pname ConvolutionParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4106 offset 353 CopyConvolutionFilter1D(target, internalformat, x, y, width) return void param target ConvolutionTarget in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4107 offset 354 CopyConvolutionFilter2D(target, internalformat, x, y, width, height) return void param target ConvolutionTarget in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4108 offset 355 GetConvolutionFilter(target, format, type, image) return void param target ConvolutionTarget in value param format PixelFormat in value param type PixelType in value param image Void out array [COMPSIZE(target/format/type)] category VERSION_1_2_DEPRECATED dlflags notlistable glxflags client-handcode server-handcode version 1.2 deprecated 3.1 glxsingle 150 offset 356 GetConvolutionParameterfv(target, pname, params) return void param target ConvolutionTarget in value param pname GetConvolutionParameterPName in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED dlflags notlistable version 1.2 deprecated 3.1 glxsingle 151 offset 357 GetConvolutionParameteriv(target, pname, params) return void param target ConvolutionTarget in value param pname GetConvolutionParameterPName in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED dlflags notlistable version 1.2 deprecated 3.1 glxsingle 152 offset 358 GetSeparableFilter(target, format, type, row, column, span) return void param target SeparableTarget in value param format PixelFormat in value param type PixelType in value param row Void out array [COMPSIZE(target/format/type)] param column Void out array [COMPSIZE(target/format/type)] param span Void out array [COMPSIZE(target/format/type)] category VERSION_1_2_DEPRECATED dlflags notlistable glxflags client-handcode server-handcode version 1.2 deprecated 3.1 glxsingle 153 offset 359 SeparableFilter2D(target, internalformat, width, height, format, type, row, column) return void param target SeparableTarget in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param row Void in array [COMPSIZE(target/format/type/width)] param column Void in array [COMPSIZE(target/format/type/height)] category VERSION_1_2_DEPRECATED dlflags handcode glxflags client-handcode server-handcode EXT version 1.2 deprecated 3.1 glxropcode 4109 offset 360 # OpenGL 1.2 (EXT_histogram) commands GetHistogram(target, reset, format, type, values) return void param target HistogramTarget in value param reset Boolean in value param format PixelFormat in value param type PixelType in value param values Void out array [COMPSIZE(target/format/type)] category VERSION_1_2_DEPRECATED dlflags notlistable glxflags client-handcode server-handcode version 1.2 deprecated 3.1 glxsingle 154 offset 361 GetHistogramParameterfv(target, pname, params) return void param target HistogramTarget in value param pname GetHistogramParameterPName in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED dlflags notlistable version 1.2 deprecated 3.1 glxsingle 155 offset 362 GetHistogramParameteriv(target, pname, params) return void param target HistogramTarget in value param pname GetHistogramParameterPName in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED dlflags notlistable version 1.2 deprecated 3.1 glxsingle 156 offset 363 GetMinmax(target, reset, format, type, values) return void param target MinmaxTarget in value param reset Boolean in value param format PixelFormat in value param type PixelType in value param values Void out array [COMPSIZE(target/format/type)] category VERSION_1_2_DEPRECATED dlflags notlistable glxflags client-handcode server-handcode version 1.2 deprecated 3.1 glxsingle 157 offset 364 GetMinmaxParameterfv(target, pname, params) return void param target MinmaxTarget in value param pname GetMinmaxParameterPName in value param params Float32 out array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED dlflags notlistable version 1.2 deprecated 3.1 glxsingle 158 offset 365 GetMinmaxParameteriv(target, pname, params) return void param target MinmaxTarget in value param pname GetMinmaxParameterPName in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_2_DEPRECATED dlflags notlistable version 1.2 deprecated 3.1 glxsingle 159 offset 366 Histogram(target, width, internalformat, sink) return void param target HistogramTarget in value param width SizeI in value param internalformat PixelInternalFormat in value param sink Boolean in value category VERSION_1_2_DEPRECATED dlflags handcode glxflags EXT version 1.2 deprecated 3.1 glxropcode 4110 offset 367 Minmax(target, internalformat, sink) return void param target MinmaxTarget in value param internalformat PixelInternalFormat in value param sink Boolean in value category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4111 offset 368 ResetHistogram(target) return void param target HistogramTarget in value category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4112 offset 369 ResetMinmax(target) return void param target MinmaxTarget in value category VERSION_1_2_DEPRECATED glxflags EXT version 1.2 deprecated 3.1 glxropcode 4113 offset 370 ############################################################################### ############################################################################### # # OpenGL 1.3 commands # ############################################################################### ############################################################################### # OpenGL 1.3 (ARB_multitexture) commands ActiveTexture(texture) return void param texture TextureUnit in value category VERSION_1_3 glxflags ARB version 1.3 glxropcode 197 offset 374 # OpenGL 1.3 (ARB_multisample) commands SampleCoverage(value, invert) return void param value ClampedFloat32 in value param invert Boolean in value category VERSION_1_3 glxflags ARB version 1.3 glxropcode 229 offset 412 # OpenGL 1.3 (ARB_texture_compression) commands # Arguably TexelInternalFormat, not PixelInternalFormat CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param depth SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category VERSION_1_3 dlflags handcode glxflags ARB client-handcode server-handcode version 1.3 glxropcode 216 wglflags client-handcode server-handcode offset 554 # Arguably TexelInternalFormat, not PixelInternalFormat CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category VERSION_1_3 dlflags handcode glxflags ARB client-handcode server-handcode version 1.3 glxropcode 215 wglflags client-handcode server-handcode offset 555 # Arguably TexelInternalFormat, not PixelInternalFormat CompressedTexImage1D(target, level, internalformat, width, border, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param width SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category VERSION_1_3 dlflags handcode glxflags ARB client-handcode server-handcode version 1.3 glxropcode 214 wglflags client-handcode server-handcode offset 556 CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param format PixelFormat in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category VERSION_1_3 dlflags handcode glxflags ARB client-handcode server-handcode version 1.3 glxropcode 219 wglflags client-handcode server-handcode offset 557 CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param format PixelFormat in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category VERSION_1_3 dlflags handcode glxflags ARB client-handcode server-handcode version 1.3 glxropcode 218 wglflags client-handcode server-handcode offset 558 CompressedTexSubImage1D(target, level, xoffset, width, format, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param width SizeI in value param format PixelFormat in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category VERSION_1_3 dlflags handcode glxflags ARB client-handcode server-handcode version 1.3 glxropcode 217 wglflags client-handcode server-handcode offset 559 GetCompressedTexImage(target, level, img) return void param target TextureTarget in value param level CheckedInt32 in value param img CompressedTextureARB out array [COMPSIZE(target/level)] category VERSION_1_3 dlflags notlistable glxflags ARB client-handcode server-handcode version 1.3 glxsingle 160 wglflags client-handcode server-handcode offset 560 ############################################################################### ############################################################################### # # OpenGL 1.3 deprecated commands # ############################################################################### ############################################################################### ClientActiveTexture(texture) return void param texture TextureUnit in value category VERSION_1_3_DEPRECATED dlflags notlistable glxflags ARB client-handcode client-intercept server-handcode version 1.3 deprecated 3.1 offset 375 MultiTexCoord1d(target, s) return void param target TextureUnit in value param s CoordD in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord1dv offset 376 MultiTexCoord1dv(target, v) return void param target TextureUnit in value param v CoordD in array [1] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 198 offset 377 MultiTexCoord1f(target, s) return void param target TextureUnit in value param s CoordF in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord1fv offset 378 MultiTexCoord1fv(target, v) return void param target TextureUnit in value param v CoordF in array [1] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 199 offset 379 MultiTexCoord1i(target, s) return void param target TextureUnit in value param s CoordI in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord1iv offset 380 MultiTexCoord1iv(target, v) return void param target TextureUnit in value param v CoordI in array [1] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 200 offset 381 MultiTexCoord1s(target, s) return void param target TextureUnit in value param s CoordS in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord1sv offset 382 MultiTexCoord1sv(target, v) return void param target TextureUnit in value param v CoordS in array [1] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 201 offset 383 MultiTexCoord2d(target, s, t) return void param target TextureUnit in value param s CoordD in value param t CoordD in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord2dv offset 384 MultiTexCoord2dv(target, v) return void param target TextureUnit in value param v CoordD in array [2] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 202 offset 385 MultiTexCoord2f(target, s, t) return void param target TextureUnit in value param s CoordF in value param t CoordF in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord2fv offset 386 MultiTexCoord2fv(target, v) return void param target TextureUnit in value param v CoordF in array [2] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 203 offset 387 MultiTexCoord2i(target, s, t) return void param target TextureUnit in value param s CoordI in value param t CoordI in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord2iv offset 388 MultiTexCoord2iv(target, v) return void param target TextureUnit in value param v CoordI in array [2] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 204 offset 389 MultiTexCoord2s(target, s, t) return void param target TextureUnit in value param s CoordS in value param t CoordS in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord2sv offset 390 MultiTexCoord2sv(target, v) return void param target TextureUnit in value param v CoordS in array [2] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 205 offset 391 MultiTexCoord3d(target, s, t, r) return void param target TextureUnit in value param s CoordD in value param t CoordD in value param r CoordD in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord3dv offset 392 MultiTexCoord3dv(target, v) return void param target TextureUnit in value param v CoordD in array [3] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 206 offset 393 MultiTexCoord3f(target, s, t, r) return void param target TextureUnit in value param s CoordF in value param t CoordF in value param r CoordF in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord3fv offset 394 MultiTexCoord3fv(target, v) return void param target TextureUnit in value param v CoordF in array [3] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 207 offset 395 MultiTexCoord3i(target, s, t, r) return void param target TextureUnit in value param s CoordI in value param t CoordI in value param r CoordI in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord3iv offset 396 MultiTexCoord3iv(target, v) return void param target TextureUnit in value param v CoordI in array [3] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 208 offset 397 MultiTexCoord3s(target, s, t, r) return void param target TextureUnit in value param s CoordS in value param t CoordS in value param r CoordS in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord3sv offset 398 MultiTexCoord3sv(target, v) return void param target TextureUnit in value param v CoordS in array [3] category VERSION_1_3_DEPRECATED version 1.3 deprecated 3.1 glxflags ARB glxropcode 209 offset 399 MultiTexCoord4d(target, s, t, r, q) return void param target TextureUnit in value param s CoordD in value param t CoordD in value param r CoordD in value param q CoordD in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord4dv offset 400 MultiTexCoord4dv(target, v) return void param target TextureUnit in value param v CoordD in array [4] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 210 offset 401 MultiTexCoord4f(target, s, t, r, q) return void param target TextureUnit in value param s CoordF in value param t CoordF in value param r CoordF in value param q CoordF in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord4fv offset 402 MultiTexCoord4fv(target, v) return void param target TextureUnit in value param v CoordF in array [4] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 211 offset 403 MultiTexCoord4i(target, s, t, r, q) return void param target TextureUnit in value param s CoordI in value param t CoordI in value param r CoordI in value param q CoordI in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord4iv offset 404 MultiTexCoord4iv(target, v) return void param target TextureUnit in value param v CoordI in array [4] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 212 offset 405 MultiTexCoord4s(target, s, t, r, q) return void param target TextureUnit in value param s CoordS in value param t CoordS in value param r CoordS in value param q CoordS in value category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 vectorequiv MultiTexCoord4sv offset 406 MultiTexCoord4sv(target, v) return void param target TextureUnit in value param v CoordS in array [4] category VERSION_1_3_DEPRECATED glxflags ARB version 1.3 deprecated 3.1 glxropcode 213 offset 407 # OpenGL 1.3 (ARB_transpose_matrix) commands LoadTransposeMatrixf(m) return void param m Float32 in array [16] category VERSION_1_3_DEPRECATED glxflags ARB client-handcode client-intercept server-handcode version 1.3 deprecated 3.1 offset 408 LoadTransposeMatrixd(m) return void param m Float64 in array [16] category VERSION_1_3_DEPRECATED glxflags ARB client-handcode client-intercept server-handcode version 1.3 deprecated 3.1 offset 409 MultTransposeMatrixf(m) return void param m Float32 in array [16] category VERSION_1_3_DEPRECATED glxflags ARB client-handcode client-intercept server-handcode version 1.3 deprecated 3.1 offset 410 MultTransposeMatrixd(m) return void param m Float64 in array [16] category VERSION_1_3_DEPRECATED glxflags ARB client-handcode client-intercept server-handcode version 1.3 deprecated 3.1 offset 411 ############################################################################### ############################################################################### # # OpenGL 1.4 commands # ############################################################################### ############################################################################### # OpenGL 1.4 (EXT_blend_func_separate) commands BlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha) return void param sfactorRGB BlendFuncSeparateParameterEXT in value param dfactorRGB BlendFuncSeparateParameterEXT in value param sfactorAlpha BlendFuncSeparateParameterEXT in value param dfactorAlpha BlendFuncSeparateParameterEXT in value category VERSION_1_4 glxropcode 4134 version 1.4 extension offset 537 # OpenGL 1.4 (EXT_multi_draw_arrays) commands # first and count are really 'in' MultiDrawArrays(mode, first, count, primcount) return void param mode BeginMode in value param first Int32 out array [COMPSIZE(count)] param count SizeI out array [COMPSIZE(primcount)] param primcount SizeI in value category VERSION_1_4 version 1.4 glxropcode ? offset 644 MultiDrawElements(mode, count, type, indices, primcount) return void param mode BeginMode in value param count SizeI in array [COMPSIZE(primcount)] param type DrawElementsType in value param indices VoidPointer in array [COMPSIZE(primcount)] param primcount SizeI in value category VERSION_1_4 version 1.4 glxropcode ? offset 645 # OpenGL 1.4 (ARB_point_parameters, NV_point_sprite) commands PointParameterf(pname, param) return void param pname PointParameterNameARB in value param param CheckedFloat32 in value category VERSION_1_4 version 1.4 glxropcode 2065 extension offset 458 PointParameterfv(pname, params) return void param pname PointParameterNameARB in value param params CheckedFloat32 in array [COMPSIZE(pname)] category VERSION_1_4 version 1.4 glxropcode 2066 extension offset 459 PointParameteri(pname, param) return void param pname PointParameterNameARB in value param param Int32 in value category VERSION_1_4 version 1.4 extension soft WINSOFT NV20 glxropcode 4221 offset 642 PointParameteriv(pname, params) return void param pname PointParameterNameARB in value param params Int32 in array [COMPSIZE(pname)] category VERSION_1_4 version 1.4 extension soft WINSOFT NV20 glxropcode 4222re offset 643 ############################################################################### ############################################################################### # # OpenGL 1.4 deprecated commands # ############################################################################### ############################################################################### # OpenGL 1.4 (EXT_fog_coord) commands FogCoordf(coord) return void param coord CoordF in value category VERSION_1_4_DEPRECATED vectorequiv FogCoordfv version 1.4 deprecated 3.1 offset 545 FogCoordfv(coord) return void param coord CoordF in array [1] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4124 offset 546 FogCoordd(coord) return void param coord CoordD in value category VERSION_1_4_DEPRECATED vectorequiv FogCoorddv version 1.4 deprecated 3.1 offset 547 FogCoorddv(coord) return void param coord CoordD in array [1] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4125 offset 548 FogCoordPointer(type, stride, pointer) return void param type FogPointerTypeEXT in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category VERSION_1_4_DEPRECATED dlflags notlistable version 1.4 deprecated 3.1 glxflags client-handcode server-handcode offset 549 # OpenGL 1.4 (EXT_secondary_color) commands SecondaryColor3b(red, green, blue) return void param red ColorB in value param green ColorB in value param blue ColorB in value category VERSION_1_4_DEPRECATED vectorequiv SecondaryColor3bv version 1.4 deprecated 3.1 offset 561 SecondaryColor3bv(v) return void param v ColorB in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4126 offset 562 SecondaryColor3d(red, green, blue) return void param red ColorD in value param green ColorD in value param blue ColorD in value category VERSION_1_4_DEPRECATED vectorequiv SecondaryColor3dv version 1.4 deprecated 3.1 offset 563 SecondaryColor3dv(v) return void param v ColorD in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4130 offset 564 SecondaryColor3f(red, green, blue) return void param red ColorF in value param green ColorF in value param blue ColorF in value category VERSION_1_4_DEPRECATED vectorequiv SecondaryColor3fv version 1.4 deprecated 3.1 offset 565 SecondaryColor3fv(v) return void param v ColorF in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4129 offset 566 SecondaryColor3i(red, green, blue) return void param red ColorI in value param green ColorI in value param blue ColorI in value category VERSION_1_4_DEPRECATED vectorequiv SecondaryColor3iv version 1.4 deprecated 3.1 offset 567 SecondaryColor3iv(v) return void param v ColorI in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4128 offset 568 SecondaryColor3s(red, green, blue) return void param red ColorS in value param green ColorS in value param blue ColorS in value category VERSION_1_4_DEPRECATED vectorequiv SecondaryColor3sv version 1.4 deprecated 3.1 offset 569 SecondaryColor3sv(v) return void param v ColorS in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4127 offset 570 SecondaryColor3ub(red, green, blue) return void param red ColorUB in value param green ColorUB in value param blue ColorUB in value category VERSION_1_4_DEPRECATED vectorequiv SecondaryColor3ubv version 1.4 deprecated 3.1 offset 571 SecondaryColor3ubv(v) return void param v ColorUB in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4131 offset 572 SecondaryColor3ui(red, green, blue) return void param red ColorUI in value param green ColorUI in value param blue ColorUI in value category VERSION_1_4_DEPRECATED vectorequiv SecondaryColor3uiv version 1.4 deprecated 3.1 offset 573 SecondaryColor3uiv(v) return void param v ColorUI in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4133 offset 574 SecondaryColor3us(red, green, blue) return void param red ColorUS in value param green ColorUS in value param blue ColorUS in value category VERSION_1_4_DEPRECATED vectorequiv SecondaryColor3usv version 1.4 deprecated 3.1 offset 575 SecondaryColor3usv(v) return void param v ColorUS in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 4132 offset 576 SecondaryColorPointer(size, type, stride, pointer) return void param size Int32 in value param type ColorPointerType in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained category VERSION_1_4_DEPRECATED dlflags notlistable glxflags client-handcode server-handcode version 1.4 deprecated 3.1 extension offset 577 # OpenGL 1.4 (ARB_window_pos) commands # Note: all WindowPos* entry points use glxropcode ropcode 230, with 3 float parameters WindowPos2d(x, y) return void param x CoordD in value param y CoordD in value category VERSION_1_4_DEPRECATED vectorequiv WindowPos2dv version 1.4 deprecated 3.1 offset 513 WindowPos2dv(v) return void param v CoordD in array [2] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 230 glxflags client-handcode server-handcode offset 514 WindowPos2f(x, y) return void param x CoordF in value param y CoordF in value category VERSION_1_4_DEPRECATED vectorequiv WindowPos2fv version 1.4 deprecated 3.1 offset 515 WindowPos2fv(v) return void param v CoordF in array [2] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 230 glxflags client-handcode server-handcode offset 516 WindowPos2i(x, y) return void param x CoordI in value param y CoordI in value category VERSION_1_4_DEPRECATED vectorequiv WindowPos2iv version 1.4 deprecated 3.1 offset 517 WindowPos2iv(v) return void param v CoordI in array [2] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 230 glxflags client-handcode server-handcode offset 518 WindowPos2s(x, y) return void param x CoordS in value param y CoordS in value category VERSION_1_4_DEPRECATED vectorequiv WindowPos2sv version 1.4 deprecated 3.1 offset 519 WindowPos2sv(v) return void param v CoordS in array [2] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 230 glxflags client-handcode server-handcode offset 520 WindowPos3d(x, y, z) return void param x CoordD in value param y CoordD in value param z CoordD in value vectorequiv WindowPos3dv category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 offset 521 WindowPos3dv(v) return void param v CoordD in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 230 glxflags client-handcode server-handcode offset 522 WindowPos3f(x, y, z) return void param x CoordF in value param y CoordF in value param z CoordF in value category VERSION_1_4_DEPRECATED vectorequiv WindowPos3fv version 1.4 deprecated 3.1 offset 523 WindowPos3fv(v) return void param v CoordF in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 230 glxflags client-handcode server-handcode offset 524 WindowPos3i(x, y, z) return void param x CoordI in value param y CoordI in value param z CoordI in value category VERSION_1_4_DEPRECATED vectorequiv WindowPos3iv version 1.4 deprecated 3.1 offset 525 WindowPos3iv(v) return void param v CoordI in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 230 glxflags client-handcode server-handcode offset 526 WindowPos3s(x, y, z) return void param x CoordS in value param y CoordS in value param z CoordS in value category VERSION_1_4_DEPRECATED vectorequiv WindowPos3sv version 1.4 deprecated 3.1 offset 527 WindowPos3sv(v) return void param v CoordS in array [3] category VERSION_1_4_DEPRECATED version 1.4 deprecated 3.1 glxropcode 230 glxflags client-handcode server-handcode offset 528 ############################################################################### ############################################################################### # # OpenGL 1.5 commands # ############################################################################### ############################################################################### # OpenGL 1.5 (ARB_occlusion_query) commands GenQueries(n, ids) return void param n SizeI in value param ids UInt32 out array [n] category VERSION_1_5 version 1.5 extension glxsingle 162 glxflags ignore offset 700 DeleteQueries(n, ids) return void param n SizeI in value param ids UInt32 in array [n] category VERSION_1_5 version 1.5 extension glxsingle 161 glxflags ignore offset 701 IsQuery(id) return Boolean param id UInt32 in value category VERSION_1_5 version 1.5 extension glxsingle 163 glxflags ignore offset 702 BeginQuery(target, id) return void param target GLenum in value param id UInt32 in value category VERSION_1_5 version 1.5 extension glxropcode 231 glxflags ignore offset 703 EndQuery(target) return void param target GLenum in value category VERSION_1_5 version 1.5 extension glxropcode 232 glxflags ignore offset 704 GetQueryiv(target, pname, params) return void param target GLenum in value param pname GLenum in value param params Int32 out array [pname] category VERSION_1_5 dlflags notlistable version 1.5 extension glxsingle 164 glxflags ignore offset 705 GetQueryObjectiv(id, pname, params) return void param id UInt32 in value param pname GLenum in value param params Int32 out array [pname] category VERSION_1_5 dlflags notlistable version 1.5 extension glxsingle 165 glxflags ignore offset 706 GetQueryObjectuiv(id, pname, params) return void param id UInt32 in value param pname GLenum in value param params UInt32 out array [pname] category VERSION_1_5 dlflags notlistable version 1.5 extension glxsingle 166 glxflags ignore offset 707 # OpenGL 1.5 (ARB_vertex_buffer_object) commands BindBuffer(target, buffer) return void param target BufferTargetARB in value param buffer UInt32 in value category VERSION_1_5 version 1.5 extension glxropcode ? glxflags ignore offset 688 DeleteBuffers(n, buffers) return void param n SizeI in value param buffers ConstUInt32 in array [n] category VERSION_1_5 version 1.5 extension glxropcode ? glxflags ignore offset 691 GenBuffers(n, buffers) return void param n SizeI in value param buffers UInt32 out array [n] category VERSION_1_5 version 1.5 extension glxropcode ? glxflags ignore offset 692 IsBuffer(buffer) return Boolean param buffer UInt32 in value category VERSION_1_5 version 1.5 extension glxropcode ? glxflags ignore offset 696 BufferData(target, size, data, usage) return void param target BufferTargetARB in value param size BufferSize in value param data ConstVoid in array [size] param usage BufferUsageARB in value category VERSION_1_5 version 1.5 extension glxropcode ? glxflags ignore offset 689 BufferSubData(target, offset, size, data) return void param target BufferTargetARB in value param offset BufferOffset in value param size BufferSize in value param data ConstVoid in array [size] category VERSION_1_5 version 1.5 extension glxropcode ? glxflags ignore offset 690 GetBufferSubData(target, offset, size, data) return void param target BufferTargetARB in value param offset BufferOffset in value param size BufferSize in value param data Void out array [size] category VERSION_1_5 dlflags notlistable version 1.5 extension glxsingle ? glxflags ignore offset 695 MapBuffer(target, access) return VoidPointer param target BufferTargetARB in value param access BufferAccessARB in value category VERSION_1_5 version 1.5 extension glxropcode ? glxflags ignore offset 697 UnmapBuffer(target) return Boolean param target BufferTargetARB in value category VERSION_1_5 version 1.5 extension glxropcode ? glxflags ignore offset 698 GetBufferParameteriv(target, pname, params) return void param target BufferTargetARB in value param pname BufferPNameARB in value param params Int32 out array [COMPSIZE(pname)] category VERSION_1_5 dlflags notlistable version 1.5 extension glxsingle ? glxflags ignore offset 693 GetBufferPointerv(target, pname, params) return void param target BufferTargetARB in value param pname BufferPointerNameARB in value param params VoidPointer out array [1] category VERSION_1_5 dlflags notlistable version 1.5 extension glxsingle ? glxflags ignore offset 694 # OpenGL 1.5 (EXT_shadow_funcs) commands - none ############################################################################### ############################################################################### # # OpenGL 2.0 commands # ############################################################################### ############################################################################### # OpenGL 2.0 (EXT_blend_equation_separate) commands BlendEquationSeparate(modeRGB, modeAlpha) return void param modeRGB BlendEquationModeEXT in value param modeAlpha BlendEquationModeEXT in value category VERSION_2_0 version 2.0 extension glxropcode 4228 # OpenGL 2.0 (ARB_draw_buffers) commands DrawBuffers(n, bufs) return void param n SizeI in value param bufs DrawBufferModeATI in array [n] category VERSION_2_0 version 2.0 extension glxropcode 233 glxflags ignore offset ? # OpenGL 2.0 (ARB_stencil_two_side) commands StencilOpSeparate(face, sfail, dpfail, dppass) return void param face StencilFaceDirection in value param sfail StencilOp in value param dpfail StencilOp in value param dppass StencilOp in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? StencilFuncSeparate(frontfunc, backfunc, ref, mask) return void param frontfunc StencilFunction in value param backfunc StencilFunction in value param ref ClampedStencilValue in value param mask MaskedStencilValue in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? StencilMaskSeparate(face, mask) return void param face StencilFaceDirection in value param mask MaskedStencilValue in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? # OpenGL 2.0 (ARB_shader_objects / ARB_vertex_shader / ARB_fragment_shader) commands AttachShader(program, shader) return void param program UInt32 in value param shader UInt32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? BindAttribLocation(program, index, name) return void param program UInt32 in value param index UInt32 in value param name Char in array [] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? CompileShader(shader) return void param shader UInt32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? CreateProgram() return UInt32 category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? CreateShader(type) return UInt32 param type GLenum in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? DeleteProgram(program) return void param program UInt32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? DeleteShader(shader) return void param shader UInt32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? DetachShader(program, shader) return void param program UInt32 in value param shader UInt32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? DisableVertexAttribArray(index) return void param index UInt32 in value dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxflags ignore offset 666 EnableVertexAttribArray(index) return void param index UInt32 in value dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxflags ignore offset 665 GetActiveAttrib(program, index, bufSize, length, size, type, name) return void param program UInt32 in value param index UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param size Int32 out array [1] param type GLenum out array [1] param name Char out array [] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetActiveUniform(program, index, bufSize, length, size, type, name) return void param program UInt32 in value param index UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param size Int32 out array [1] param type GLenum out array [1] param name Char out array [] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetAttachedShaders(program, maxCount, count, obj) return void param program UInt32 in value param maxCount SizeI in value param count SizeI out array [1] param obj UInt32 out array [count] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetAttribLocation(program, name) return Int32 param program UInt32 in value param name Char in array [] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetProgramiv(program, pname, params) return void param program UInt32 in value param pname GLenum in value param params Int32 out array [pname] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetProgramInfoLog(program, bufSize, length, infoLog) return void param program UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param infoLog Char out array [length] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetShaderiv(shader, pname, params) return void param shader UInt32 in value param pname GLenum in value param params Int32 out array [pname] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetShaderInfoLog(shader, bufSize, length, infoLog) return void param shader UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param infoLog Char out array [length] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetShaderSource(shader, bufSize, length, source) return void param shader UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param source Char out array [length] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetUniformLocation(program, name) return Int32 param program UInt32 in value param name Char in array [] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetUniformfv(program, location, params) return void param program UInt32 in value param location Int32 in value param params Float32 out array [location] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetUniformiv(program, location, params) return void param program UInt32 in value param location Int32 in value param params Int32 out array [location] category VERSION_2_0 dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetVertexAttribdv(index, pname, params) return void param index UInt32 in value param pname VertexAttribPropertyARB in value param params Float64 out array [4] dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxvendorpriv 1301 offset 588 GetVertexAttribfv(index, pname, params) return void param index UInt32 in value param pname VertexAttribPropertyARB in value param params Float32 out array [4] dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxvendorpriv 1302 offset 589 GetVertexAttribiv(index, pname, params) return void param index UInt32 in value param pname VertexAttribPropertyARB in value param params Int32 out array [4] dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxvendorpriv 1303 offset 590 GetVertexAttribPointerv(index, pname, pointer) return void param index UInt32 in value param pname VertexAttribPointerPropertyARB in value param pointer VoidPointer out array [1] dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxflags ignore offset 591 IsProgram(program) return Boolean param program UInt32 in value dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxvendorpriv 1304 offset 592 IsShader(shader) return Boolean param shader UInt32 in value dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxvendorpriv ? offset ? LinkProgram(program) return void param program UInt32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? ShaderSource(shader, count, string, length) return void param shader UInt32 in value param count SizeI in value param string CharPointer in array [count] param length Int32 in array [1] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? UseProgram(program) return void param program UInt32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform1f(location, v0) return void param location Int32 in value param v0 Float32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform2f(location, v0, v1) return void param location Int32 in value param v0 Float32 in value param v1 Float32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform3f(location, v0, v1, v2) return void param location Int32 in value param v0 Float32 in value param v1 Float32 in value param v2 Float32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform4f(location, v0, v1, v2, v3) return void param location Int32 in value param v0 Float32 in value param v1 Float32 in value param v2 Float32 in value param v3 Float32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform1i(location, v0) return void param location Int32 in value param v0 Int32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform2i(location, v0, v1) return void param location Int32 in value param v0 Int32 in value param v1 Int32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform3i(location, v0, v1, v2) return void param location Int32 in value param v0 Int32 in value param v1 Int32 in value param v2 Int32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform4i(location, v0, v1, v2, v3) return void param location Int32 in value param v0 Int32 in value param v1 Int32 in value param v2 Int32 in value param v3 Int32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform1fv(location, count, value) return void param location Int32 in value param count SizeI in value param value Float32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform2fv(location, count, value) return void param location Int32 in value param count SizeI in value param value Float32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform3fv(location, count, value) return void param location Int32 in value param count SizeI in value param value Float32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform4fv(location, count, value) return void param location Int32 in value param count SizeI in value param value Float32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform1iv(location, count, value) return void param location Int32 in value param count SizeI in value param value Int32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform2iv(location, count, value) return void param location Int32 in value param count SizeI in value param value Int32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform3iv(location, count, value) return void param location Int32 in value param count SizeI in value param value Int32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? Uniform4iv(location, count, value) return void param location Int32 in value param count SizeI in value param value Int32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? UniformMatrix2fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? UniformMatrix3fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? UniformMatrix4fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count] category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? ValidateProgram(program) return void param program UInt32 in value category VERSION_2_0 version 2.0 extension glxropcode ? glxflags ignore offset ? VertexAttrib1d(index, x) return void param index UInt32 in value param x Float64 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib1dv extension soft WINSOFT NV10 glxflags ignore offset 603 VertexAttrib1dv(index, v) return void param index UInt32 in value param v Float64 in array [1] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4197 offset 604 VertexAttrib1f(index, x) return void param index UInt32 in value param x Float32 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib1fv extension soft WINSOFT NV10 glxflags ignore offset 605 VertexAttrib1fv(index, v) return void param index UInt32 in value param v Float32 in array [1] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4193 offset 606 VertexAttrib1s(index, x) return void param index UInt32 in value param x Int16 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib1sv extension soft WINSOFT NV10 glxflags ignore offset 607 VertexAttrib1sv(index, v) return void param index UInt32 in value param v Int16 in array [1] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4189 offset 608 VertexAttrib2d(index, x, y) return void param index UInt32 in value param x Float64 in value param y Float64 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib2dv extension soft WINSOFT NV10 glxflags ignore offset 609 VertexAttrib2dv(index, v) return void param index UInt32 in value param v Float64 in array [2] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4198 offset 610 VertexAttrib2f(index, x, y) return void param index UInt32 in value param x Float32 in value param y Float32 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib2fv extension soft WINSOFT NV10 glxflags ignore offset 611 VertexAttrib2fv(index, v) return void param index UInt32 in value param v Float32 in array [2] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4194 offset 612 VertexAttrib2s(index, x, y) return void param index UInt32 in value param x Int16 in value param y Int16 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib2sv extension soft WINSOFT NV10 glxflags ignore offset 613 VertexAttrib2sv(index, v) return void param index UInt32 in value param v Int16 in array [2] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4190 offset 614 VertexAttrib3d(index, x, y, z) return void param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib3dv extension soft WINSOFT NV10 glxflags ignore offset 615 VertexAttrib3dv(index, v) return void param index UInt32 in value param v Float64 in array [3] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4199 offset 616 VertexAttrib3f(index, x, y, z) return void param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib3fv extension soft WINSOFT NV10 glxflags ignore offset 617 VertexAttrib3fv(index, v) return void param index UInt32 in value param v Float32 in array [3] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4195 offset 618 VertexAttrib3s(index, x, y, z) return void param index UInt32 in value param x Int16 in value param y Int16 in value param z Int16 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib3sv extension soft WINSOFT NV10 glxflags ignore offset 619 VertexAttrib3sv(index, v) return void param index UInt32 in value param v Int16 in array [3] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4191 offset 620 VertexAttrib4Nbv(index, v) return void param index UInt32 in value param v Int8 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 659 VertexAttrib4Niv(index, v) return void param index UInt32 in value param v Int32 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 661 VertexAttrib4Nsv(index, v) return void param index UInt32 in value param v Int16 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 660 VertexAttrib4Nub(index, x, y, z, w) return void param index UInt32 in value param x UInt8 in value param y UInt8 in value param z UInt8 in value param w UInt8 in value category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 627 VertexAttrib4Nubv(index, v) return void param index UInt32 in value param v UInt8 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore glxropcode 4201 offset 628 VertexAttrib4Nuiv(index, v) return void param index UInt32 in value param v UInt32 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 663 VertexAttrib4Nusv(index, v) return void param index UInt32 in value param v UInt16 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 662 VertexAttrib4bv(index, v) return void param index UInt32 in value param v Int8 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 654 VertexAttrib4d(index, x, y, z, w) return void param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib4dv extension soft WINSOFT NV10 glxflags ignore offset 621 VertexAttrib4dv(index, v) return void param index UInt32 in value param v Float64 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4200 offset 622 VertexAttrib4f(index, x, y, z, w) return void param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib4fv extension soft WINSOFT NV10 glxflags ignore offset 623 VertexAttrib4fv(index, v) return void param index UInt32 in value param v Float32 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxropcode 4196 offset 624 VertexAttrib4iv(index, v) return void param index UInt32 in value param v Int32 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 655 VertexAttrib4s(index, x, y, z, w) return void param index UInt32 in value param x Int16 in value param y Int16 in value param z Int16 in value param w Int16 in value category VERSION_2_0 version 2.0 deprecated 3.1 vectorequiv VertexAttrib4sv extension soft WINSOFT NV10 glxflags ignore offset 625 VertexAttrib4sv(index, v) return void param index UInt32 in value param v Int16 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore glxropcode 4192 offset 626 VertexAttrib4ubv(index, v) return void param index UInt32 in value param v UInt8 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 656 VertexAttrib4uiv(index, v) return void param index UInt32 in value param v UInt32 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 658 VertexAttrib4usv(index, v) return void param index UInt32 in value param v UInt16 in array [4] category VERSION_2_0 version 2.0 deprecated 3.1 extension soft WINSOFT NV10 glxflags ignore offset 657 VertexAttribPointer(index, size, type, normalized, stride, pointer) return void param index UInt32 in value param size Int32 in value param type VertexAttribPointerTypeARB in value param normalized Boolean in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained dlflags notlistable category VERSION_2_0 version 2.0 extension soft WINSOFT NV10 glxflags ignore offset 664 ############################################################################### ############################################################################### # # OpenGL 2.1 commands # ############################################################################### ############################################################################### # OpenGL 2.1 (ARB_pixel_buffer_object) commands - none # OpenGL 2.1 (EXT_texture_sRGB) commands - none # New commands in OpenGL 2.1 UniformMatrix2x3fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [6] category VERSION_2_1 version 2.1 extension glxropcode ? glxflags ignore offset ? UniformMatrix3x2fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [6] category VERSION_2_1 version 2.1 extension glxropcode ? glxflags ignore offset ? UniformMatrix2x4fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [8] category VERSION_2_1 version 2.1 extension glxropcode ? glxflags ignore offset ? UniformMatrix4x2fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [8] category VERSION_2_1 version 2.1 extension glxropcode ? glxflags ignore offset ? UniformMatrix3x4fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [12] category VERSION_2_1 version 2.1 extension glxropcode ? glxflags ignore offset ? UniformMatrix4x3fv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [12] category VERSION_2_1 version 2.1 extension glxropcode ? glxflags ignore offset ? ############################################################################### ############################################################################### # # OpenGL 3.0 commands # ############################################################################### ############################################################################### # OpenGL 3.0 (EXT_draw_buffers2) commands ColorMaski(index, r, g, b, a) return void param index UInt32 in value param r Boolean in value param g Boolean in value param b Boolean in value param a Boolean in value category VERSION_3_0 version 3.0 extension glxflags ignore glfflags ignore GetBooleani_v(target, index, data) return void param target GLenum in value param index UInt32 in value param data Boolean out array [COMPSIZE(target)] category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags ignore glfflags ignore GetIntegeri_v(target, index, data) return void param target GLenum in value param index UInt32 in value param data Int32 out array [COMPSIZE(target)] category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags ignore glfflags ignore Enablei(target, index) return void param target GLenum in value param index UInt32 in value category VERSION_3_0 version 3.0 extension glxflags ignore glfflags ignore Disablei(target, index) return void param target GLenum in value param index UInt32 in value category VERSION_3_0 version 3.0 extension glxflags ignore glfflags ignore IsEnabledi(target, index) return Boolean param target GLenum in value param index UInt32 in value category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags ignore glfflags ignore # OpenGL 3.0 (EXT_transform_feedback) commands BeginTransformFeedback(primitiveMode) return void param primitiveMode GLenum in value category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags ignore glfflags ignore EndTransformFeedback() return void category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags ignore glfflags ignore BindBufferRange(target, index, buffer, offset, size) return void param target GLenum in value param index UInt32 in value param buffer UInt32 in value param offset BufferOffset in value param size BufferSize in value category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags ignore glfflags ignore BindBufferBase(target, index, buffer) return void param target GLenum in value param index UInt32 in value param buffer UInt32 in value category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags ignore glfflags ignore TransformFeedbackVaryings(program, count, varyings, bufferMode) return void param program UInt32 in value param count SizeI in value param varyings CharPointer in array [count] param bufferMode GLenum in value category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags ignore glfflags ignore GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name) return void param program UInt32 in value param index UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param size SizeI out array [1] param type GLenum out array [1] param name Char out array [COMPSIZE(length)] category VERSION_3_0 dlflags notlistable version 3.0 extension glfflags ignore glxflags ignore ClampColor(target, clamp) return void param target ClampColorTargetARB in value param clamp ClampColorModeARB in value category VERSION_3_0 version 3.0 extension glxropcode 234 glxflags ignore offset ? BeginConditionalRender(id, mode) return void param id UInt32 in value param mode TypeEnum in value category VERSION_3_0 version 3.0 glfflags ignore glxflags ignore EndConditionalRender() return void category VERSION_3_0 version 3.0 glfflags ignore glxflags ignore VertexAttribIPointer(index, size, type, stride, pointer) return void param index UInt32 in value param size Int32 in value param type VertexAttribEnum in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained category VERSION_3_0 version 3.0 dlflags notlistable extension glfflags ignore glxflags ignore GetVertexAttribIiv(index, pname, params) return void param index UInt32 in value param pname VertexAttribEnum in value param params Int32 out array [1] category VERSION_3_0 version 3.0 dlflags notlistable extension glfflags ignore glxflags ignore GetVertexAttribIuiv(index, pname, params) return void param index UInt32 in value param pname VertexAttribEnum in value param params UInt32 out array [1] category VERSION_3_0 version 3.0 dlflags notlistable extension glfflags ignore glxflags ignore # OpenGL 3.0 (NV_vertex_program4) commands VertexAttribI1i(index, x) return void param index UInt32 in value param x Int32 in value category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside vectorequiv VertexAttribI1iv glxvectorequiv VertexAttribI1iv extension glfflags ignore glxflags ignore VertexAttribI2i(index, x, y) return void param index UInt32 in value param x Int32 in value param y Int32 in value category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside vectorequiv VertexAttribI2iv glxvectorequiv VertexAttribI2iv extension glfflags ignore glxflags ignore VertexAttribI3i(index, x, y, z) return void param index UInt32 in value param x Int32 in value param y Int32 in value param z Int32 in value category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside vectorequiv VertexAttribI3iv glxvectorequiv VertexAttribI3iv extension glfflags ignore glxflags ignore VertexAttribI4i(index, x, y, z, w) return void param index UInt32 in value param x Int32 in value param y Int32 in value param z Int32 in value param w Int32 in value category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside vectorequiv VertexAttribI4iv glxvectorequiv VertexAttribI4iv extension glfflags ignore glxflags ignore VertexAttribI1ui(index, x) return void param index UInt32 in value param x UInt32 in value category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside vectorequiv VertexAttribI1uiv glxvectorequiv VertexAttribI1uiv extension glfflags ignore glxflags ignore VertexAttribI2ui(index, x, y) return void param index UInt32 in value param x UInt32 in value param y UInt32 in value category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside vectorequiv VertexAttribI2uiv glxvectorequiv VertexAttribI2uiv extension glfflags ignore glxflags ignore VertexAttribI3ui(index, x, y, z) return void param index UInt32 in value param x UInt32 in value param y UInt32 in value param z UInt32 in value category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside vectorequiv VertexAttribI3uiv glxvectorequiv VertexAttribI3uiv extension glfflags ignore glxflags ignore VertexAttribI4ui(index, x, y, z, w) return void param index UInt32 in value param x UInt32 in value param y UInt32 in value param z UInt32 in value param w UInt32 in value category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside vectorequiv VertexAttribI4uiv glxvectorequiv VertexAttribI4uiv extension glfflags ignore glxflags ignore VertexAttribI1iv(index, v) return void param index UInt32 in value param v Int32 in array [1] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI2iv(index, v) return void param index UInt32 in value param v Int32 in array [2] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI3iv(index, v) return void param index UInt32 in value param v Int32 in array [3] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI4iv(index, v) return void param index UInt32 in value param v Int32 in array [4] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI1uiv(index, v) return void param index UInt32 in value param v UInt32 in array [1] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI2uiv(index, v) return void param index UInt32 in value param v UInt32 in array [2] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI3uiv(index, v) return void param index UInt32 in value param v UInt32 in array [3] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI4uiv(index, v) return void param index UInt32 in value param v UInt32 in array [4] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI4bv(index, v) return void param index UInt32 in value param v Int8 in array [4] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI4sv(index, v) return void param index UInt32 in value param v Int16 in array [4] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI4ubv(index, v) return void param index UInt32 in value param v UInt8 in array [4] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore VertexAttribI4usv(index, v) return void param index UInt32 in value param v UInt16 in array [4] category VERSION_3_0 version 3.0 deprecated 3.1 beginend allow-inside extension glfflags ignore glxflags ignore # OpenGL 3.0 (EXT_gpu_shader4) commands GetUniformuiv(program, location, params) return void param program UInt32 in value param location Int32 in value param params UInt32 out array [COMPSIZE(program/location)] category VERSION_3_0 dlflags notlistable version 3.0 extension glfflags ignore glxflags ignore BindFragDataLocation(program, color, name) return void param program UInt32 in value param color UInt32 in value param name Char in array [COMPSIZE(name)] category VERSION_3_0 dlflags notlistable version 3.0 extension glfflags ignore glxflags ignore GetFragDataLocation(program, name) return Int32 param program UInt32 in value param name Char in array [COMPSIZE(name)] category VERSION_3_0 dlflags notlistable version 3.0 extension glfflags ignore glxflags ignore Uniform1ui(location, v0) return void param location Int32 in value param v0 UInt32 in value category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore Uniform2ui(location, v0, v1) return void param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore Uniform3ui(location, v0, v1, v2) return void param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value param v2 UInt32 in value category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore Uniform4ui(location, v0, v1, v2, v3) return void param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value param v2 UInt32 in value param v3 UInt32 in value category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore Uniform1uiv(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt32 in array [count] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore Uniform2uiv(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt32 in array [count*2] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore Uniform3uiv(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt32 in array [count*3] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore Uniform4uiv(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt32 in array [count*4] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore # OpenGL 3.0 (EXT_texture_integer) commands TexParameterIiv(target, pname, params) return void param target TextureTarget in value param pname TextureParameterName in value param params Int32 in array [COMPSIZE(pname)] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore TexParameterIuiv(target, pname, params) return void param target TextureTarget in value param pname TextureParameterName in value param params UInt32 in array [COMPSIZE(pname)] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore GetTexParameterIiv(target, pname, params) return void param target TextureTarget in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category VERSION_3_0 dlflags notlistable version 3.0 extension glfflags ignore glxflags ignore GetTexParameterIuiv(target, pname, params) return void param target TextureTarget in value param pname GetTextureParameter in value param params UInt32 out array [COMPSIZE(pname)] category VERSION_3_0 dlflags notlistable version 3.0 extension glfflags ignore glxflags ignore # New commands in OpenGL 3.0 ClearBufferiv(buffer, drawbuffer, value) return void param buffer GLenum in value param drawbuffer DrawBufferName in value param value Int32 in array [COMPSIZE(buffer)] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore ClearBufferuiv(buffer, drawbuffer, value) return void param buffer GLenum in value param drawbuffer DrawBufferName in value param value UInt32 in array [COMPSIZE(buffer)] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore ClearBufferfv(buffer, drawbuffer, value) return void param buffer GLenum in value param drawbuffer DrawBufferName in value param value Float32 in array [COMPSIZE(buffer)] category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore ClearBufferfi(buffer, drawbuffer, depth, stencil) return void param buffer GLenum in value param drawbuffer DrawBufferName in value param depth Float32 in value param stencil Int32 in value category VERSION_3_0 version 3.0 extension glfflags ignore glxflags ignore GetStringi(name, index) return String param name GLenum in value param index UInt32 in value category VERSION_3_0 version 3.0 extension dlflags notlistable glxflags client-handcode server-handcode glfflags ignore glxsingle ? passthru: /* OpenGL 3.0 also reuses entry points from these extensions: */ passthru: /* ARB_framebuffer_object */ passthru: /* ARB_map_buffer_range */ passthru: /* ARB_vertex_array_object */ ############################################################################### ############################################################################### # # OpenGL 3.0 deprecated commands # ############################################################################### ############################################################################### # (none - VertexAttribI* were moved back into non-deprecated) ############################################################################### ############################################################################### # # OpenGL 3.1 commands # ############################################################################### ############################################################################### # New commands in OpenGL 3.1 - none # OpenGL 3.1 (ARB_draw_instanced) commands DrawArraysInstanced(mode, first, count, primcount) return void param mode BeginMode in value param first Int32 in value param count SizeI in value param primcount SizeI in value category VERSION_3_1 version 3.1 extension dlflags notlistable vectorequiv ArrayElement glfflags ignore glxflags ignore DrawElementsInstanced(mode, count, type, indices, primcount) return void param mode BeginMode in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] param primcount SizeI in value category VERSION_3_1 version 3.1 extension dlflags notlistable vectorequiv ArrayElement glfflags ignore glxflags ignore # OpenGL 3.1 (ARB_texture_buffer_object) commands TexBuffer(target, internalformat, buffer) return void param target TextureTarget in value param internalformat GLenum in value param buffer UInt32 in value category VERSION_3_1 version 3.1 extension glfflags ignore glxflags ignore # OpenGL 3.1 (ARB_texture_rectangle) commands - none # OpenGL 3.1 (SNORM texture) commands - none # OpenGL 3.1 (NV_primitive_restart) commands # This is *not* an alias of PrimitiveRestartIndexNV, since it sets # server instead of client state. PrimitiveRestartIndex(index) return void param index UInt32 in value category VERSION_3_1 version 3.1 extension glxropcode ? glxflags ignore offset ? passthru: /* OpenGL 3.1 also reuses entry points from these extensions: */ passthru: /* ARB_copy_buffer */ passthru: /* ARB_uniform_buffer_object */ ############################################################################### ############################################################################### # # OpenGL 3.2 commands # ############################################################################### ############################################################################### # New commands in OpenGL 3.2 GetInteger64i_v(target, index, data) return void param target GLenum in value param index UInt32 in value param data Int64 out array [COMPSIZE(target)] category VERSION_3_2 version 3.2 extension dlflags notlistable glxflags ignore glfflags ignore GetBufferParameteri64v(target, pname, params) return void param target BufferTargetARB in value param pname BufferPNameARB in value param params Int64 out array [COMPSIZE(pname)] category VERSION_3_2 dlflags notlistable version 3.2 extension glxsingle ? glxflags ignore # OpenGL 3.2 (ARB_depth_clamp) commands - none # OpenGL 3.2 (ARB_fragment_coord_conventions) commands - none # OpenGL 3.2 (ARB_geometry_shader4) commands ProgramParameteri(program, pname, value) return void param program UInt32 in value param pname GLenum in value param value Int32 in value category VERSION_3_2 version 1.2 extension glxropcode ? glxflags ignore offset ? FramebufferTexture(target, attachment, texture, level) return void param target GLenum in value param attachment GLenum in value param texture UInt32 in value param level Int32 in value category VERSION_3_2 version 1.2 extension glxropcode ? glxflags ignore offset ? # FramebufferTextureLayer already declared in ARB_framebuffer_object # FramebufferTextureLayer(target, attachment, texture, level, layer) # Not promoted to the core along with the rest # FramebufferTextureFace(target, attachment, texture, level, face) # OpenGL 3.2 (ARB_seamless_cube_map) commands - none # OpenGL 3.2 (ARB_vertex_array_bgra) commands - none passthru: /* OpenGL 3.2 also reuses entry points from these extensions: */ passthru: /* ARB_draw_elements_base_vertex */ passthru: /* ARB_provoking_vertex */ passthru: /* ARB_sync */ passthru: /* ARB_texture_multisample */ ############################################################################### ############################################################################### # # OpenGL 3.3 commands # ############################################################################### ############################################################################### # New commands in OpenGL 3.3 - none newcategory: VERSION_3_3 passthru: /* OpenGL 3.3 also reuses entry points from these extensions: */ passthru: /* ARB_blend_func_extended */ passthru: /* ARB_sampler_objects */ passthru: /* ARB_explicit_attrib_location, but it has none */ passthru: /* ARB_occlusion_query2 (no entry points) */ passthru: /* ARB_shader_bit_encoding (no entry points) */ passthru: /* ARB_texture_rgb10_a2ui (no entry points) */ passthru: /* ARB_texture_swizzle (no entry points) */ passthru: /* ARB_timer_query */ passthru: /* ARB_vertex_type_2_10_10_10_rev */ ############################################################################### ############################################################################### # # OpenGL 4.0 commands # ############################################################################### ############################################################################### # New commands in OpenGL 4.0 - none newcategory: VERSION_4_0 passthru: /* OpenGL 4.0 also reuses entry points from these extensions: */ passthru: /* ARB_gpu_shader5 (no entry points) */ passthru: /* ARB_gpu_shader_fp64 */ passthru: /* ARB_shader_subroutine */ passthru: /* ARB_tessellation_shader */ passthru: /* ARB_texture_buffer_object_rgb32 (no entry points) */ passthru: /* ARB_transform_feedback2 */ passthru: /* ARB_transform_feedback3 */ ############################################################################### ############################################################################### # # ARB extensions, in order by ARB extension number # ############################################################################### ############################################################################### ############################################################################### # # ARB Extension #1 # ARB_multitexture commands # ############################################################################### ActiveTextureARB(texture) return void param texture TextureUnit in value category ARB_multitexture glxflags ARB version 1.2 glxropcode 197 alias ActiveTexture ClientActiveTextureARB(texture) return void param texture TextureUnit in value category ARB_multitexture dlflags notlistable glxflags ARB client-handcode client-intercept server-handcode version 1.2 alias ClientActiveTexture MultiTexCoord1dARB(target, s) return void param target TextureUnit in value param s CoordD in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord1dv MultiTexCoord1dvARB(target, v) return void param target TextureUnit in value param v CoordD in array [1] category ARB_multitexture glxflags ARB version 1.2 glxropcode 198 alias MultiTexCoord1dv MultiTexCoord1fARB(target, s) return void param target TextureUnit in value param s CoordF in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord1fv MultiTexCoord1fvARB(target, v) return void param target TextureUnit in value param v CoordF in array [1] category ARB_multitexture glxflags ARB version 1.2 glxropcode 199 alias MultiTexCoord1fv MultiTexCoord1iARB(target, s) return void param target TextureUnit in value param s CoordI in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord1iv MultiTexCoord1ivARB(target, v) return void param target TextureUnit in value param v CoordI in array [1] category ARB_multitexture glxflags ARB version 1.2 glxropcode 200 alias MultiTexCoord1iv MultiTexCoord1sARB(target, s) return void param target TextureUnit in value param s CoordS in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord1sv MultiTexCoord1svARB(target, v) return void param target TextureUnit in value param v CoordS in array [1] category ARB_multitexture glxflags ARB version 1.2 glxropcode 201 alias MultiTexCoord1sv MultiTexCoord2dARB(target, s, t) return void param target TextureUnit in value param s CoordD in value param t CoordD in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord2dv MultiTexCoord2dvARB(target, v) return void param target TextureUnit in value param v CoordD in array [2] category ARB_multitexture glxflags ARB version 1.2 glxropcode 202 alias MultiTexCoord2dv MultiTexCoord2fARB(target, s, t) return void param target TextureUnit in value param s CoordF in value param t CoordF in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord2fv MultiTexCoord2fvARB(target, v) return void param target TextureUnit in value param v CoordF in array [2] category ARB_multitexture glxflags ARB version 1.2 glxropcode 203 alias MultiTexCoord2fv MultiTexCoord2iARB(target, s, t) return void param target TextureUnit in value param s CoordI in value param t CoordI in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord2iv MultiTexCoord2ivARB(target, v) return void param target TextureUnit in value param v CoordI in array [2] category ARB_multitexture glxflags ARB version 1.2 glxropcode 204 alias MultiTexCoord2iv MultiTexCoord2sARB(target, s, t) return void param target TextureUnit in value param s CoordS in value param t CoordS in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord2sv MultiTexCoord2svARB(target, v) return void param target TextureUnit in value param v CoordS in array [2] category ARB_multitexture glxflags ARB version 1.2 glxropcode 205 alias MultiTexCoord2sv MultiTexCoord3dARB(target, s, t, r) return void param target TextureUnit in value param s CoordD in value param t CoordD in value param r CoordD in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord3dv MultiTexCoord3dvARB(target, v) return void param target TextureUnit in value param v CoordD in array [3] category ARB_multitexture glxflags ARB version 1.2 glxropcode 206 alias MultiTexCoord3dv MultiTexCoord3fARB(target, s, t, r) return void param target TextureUnit in value param s CoordF in value param t CoordF in value param r CoordF in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord3fv MultiTexCoord3fvARB(target, v) return void param target TextureUnit in value param v CoordF in array [3] category ARB_multitexture glxflags ARB version 1.2 glxropcode 207 alias MultiTexCoord3fv MultiTexCoord3iARB(target, s, t, r) return void param target TextureUnit in value param s CoordI in value param t CoordI in value param r CoordI in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord3iv MultiTexCoord3ivARB(target, v) return void param target TextureUnit in value param v CoordI in array [3] category ARB_multitexture glxflags ARB version 1.2 glxropcode 208 alias MultiTexCoord3iv MultiTexCoord3sARB(target, s, t, r) return void param target TextureUnit in value param s CoordS in value param t CoordS in value param r CoordS in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord3sv MultiTexCoord3svARB(target, v) return void param target TextureUnit in value param v CoordS in array [3] category ARB_multitexture version 1.2 glxflags ARB glxropcode 209 alias MultiTexCoord3sv MultiTexCoord4dARB(target, s, t, r, q) return void param target TextureUnit in value param s CoordD in value param t CoordD in value param r CoordD in value param q CoordD in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord4dv MultiTexCoord4dvARB(target, v) return void param target TextureUnit in value param v CoordD in array [4] category ARB_multitexture glxflags ARB version 1.2 glxropcode 210 alias MultiTexCoord4dv MultiTexCoord4fARB(target, s, t, r, q) return void param target TextureUnit in value param s CoordF in value param t CoordF in value param r CoordF in value param q CoordF in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord4fv MultiTexCoord4fvARB(target, v) return void param target TextureUnit in value param v CoordF in array [4] category ARB_multitexture glxflags ARB version 1.2 glxropcode 211 alias MultiTexCoord4fv MultiTexCoord4iARB(target, s, t, r, q) return void param target TextureUnit in value param s CoordI in value param t CoordI in value param r CoordI in value param q CoordI in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord4iv MultiTexCoord4ivARB(target, v) return void param target TextureUnit in value param v CoordI in array [4] category ARB_multitexture glxflags ARB version 1.2 glxropcode 212 alias MultiTexCoord4iv MultiTexCoord4sARB(target, s, t, r, q) return void param target TextureUnit in value param s CoordS in value param t CoordS in value param r CoordS in value param q CoordS in value category ARB_multitexture glxflags ARB version 1.2 vectorequiv MultiTexCoord4sv MultiTexCoord4svARB(target, v) return void param target TextureUnit in value param v CoordS in array [4] category ARB_multitexture glxflags ARB version 1.2 glxropcode 213 alias MultiTexCoord4sv ################################################################################ # # ARB Extension #2 - GLX_ARB_get_proc_address # ############################################################################### ################################################################################ # # ARB Extension #3 # ARB_transpose_matrix commands # ############################################################################### LoadTransposeMatrixfARB(m) return void param m Float32 in array [16] category ARB_transpose_matrix glxflags ARB client-handcode client-intercept server-handcode version 1.2 alias LoadTransposeMatrixf LoadTransposeMatrixdARB(m) return void param m Float64 in array [16] category ARB_transpose_matrix glxflags ARB client-handcode client-intercept server-handcode version 1.2 alias LoadTransposeMatrixd MultTransposeMatrixfARB(m) return void param m Float32 in array [16] category ARB_transpose_matrix glxflags ARB client-handcode client-intercept server-handcode version 1.2 alias MultTransposeMatrixf MultTransposeMatrixdARB(m) return void param m Float64 in array [16] category ARB_transpose_matrix glxflags ARB client-handcode client-intercept server-handcode version 1.2 alias MultTransposeMatrixd ################################################################################ # # ARB Extension #4 - WGL_ARB_buffer_region # ############################################################################### ################################################################################ # # ARB Extension #5 # ARB_multisample commands # ############################################################################### SampleCoverageARB(value, invert) return void param value ClampedFloat32 in value param invert Boolean in value category ARB_multisample glxflags ARB version 1.2 alias SampleCoverage ################################################################################ # # ARB Extension #6 # ARB_texture_env_add commands # ############################################################################### # (none) newcategory: ARB_texture_env_add ################################################################################ # # ARB Extension #7 # ARB_texture_cube_map commands # ############################################################################### # (none) newcategory: ARB_texture_cube_map ################################################################################ # # ARB Extension #8 - WGL_ARB_extensions_string # ARB Extension #9 - WGL_ARB_pixel_format commands # ARB Extension #10 - WGL_ARB_make_current_read commands # ARB Extension #11 - WGL_ARB_pbuffer # ############################################################################### ################################################################################ # # ARB Extension #12 # ARB_texture_compression commands # ############################################################################### # Arguably TexelInternalFormat, not PixelInternalFormat CompressedTexImage3DARB(target, level, internalformat, width, height, depth, border, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param depth SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category ARB_texture_compression dlflags handcode glxflags ARB client-handcode server-handcode version 1.2 glxropcode 216 alias CompressedTexImage3D wglflags client-handcode server-handcode # Arguably TexelInternalFormat, not PixelInternalFormat CompressedTexImage2DARB(target, level, internalformat, width, height, border, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category ARB_texture_compression dlflags handcode glxflags ARB client-handcode server-handcode version 1.2 glxropcode 215 alias CompressedTexImage2D wglflags client-handcode server-handcode # Arguably TexelInternalFormat, not PixelInternalFormat CompressedTexImage1DARB(target, level, internalformat, width, border, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param width SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category ARB_texture_compression dlflags handcode glxflags ARB client-handcode server-handcode version 1.2 glxropcode 214 alias CompressedTexImage1D wglflags client-handcode server-handcode CompressedTexSubImage3DARB(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param format PixelFormat in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category ARB_texture_compression dlflags handcode glxflags ARB client-handcode server-handcode version 1.2 glxropcode 219 alias CompressedTexSubImage3D wglflags client-handcode server-handcode CompressedTexSubImage2DARB(target, level, xoffset, yoffset, width, height, format, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param format PixelFormat in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category ARB_texture_compression dlflags handcode glxflags ARB client-handcode server-handcode version 1.2 glxropcode 218 alias CompressedTexSubImage2D wglflags client-handcode server-handcode CompressedTexSubImage1DARB(target, level, xoffset, width, format, imageSize, data) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param width SizeI in value param format PixelFormat in value param imageSize SizeI in value param data CompressedTextureARB in array [imageSize] category ARB_texture_compression dlflags handcode glxflags ARB client-handcode server-handcode version 1.2 glxropcode 217 alias CompressedTexSubImage1D wglflags client-handcode server-handcode GetCompressedTexImageARB(target, level, img) return void param target TextureTarget in value param level CheckedInt32 in value param img CompressedTextureARB out array [COMPSIZE(target/level)] category ARB_texture_compression dlflags notlistable glxflags ARB client-handcode server-handcode version 1.2 glxsingle 160 alias GetCompressedTexImage wglflags client-handcode server-handcode ################################################################################ # # ARB Extension #13 # ARB_texture_border_clamp commands # ############################################################################### # (none) newcategory: ARB_texture_border_clamp ############################################################################### # # ARB Extension #14 # ARB_point_parameters commands # ############################################################################### PointParameterfARB(pname, param) return void param pname PointParameterNameARB in value param param CheckedFloat32 in value category ARB_point_parameters version 1.0 glxflags ARB glxropcode 2065 extension alias PointParameterf PointParameterfvARB(pname, params) return void param pname PointParameterNameARB in value param params CheckedFloat32 in array [COMPSIZE(pname)] category ARB_point_parameters version 1.0 glxflags ARB glxropcode 2066 extension alias PointParameterfv ################################################################################ # # ARB Extension #15 # ARB_vertex_blend commands # ############################################################################### WeightbvARB(size, weights) return void param size Int32 in value param weights Int8 in array [size] category ARB_vertex_blend version 1.1 extension glxropcode 220 glxflags ignore offset ? WeightsvARB(size, weights) return void param size Int32 in value param weights Int16 in array [size] category ARB_vertex_blend version 1.1 extension glxropcode 222 glxflags ignore offset ? WeightivARB(size, weights) return void param size Int32 in value param weights Int32 in array [size] category ARB_vertex_blend version 1.1 extension glxropcode 224 glxflags ignore offset ? WeightfvARB(size, weights) return void param size Int32 in value param weights Float32 in array [size] category ARB_vertex_blend version 1.1 extension glxropcode 227 glxflags ignore offset ? WeightdvARB(size, weights) return void param size Int32 in value param weights Float64 in array [size] category ARB_vertex_blend version 1.1 extension glxropcode 228 glxflags ignore offset ? WeightubvARB(size, weights) return void param size Int32 in value param weights UInt8 in array [size] category ARB_vertex_blend version 1.1 extension glxropcode 221 glxflags ignore offset ? WeightusvARB(size, weights) return void param size Int32 in value param weights UInt16 in array [size] category ARB_vertex_blend version 1.1 extension glxropcode 223 glxflags ignore offset ? WeightuivARB(size, weights) return void param size Int32 in value param weights UInt32 in array [size] category ARB_vertex_blend version 1.1 extension glxropcode 225 glxflags ignore offset ? WeightPointerARB(size, type, stride, pointer) return void param size Int32 in value param type WeightPointerTypeARB in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category ARB_vertex_blend version 1.1 extension dlflags notlistable glxflags ignore offset ? VertexBlendARB(count) return void param count Int32 in value category ARB_vertex_blend version 1.1 extension glxropcode 226 glxflags ignore offset ? ################################################################################ # # ARB Extension #16 # ARB_matrix_palette commands # ############################################################################### CurrentPaletteMatrixARB(index) return void param index Int32 in value category ARB_matrix_palette version 1.1 extension glxropcode 4329 glxflags ignore offset ? MatrixIndexubvARB(size, indices) return void param size Int32 in value param indices UInt8 in array [size] category ARB_matrix_palette version 1.1 extension glxropcode 4326 glxflags ignore offset ? MatrixIndexusvARB(size, indices) return void param size Int32 in value param indices UInt16 in array [size] category ARB_matrix_palette version 1.1 extension glxropcode 4327 glxflags ignore offset ? MatrixIndexuivARB(size, indices) return void param size Int32 in value param indices UInt32 in array [size] category ARB_matrix_palette version 1.1 extension glxropcode 4328 glxflags ignore offset ? MatrixIndexPointerARB(size, type, stride, pointer) return void param size Int32 in value param type MatrixIndexPointerTypeARB in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category ARB_matrix_palette version 1.1 extension dlflags notlistable glxflags ignore offset ? ################################################################################ # # ARB Extension #17 # ARB_texture_env_combine commands # ############################################################################### # (none) newcategory: ARB_texture_env_combine ################################################################################ # # ARB Extension #18 # ARB_texture_env_crossbar commands # ############################################################################### # (none) newcategory: ARB_texture_env_crossbar ################################################################################ # # ARB Extension #19 # ARB_texture_env_dot3 commands # ############################################################################### # (none) newcategory: ARB_texture_env_dot3 ############################################################################### # # ARB Extension #20 - WGL_ARB_render_texture # ############################################################################### ############################################################################### # # ARB Extension #21 # ARB_texture_mirrored_repeat commands # ############################################################################### # (none) newcategory: ARB_texture_mirrored_repeat ############################################################################### # # ARB Extension #22 # ARB_depth_texture commands # ############################################################################### # (none) newcategory: ARB_depth_texture ############################################################################### # # ARB Extension #23 # ARB_shadow commands # ############################################################################### # (none) newcategory: ARB_shadow ############################################################################### # # ARB Extension #24 # ARB_shadow_ambient commands # ############################################################################### # (none) newcategory: ARB_shadow_ambient ############################################################################### # # ARB Extension #25 # ARB_window_pos commands # Note: all entry points use glxropcode ropcode 230, with 3 float parameters # ############################################################################### WindowPos2dARB(x, y) return void param x CoordD in value param y CoordD in value category ARB_window_pos vectorequiv WindowPos2dvARB version 1.0 alias WindowPos2d WindowPos2dvARB(v) return void param v CoordD in array [2] category ARB_window_pos version 1.0 glxropcode 230 glxflags client-handcode server-handcode alias WindowPos2dv WindowPos2fARB(x, y) return void param x CoordF in value param y CoordF in value category ARB_window_pos vectorequiv WindowPos2fvARB version 1.0 alias WindowPos2f WindowPos2fvARB(v) return void param v CoordF in array [2] category ARB_window_pos version 1.0 glxropcode 230 glxflags client-handcode server-handcode alias WindowPos2fv WindowPos2iARB(x, y) return void param x CoordI in value param y CoordI in value category ARB_window_pos vectorequiv WindowPos2ivARB version 1.0 alias WindowPos2i WindowPos2ivARB(v) return void param v CoordI in array [2] category ARB_window_pos version 1.0 glxropcode 230 glxflags client-handcode server-handcode alias WindowPos2iv WindowPos2sARB(x, y) return void param x CoordS in value param y CoordS in value category ARB_window_pos vectorequiv WindowPos2svARB version 1.0 alias WindowPos2s WindowPos2svARB(v) return void param v CoordS in array [2] category ARB_window_pos version 1.0 glxropcode 230 glxflags client-handcode server-handcode alias WindowPos2sv WindowPos3dARB(x, y, z) return void param x CoordD in value param y CoordD in value param z CoordD in value vectorequiv WindowPos3dvARB category ARB_window_pos version 1.0 alias WindowPos3d WindowPos3dvARB(v) return void param v CoordD in array [3] category ARB_window_pos version 1.0 glxropcode 230 glxflags client-handcode server-handcode alias WindowPos3dv WindowPos3fARB(x, y, z) return void param x CoordF in value param y CoordF in value param z CoordF in value category ARB_window_pos vectorequiv WindowPos3fvARB version 1.0 alias WindowPos3f WindowPos3fvARB(v) return void param v CoordF in array [3] category ARB_window_pos version 1.0 glxropcode 230 glxflags client-handcode server-handcode alias WindowPos3fv WindowPos3iARB(x, y, z) return void param x CoordI in value param y CoordI in value param z CoordI in value category ARB_window_pos vectorequiv WindowPos3ivARB version 1.0 alias WindowPos3i WindowPos3ivARB(v) return void param v CoordI in array [3] category ARB_window_pos version 1.0 glxropcode 230 glxflags client-handcode server-handcode alias WindowPos3iv WindowPos3sARB(x, y, z) return void param x CoordS in value param y CoordS in value param z CoordS in value category ARB_window_pos vectorequiv WindowPos3svARB version 1.0 alias WindowPos3s WindowPos3svARB(v) return void param v CoordS in array [3] category ARB_window_pos version 1.0 glxropcode 230 glxflags client-handcode server-handcode alias WindowPos3sv ############################################################################### # # ARB Extension #26 # ARB_vertex_program commands # ############################################################################### VertexAttrib1dARB(index, x) return void param index UInt32 in value param x Float64 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib1dvARB extension soft WINSOFT NV10 alias VertexAttrib1d VertexAttrib1dvARB(index, v) return void param index UInt32 in value param v Float64 in array [1] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4197 alias VertexAttrib1dv VertexAttrib1fARB(index, x) return void param index UInt32 in value param x Float32 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib1fvARB extension soft WINSOFT NV10 alias VertexAttrib1f VertexAttrib1fvARB(index, v) return void param index UInt32 in value param v Float32 in array [1] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4193 alias VertexAttrib1fv VertexAttrib1sARB(index, x) return void param index UInt32 in value param x Int16 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib1svARB extension soft WINSOFT NV10 alias VertexAttrib1s VertexAttrib1svARB(index, v) return void param index UInt32 in value param v Int16 in array [1] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4189 alias VertexAttrib1sv VertexAttrib2dARB(index, x, y) return void param index UInt32 in value param x Float64 in value param y Float64 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib2dvARB extension soft WINSOFT NV10 alias VertexAttrib2d VertexAttrib2dvARB(index, v) return void param index UInt32 in value param v Float64 in array [2] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4198 alias VertexAttrib2dv VertexAttrib2fARB(index, x, y) return void param index UInt32 in value param x Float32 in value param y Float32 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib2fvARB extension soft WINSOFT NV10 alias VertexAttrib2f VertexAttrib2fvARB(index, v) return void param index UInt32 in value param v Float32 in array [2] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4194 alias VertexAttrib2fv VertexAttrib2sARB(index, x, y) return void param index UInt32 in value param x Int16 in value param y Int16 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib2svARB extension soft WINSOFT NV10 alias VertexAttrib2s VertexAttrib2svARB(index, v) return void param index UInt32 in value param v Int16 in array [2] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4190 alias VertexAttrib2sv VertexAttrib3dARB(index, x, y, z) return void param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib3dvARB extension soft WINSOFT NV10 alias VertexAttrib3d VertexAttrib3dvARB(index, v) return void param index UInt32 in value param v Float64 in array [3] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4199 alias VertexAttrib3dv VertexAttrib3fARB(index, x, y, z) return void param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib3fvARB extension soft WINSOFT NV10 alias VertexAttrib3f VertexAttrib3fvARB(index, v) return void param index UInt32 in value param v Float32 in array [3] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4195 alias VertexAttrib3fv VertexAttrib3sARB(index, x, y, z) return void param index UInt32 in value param x Int16 in value param y Int16 in value param z Int16 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib3svARB extension soft WINSOFT NV10 alias VertexAttrib3s VertexAttrib3svARB(index, v) return void param index UInt32 in value param v Int16 in array [3] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4191 alias VertexAttrib3sv VertexAttrib4NbvARB(index, v) return void param index UInt32 in value param v Int8 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4Nbv VertexAttrib4NivARB(index, v) return void param index UInt32 in value param v Int32 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4Niv VertexAttrib4NsvARB(index, v) return void param index UInt32 in value param v Int16 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4Nsv VertexAttrib4NubARB(index, x, y, z, w) return void param index UInt32 in value param x UInt8 in value param y UInt8 in value param z UInt8 in value param w UInt8 in value category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4Nub VertexAttrib4NubvARB(index, v) return void param index UInt32 in value param v UInt8 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4201 alias VertexAttrib4Nubv VertexAttrib4NuivARB(index, v) return void param index UInt32 in value param v UInt32 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4Nuiv VertexAttrib4NusvARB(index, v) return void param index UInt32 in value param v UInt16 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4Nusv VertexAttrib4bvARB(index, v) return void param index UInt32 in value param v Int8 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4bv VertexAttrib4dARB(index, x, y, z, w) return void param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib4dvARB extension soft WINSOFT NV10 alias VertexAttrib4d VertexAttrib4dvARB(index, v) return void param index UInt32 in value param v Float64 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4200 alias VertexAttrib4dv VertexAttrib4fARB(index, x, y, z, w) return void param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib4fvARB extension soft WINSOFT NV10 alias VertexAttrib4f VertexAttrib4fvARB(index, v) return void param index UInt32 in value param v Float32 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4196 alias VertexAttrib4fv VertexAttrib4ivARB(index, v) return void param index UInt32 in value param v Int32 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4iv VertexAttrib4sARB(index, x, y, z, w) return void param index UInt32 in value param x Int16 in value param y Int16 in value param z Int16 in value param w Int16 in value category ARB_vertex_program version 1.3 vectorequiv VertexAttrib4svARB extension soft WINSOFT NV10 alias VertexAttrib4s VertexAttrib4svARB(index, v) return void param index UInt32 in value param v Int16 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4192 alias VertexAttrib4sv VertexAttrib4ubvARB(index, v) return void param index UInt32 in value param v UInt8 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4ubv VertexAttrib4uivARB(index, v) return void param index UInt32 in value param v UInt32 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4uiv VertexAttrib4usvARB(index, v) return void param index UInt32 in value param v UInt16 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttrib4usv VertexAttribPointerARB(index, size, type, normalized, stride, pointer) return void param index UInt32 in value param size Int32 in value param type VertexAttribPointerTypeARB in value param normalized Boolean in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias VertexAttribPointer EnableVertexAttribArrayARB(index) return void param index UInt32 in value dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias EnableVertexAttribArray DisableVertexAttribArrayARB(index) return void param index UInt32 in value dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 alias DisableVertexAttribArray ProgramStringARB(target, format, len, string) return void param target ProgramTargetARB in value param format ProgramFormatARB in value param len SizeI in value param string Void in array [len] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 667 BindProgramARB(target, program) return void param target ProgramTargetARB in value param program UInt32 in value category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxropcode 4180 offset 579 DeleteProgramsARB(n, programs) return void param n SizeI in value param programs UInt32 in array [n] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxvendorpriv 1294 offset 580 GenProgramsARB(n, programs) return void param n SizeI in value param programs UInt32 out array [n] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxvendorpriv 1295 offset 582 ProgramEnvParameter4dARB(target, index, x, y, z, w) return void param target ProgramTargetARB in value param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category ARB_vertex_program version 1.3 vectorequiv ProgramEnvParameter4dvARB extension soft WINSOFT NV10 glxflags ignore offset 668 ProgramEnvParameter4dvARB(target, index, params) return void param target ProgramTargetARB in value param index UInt32 in value param params Float64 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 669 ProgramEnvParameter4fARB(target, index, x, y, z, w) return void param target ProgramTargetARB in value param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category ARB_vertex_program version 1.3 vectorequiv ProgramEnvParameter4fvARB extension soft WINSOFT NV10 glxflags ignore offset 670 ProgramEnvParameter4fvARB(target, index, params) return void param target ProgramTargetARB in value param index UInt32 in value param params Float32 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 671 ProgramLocalParameter4dARB(target, index, x, y, z, w) return void param target ProgramTargetARB in value param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category ARB_vertex_program version 1.3 vectorequiv ProgramLocalParameter4dvARB extension soft WINSOFT NV10 glxflags ignore offset 672 ProgramLocalParameter4dvARB(target, index, params) return void param target ProgramTargetARB in value param index UInt32 in value param params Float64 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 673 ProgramLocalParameter4fARB(target, index, x, y, z, w) return void param target ProgramTargetARB in value param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category ARB_vertex_program version 1.3 vectorequiv ProgramLocalParameter4fvARB extension soft WINSOFT NV10 glxflags ignore offset 674 ProgramLocalParameter4fvARB(target, index, params) return void param target ProgramTargetARB in value param index UInt32 in value param params Float32 in array [4] category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 675 GetProgramEnvParameterdvARB(target, index, params) return void param target ProgramTargetARB in value param index UInt32 in value param params Float64 out array [4] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 676 GetProgramEnvParameterfvARB(target, index, params) return void param target ProgramTargetARB in value param index UInt32 in value param params Float32 out array [4] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 677 GetProgramLocalParameterdvARB(target, index, params) return void param target ProgramTargetARB in value param index UInt32 in value param params Float64 out array [4] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 678 GetProgramLocalParameterfvARB(target, index, params) return void param target ProgramTargetARB in value param index UInt32 in value param params Float32 out array [4] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 679 GetProgramivARB(target, pname, params) return void param target ProgramTargetARB in value param pname ProgramPropertyARB in value param params Int32 out array [1] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 680 GetProgramStringARB(target, pname, string) return void param target ProgramTargetARB in value param pname ProgramStringPropertyARB in value param string Void out array [COMPSIZE(target,pname)] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore offset 681 GetVertexAttribdvARB(index, pname, params) return void param index UInt32 in value param pname VertexAttribPropertyARB in value param params Float64 out array [4] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxvendorpriv 1301 alias GetVertexAttribdv GetVertexAttribfvARB(index, pname, params) return void param index UInt32 in value param pname VertexAttribPropertyARB in value param params Float32 out array [4] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxvendorpriv 1302 alias GetVertexAttribfv GetVertexAttribivARB(index, pname, params) return void param index UInt32 in value param pname VertexAttribPropertyARB in value param params Int32 out array [4] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxvendorpriv 1303 alias GetVertexAttribiv GetVertexAttribPointervARB(index, pname, pointer) return void param index UInt32 in value param pname VertexAttribPointerPropertyARB in value param pointer VoidPointer out array [1] dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxflags ignore alias GetVertexAttribPointerv IsProgramARB(program) return Boolean param program UInt32 in value dlflags notlistable category ARB_vertex_program version 1.3 extension soft WINSOFT NV10 glxvendorpriv 1304 alias IsProgram ############################################################################### # # ARB Extension #27 # ARB_fragment_program commands # ############################################################################### # All ARB_fragment_program entry points are shared with ARB_vertex_program, # and are only included in that #define block, for now. newcategory: ARB_fragment_program passthru: /* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ ############################################################################### # # ARB Extension #28 # ARB_vertex_buffer_object commands # ############################################################################### BindBufferARB(target, buffer) return void param target BufferTargetARB in value param buffer UInt32 in value category ARB_vertex_buffer_object version 1.2 extension alias BindBuffer DeleteBuffersARB(n, buffers) return void param n SizeI in value param buffers ConstUInt32 in array [n] category ARB_vertex_buffer_object version 1.2 extension alias DeleteBuffers GenBuffersARB(n, buffers) return void param n SizeI in value param buffers UInt32 out array [n] category ARB_vertex_buffer_object version 1.2 extension alias GenBuffers IsBufferARB(buffer) return Boolean param buffer UInt32 in value category ARB_vertex_buffer_object version 1.2 extension alias IsBuffer BufferDataARB(target, size, data, usage) return void param target BufferTargetARB in value param size BufferSizeARB in value param data ConstVoid in array [size] param usage BufferUsageARB in value category ARB_vertex_buffer_object version 1.2 extension alias BufferData BufferSubDataARB(target, offset, size, data) return void param target BufferTargetARB in value param offset BufferOffsetARB in value param size BufferSizeARB in value param data ConstVoid in array [size] category ARB_vertex_buffer_object version 1.2 extension alias BufferSubData GetBufferSubDataARB(target, offset, size, data) return void param target BufferTargetARB in value param offset BufferOffsetARB in value param size BufferSizeARB in value param data Void out array [size] category ARB_vertex_buffer_object dlflags notlistable version 1.2 extension alias GetBufferSubData MapBufferARB(target, access) return VoidPointer param target BufferTargetARB in value param access BufferAccessARB in value category ARB_vertex_buffer_object version 1.2 extension alias MapBuffer UnmapBufferARB(target) return Boolean param target BufferTargetARB in value category ARB_vertex_buffer_object version 1.2 extension alias UnmapBuffer GetBufferParameterivARB(target, pname, params) return void param target BufferTargetARB in value param pname BufferPNameARB in value param params Int32 out array [COMPSIZE(pname)] category ARB_vertex_buffer_object dlflags notlistable version 1.2 extension alias GetBufferParameteriv GetBufferPointervARB(target, pname, params) return void param target BufferTargetARB in value param pname BufferPointerNameARB in value param params VoidPointer out array [1] category ARB_vertex_buffer_object dlflags notlistable version 1.2 extension alias GetBufferPointerv ############################################################################### # # ARB Extension #29 # ARB_occlusion_query commands # ############################################################################### GenQueriesARB(n, ids) return void param n SizeI in value param ids UInt32 out array [n] category ARB_occlusion_query version 1.5 extension alias GenQueries DeleteQueriesARB(n, ids) return void param n SizeI in value param ids UInt32 in array [n] category ARB_occlusion_query version 1.5 extension alias DeleteQueries IsQueryARB(id) return Boolean param id UInt32 in value category ARB_occlusion_query version 1.5 extension alias IsQuery BeginQueryARB(target, id) return void param target GLenum in value param id UInt32 in value category ARB_occlusion_query version 1.5 extension alias BeginQuery EndQueryARB(target) return void param target GLenum in value category ARB_occlusion_query version 1.5 extension alias EndQuery GetQueryivARB(target, pname, params) return void param target GLenum in value param pname GLenum in value param params Int32 out array [pname] category ARB_occlusion_query dlflags notlistable version 1.5 extension alias GetQueryiv GetQueryObjectivARB(id, pname, params) return void param id UInt32 in value param pname GLenum in value param params Int32 out array [pname] category ARB_occlusion_query dlflags notlistable version 1.5 extension alias GetQueryObjectiv GetQueryObjectuivARB(id, pname, params) return void param id UInt32 in value param pname GLenum in value param params UInt32 out array [pname] category ARB_occlusion_query dlflags notlistable version 1.5 extension alias GetQueryObjectuiv ############################################################################### # # ARB Extension #30 # ARB_shader_objects commands # ############################################################################### DeleteObjectARB(obj) return void param obj handleARB in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore offset ? GetHandleARB(pname) return handleARB param pname GLenum in value category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? DetachObjectARB(containerObj, attachedObj) return void param containerObj handleARB in value param attachedObj handleARB in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias DetachShader CreateShaderObjectARB(shaderType) return handleARB param shaderType GLenum in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias CreateShader ShaderSourceARB(shaderObj, count, string, length) return void param shaderObj handleARB in value param count SizeI in value param string charPointerARB in array [count] param length Int32 in array [1] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias ShaderSource CompileShaderARB(shaderObj) return void param shaderObj handleARB in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias CompileShader CreateProgramObjectARB() return handleARB category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias CreateProgram AttachObjectARB(containerObj, obj) return void param containerObj handleARB in value param obj handleARB in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias AttachShader LinkProgramARB(programObj) return void param programObj handleARB in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias LinkProgram UseProgramObjectARB(programObj) return void param programObj handleARB in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias UseProgram ValidateProgramARB(programObj) return void param programObj handleARB in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias ValidateProgram Uniform1fARB(location, v0) return void param location Int32 in value param v0 Float32 in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform1f Uniform2fARB(location, v0, v1) return void param location Int32 in value param v0 Float32 in value param v1 Float32 in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform2f Uniform3fARB(location, v0, v1, v2) return void param location Int32 in value param v0 Float32 in value param v1 Float32 in value param v2 Float32 in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform3f Uniform4fARB(location, v0, v1, v2, v3) return void param location Int32 in value param v0 Float32 in value param v1 Float32 in value param v2 Float32 in value param v3 Float32 in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform4f Uniform1iARB(location, v0) return void param location Int32 in value param v0 Int32 in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform1i Uniform2iARB(location, v0, v1) return void param location Int32 in value param v0 Int32 in value param v1 Int32 in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform2i Uniform3iARB(location, v0, v1, v2) return void param location Int32 in value param v0 Int32 in value param v1 Int32 in value param v2 Int32 in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform3i Uniform4iARB(location, v0, v1, v2, v3) return void param location Int32 in value param v0 Int32 in value param v1 Int32 in value param v2 Int32 in value param v3 Int32 in value category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform4i Uniform1fvARB(location, count, value) return void param location Int32 in value param count SizeI in value param value Float32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform1fv Uniform2fvARB(location, count, value) return void param location Int32 in value param count SizeI in value param value Float32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform2fv Uniform3fvARB(location, count, value) return void param location Int32 in value param count SizeI in value param value Float32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform3fv Uniform4fvARB(location, count, value) return void param location Int32 in value param count SizeI in value param value Float32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform4fv Uniform1ivARB(location, count, value) return void param location Int32 in value param count SizeI in value param value Int32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform1iv Uniform2ivARB(location, count, value) return void param location Int32 in value param count SizeI in value param value Int32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform2iv Uniform3ivARB(location, count, value) return void param location Int32 in value param count SizeI in value param value Int32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform3iv Uniform4ivARB(location, count, value) return void param location Int32 in value param count SizeI in value param value Int32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias Uniform4iv UniformMatrix2fvARB(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias UniformMatrix2fv UniformMatrix3fvARB(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias UniformMatrix3fv UniformMatrix4fvARB(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count] category ARB_shader_objects version 1.2 extension glxropcode ? glxflags ignore alias UniformMatrix4fv GetObjectParameterfvARB(obj, pname, params) return void param obj handleARB in value param pname GLenum in value param params Float32 out array [pname] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetObjectParameterivARB(obj, pname, params) return void param obj handleARB in value param pname GLenum in value param params Int32 out array [pname] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetInfoLogARB(obj, maxLength, length, infoLog) return void param obj handleARB in value param maxLength SizeI in value param length SizeI out array [1] param infoLog charARB out array [length] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetAttachedObjectsARB(containerObj, maxCount, count, obj) return void param containerObj handleARB in value param maxCount SizeI in value param count SizeI out array [1] param obj handleARB out array [count] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore alias GetAttachedShaders GetUniformLocationARB(programObj, name) return Int32 param programObj handleARB in value param name charARB in array [] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore alias GetUniformLocation GetActiveUniformARB(programObj, index, maxLength, length, size, type, name) return void param programObj handleARB in value param index UInt32 in value param maxLength SizeI in value param length SizeI out array [1] param size Int32 out array [1] param type GLenum out array [1] param name charARB out array [] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore alias GetActiveUniform GetUniformfvARB(programObj, location, params) return void param programObj handleARB in value param location Int32 in value param params Float32 out array [location] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore alias GetUniformfv GetUniformivARB(programObj, location, params) return void param programObj handleARB in value param location Int32 in value param params Int32 out array [location] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore alias GetUniformiv GetShaderSourceARB(obj, maxLength, length, source) return void param obj handleARB in value param maxLength SizeI in value param length SizeI out array [1] param source charARB out array [length] category ARB_shader_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore alias GetShaderSource ############################################################################### # # ARB Extension #31 # ARB_vertex_shader commands # ############################################################################### BindAttribLocationARB(programObj, index, name) return void param programObj handleARB in value param index UInt32 in value param name charARB in array [] category ARB_vertex_shader version 1.2 extension glxropcode ? glxflags ignore alias BindAttribLocation GetActiveAttribARB(programObj, index, maxLength, length, size, type, name) return void param programObj handleARB in value param index UInt32 in value param maxLength SizeI in value param length SizeI out array [1] param size Int32 out array [1] param type GLenum out array [1] param name charARB out array [] category ARB_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore alias GetActiveAttrib GetAttribLocationARB(programObj, name) return Int32 param programObj handleARB in value param name charARB in array [] category ARB_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore alias GetAttribLocation ############################################################################### # # ARB Extension #32 # ARB_fragment_shader commands # ############################################################################### # (none) newcategory: ARB_fragment_shader ############################################################################### # # ARB Extension #33 # ARB_shading_language_100 commands # ############################################################################### # (none) newcategory: ARB_shading_language_100 ############################################################################### # # ARB Extension #34 # ARB_texture_non_power_of_two commands # ############################################################################### # (none) newcategory: ARB_texture_non_power_of_two ############################################################################### # # ARB Extension #35 # ARB_point_sprite commands # ############################################################################### # (none) newcategory: ARB_point_sprite ############################################################################### # # ARB Extension #36 # ARB_fragment_program_shadow commands # ############################################################################### # (none) newcategory: ARB_fragment_program_shadow ############################################################################### # # ARB Extension #37 # ARB_draw_buffers commands # ############################################################################### DrawBuffersARB(n, bufs) return void param n SizeI in value param bufs DrawBufferModeATI in array [n] category ARB_draw_buffers version 1.5 extension alias DrawBuffers ############################################################################### # # ARB Extension #38 # ARB_texture_rectangle commands # ############################################################################### # (none) newcategory: ARB_texture_rectangle ############################################################################### # # ARB Extension #39 # ARB_color_buffer_float commands # ############################################################################### ClampColorARB(target, clamp) return void param target ClampColorTargetARB in value param clamp ClampColorModeARB in value category ARB_color_buffer_float version 1.5 extension glxropcode 234 glxflags ignore alias ClampColor ############################################################################### # # ARB Extension #40 # ARB_half_float_pixel commands # ############################################################################### # (none) newcategory: ARB_half_float_pixel ############################################################################### # # ARB Extension #41 # ARB_texture_float commands # ############################################################################### # (none) newcategory: ARB_texture_float ############################################################################### # # ARB Extension #42 # ARB_pixel_buffer_object commands # ############################################################################### # (none) newcategory: ARB_pixel_buffer_object ############################################################################### # # ARB Extension #43 # ARB_depth_buffer_float commands (also OpenGL 3.0) # ############################################################################### # (none) newcategory: ARB_depth_buffer_float ############################################################################### # # ARB Extension #44 # ARB_draw_instanced commands # ############################################################################### DrawArraysInstancedARB(mode, first, count, primcount) return void param mode BeginMode in value param first Int32 in value param count SizeI in value param primcount SizeI in value category ARB_draw_instanced version 2.0 extension soft WINSOFT dlflags notlistable vectorequiv ArrayElement glfflags ignore glxflags ignore alias DrawArraysInstanced DrawElementsInstancedARB(mode, count, type, indices, primcount) return void param mode BeginMode in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] param primcount SizeI in value category ARB_draw_instanced version 2.0 extension soft WINSOFT dlflags notlistable vectorequiv ArrayElement glfflags ignore glxflags ignore alias DrawElementsInstanced ############################################################################### # # ARB Extension #45 # ARB_framebuffer_object commands (also OpenGL 3.0) # ############################################################################### # Promoted from EXT_framebuffer_object IsRenderbuffer(renderbuffer) return Boolean param renderbuffer UInt32 in value category ARB_framebuffer_object version 3.0 extension glxvendorpriv 1422 glxflags ignore offset ? BindRenderbuffer(target, renderbuffer) return void param target RenderbufferTarget in value param renderbuffer UInt32 in value category ARB_framebuffer_object version 3.0 extension glxropcode 4316 glxflags ignore offset ? DeleteRenderbuffers(n, renderbuffers) return void param n SizeI in value param renderbuffers UInt32 in array [n] category ARB_framebuffer_object version 3.0 extension glxropcode 4317 glxflags ignore offset ? GenRenderbuffers(n, renderbuffers) return void param n SizeI in value param renderbuffers UInt32 out array [n] category ARB_framebuffer_object version 3.0 extension glxvendorpriv 1423 glxflags ignore offset ? RenderbufferStorage(target, internalformat, width, height) return void param target RenderbufferTarget in value param internalformat GLenum in value param width SizeI in value param height SizeI in value category ARB_framebuffer_object version 3.0 extension glxropcode 4318 glxflags ignore offset ? GetRenderbufferParameteriv(target, pname, params) return void param target RenderbufferTarget in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category ARB_framebuffer_object dlflags notlistable version 3.0 extension glxvendorpriv 1424 glxflags ignore offset ? IsFramebuffer(framebuffer) return Boolean param framebuffer UInt32 in value category ARB_framebuffer_object version 3.0 extension glxvendorpriv 1425 glxflags ignore offset ? BindFramebuffer(target, framebuffer) return void param target FramebufferTarget in value param framebuffer UInt32 in value category ARB_framebuffer_object version 3.0 extension glxropcode 4319 glxflags ignore offset ? DeleteFramebuffers(n, framebuffers) return void param n SizeI in value param framebuffers UInt32 in array [n] category ARB_framebuffer_object version 3.0 extension glxropcode 4320 glxflags ignore offset ? GenFramebuffers(n, framebuffers) return void param n SizeI in value param framebuffers UInt32 out array [n] category ARB_framebuffer_object version 3.0 extension glxvendorpriv 1426 glxflags ignore offset ? CheckFramebufferStatus(target) return GLenum param target FramebufferTarget in value category ARB_framebuffer_object version 3.0 extension glxvendorpriv 1427 glxflags ignore offset ? FramebufferTexture1D(target, attachment, textarget, texture, level) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param textarget GLenum in value param texture UInt32 in value param level Int32 in value category ARB_framebuffer_object version 3.0 extension glxropcode 4321 glxflags ignore offset ? FramebufferTexture2D(target, attachment, textarget, texture, level) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param textarget GLenum in value param texture UInt32 in value param level Int32 in value category ARB_framebuffer_object version 3.0 extension glxropcode 4322 glxflags ignore offset ? FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param textarget GLenum in value param texture UInt32 in value param level Int32 in value param zoffset Int32 in value category ARB_framebuffer_object version 3.0 extension glxropcode 4323 glxflags ignore offset ? FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param renderbuffertarget RenderbufferTarget in value param renderbuffer UInt32 in value category ARB_framebuffer_object version 3.0 extension glxropcode 4324 glxflags ignore offset ? GetFramebufferAttachmentParameteriv(target, attachment, pname, params) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category ARB_framebuffer_object dlflags notlistable version 3.0 extension glxvendorpriv 1428 glxflags ignore offset ? GenerateMipmap(target) return void param target GLenum in value category ARB_framebuffer_object version 3.0 extension glxropcode 4325 glxflags ignore offset ? # Promoted from EXT_framebuffer_blit BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter) return void param srcX0 Int32 in value param srcY0 Int32 in value param srcX1 Int32 in value param srcY1 Int32 in value param dstX0 Int32 in value param dstY0 Int32 in value param dstX1 Int32 in value param dstY1 Int32 in value param mask ClearBufferMask in value param filter GLenum in value category ARB_framebuffer_object version 3.0 glxropcode 4330 offset ? # Promoted from EXT_framebuffer_multisample RenderbufferStorageMultisample(target, samples, internalformat, width, height) return void param target GLenum in value param samples SizeI in value param internalformat GLenum in value param width SizeI in value param height SizeI in value category ARB_framebuffer_object version 3.0 glxropcode 4331 offset ? # Promoted from ARB_geometry_shader4 FramebufferTextureLayer(target, attachment, texture, level, layer) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value param layer CheckedInt32 in value category ARB_framebuffer_object version 3.0 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore ############################################################################### # # ARB Extension #46 # ARB_framebuffer_sRGB commands (also OpenGL 3.0) # ############################################################################### # (none) newcategory: ARB_framebuffer_sRGB ############################################################################### # # ARB Extension #47 # ARB_geometry_shader4 commands # ############################################################################### ProgramParameteriARB(program, pname, value) return void param program UInt32 in value param pname ProgramParameterPName in value param value Int32 in value category ARB_geometry_shader4 version 3.0 extension soft WINSOFT glfflags ignore glxflags ignore FramebufferTextureARB(target, attachment, texture, level) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value category ARB_geometry_shader4 version 3.0 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore FramebufferTextureLayerARB(target, attachment, texture, level, layer) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value param layer CheckedInt32 in value category ARB_geometry_shader4 version 3.0 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore alias FramebufferTextureLayer FramebufferTextureFaceARB(target, attachment, texture, level, face) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value param face TextureTarget in value category ARB_geometry_shader4 version 3.0 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore ############################################################################### # # ARB Extension #48 # ARB_half_float_vertex commands (also OpenGL 3.0) # ############################################################################### # (none) newcategory: ARB_half_float_vertex ############################################################################### # # ARB Extension #49 # ARB_instanced_arrays commands # ############################################################################### VertexAttribDivisorARB(index, divisor) return void param index UInt32 in value param divisor UInt32 in value category ARB_instanced_arrays version 2.0 extension glfflags ignore glxflags ignore ############################################################################### # # ARB Extension #50 # ARB_map_buffer_range commands (also OpenGL 3.0) # ############################################################################### MapBufferRange(target, offset, length, access) return VoidPointer param target BufferTargetARB in value param offset BufferOffset in value param length BufferSize in value param access BufferAccessMask in value category ARB_map_buffer_range version 3.0 extension glxropcode ? glxflags ignore offset ? # Promoted from APPLE_flush_buffer_range FlushMappedBufferRange(target, offset, length) return void param target BufferTargetARB in value param offset BufferOffset in value param length BufferSize in value category ARB_map_buffer_range version 3.0 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #51 # ARB_texture_buffer_object commands # ############################################################################### TexBufferARB(target, internalformat, buffer) return void param target TextureTarget in value param internalformat GLenum in value param buffer UInt32 in value category ARB_texture_buffer_object version 3.0 extension soft WINSOFT NV50 glfflags ignore alias TexBuffer ############################################################################### # # ARB Extension #52 # ARB_texture_compression_rgtc commands (also OpenGL 3.0) # ############################################################################### # (none) newcategory: ARB_texture_compression_rgtc ############################################################################### # # ARB Extension #53 # ARB_texture_rg commands (also OpenGL 3.0) # ############################################################################### # (none) newcategory: ARB_texture_rg ############################################################################### # # ARB Extension #54 # ARB_vertex_array_object commands (also OpenGL 3.0) # ############################################################################### # Promoted from APPLE_vertex_array_object BindVertexArray(array) return void param array UInt32 in value category ARB_vertex_array_object version 3.0 extension glxropcode ? glxflags ignore offset ? DeleteVertexArrays(n, arrays) return void param n SizeI in value param arrays UInt32 in array [n] category ARB_vertex_array_object version 3.0 extension glxropcode ? glxflags ignore offset ? GenVertexArrays(n, arrays) return void param n SizeI in value param arrays UInt32 out array [n] category ARB_vertex_array_object version 3.0 extension glxropcode ? glxflags ignore offset ? IsVertexArray(array) return Boolean param array UInt32 in value category ARB_vertex_array_object version 3.0 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #55 - WGL_ARB_create_context # ARB Extension #56 - GLX_ARB_create_context # ############################################################################### ############################################################################### # # ARB Extension #57 # ARB_uniform_buffer_object commands # ############################################################################### GetUniformIndices(program, uniformCount, uniformNames, uniformIndices) return void param program UInt32 in value param uniformCount SizeI in value param uniformNames CharPointer in array [COMPSIZE(uniformCount)] param uniformIndices UInt32 out array [COMPSIZE(uniformCount)] category ARB_uniform_buffer_object dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params) return void param program UInt32 in value param uniformCount SizeI in value param uniformIndices UInt32 in array [COMPSIZE(uniformCount)] param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category ARB_uniform_buffer_object dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetActiveUniformName(program, uniformIndex, bufSize, length, uniformName) return void param program UInt32 in value param uniformIndex UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param uniformName Char out array [bufSize] category ARB_uniform_buffer_object dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetUniformBlockIndex(program, uniformBlockName) return UInt32 param program UInt32 in value param uniformBlockName Char in array [COMPSIZE()] category ARB_uniform_buffer_object dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params) return void param program UInt32 in value param uniformBlockIndex UInt32 in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category ARB_uniform_buffer_object dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName) return void param program UInt32 in value param uniformBlockIndex UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param uniformBlockName Char out array [bufSize] category ARB_uniform_buffer_object dlflags notlistable version 2.0 extension glxsingle ? glxflags ignore offset ? UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding) return void param program UInt32 in value param uniformBlockIndex UInt32 in value param uniformBlockBinding UInt32 in value category ARB_uniform_buffer_object version 2.0 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #58 # ARB_compatibility commands # ############################################################################### # (none) newcategory: ARB_compatibility ############################################################################### # # ARB Extension #59 # ARB_copy_buffer commands # ############################################################################### CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size) return void param readTarget GLenum in value param writeTarget GLenum in value param readOffset BufferOffset in value param writeOffset BufferOffset in value param size BufferSize in value category ARB_copy_buffer version 3.0 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #60 # ARB_shader_texture_lod commands # ############################################################################### # (none) newcategory: ARB_shader_texture_lod ############################################################################### # # ARB Extension #61 # ARB_depth_clamp commands # ############################################################################### # (none) newcategory: ARB_depth_clamp ############################################################################### # # ARB Extension #62 # ARB_draw_elements_base_vertex commands # ############################################################################### DrawElementsBaseVertex(mode, count, type, indices, basevertex) return void param mode GLenum in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] param basevertex Int32 in value category ARB_draw_elements_base_vertex version 1.2 extension glxropcode ? glxflags ignore offset ? DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, basevertex) return void param mode GLenum in value param start UInt32 in value param end UInt32 in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] param basevertex Int32 in value category ARB_draw_elements_base_vertex version 1.2 extension glxropcode ? glxflags ignore offset ? DrawElementsInstancedBaseVertex(mode, count, type, indices, primcount, basevertex) return void param mode GLenum in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] param primcount SizeI in value param basevertex Int32 in value category ARB_draw_elements_base_vertex version 1.2 extension glxropcode ? glxflags ignore offset ? MultiDrawElementsBaseVertex(mode, count, type, indices, primcount, basevertex) return void param mode GLenum in value param count SizeI in array [COMPSIZE(primcount)] param type DrawElementsType in value param indices VoidPointer in array [COMPSIZE(primcount)] param primcount SizeI in value param basevertex Int32 in array [COMPSIZE(primcount)] category ARB_draw_elements_base_vertex version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #63 # ARB_fragment_coord_conventions commands # ############################################################################### # (none) newcategory: ARB_fragment_coord_conventions ############################################################################### # # ARB Extension #64 # ARB_provoking_vertex commands # ############################################################################### ProvokingVertex(mode) return void param mode GLenum in value category ARB_provoking_vertex version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #65 # ARB_seamless_cube_map commands # ############################################################################### # (none) newcategory: ARB_seamless_cube_map ############################################################################### # # ARB Extension #66 # ARB_sync commands # ############################################################################### FenceSync(condition, flags) return sync param condition GLenum in value param flags GLbitfield in value category ARB_sync version 1.2 extension glxropcode ? glxflags ignore offset ? IsSync(sync) return Boolean param sync sync in value category ARB_sync version 1.2 extension glxropcode ? glxflags ignore offset ? DeleteSync(sync) return void param sync sync in value category ARB_sync version 1.2 extension glxropcode ? glxflags ignore offset ? ClientWaitSync(sync, flags, timeout) return GLenum param sync sync in value param flags GLbitfield in value param timeout UInt64 in value category ARB_sync version 1.2 extension glxropcode ? glxflags ignore offset ? WaitSync(sync, flags, timeout) return void param sync sync in value param flags GLbitfield in value param timeout UInt64 in value category ARB_sync version 1.2 extension glxropcode ? glxflags ignore offset ? GetInteger64v(pname, params) return void param pname GLenum in value param params Int64 out array [COMPSIZE(pname)] category ARB_sync dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetSynciv(sync, pname, bufSize, length, values) return void param sync sync in value param pname GLenum in value param bufSize SizeI in value param length SizeI out array [1] param values Int32 out array [length] category ARB_sync dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # ARB Extension #67 # ARB_texture_multisample commands # ############################################################################### TexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations) return void param target GLenum in value param samples SizeI in value param internalformat Int32 in value param width SizeI in value param height SizeI in value param fixedsamplelocations Boolean in value category ARB_texture_multisample version 1.2 extension glxropcode ? glxflags ignore offset ? TexImage3DMultisample(target, samples, internalformat, width, height, depth, fixedsamplelocations) return void param target GLenum in value param samples SizeI in value param internalformat Int32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param fixedsamplelocations Boolean in value category ARB_texture_multisample version 1.2 extension glxropcode ? glxflags ignore offset ? GetMultisamplefv(pname, index, val) return void param pname GLenum in value param index UInt32 in value param val Float32 out array [COMPSIZE(pname)] category ARB_texture_multisample dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? SampleMaski(index, mask) return void param index UInt32 in value param mask GLbitfield in value category ARB_texture_multisample version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #68 # ARB_vertex_array_bgra commands # ############################################################################### # (none) newcategory: ARB_vertex_array_bgra ############################################################################### # # ARB Extension #69 # ARB_draw_buffers_blend commands # ############################################################################### @@@ Add ARB suffixes here & functions! BlendEquationi(buf, mode) return void param buf UInt32 in value param mode GLenum in value category ARB_draw_buffers_blend version 1.2 extension glxropcode ? glxflags ignore offset ? BlendEquationSeparatei(buf, modeRGB, modeAlpha) return void param buf UInt32 in value param modeRGB GLenum in value param modeAlpha GLenum in value category ARB_draw_buffers_blend version 1.2 extension glxropcode ? glxflags ignore offset ? BlendFunci(buf, src, dst) return void param buf UInt32 in value param src GLenum in value param dst GLenum in value category ARB_draw_buffers_blend version 1.2 extension glxropcode ? glxflags ignore offset ? BlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha) return void param buf UInt32 in value param srcRGB GLenum in value param dstRGB GLenum in value param srcAlpha GLenum in value param dstAlpha GLenum in value category ARB_draw_buffers_blend version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #70 # ARB_sample_shading commands # ############################################################################### @@@ Add ARB suffixes here & functions! MinSampleShading(value) return void param value ClampedColorF in value category ARB_sample_shading version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #71 # ARB_texture_cube_map_array commands # ############################################################################### # (none) newcategory: ARB_texture_cube_map_array ############################################################################### # # ARB Extension #72 # ARB_texture_gather commands # ############################################################################### # (none) newcategory: ARB_texture_gather ############################################################################### # # ARB Extension #73 # ARB_texture_query_lod commands # ############################################################################### # (none) newcategory: ARB_texture_query_lod ############################################################################### # # ARB Extension #74 - WGL_ARB_create_context_profile # ARB Extension #75 - GLX_ARB_create_context_profile # ############################################################################### ############################################################################### # # ARB Extension #76 # ARB_shading_language_include commands # ############################################################################### # ??? VERIFY DONE ??? NamedStringARB(type, namelen, name, stringlen, string) return void param type GLenum in value param namelen Int32 in value param name Char in array [namelen] param stringlen Int32 in value param string Char in array [stringlen] category ARB_shading_language_include version 1.2 extension glxropcode ? glxflags ignore offset ? DeleteNamedStringARB(namelen, name) return void param namelen Int32 in value param name Char in array [namelen] category ARB_shading_language_include version 1.2 extension glxropcode ? glxflags ignore offset ? CompileShaderIncludeARB(shader, count, path, length) return void param shader UInt32 in value param count SizeI in value param path CharPointer in array [count] param length Int32 in array [count] category ARB_shading_language_include version 1.2 extension glxropcode ? glxflags ignore offset ? IsNamedStringARB(namelen, name) return Boolean param namelen Int32 in value param name Char in array [namelen] category ARB_shading_language_include version 1.2 extension glxropcode ? glxflags ignore offset ? GetNamedStringARB(namelen, name, bufSize, stringlen, string) return void param namelen Int32 in value param name Char in array [namelen] param bufSize SizeI in value param stringlen Int32 out array [1] param string Char out array [bufSize] category ARB_shading_language_include dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetNamedStringivARB(namelen, name, pname, params) return void param namelen Int32 in value param name Char in array [namelen] param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category ARB_shading_language_include dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # ARB Extension #77 # ARB_texture_compression_bptc commands # ############################################################################### # ??? VERIFY DONE ??? ############################################################################### # # ARB Extension #78 # ARB_blend_func_extended commands # ############################################################################### # ??? VERIFY DONE ??? BindFragDataLocationIndexed(program, colorNumber, index, name) return void param program UInt32 in value param colorNumber UInt32 in value param index UInt32 in value param name Char in array [] category ARB_blend_func_extended version 1.2 extension glxropcode ? glxflags ignore offset ? GetFragDataIndex(program, name) return Int32 param program UInt32 in value param name Char in array [] category ARB_blend_func_extended dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # ARB Extension #79 # ARB_explicit_attrib_location commands # ############################################################################### # ??? VERIFY DONE ??? ############################################################################### # # ARB Extension #80 # ARB_occlusion_query2 commands # ############################################################################### # ??? VERIFY DONE ??? ############################################################################### # # ARB Extension #81 # ARB_sampler_objects commands # ############################################################################### # ??? VERIFY DONE ??? GenSamplers(count, samplers) return void param count SizeI in value param samplers UInt32 out array [count] category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? DeleteSamplers(count, samplers) return void param count SizeI in value param samplers UInt32 in array [count] category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? IsSampler(sampler) return Boolean param sampler UInt32 in value category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? BindSampler(unit, sampler) return void param unit GLenum in value param sampler UInt32 in value category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? SamplerParameteri(sampler, pname, param) return void param sampler UInt32 in value param pname GLenum in value param param Int32 in value category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? SamplerParameteriv(sampler, pname, param) return void param sampler UInt32 in value param pname GLenum in value param param Int32 in array [COMPSIZE(pname)] category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? SamplerParameterf(sampler, pname, param) return void param sampler UInt32 in value param pname GLenum in value param param Float32 in value category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? SamplerParameterfv(sampler, pname, param) return void param sampler UInt32 in value param pname GLenum in value param param Float32 in array [COMPSIZE(pname)] category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? SamplerParameterIiv(sampler, pname, param) return void param sampler UInt32 in value param pname GLenum in value param param Int32 in array [COMPSIZE(pname)] category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? SamplerParameterIuiv(sampler, pname, param) return void param sampler UInt32 in value param pname GLenum in value param param UInt32 in array [COMPSIZE(pname)] category ARB_sampler_objects version 1.2 extension glxropcode ? glxflags ignore offset ? GetSamplerParameteriv(sampler, pname, params) return void param sampler UInt32 in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category ARB_sampler_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetSamplerParameterIiv(sampler, pname, params) return void param sampler UInt32 in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category ARB_sampler_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetSamplerParameterfv(sampler, pname, params) return void param sampler UInt32 in value param pname GLenum in value param params Float32 out array [COMPSIZE(pname)] category ARB_sampler_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetSamplerParameterIfv(sampler, pname, params) return void param sampler UInt32 in value param pname GLenum in value param params Float32 out array [COMPSIZE(pname)] category ARB_sampler_objects dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # ARB Extension #82 # ARB_shader_bit_encoding commands # ############################################################################### # ??? VERIFY DONE ??? ############################################################################### # # ARB Extension #83 # ARB_texture_rgb10_a2ui commands # ############################################################################### # ??? VERIFY DONE ??? ############################################################################### # # ARB Extension #84 # ARB_texture_swizzle commands # ############################################################################### # ??? VERIFY DONE ??? ############################################################################### # # ARB Extension #85 # ARB_timer_query commands # ############################################################################### # ??? VERIFY DONE ??? QueryCounter(id, target) return void param id UInt32 in value param target GLenum in value category ARB_timer_query version 1.2 extension glxropcode ? glxflags ignore offset ? GetQueryObjecti64v(id, pname, params) return void param id UInt32 in value param pname GLenum in value param params Int64 out array [COMPSIZE(pname)] category ARB_timer_query dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetQueryObjectui64v(id, pname, params) return void param id UInt32 in value param pname GLenum in value param params UInt64 out array [COMPSIZE(pname)] category ARB_timer_query dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # ARB Extension #86 # ARB_vertex_type_2_10_10_10_rev commands # ############################################################################### # ??? VERIFY DONE ??? VertexP2ui(type, value) return void param type GLenum in value param value UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexP2uiv(type, value) return void param type GLenum in value param value UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexP3ui(type, value) return void param type GLenum in value param value UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexP3uiv(type, value) return void param type GLenum in value param value UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexP4ui(type, value) return void param type GLenum in value param value UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexP4uiv(type, value) return void param type GLenum in value param value UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordP1ui(type, coords) return void param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordP1uiv(type, coords) return void param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordP2ui(type, coords) return void param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordP2uiv(type, coords) return void param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordP3ui(type, coords) return void param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordP3uiv(type, coords) return void param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordP4ui(type, coords) return void param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordP4uiv(type, coords) return void param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoordP1ui(texture, type, coords) return void param texture GLenum in value param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoordP1uiv(texture, type, coords) return void param texture GLenum in value param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoordP2ui(texture, type, coords) return void param texture GLenum in value param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoordP2uiv(texture, type, coords) return void param texture GLenum in value param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoordP3ui(texture, type, coords) return void param texture GLenum in value param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoordP3uiv(texture, type, coords) return void param texture GLenum in value param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoordP4ui(texture, type, coords) return void param texture GLenum in value param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoordP4uiv(texture, type, coords) return void param texture GLenum in value param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? NormalP3ui(type, coords) return void param type GLenum in value param coords UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? NormalP3uiv(type, coords) return void param type GLenum in value param coords UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? ColorP3ui(type, color) return void param type GLenum in value param color UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? ColorP3uiv(type, color) return void param type GLenum in value param color UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? ColorP4ui(type, color) return void param type GLenum in value param color UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? ColorP4uiv(type, color) return void param type GLenum in value param color UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? SecondaryColorP3ui(type, color) return void param type GLenum in value param color UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? SecondaryColorP3uiv(type, color) return void param type GLenum in value param color UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribP1ui(index, type, normalized, value) return void param index UInt32 in value param type GLenum in value param normalized Boolean in value param value UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribP1uiv(index, type, normalized, value) return void param index UInt32 in value param type GLenum in value param normalized Boolean in value param value UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribP2ui(index, type, normalized, value) return void param index UInt32 in value param type GLenum in value param normalized Boolean in value param value UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribP2uiv(index, type, normalized, value) return void param index UInt32 in value param type GLenum in value param normalized Boolean in value param value UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribP3ui(index, type, normalized, value) return void param index UInt32 in value param type GLenum in value param normalized Boolean in value param value UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribP3uiv(index, type, normalized, value) return void param index UInt32 in value param type GLenum in value param normalized Boolean in value param value UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribP4ui(index, type, normalized, value) return void param index UInt32 in value param type GLenum in value param normalized Boolean in value param value UInt32 in value category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribP4uiv(index, type, normalized, value) return void param index UInt32 in value param type GLenum in value param normalized Boolean in value param value UInt32 in array [1] category ARB_vertex_type_2_10_10_10_rev version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #87 # ARB_draw_indirect commands # ############################################################################### # ??? VERIFY DONE ??? DrawArraysIndirect(mode, indirect) return void param mode GLenum in value param indirect Void in array [] category ARB_draw_indirect version 1.2 extension glxropcode ? glxflags ignore offset ? DrawElementsIndirect(mode, type, indirect) return void param mode GLenum in value param type GLenum in value param indirect Void in array [] category ARB_draw_indirect version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #88 # ARB_gpu_shader5 commands # ############################################################################### # ??? VERIFY DONE ??? ############################################################################### # # ARB Extension #89 # ARB_gpu_shader_fp64 commands # ############################################################################### # ??? VERIFY DONE ??? Uniform1d(location, x) return void param location Int32 in value param x Float64 in value category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? Uniform2d(location, x, y) return void param location Int32 in value param x Float64 in value param y Float64 in value category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? Uniform3d(location, x, y, z) return void param location Int32 in value param x Float64 in value param y Float64 in value param z Float64 in value category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? Uniform4d(location, x, y, z, w) return void param location Int32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? Uniform1dv(location, count, value) return void param location Int32 in value param count SizeI in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? Uniform2dv(location, count, value) return void param location Int32 in value param count SizeI in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? Uniform3dv(location, count, value) return void param location Int32 in value param count SizeI in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? Uniform4dv(location, count, value) return void param location Int32 in value param count SizeI in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix2dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix3dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix4dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix2x3dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix2x4dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix3x2dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix3x4dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix4x2dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? UniformMatrix4x3dv(location, count, transpose, value) return void param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? GetUniformdv(program, location, params) return void param program UInt32 in value param location Int32 in value param params Float64 out array [location] category ARB_gpu_shader_fp64 dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ProgramUniform1dEXT(program, location, x) return void param program UInt32 in value param location Int32 in value param x Float64 in value category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniform2dEXT(program, location, x, y) return void param program UInt32 in value param location Int32 in value param x Float64 in value param y Float64 in value category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniform3dEXT(program, location, x, y, z) return void param program UInt32 in value param location Int32 in value param x Float64 in value param y Float64 in value param z Float64 in value category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniform4dEXT(program, location, x, y, z, w) return void param program UInt32 in value param location Int32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniform1dvEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniform2dvEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniform3dvEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniform4dvEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix2dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix3dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix4dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix2x3dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix2x4dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix3x2dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix3x4dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix4x2dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformMatrix4x3dvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float64 in array [count] category ARB_gpu_shader_fp64 version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #90 # ARB_shader_subroutine commands # ############################################################################### # ??? VERIFY DONE ??? GetSubroutineUniformLocation(program, shadertype, name) return Int32 param program UInt32 in value param shadertype GLenum in value param name Char in array [] category ARB_shader_subroutine dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetSubroutineIndex(program, shadertype, name) return UInt32 param program UInt32 in value param shadertype GLenum in value param name Char in array [] category ARB_shader_subroutine dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetActiveSubroutineUniformiv(program, shadertype, index, pname, values) return void param program UInt32 in value param shadertype GLenum in value param index UInt32 in value param pname GLenum in value param values Int32 out array [COMPSIZE(pname)] category ARB_shader_subroutine dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetActiveSubroutineUniformName(program, shadertype, index, bufsize, length, name) return void param program UInt32 in value param shadertype GLenum in value param index UInt32 in value param bufsize SizeI in value param length SizeI out array [1] param name Char out array [bufsize] category ARB_shader_subroutine dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetActiveSubroutineName(program, shadertype, index, bufsize, length, name) return void param program UInt32 in value param shadertype GLenum in value param index UInt32 in value param bufsize SizeI in value param length SizeI out array [1] param name Char out array [bufsize] category ARB_shader_subroutine dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? UniformSubroutinesuiv(shadertype, count, indices) return void param shadertype GLenum in value param count SizeI in value param indices UInt32 in array [count] category ARB_shader_subroutine version 1.2 extension glxropcode ? glxflags ignore offset ? GetUniformSubroutineuiv(shadertype, location, params) return void param shadertype GLenum in value param location Int32 in value param params UInt32 out array [1] category ARB_shader_subroutine dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetProgramStageiv(program, shadertype, pname, values) return void param program UInt32 in value param shadertype GLenum in value param pname GLenum in value param values Int32 out array [1] category ARB_shader_subroutine dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # ARB Extension #91 # ARB_tessellation_shader commands # ############################################################################### # ??? VERIFY DONE ??? PatchParameteri(pname, value) return void param pname GLenum in value param value Int32 in value category ARB_tessellation_shader version 1.2 extension glxropcode ? glxflags ignore offset ? PatchParameterfv(pname, values) return void param pname GLenum in value param values Float32 in array [COMPSIZE(pname)] category ARB_tessellation_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #92 # ARB_texture_buffer_object_rgb32 commands # ############################################################################### # ??? VERIFY DONE ??? ############################################################################### # # ARB Extension #93 # ARB_transform_feedback2 commands # ############################################################################### # ??? VERIFY DONE ??? BindTransformFeedback(target, id) return void param target GLenum in value param id UInt32 in value category ARB_transform_feedback2 version 1.2 extension glxropcode ? glxflags ignore offset ? DeleteTransformFeedbacks(n, ids) return void param n SizeI in value param ids UInt32 in array [n] category ARB_transform_feedback2 version 1.2 extension glxropcode ? glxflags ignore offset ? GenTransformFeedbacks(n, ids) return void param n SizeI in value param ids UInt32 out array [n] category ARB_transform_feedback2 version 1.2 extension glxropcode ? glxflags ignore offset ? IsTransformFeedback(id) return Boolean param id UInt32 in value category ARB_transform_feedback2 version 1.2 extension glxropcode ? glxflags ignore offset ? PauseTransformFeedback() return void category ARB_transform_feedback2 version 1.2 extension glxropcode ? glxflags ignore offset ? ResumeTransformFeedback() return void category ARB_transform_feedback2 version 1.2 extension glxropcode ? glxflags ignore offset ? DrawTransformFeedback(mode, id) return void param mode GLenum in value param id UInt32 in value category ARB_transform_feedback2 version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # ARB Extension #94 # ARB_transform_feedback3 commands # ############################################################################### # ??? VERIFY DONE ??? DrawTransformFeedbackStream(mode, id, stream) return void param mode GLenum in value param id UInt32 in value param stream UInt32 in value category ARB_transform_feedback3 version 1.2 extension glxropcode ? glxflags ignore offset ? BeginQueryIndexed(target, index, id) return void param target GLenum in value param index UInt32 in value param id UInt32 in value category ARB_transform_feedback3 version 1.2 extension glxropcode ? glxflags ignore offset ? EndQueryIndexed(target, index) return void param target GLenum in value param index UInt32 in value category ARB_transform_feedback3 version 1.2 extension glxropcode ? glxflags ignore offset ? GetQueryIndexediv(target, index, pname, params) return void param target GLenum in value param index UInt32 in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category ARB_transform_feedback3 dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### ############################################################################### # # Non-ARB extensions, in order by registry extension number # ############################################################################### ############################################################################### ############################################################################### # # Extension #1 # EXT_abgr commands # ############################################################################### # (none) newcategory: EXT_abgr ############################################################################### # # Extension #2 # EXT_blend_color commands # ############################################################################### BlendColorEXT(red, green, blue, alpha) return void param red ClampedColorF in value param green ClampedColorF in value param blue ClampedColorF in value param alpha ClampedColorF in value category EXT_blend_color version 1.0 glxropcode 4096 glxflags EXT extension soft alias BlendColor ############################################################################### # # Extension #3 # EXT_polygon_offset commands # ############################################################################### PolygonOffsetEXT(factor, bias) return void param factor Float32 in value param bias Float32 in value category EXT_polygon_offset version 1.0 glxropcode 4098 glxflags EXT extension soft offset 414 ############################################################################### # # Extension #4 # EXT_texture commands # ############################################################################### # (none) newcategory: EXT_texture ############################################################################### # # Extension #5 - skipped # ############################################################################### ############################################################################### # # Extension #6 # EXT_texture3D commands # ############################################################################### # Arguably TexelInternalFormat, not PixelInternalFormat TexImage3DEXT(target, level, internalformat, width, height, depth, border, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param depth SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth)] category EXT_texture3D dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 glxropcode 4114 extension alias TexImage3D TexSubImage3DEXT(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth)] category EXT_texture3D dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 glxropcode 4115 extension alias TexSubImage3D ############################################################################### # # Extension #7 # SGIS_texture_filter4 commands # ############################################################################### GetTexFilterFuncSGIS(target, filter, weights) return void param target TextureTarget in value param filter TextureFilterSGIS in value param weights Float32 out array [COMPSIZE(target/filter)] category SGIS_texture_filter4 dlflags notlistable version 1.0 glxflags SGI glxvendorpriv 4101 extension offset 415 TexFilterFuncSGIS(target, filter, n, weights) return void param target TextureTarget in value param filter TextureFilterSGIS in value param n SizeI in value param weights Float32 in array [n] category SGIS_texture_filter4 glxflags SGI version 1.0 glxropcode 2064 extension offset 416 ############################################################################### # # Extension #8 - skipped # ############################################################################### ############################################################################### # # Extension #9 # EXT_subtexture commands # ############################################################################### TexSubImage1DEXT(target, level, xoffset, width, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param width SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width)] category EXT_subtexture dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 glxropcode 4099 extension alias TexSubImage1D TexSubImage2DEXT(target, level, xoffset, yoffset, width, height, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height)] category EXT_subtexture dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 glxropcode 4100 extension alias TexSubImage2D ############################################################################### # # Extension #10 # EXT_copy_texture commands # ############################################################################### # Arguably TexelInternalFormat, not PixelInternalFormat CopyTexImage1DEXT(target, level, internalformat, x, y, width, border) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param border CheckedInt32 in value category EXT_copy_texture version 1.0 glxflags EXT glxropcode 4119 extension alias CopyTexImage1D # Arguably TexelInternalFormat, not PixelInternalFormat CopyTexImage2DEXT(target, level, internalformat, x, y, width, height, border) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value category EXT_copy_texture version 1.0 glxflags EXT glxropcode 4120 extension alias CopyTexImage2D CopyTexSubImage1DEXT(target, level, xoffset, x, y, width) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value category EXT_copy_texture version 1.0 glxflags EXT glxropcode 4121 extension alias CopyTexSubImage1D CopyTexSubImage2DEXT(target, level, xoffset, yoffset, x, y, width, height) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category EXT_copy_texture version 1.0 glxflags EXT glxropcode 4122 extension alias CopyTexSubImage2D CopyTexSubImage3DEXT(target, level, xoffset, yoffset, zoffset, x, y, width, height) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category EXT_copy_texture version 1.0 glxflags EXT glxropcode 4123 extension alias CopyTexSubImage3D ############################################################################### # # Extension #11 # EXT_histogram commands # ############################################################################### GetHistogramEXT(target, reset, format, type, values) return void param target HistogramTargetEXT in value param reset Boolean in value param format PixelFormat in value param type PixelType in value param values Void out array [COMPSIZE(target/format/type)] category EXT_histogram dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 glxvendorpriv 5 extension offset 417 GetHistogramParameterfvEXT(target, pname, params) return void param target HistogramTargetEXT in value param pname GetHistogramParameterPNameEXT in value param params Float32 out array [COMPSIZE(pname)] category EXT_histogram dlflags notlistable version 1.0 glxvendorpriv 6 glxflags EXT extension offset 418 GetHistogramParameterivEXT(target, pname, params) return void param target HistogramTargetEXT in value param pname GetHistogramParameterPNameEXT in value param params Int32 out array [COMPSIZE(pname)] category EXT_histogram dlflags notlistable version 1.0 glxvendorpriv 7 glxflags EXT extension offset 419 GetMinmaxEXT(target, reset, format, type, values) return void param target MinmaxTargetEXT in value param reset Boolean in value param format PixelFormat in value param type PixelType in value param values Void out array [COMPSIZE(target/format/type)] category EXT_histogram dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 glxvendorpriv 8 extension offset 420 GetMinmaxParameterfvEXT(target, pname, params) return void param target MinmaxTargetEXT in value param pname GetMinmaxParameterPNameEXT in value param params Float32 out array [COMPSIZE(pname)] category EXT_histogram dlflags notlistable version 1.0 glxvendorpriv 9 glxflags EXT extension offset 421 GetMinmaxParameterivEXT(target, pname, params) return void param target MinmaxTargetEXT in value param pname GetMinmaxParameterPNameEXT in value param params Int32 out array [COMPSIZE(pname)] category EXT_histogram dlflags notlistable version 1.0 glxvendorpriv 10 glxflags EXT extension offset 422 HistogramEXT(target, width, internalformat, sink) return void param target HistogramTargetEXT in value param width SizeI in value param internalformat PixelInternalFormat in value param sink Boolean in value category EXT_histogram version 1.0 glxropcode 4110 glxflags EXT extension alias Histogram MinmaxEXT(target, internalformat, sink) return void param target MinmaxTargetEXT in value param internalformat PixelInternalFormat in value param sink Boolean in value category EXT_histogram version 1.0 glxropcode 4111 glxflags EXT extension alias Minmax ResetHistogramEXT(target) return void param target HistogramTargetEXT in value category EXT_histogram version 1.0 glxropcode 4112 glxflags EXT extension alias ResetHistogram ResetMinmaxEXT(target) return void param target MinmaxTargetEXT in value category EXT_histogram version 1.0 glxropcode 4113 glxflags EXT extension alias ResetMinmax ############################################################################### # # Extension #12 # EXT_convolution commands # ############################################################################### ConvolutionFilter1DEXT(target, internalformat, width, format, type, image) return void param target ConvolutionTargetEXT in value param internalformat PixelInternalFormat in value param width SizeI in value param format PixelFormat in value param type PixelType in value param image Void in array [COMPSIZE(format/type/width)] category EXT_convolution dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 glxropcode 4101 extension alias ConvolutionFilter1D ConvolutionFilter2DEXT(target, internalformat, width, height, format, type, image) return void param target ConvolutionTargetEXT in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param image Void in array [COMPSIZE(format/type/width/height)] category EXT_convolution dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 glxropcode 4102 extension alias ConvolutionFilter2D ConvolutionParameterfEXT(target, pname, params) return void param target ConvolutionTargetEXT in value param pname ConvolutionParameterEXT in value param params CheckedFloat32 in value category EXT_convolution version 1.0 glxropcode 4103 glxflags EXT extension alias ConvolutionParameterf ConvolutionParameterfvEXT(target, pname, params) return void param target ConvolutionTargetEXT in value param pname ConvolutionParameterEXT in value param params CheckedFloat32 in array [COMPSIZE(pname)] category EXT_convolution version 1.0 glxropcode 4104 glxflags EXT extension alias ConvolutionParameterfv ConvolutionParameteriEXT(target, pname, params) return void param target ConvolutionTargetEXT in value param pname ConvolutionParameterEXT in value param params CheckedInt32 in value category EXT_convolution version 1.0 glxropcode 4105 glxflags EXT extension alias ConvolutionParameteri ConvolutionParameterivEXT(target, pname, params) return void param target ConvolutionTargetEXT in value param pname ConvolutionParameterEXT in value param params CheckedInt32 in array [COMPSIZE(pname)] category EXT_convolution version 1.0 glxropcode 4106 glxflags EXT extension alias ConvolutionParameteriv CopyConvolutionFilter1DEXT(target, internalformat, x, y, width) return void param target ConvolutionTargetEXT in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value category EXT_convolution version 1.0 glxropcode 4107 glxflags EXT extension alias CopyConvolutionFilter1D CopyConvolutionFilter2DEXT(target, internalformat, x, y, width, height) return void param target ConvolutionTargetEXT in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category EXT_convolution version 1.0 glxropcode 4108 glxflags EXT extension alias CopyConvolutionFilter2D GetConvolutionFilterEXT(target, format, type, image) return void param target ConvolutionTargetEXT in value param format PixelFormat in value param type PixelType in value param image Void out array [COMPSIZE(target/format/type)] category EXT_convolution dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 glxvendorpriv 1 extension offset 423 GetConvolutionParameterfvEXT(target, pname, params) return void param target ConvolutionTargetEXT in value param pname ConvolutionParameterEXT in value param params Float32 out array [COMPSIZE(pname)] category EXT_convolution dlflags notlistable version 1.0 glxvendorpriv 2 glxflags EXT extension offset 424 GetConvolutionParameterivEXT(target, pname, params) return void param target ConvolutionTargetEXT in value param pname ConvolutionParameterEXT in value param params Int32 out array [COMPSIZE(pname)] category EXT_convolution dlflags notlistable version 1.0 glxvendorpriv 3 glxflags EXT extension offset 425 GetSeparableFilterEXT(target, format, type, row, column, span) return void param target SeparableTargetEXT in value param format PixelFormat in value param type PixelType in value param row Void out array [COMPSIZE(target/format/type)] param column Void out array [COMPSIZE(target/format/type)] param span Void out array [COMPSIZE(target/format/type)] category EXT_convolution dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 glxvendorpriv 4 extension offset 426 SeparableFilter2DEXT(target, internalformat, width, height, format, type, row, column) return void param target SeparableTargetEXT in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param row Void in array [COMPSIZE(target/format/type/width)] param column Void in array [COMPSIZE(target/format/type/height)] category EXT_convolution dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 glxropcode 4109 extension alias SeparableFilter2D ############################################################################### # # Extension #13 # SGI_color_matrix commands # ############################################################################### # (none) newcategory: SGI_color_matrix ############################################################################### # # Extension #14 # SGI_color_table commands # ############################################################################### ColorTableSGI(target, internalformat, width, format, type, table) return void param target ColorTableTargetSGI in value param internalformat PixelInternalFormat in value param width SizeI in value param format PixelFormat in value param type PixelType in value param table Void in array [COMPSIZE(format/type/width)] category SGI_color_table dlflags handcode glxflags client-handcode server-handcode SGI version 1.0 glxropcode 2053 extension alias ColorTable ColorTableParameterfvSGI(target, pname, params) return void param target ColorTableTargetSGI in value param pname ColorTableParameterPNameSGI in value param params CheckedFloat32 in array [COMPSIZE(pname)] category SGI_color_table version 1.0 glxropcode 2054 glxflags SGI extension alias ColorTableParameterfv ColorTableParameterivSGI(target, pname, params) return void param target ColorTableTargetSGI in value param pname ColorTableParameterPNameSGI in value param params CheckedInt32 in array [COMPSIZE(pname)] category SGI_color_table version 1.0 glxropcode 2055 glxflags SGI extension alias ColorTableParameteriv CopyColorTableSGI(target, internalformat, x, y, width) return void param target ColorTableTargetSGI in value param internalformat PixelInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value category SGI_color_table version 1.0 glxropcode 2056 glxflags SGI extension alias CopyColorTable GetColorTableSGI(target, format, type, table) return void param target ColorTableTargetSGI in value param format PixelFormat in value param type PixelType in value param table Void out array [COMPSIZE(target/format/type)] category SGI_color_table dlflags notlistable glxflags client-handcode server-handcode SGI version 1.0 glxvendorpriv 4098 extension offset 427 GetColorTableParameterfvSGI(target, pname, params) return void param target ColorTableTargetSGI in value param pname GetColorTableParameterPNameSGI in value param params Float32 out array [COMPSIZE(pname)] category SGI_color_table dlflags notlistable version 1.0 glxflags SGI glxvendorpriv 4099 extension offset 428 GetColorTableParameterivSGI(target, pname, params) return void param target ColorTableTargetSGI in value param pname GetColorTableParameterPNameSGI in value param params Int32 out array [COMPSIZE(pname)] category SGI_color_table dlflags notlistable version 1.0 glxflags SGI glxvendorpriv 4100 extension offset 429 ############################################################################### # # Extension #15 # SGIX_pixel_texture commands # ############################################################################### PixelTexGenSGIX(mode) return void param mode PixelTexGenModeSGIX in value category SGIX_pixel_texture version 1.0 glxflags SGI glxropcode 2059 extension offset 430 ############################################################################### # # Extension #15 (variant) # SGIS_pixel_texture commands # Both SGIS and SGIX forms have extension #15! # ############################################################################### PixelTexGenParameteriSGIS(pname, param) return void param pname PixelTexGenParameterNameSGIS in value param param CheckedInt32 in value category SGIS_pixel_texture version 1.0 extension glxropcode ? glxflags ignore offset 431 PixelTexGenParameterivSGIS(pname, params) return void param pname PixelTexGenParameterNameSGIS in value param params CheckedInt32 in array [COMPSIZE(pname)] category SGIS_pixel_texture version 1.0 extension glxropcode ? glxflags ignore offset 432 PixelTexGenParameterfSGIS(pname, param) return void param pname PixelTexGenParameterNameSGIS in value param param CheckedFloat32 in value category SGIS_pixel_texture version 1.0 extension glxropcode ? glxflags ignore offset 433 PixelTexGenParameterfvSGIS(pname, params) return void param pname PixelTexGenParameterNameSGIS in value param params CheckedFloat32 in array [COMPSIZE(pname)] category SGIS_pixel_texture version 1.0 extension glxropcode ? glxflags ignore offset 434 GetPixelTexGenParameterivSGIS(pname, params) return void param pname PixelTexGenParameterNameSGIS in value param params CheckedInt32 out array [COMPSIZE(pname)] dlflags notlistable category SGIS_pixel_texture version 1.0 extension glxvendorpriv ? glxflags ignore offset 435 GetPixelTexGenParameterfvSGIS(pname, params) return void param pname PixelTexGenParameterNameSGIS in value param params CheckedFloat32 out array [COMPSIZE(pname)] dlflags notlistable category SGIS_pixel_texture version 1.0 extension glxvendorpriv ? glxflags ignore offset 436 ############################################################################### # # Extension #16 # SGIS_texture4D commands # ############################################################################### TexImage4DSGIS(target, level, internalformat, width, height, depth, size4d, border, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value param depth SizeI in value param size4d SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth/size4d)] category SGIS_texture4D dlflags handcode glxflags client-handcode server-handcode SGI version 1.0 glxropcode 2057 extension offset 437 TexSubImage4DSGIS(target, level, xoffset, yoffset, zoffset, woffset, width, height, depth, size4d, format, type, pixels) return void param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param woffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param size4d SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth/size4d)] category SGIS_texture4D dlflags handcode glxflags client-handcode server-handcode SGI version 1.0 glxropcode 2058 extension offset 438 ############################################################################### # # Extension #17 # SGI_texture_color_table commands # ############################################################################### # (none) newcategory: SGI_texture_color_table ############################################################################### # # Extension #18 # EXT_cmyka commands # ############################################################################### # (none) newcategory: EXT_cmyka ############################################################################### # # Extension #19 - skipped # ############################################################################### ############################################################################### # # Extension #20 # EXT_texture_object commands # ############################################################################### AreTexturesResidentEXT(n, textures, residences) return Boolean param n SizeI in value param textures Texture in array [n] param residences Boolean out array [n] category EXT_texture_object glxflags EXT glxvendorpriv 11 dlflags notlistable version 1.0 extension offset 439 BindTextureEXT(target, texture) return void param target TextureTarget in value param texture Texture in value category EXT_texture_object version 1.0 glxflags EXT glxropcode 4117 extension alias BindTexture DeleteTexturesEXT(n, textures) return void param n SizeI in value param textures Texture in array [n] category EXT_texture_object dlflags notlistable version 1.0 glxflags EXT glxvendorpriv 12 extension offset 561 GenTexturesEXT(n, textures) return void param n SizeI in value param textures Texture out array [n] category EXT_texture_object dlflags notlistable version 1.0 glxflags EXT glxvendorpriv 13 extension offset 440 IsTextureEXT(texture) return Boolean param texture Texture in value category EXT_texture_object dlflags notlistable version 1.0 glxflags EXT glxvendorpriv 14 extension offset 441 PrioritizeTexturesEXT(n, textures, priorities) return void param n SizeI in value param textures Texture in array [n] param priorities ClampedFloat32 in array [n] category EXT_texture_object glxflags EXT version 1.0 glxropcode 4118 extension alias PrioritizeTextures ############################################################################### # # Extension #21 # SGIS_detail_texture commands # ############################################################################### DetailTexFuncSGIS(target, n, points) return void param target TextureTarget in value param n SizeI in value param points Float32 in array [n*2] category SGIS_detail_texture glxflags SGI version 1.0 glxropcode 2051 extension offset 442 GetDetailTexFuncSGIS(target, points) return void param target TextureTarget in value param points Float32 out array [COMPSIZE(target)] category SGIS_detail_texture dlflags notlistable version 1.0 glxflags SGI glxvendorpriv 4096 extension offset 443 ############################################################################### # # Extension #22 # SGIS_sharpen_texture commands # ############################################################################### SharpenTexFuncSGIS(target, n, points) return void param target TextureTarget in value param n SizeI in value param points Float32 in array [n*2] category SGIS_sharpen_texture glxflags SGI version 1.0 glxropcode 2052 extension offset 444 GetSharpenTexFuncSGIS(target, points) return void param target TextureTarget in value param points Float32 out array [COMPSIZE(target)] category SGIS_sharpen_texture dlflags notlistable version 1.0 glxflags SGI glxvendorpriv 4097 extension offset 445 ############################################################################### # # EXT_packed_pixels commands # Extension #23 # ############################################################################### # (none) newcategory: EXT_packed_pixels ############################################################################### # # Extension #24 # SGIS_texture_lod commands # ############################################################################### # (none) newcategory: SGIS_texture_lod ############################################################################### # # Extension #25 # SGIS_multisample commands # ############################################################################### SampleMaskSGIS(value, invert) return void param value ClampedFloat32 in value param invert Boolean in value category SGIS_multisample version 1.1 glxropcode 2048 glxflags SGI extension alias SampleMaskEXT SamplePatternSGIS(pattern) return void param pattern SamplePatternSGIS in value category SGIS_multisample version 1.0 glxropcode 2049 glxflags SGI extension alias SamplePatternEXT ############################################################################### # # Extension #26 - no specification? # ############################################################################### ############################################################################### # # Extension #27 # EXT_rescale_normal commands # ############################################################################### # (none) newcategory: EXT_rescale_normal ############################################################################### # # Extension #28 - GLX_EXT_visual_info # Extension #29 - skipped # ############################################################################### ############################################################################### # # Extension #30 # EXT_vertex_array commands # ############################################################################### ArrayElementEXT(i) return void param i Int32 in value category EXT_vertex_array dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 extension alias ArrayElement ColorPointerEXT(size, type, stride, count, pointer) return void param size Int32 in value param type ColorPointerType in value param stride SizeI in value param count SizeI in value param pointer Void in array [COMPSIZE(size/type/stride/count)] retained category EXT_vertex_array dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 extension offset 448 DrawArraysEXT(mode, first, count) return void param mode BeginMode in value param first Int32 in value param count SizeI in value category EXT_vertex_array dlflags handcode glxflags client-handcode server-handcode EXT version 1.0 glxropcode 4116 extension alias DrawArrays EdgeFlagPointerEXT(stride, count, pointer) return void param stride SizeI in value param count SizeI in value param pointer Boolean in array [COMPSIZE(stride/count)] retained category EXT_vertex_array dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 extension offset 449 GetPointervEXT(pname, params) return void param pname GetPointervPName in value param params VoidPointer out array [1] category EXT_vertex_array dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 extension alias GetPointerv IndexPointerEXT(type, stride, count, pointer) return void param type IndexPointerType in value param stride SizeI in value param count SizeI in value param pointer Void in array [COMPSIZE(type/stride/count)] retained category EXT_vertex_array dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 extension offset 450 NormalPointerEXT(type, stride, count, pointer) return void param type NormalPointerType in value param stride SizeI in value param count SizeI in value param pointer Void in array [COMPSIZE(type/stride/count)] retained category EXT_vertex_array dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 extension offset 451 TexCoordPointerEXT(size, type, stride, count, pointer) return void param size Int32 in value param type TexCoordPointerType in value param stride SizeI in value param count SizeI in value param pointer Void in array [COMPSIZE(size/type/stride/count)] retained category EXT_vertex_array dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 extension offset 452 VertexPointerEXT(size, type, stride, count, pointer) return void param size Int32 in value param type VertexPointerType in value param stride SizeI in value param count SizeI in value param pointer Void in array [COMPSIZE(size/type/stride/count)] retained category EXT_vertex_array dlflags notlistable glxflags client-handcode server-handcode EXT version 1.0 extension offset 453 ############################################################################### # # Extension #31 # EXT_misc_attribute commands # ############################################################################### # (none) newcategory: EXT_misc_attribute ############################################################################### # # Extension #32 # SGIS_generate_mipmap commands # ############################################################################### # (none) newcategory: SGIS_generate_mipmap ############################################################################### # # Extension #33 # SGIX_clipmap commands # ############################################################################### # (none) newcategory: SGIX_clipmap ############################################################################### # # Extension #34 # SGIX_shadow commands # ############################################################################### # (none) newcategory: SGIX_shadow ############################################################################### # # Extension #35 # SGIS_texture_edge_clamp commands # ############################################################################### # (none) newcategory: SGIS_texture_edge_clamp ############################################################################### # # Extension #36 # SGIS_texture_border_clamp commands # ############################################################################### # (none) newcategory: SGIS_texture_border_clamp ############################################################################### # # Extension #37 # EXT_blend_minmax commands # ############################################################################### BlendEquationEXT(mode) return void param mode BlendEquationModeEXT in value category EXT_blend_minmax version 1.0 glxropcode 4097 glxflags EXT extension soft alias BlendEquation ############################################################################### # # Extension #38 # EXT_blend_subtract commands # ############################################################################### # (none) newcategory: EXT_blend_subtract ############################################################################### # # Extension #39 # EXT_blend_logic_op commands # ############################################################################### # (none) newcategory: EXT_blend_logic_op ############################################################################### # # Extension #40 - GLX_SGI_swap_control # Extension #41 - GLX_SGI_video_sync # Extension #42 - GLX_SGI_make_current_read # Extension #43 - GLX_SGIX_video_source # Extension #44 - GLX_EXT_visual_rating # ############################################################################### ############################################################################### # # Extension #45 # SGIX_interlace commands # ############################################################################### # (none) newcategory: SGIX_interlace ############################################################################### # # Extension #46 # SGIX_pixel_tiles commands # ############################################################################### # (none) newcategory: SGIX_pixel_tiles ############################################################################### # # Extension #47 - GLX_EXT_import_context # Extension #48 - skipped # Extension #49 - GLX_SGIX_fbconfig # Extension #50 - GLX_SGIX_pbuffer # ############################################################################### ############################################################################### # # Extension #51 # SGIX_texture_select commands # ############################################################################### # (none) newcategory: SGIX_texture_select ############################################################################### # # Extension #52 # SGIX_sprite commands # ############################################################################### SpriteParameterfSGIX(pname, param) return void param pname SpriteParameterNameSGIX in value param param CheckedFloat32 in value category SGIX_sprite version 1.0 glxflags SGI glxropcode 2060 extension offset 454 SpriteParameterfvSGIX(pname, params) return void param pname SpriteParameterNameSGIX in value param params CheckedFloat32 in array [COMPSIZE(pname)] category SGIX_sprite version 1.0 glxflags SGI glxropcode 2061 extension offset 455 SpriteParameteriSGIX(pname, param) return void param pname SpriteParameterNameSGIX in value param param CheckedInt32 in value category SGIX_sprite version 1.0 glxflags SGI glxropcode 2062 extension offset 456 SpriteParameterivSGIX(pname, params) return void param pname SpriteParameterNameSGIX in value param params CheckedInt32 in array [COMPSIZE(pname)] category SGIX_sprite version 1.0 glxflags SGI glxropcode 2063 extension offset 457 ############################################################################### # # Extension #53 # SGIX_texture_multi_buffer commands # ############################################################################### # (none) newcategory: SGIX_texture_multi_buffer ############################################################################### # # Extension #54 # EXT_point_parameters / SGIS_point_parameters commands # ############################################################################### PointParameterfEXT(pname, param) return void param pname PointParameterNameARB in value param param CheckedFloat32 in value category EXT_point_parameters version 1.0 glxflags SGI extension alias PointParameterfARB PointParameterfvEXT(pname, params) return void param pname PointParameterNameARB in value param params CheckedFloat32 in array [COMPSIZE(pname)] category EXT_point_parameters version 1.0 glxflags SGI extension alias PointParameterfvARB PointParameterfSGIS(pname, param) return void param pname PointParameterNameARB in value param param CheckedFloat32 in value category SGIS_point_parameters version 1.0 glxflags SGI extension alias PointParameterfARB PointParameterfvSGIS(pname, params) return void param pname PointParameterNameARB in value param params CheckedFloat32 in array [COMPSIZE(pname)] category SGIS_point_parameters version 1.0 glxflags SGI extension alias PointParameterfvARB ############################################################################### # # Extension #55 # SGIX_instruments commands # ############################################################################### GetInstrumentsSGIX() return Int32 dlflags notlistable category SGIX_instruments version 1.0 glxflags SGI glxvendorpriv 4102 extension offset 460 InstrumentsBufferSGIX(size, buffer) return void param size SizeI in value param buffer Int32 out array [size] retained dlflags notlistable category SGIX_instruments version 1.0 glxflags SGI glxvendorpriv 4103 extension offset 461 PollInstrumentsSGIX(marker_p) return Int32 param marker_p Int32 out array [1] dlflags notlistable category SGIX_instruments version 1.0 glxflags SGI glxvendorpriv 4104 extension offset 462 ReadInstrumentsSGIX(marker) return void param marker Int32 in value category SGIX_instruments version 1.0 glxflags SGI glxropcode 2077 extension offset 463 StartInstrumentsSGIX() return void category SGIX_instruments version 1.0 glxflags SGI glxropcode 2069 extension offset 464 StopInstrumentsSGIX(marker) return void param marker Int32 in value category SGIX_instruments version 1.0 glxflags SGI glxropcode 2070 extension offset 465 ############################################################################### # # Extension #56 # SGIX_texture_scale_bias commands # ############################################################################### # (none) newcategory: SGIX_texture_scale_bias ############################################################################### # # Extension #57 # SGIX_framezoom commands # ############################################################################### FrameZoomSGIX(factor) return void param factor CheckedInt32 in value category SGIX_framezoom version 1.0 glxflags SGI glxropcode 2072 extension offset 466 ############################################################################### # # Extension #58 # SGIX_tag_sample_buffer commands # ############################################################################### TagSampleBufferSGIX() return void category SGIX_tag_sample_buffer version 1.0 glxropcode 2050 glxflags SGI extension offset 467 ############################################################################### # # Extension #59 # SGIX_polynomial_ffd commands # ############################################################################### DeformationMap3dSGIX(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, w1, w2, wstride, worder, points) return void param target FfdTargetSGIX in value param u1 CoordD in value param u2 CoordD in value param ustride Int32 in value param uorder CheckedInt32 in value param v1 CoordD in value param v2 CoordD in value param vstride Int32 in value param vorder CheckedInt32 in value param w1 CoordD in value param w2 CoordD in value param wstride Int32 in value param worder CheckedInt32 in value param points CoordD in array [COMPSIZE(target/ustride/uorder/vstride/vorder/wstride/worder)] dlflags handcode category SGIX_polynomial_ffd version 1.0 glxflags SGI ignore glxropcode 2073 extension offset ? DeformationMap3fSGIX(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, w1, w2, wstride, worder, points) return void param target FfdTargetSGIX in value param u1 CoordF in value param u2 CoordF in value param ustride Int32 in value param uorder CheckedInt32 in value param v1 CoordF in value param v2 CoordF in value param vstride Int32 in value param vorder CheckedInt32 in value param w1 CoordF in value param w2 CoordF in value param wstride Int32 in value param worder CheckedInt32 in value param points CoordF in array [COMPSIZE(target/ustride/uorder/vstride/vorder/wstride/worder)] category SGIX_polynomial_ffd dlflags handcode version 1.0 glxflags SGI ignore glxropcode 2074 extension offset ? DeformSGIX(mask) return void param mask FfdMaskSGIX in value category SGIX_polynomial_ffd version 1.0 glxflags SGI ignore glxropcode 2075 extension offset ? LoadIdentityDeformationMapSGIX(mask) return void param mask FfdMaskSGIX in value category SGIX_polynomial_ffd version 1.0 glxflags SGI ignore glxropcode 2076 extension offset ? ############################################################################### # # Extension #60 # SGIX_reference_plane commands # ############################################################################### ReferencePlaneSGIX(equation) return void param equation Float64 in array [4] category SGIX_reference_plane version 1.0 glxflags SGI glxropcode 2071 extension offset 468 ############################################################################### # # Extension #61 # SGIX_flush_raster commands # ############################################################################### FlushRasterSGIX() return void category SGIX_flush_raster version 1.0 dlflags notlistable glxflags SGI glxvendorpriv 4105 extension offset 469 ############################################################################### # # Extension #62 - GLX_SGIX_cushion # ############################################################################### ############################################################################### # # Extension #63 # SGIX_depth_texture commands # ############################################################################### # (none) newcategory: SGIX_depth_texture ############################################################################### # # Extension #64 # SGIS_fog_function commands # ############################################################################### FogFuncSGIS(n, points) return void param n SizeI in value param points Float32 in array [n*2] category SGIS_fog_function version 1.1 glxflags SGI glxropcode 2067 extension offset # Need to insert GLX information GetFogFuncSGIS(points) return void param points Float32 out array [COMPSIZE()] category SGIS_fog_function version 1.1 dlflags notlistable glxflags ignore extension offset ############################################################################### # # Extension #65 # SGIX_fog_offset commands # ############################################################################### # (none) newcategory: SGIX_fog_offset ############################################################################### # # Extension #66 # HP_image_transform commands # ############################################################################### ImageTransformParameteriHP(target, pname, param) return void param target ImageTransformTargetHP in value param pname ImageTransformPNameHP in value param param Int32 in value category HP_image_transform version 1.1 glxropcode ? offset ? ImageTransformParameterfHP(target, pname, param) return void param target ImageTransformTargetHP in value param pname ImageTransformPNameHP in value param param Float32 in value category HP_image_transform version 1.1 glxropcode ? offset ? ImageTransformParameterivHP(target, pname, params) return void param target ImageTransformTargetHP in value param pname ImageTransformPNameHP in value param params Int32 in array [COMPSIZE(pname)] category HP_image_transform version 1.1 glxropcode ? offset ? ImageTransformParameterfvHP(target, pname, params) return void param target ImageTransformTargetHP in value param pname ImageTransformPNameHP in value param params Float32 in array [COMPSIZE(pname)] category HP_image_transform version 1.1 glxropcode ? offset ? GetImageTransformParameterivHP(target, pname, params) return void param target ImageTransformTargetHP in value param pname ImageTransformPNameHP in value param params Int32 out array [COMPSIZE(pname)] dlflags notlistable category HP_image_transform version 1.1 glxropcode ? offset ? GetImageTransformParameterfvHP(target, pname, params) return void param target ImageTransformTargetHP in value param pname ImageTransformPNameHP in value param params Float32 out array [COMPSIZE(pname)] category HP_image_transform version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #67 # HP_convolution_border_modes commands # ############################################################################### # (none) newcategory: HP_convolution_border_modes ############################################################################### # # Extension #68 # INGR_palette_buffer commands # ############################################################################### #@ (Intergraph hasn't provided a spec) ############################################################################### # # Extension #69 # SGIX_texture_add_env commands # ############################################################################### # (none) newcategory: SGIX_texture_add_env ############################################################################### # # Extension #70 - skipped # Extension #71 - skipped # Extension #72 - skipped # Extension #73 - skipped # ############################################################################### ############################################################################### # # Extension #74 # EXT_color_subtable commands # # This was probably never actually shipped as an EXT - just written up as a # reference for OpenGL 1.2 ARB_imaging. # ############################################################################### ColorSubTableEXT(target, start, count, format, type, data) return void param target ColorTableTarget in value param start SizeI in value param count SizeI in value param format PixelFormat in value param type PixelType in value param data Void in array [COMPSIZE(format/type/count)] category EXT_color_subtable version 1.2 alias ColorSubTable CopyColorSubTableEXT(target, start, x, y, width) return void param target ColorTableTarget in value param start SizeI in value param x WinCoord in value param y WinCoord in value param width SizeI in value category EXT_color_subtable version 1.2 alias CopyColorSubTable ############################################################################### # # Extension #75 - GLU_EXT_object_space_tess # ############################################################################### ############################################################################### # # Extension #76 # PGI_vertex_hints commands # ############################################################################### # (none) newcategory: PGI_vertex_hints ############################################################################### # # Extension #77 # PGI_misc_hints commands # ############################################################################### HintPGI(target, mode) return void param target HintTargetPGI in value param mode Int32 in value category PGI_misc_hints version 1.1 offset 544 ############################################################################### # # Extension #78 # EXT_paletted_texture commands # ############################################################################### ColorTableEXT(target, internalFormat, width, format, type, table) return void param target ColorTableTarget in value param internalFormat PixelInternalFormat in value param width SizeI in value param format PixelFormat in value param type PixelType in value param table Void in array [COMPSIZE(format/type/width)] category EXT_paletted_texture version 1.1 alias ColorTable GetColorTableEXT(target, format, type, data) return void param target ColorTableTarget in value param format PixelFormat in value param type PixelType in value param data Void out array [COMPSIZE(target/format/type)] category EXT_paletted_texture version 1.1 offset 550 GetColorTableParameterivEXT(target, pname, params) return void param target ColorTableTarget in value param pname GetColorTableParameterPName in value param params Int32 out array [COMPSIZE(pname)] category EXT_paletted_texture version 1.1 offset 551 GetColorTableParameterfvEXT(target, pname, params) return void param target ColorTableTarget in value param pname GetColorTableParameterPName in value param params Float32 out array [COMPSIZE(pname)] category EXT_paletted_texture version 1.1 offset 552 ############################################################################### # # Extension #79 # EXT_clip_volume_hint commands # ############################################################################### # (none) newcategory: EXT_clip_volume_hint ############################################################################### # # Extension #80 # SGIX_list_priority commands # ############################################################################### # @@@ Needs vendorpriv opcodes assigned GetListParameterfvSGIX(list, pname, params) return void param list List in value param pname ListParameterName in value param params CheckedFloat32 out array [COMPSIZE(pname)] dlflags notlistable glxflags ignore category SGIX_list_priority version 1.0 glxvendorpriv ? extension offset 470 # @@@ Needs vendorpriv opcodes assigned GetListParameterivSGIX(list, pname, params) return void param list List in value param pname ListParameterName in value param params CheckedInt32 out array [COMPSIZE(pname)] dlflags notlistable glxflags ignore category SGIX_list_priority version 1.0 glxvendorpriv ? extension offset 471 ListParameterfSGIX(list, pname, param) return void param list List in value param pname ListParameterName in value param param CheckedFloat32 in value dlflags notlistable glxflags ignore category SGIX_list_priority version 1.0 glxropcode 2078 extension offset 472 ListParameterfvSGIX(list, pname, params) return void param list List in value param pname ListParameterName in value param params CheckedFloat32 in array [COMPSIZE(pname)] dlflags notlistable glxflags ignore category SGIX_list_priority version 1.0 glxropcode 2079 extension offset 473 ListParameteriSGIX(list, pname, param) return void param list List in value param pname ListParameterName in value param param CheckedInt32 in value dlflags notlistable glxflags ignore category SGIX_list_priority version 1.0 glxropcode 2080 extension offset 474 ListParameterivSGIX(list, pname, params) return void param list List in value param pname ListParameterName in value param params CheckedInt32 in array [COMPSIZE(pname)] dlflags notlistable glxflags ignore category SGIX_list_priority version 1.0 glxropcode 2081 extension offset 475 ############################################################################### # # Extension #81 # SGIX_ir_instrument1 commands # ############################################################################### # (none) newcategory: SGIX_ir_instrument1 ############################################################################### # # Extension #82 # SGIX_calligraphic_fragment commands # ############################################################################### # (none) newcategory: SGIX_calligraphic_fragment ############################################################################### # # Extension #83 - GLX_SGIX_video_resize # ############################################################################### ############################################################################### # # Extension #84 # SGIX_texture_lod_bias commands # ############################################################################### # (none) newcategory: SGIX_texture_lod_bias ############################################################################### # # Extension #85 - skipped # Extension #86 - GLX_SGIX_dmbuffer # Extension #87 - skipped # Extension #88 - skipped # Extension #89 - skipped # ############################################################################### ############################################################################### # # Extension #90 # SGIX_shadow_ambient commands # ############################################################################### # (none) newcategory: SGIX_shadow_ambient ############################################################################### # # Extension #91 - GLX_SGIX_swap_group # Extension #92 - GLX_SGIX_swap_barrier # ############################################################################### ############################################################################### # # Extension #93 # EXT_index_texture commands # ############################################################################### # (none) newcategory: EXT_index_texture ############################################################################### # # Extension #94 # EXT_index_material commands # ############################################################################### IndexMaterialEXT(face, mode) return void param face MaterialFace in value param mode IndexMaterialParameterEXT in value category EXT_index_material version 1.1 extension soft glxflags ignore offset 538 ############################################################################### # # Extension #95 # EXT_index_func commands # ############################################################################### IndexFuncEXT(func, ref) return void param func IndexFunctionEXT in value param ref ClampedFloat32 in value category EXT_index_func version 1.1 extension soft glxflags ignore offset 539 ############################################################################### # # Extension #96 # EXT_index_array_formats commands # ############################################################################### # (none) newcategory: EXT_index_array_formats ############################################################################### # # Extension #97 # EXT_compiled_vertex_array commands # ############################################################################### LockArraysEXT(first, count) return void param first Int32 in value param count SizeI in value category EXT_compiled_vertex_array version 1.1 dlflags notlistable extension soft glxflags ignore offset 540 UnlockArraysEXT() return void category EXT_compiled_vertex_array version 1.1 dlflags notlistable extension soft glxflags ignore offset 541 ############################################################################### # # Extension #98 # EXT_cull_vertex commands # ############################################################################### CullParameterdvEXT(pname, params) return void param pname CullParameterEXT in value param params Float64 out array [4] category EXT_cull_vertex version 1.1 dlflags notlistable extension soft glxflags ignore offset 542 CullParameterfvEXT(pname, params) return void param pname CullParameterEXT in value param params Float32 out array [4] category EXT_cull_vertex version 1.1 dlflags notlistable extension soft glxflags ignore offset 543 ############################################################################### # # Extension #99 - skipped # Extension #100 - GLU_EXT_nurbs_tessellator # ############################################################################### ############################################################################### # # Extension #101 # SGIX_ycrcb commands # ############################################################################### # (none) newcategory: SGIX_ycrcb ############################################################################### # # Extension #102 # SGIX_fragment_lighting commands # ############################################################################### FragmentColorMaterialSGIX(face, mode) return void param face MaterialFace in value param mode MaterialParameter in value category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 476 FragmentLightfSGIX(light, pname, param) return void param light FragmentLightNameSGIX in value param pname FragmentLightParameterSGIX in value param param CheckedFloat32 in value category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 477 FragmentLightfvSGIX(light, pname, params) return void param light FragmentLightNameSGIX in value param pname FragmentLightParameterSGIX in value param params CheckedFloat32 in array [COMPSIZE(pname)] category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 478 FragmentLightiSGIX(light, pname, param) return void param light FragmentLightNameSGIX in value param pname FragmentLightParameterSGIX in value param param CheckedInt32 in value category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 479 FragmentLightivSGIX(light, pname, params) return void param light FragmentLightNameSGIX in value param pname FragmentLightParameterSGIX in value param params CheckedInt32 in array [COMPSIZE(pname)] category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 480 FragmentLightModelfSGIX(pname, param) return void param pname FragmentLightModelParameterSGIX in value param param CheckedFloat32 in value category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 481 FragmentLightModelfvSGIX(pname, params) return void param pname FragmentLightModelParameterSGIX in value param params CheckedFloat32 in array [COMPSIZE(pname)] category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 482 FragmentLightModeliSGIX(pname, param) return void param pname FragmentLightModelParameterSGIX in value param param CheckedInt32 in value category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 483 FragmentLightModelivSGIX(pname, params) return void param pname FragmentLightModelParameterSGIX in value param params CheckedInt32 in array [COMPSIZE(pname)] category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 484 FragmentMaterialfSGIX(face, pname, param) return void param face MaterialFace in value param pname MaterialParameter in value param param CheckedFloat32 in value category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 485 FragmentMaterialfvSGIX(face, pname, params) return void param face MaterialFace in value param pname MaterialParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 486 FragmentMaterialiSGIX(face, pname, param) return void param face MaterialFace in value param pname MaterialParameter in value param param CheckedInt32 in value category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 487 FragmentMaterialivSGIX(face, pname, params) return void param face MaterialFace in value param pname MaterialParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 488 GetFragmentLightfvSGIX(light, pname, params) return void param light FragmentLightNameSGIX in value param pname FragmentLightParameterSGIX in value param params Float32 out array [COMPSIZE(pname)] category SGIX_fragment_lighting dlflags notlistable glxflags ignore version 1.0 extension offset 489 GetFragmentLightivSGIX(light, pname, params) return void param light FragmentLightNameSGIX in value param pname FragmentLightParameterSGIX in value param params Int32 out array [COMPSIZE(pname)] category SGIX_fragment_lighting dlflags notlistable glxflags ignore version 1.0 extension offset 490 GetFragmentMaterialfvSGIX(face, pname, params) return void param face MaterialFace in value param pname MaterialParameter in value param params Float32 out array [COMPSIZE(pname)] category SGIX_fragment_lighting dlflags notlistable glxflags ignore version 1.0 extension offset 491 GetFragmentMaterialivSGIX(face, pname, params) return void param face MaterialFace in value param pname MaterialParameter in value param params Int32 out array [COMPSIZE(pname)] category SGIX_fragment_lighting dlflags notlistable glxflags ignore version 1.0 extension offset 492 LightEnviSGIX(pname, param) return void param pname LightEnvParameterSGIX in value param param CheckedInt32 in value category SGIX_fragment_lighting glxflags ignore version 1.0 extension offset 493 ############################################################################### # # Extension #103 - skipped # Extension #104 - skipped # Extension #105 - skipped # Extension #106 - skipped # Extension #107 - skipped # Extension #108 - skipped # Extension #109 - skipped # ############################################################################### ############################################################################### # # Extension #110 # IBM_rasterpos_clip commands # ############################################################################### # (none) newcategory: IBM_rasterpos_clip ############################################################################### # # Extension #111 # HP_texture_lighting commands # ############################################################################### # (none) newcategory: HP_texture_lighting ############################################################################### # # Extension #112 # EXT_draw_range_elements commands # ############################################################################### # Spec entries to be written DrawRangeElementsEXT(mode, start, end, count, type, indices) return void param mode BeginMode in value param start UInt32 in value param end UInt32 in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] category EXT_draw_range_elements dlflags handcode glxflags client-handcode client-intercept server-handcode version 1.1 alias DrawRangeElements ############################################################################### # # Extension #113 # WIN_phong_shading commands # ############################################################################### # (none) newcategory: WIN_phong_shading ############################################################################### # # Extension #114 # WIN_specular_fog commands # ############################################################################### # (none) newcategory: WIN_specular_fog ############################################################################### # # Extension #115 - skipped # Extension #116 - skipped # ############################################################################### ############################################################################### # # Extension #117 # EXT_light_texture commands # ############################################################################### # Spec entries to be written ApplyTextureEXT(mode) return void param mode LightTextureModeEXT in value category EXT_light_texture version 1.1 glxropcode ? offset ? TextureLightEXT(pname) return void param pname LightTexturePNameEXT in value category EXT_light_texture version 1.1 glxropcode ? offset ? TextureMaterialEXT(face, mode) return void param face MaterialFace in value param mode MaterialParameter in value category EXT_light_texture version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #118 - skipped # ############################################################################### ############################################################################### # # Extension #119 # SGIX_blend_alpha_minmax commands # ############################################################################### # (none) newcategory: SGIX_blend_alpha_minmax ############################################################################### # # Extension #120 - skipped # Extension #121 - skipped # Extension #122 - skipped # Extension #123 - skipped # Extension #124 - skipped # Extension #125 - skipped # Extension #126 - skipped # Extension #127 - skipped # Extension #128 - skipped # ############################################################################### ############################################################################### # # Extension #129 # EXT_bgra commands # ############################################################################### # (none) newcategory: EXT_bgra ############################################################################### # # Extension #130 - skipped # Extension #131 - skipped # ############################################################################### ############################################################################### # # Extension #132 # SGIX_async commands # ############################################################################### AsyncMarkerSGIX(marker) return void param marker UInt32 in value category SGIX_async version 1.0 glxflags ignore extension offset ? FinishAsyncSGIX(markerp) return Int32 param markerp UInt32 out array [1] category SGIX_async version 1.0 dlflags notlistable glxflags ignore extension offset ? PollAsyncSGIX(markerp) return Int32 param markerp UInt32 out array [1] category SGIX_async version 1.0 dlflags notlistable glxflags ignore extension offset ? GenAsyncMarkersSGIX(range) return UInt32 param range SizeI in value category SGIX_async version 1.0 dlflags notlistable glxflags ignore extension offset ? DeleteAsyncMarkersSGIX(marker, range) return void param marker UInt32 in value param range SizeI in value category SGIX_async version 1.0 dlflags notlistable glxflags ignore extension offset ? IsAsyncMarkerSGIX(marker) return Boolean param marker UInt32 in value category SGIX_async version 1.0 dlflags notlistable glxflags ignore extension offset ? ############################################################################### # # Extension #133 # SGIX_async_pixel commands # ############################################################################### # (none) newcategory: SGIX_async_pixel ############################################################################### # # Extension #134 # SGIX_async_histogram commands # ############################################################################### # (none) newcategory: SGIX_async_histogram ############################################################################### # # Extension #135 - skipped (INTEL_texture_scissor was never implemented) # ############################################################################### ############################################################################### # # Extension #136 # INTEL_parallel_arrays commands # ############################################################################### VertexPointervINTEL(size, type, pointer) return void param size Int32 in value param type VertexPointerType in value param pointer VoidPointer in array [4] retained category INTEL_parallel_arrays dlflags notlistable glxflags client-handcode server-handcode EXT version 1.1 offset ? NormalPointervINTEL(type, pointer) return void param type NormalPointerType in value param pointer VoidPointer in array [4] retained category INTEL_parallel_arrays dlflags notlistable glxflags client-handcode server-handcode EXT version 1.1 offset ? ColorPointervINTEL(size, type, pointer) return void param size Int32 in value param type VertexPointerType in value param pointer VoidPointer in array [4] retained category INTEL_parallel_arrays dlflags notlistable glxflags client-handcode server-handcode EXT version 1.1 offset ? TexCoordPointervINTEL(size, type, pointer) return void param size Int32 in value param type VertexPointerType in value param pointer VoidPointer in array [4] retained category INTEL_parallel_arrays dlflags notlistable glxflags client-handcode server-handcode EXT version 1.1 offset ? ############################################################################### # # Extension #137 # HP_occlusion_test commands # ############################################################################### # (none) newcategory: HP_occlusion_test ############################################################################### # # Extension #138 # EXT_pixel_transform commands # ############################################################################### PixelTransformParameteriEXT(target, pname, param) return void param target PixelTransformTargetEXT in value param pname PixelTransformPNameEXT in value param param Int32 in value category EXT_pixel_transform version 1.1 glxropcode ? offset ? PixelTransformParameterfEXT(target, pname, param) return void param target PixelTransformTargetEXT in value param pname PixelTransformPNameEXT in value param param Float32 in value category EXT_pixel_transform version 1.1 glxropcode ? offset ? PixelTransformParameterivEXT(target, pname, params) return void param target PixelTransformTargetEXT in value param pname PixelTransformPNameEXT in value param params Int32 in array [1] category EXT_pixel_transform version 1.1 glxropcode ? offset ? PixelTransformParameterfvEXT(target, pname, params) return void param target PixelTransformTargetEXT in value param pname PixelTransformPNameEXT in value param params Float32 in array [1] category EXT_pixel_transform version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #139 # EXT_pixel_transform_color_table commands # ############################################################################### # (none) newcategory: EXT_pixel_transform_color_table ############################################################################### # # Extension #140 - skipped # ############################################################################### ############################################################################### # # Extension #141 # EXT_shared_texture_palette commands # ############################################################################### # (none) newcategory: EXT_shared_texture_palette ############################################################################### # # Extension #142 - GLX_SGIS_blended_overlay # Extension #143 - GLX_SGIS_shared_multisample # ############################################################################### ############################################################################### # # Extension #144 # EXT_separate_specular_color commands # ############################################################################### # (none) newcategory: EXT_separate_specular_color ############################################################################### # # Extension #145 # EXT_secondary_color commands # ############################################################################### SecondaryColor3bEXT(red, green, blue) return void param red ColorB in value param green ColorB in value param blue ColorB in value category EXT_secondary_color vectorequiv SecondaryColor3bvEXT version 1.1 alias SecondaryColor3b SecondaryColor3bvEXT(v) return void param v ColorB in array [3] category EXT_secondary_color version 1.1 glxropcode 4126 alias SecondaryColor3bv SecondaryColor3dEXT(red, green, blue) return void param red ColorD in value param green ColorD in value param blue ColorD in value category EXT_secondary_color vectorequiv SecondaryColor3dvEXT version 1.1 alias SecondaryColor3d SecondaryColor3dvEXT(v) return void param v ColorD in array [3] category EXT_secondary_color version 1.1 glxropcode 4130 alias SecondaryColor3dv SecondaryColor3fEXT(red, green, blue) return void param red ColorF in value param green ColorF in value param blue ColorF in value category EXT_secondary_color vectorequiv SecondaryColor3fvEXT version 1.1 alias SecondaryColor3f SecondaryColor3fvEXT(v) return void param v ColorF in array [3] category EXT_secondary_color version 1.1 glxropcode 4129 alias SecondaryColor3fv SecondaryColor3iEXT(red, green, blue) return void param red ColorI in value param green ColorI in value param blue ColorI in value category EXT_secondary_color vectorequiv SecondaryColor3ivEXT version 1.1 alias SecondaryColor3i SecondaryColor3ivEXT(v) return void param v ColorI in array [3] category EXT_secondary_color version 1.1 glxropcode 4128 offset 568 alias SecondaryColor3iv SecondaryColor3sEXT(red, green, blue) return void param red ColorS in value param green ColorS in value param blue ColorS in value category EXT_secondary_color vectorequiv SecondaryColor3svEXT version 1.1 alias SecondaryColor3s SecondaryColor3svEXT(v) return void param v ColorS in array [3] category EXT_secondary_color version 1.1 glxropcode 4127 alias SecondaryColor3sv SecondaryColor3ubEXT(red, green, blue) return void param red ColorUB in value param green ColorUB in value param blue ColorUB in value category EXT_secondary_color vectorequiv SecondaryColor3ubvEXT version 1.1 alias SecondaryColor3ub SecondaryColor3ubvEXT(v) return void param v ColorUB in array [3] category EXT_secondary_color version 1.1 glxropcode 4131 alias SecondaryColor3ubv SecondaryColor3uiEXT(red, green, blue) return void param red ColorUI in value param green ColorUI in value param blue ColorUI in value category EXT_secondary_color vectorequiv SecondaryColor3uivEXT version 1.1 alias SecondaryColor3ui SecondaryColor3uivEXT(v) return void param v ColorUI in array [3] category EXT_secondary_color version 1.1 glxropcode 4133 alias SecondaryColor3uiv SecondaryColor3usEXT(red, green, blue) return void param red ColorUS in value param green ColorUS in value param blue ColorUS in value category EXT_secondary_color vectorequiv SecondaryColor3usvEXT version 1.1 alias SecondaryColor3us SecondaryColor3usvEXT(v) return void param v ColorUS in array [3] category EXT_secondary_color version 1.1 glxropcode 4132 alias SecondaryColor3usv SecondaryColorPointerEXT(size, type, stride, pointer) return void param size Int32 in value param type ColorPointerType in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained category EXT_secondary_color dlflags notlistable glxflags client-handcode server-handcode EXT version 1.1 extension alias SecondaryColorPointer ############################################################################### # # Extension #146 # EXT_texture_env commands # ############################################################################### # Dead extension - never implemented (removed from registry!) # (none) # newcategory: EXT_texture_env ############################################################################### # # Extension #147 # EXT_texture_perturb_normal commands # ############################################################################### TextureNormalEXT(mode) return void param mode TextureNormalModeEXT in value category EXT_texture_perturb_normal version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #148 # EXT_multi_draw_arrays commands # ############################################################################### # first and count are really 'in' MultiDrawArraysEXT(mode, first, count, primcount) return void param mode BeginMode in value param first Int32 out array [COMPSIZE(primcount)] param count SizeI out array [COMPSIZE(primcount)] param primcount SizeI in value category EXT_multi_draw_arrays version 1.1 glxropcode ? alias MultiDrawArrays MultiDrawElementsEXT(mode, count, type, indices, primcount) return void param mode BeginMode in value param count SizeI in array [COMPSIZE(primcount)] param type DrawElementsType in value param indices VoidPointer in array [COMPSIZE(primcount)] param primcount SizeI in value category EXT_multi_draw_arrays version 1.1 glxropcode ? alias MultiDrawElements ############################################################################### # # Extension #149 # EXT_fog_coord commands # ############################################################################### FogCoordfEXT(coord) return void param coord CoordF in value category EXT_fog_coord vectorequiv FogCoordfvEXT version 1.1 alias FogCoordf FogCoordfvEXT(coord) return void param coord CoordF in array [1] category EXT_fog_coord version 1.1 glxropcode 4124 alias FogCoordfv FogCoorddEXT(coord) return void param coord CoordD in value category EXT_fog_coord vectorequiv FogCoorddvEXT version 1.1 alias FogCoordd FogCoorddvEXT(coord) return void param coord CoordD in array [1] category EXT_fog_coord version 1.1 glxropcode 4125 alias FogCoorddv FogCoordPointerEXT(type, stride, pointer) return void param type FogPointerTypeEXT in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category EXT_fog_coord dlflags notlistable version 1.1 glxflags client-handcode server-handcode EXT alias FogCoordPointer ############################################################################### # # Extension #150 - skipped # Extension #151 - skipped # Extension #152 - skipped # Extension #153 - skipped # Extension #154 - skipped # ############################################################################### ############################################################################### # # Extension #155 # REND_screen_coordinates commands # ############################################################################### # (none) newcategory: REND_screen_coordinates ############################################################################### # # Extension #156 # EXT_coordinate_frame commands # ############################################################################### Tangent3bEXT(tx, ty, tz) return void param tx Int8 in value param ty Int8 in value param tz Int8 in value category EXT_coordinate_frame vectorequiv Tangent3bvEXT version 1.1 offset ? Tangent3bvEXT(v) return void param v Int8 in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Tangent3dEXT(tx, ty, tz) return void param tx CoordD in value param ty CoordD in value param tz CoordD in value category EXT_coordinate_frame vectorequiv Tangent3dvEXT version 1.1 offset ? Tangent3dvEXT(v) return void param v CoordD in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Tangent3fEXT(tx, ty, tz) return void param tx CoordF in value param ty CoordF in value param tz CoordF in value category EXT_coordinate_frame vectorequiv Tangent3fvEXT version 1.1 offset ? Tangent3fvEXT(v) return void param v CoordF in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Tangent3iEXT(tx, ty, tz) return void param tx Int32 in value param ty Int32 in value param tz Int32 in value category EXT_coordinate_frame vectorequiv Tangent3ivEXT version 1.1 offset ? Tangent3ivEXT(v) return void param v Int32 in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Tangent3sEXT(tx, ty, tz) return void param tx Int16 in value param ty Int16 in value param tz Int16 in value category EXT_coordinate_frame vectorequiv Tangent3svEXT version 1.1 offset ? Tangent3svEXT(v) return void param v Int16 in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Binormal3bEXT(bx, by, bz) return void param bx Int8 in value param by Int8 in value param bz Int8 in value category EXT_coordinate_frame vectorequiv Binormal3bvEXT version 1.1 offset ? Binormal3bvEXT(v) return void param v Int8 in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Binormal3dEXT(bx, by, bz) return void param bx CoordD in value param by CoordD in value param bz CoordD in value category EXT_coordinate_frame vectorequiv Binormal3dvEXT version 1.1 offset ? Binormal3dvEXT(v) return void param v CoordD in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Binormal3fEXT(bx, by, bz) return void param bx CoordF in value param by CoordF in value param bz CoordF in value category EXT_coordinate_frame vectorequiv Binormal3fvEXT version 1.1 offset ? Binormal3fvEXT(v) return void param v CoordF in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Binormal3iEXT(bx, by, bz) return void param bx Int32 in value param by Int32 in value param bz Int32 in value category EXT_coordinate_frame vectorequiv Binormal3ivEXT version 1.1 offset ? Binormal3ivEXT(v) return void param v Int32 in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? Binormal3sEXT(bx, by, bz) return void param bx Int16 in value param by Int16 in value param bz Int16 in value category EXT_coordinate_frame vectorequiv Binormal3svEXT version 1.1 offset ? Binormal3svEXT(v) return void param v Int16 in array [3] category EXT_coordinate_frame version 1.1 glxropcode ? offset ? TangentPointerEXT(type, stride, pointer) return void param type TangentPointerTypeEXT in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category EXT_coordinate_frame dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 offset ? BinormalPointerEXT(type, stride, pointer) return void param type BinormalPointerTypeEXT in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category EXT_coordinate_frame dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.1 offset ? ############################################################################### # # Extension #157 - skipped # ############################################################################### ############################################################################### # # Extension #158 # EXT_texture_env_combine commands # ############################################################################### # (none) newcategory: EXT_texture_env_combine ############################################################################### # # Extension #159 # APPLE_specular_vector commands # ############################################################################### # (none) newcategory: APPLE_specular_vector ############################################################################### # # Extension #160 # APPLE_transform_hint commands # ############################################################################### # (none) newcategory: APPLE_transform_hint ############################################################################### # # Extension #161 # SGIX_fog_scale commands # ############################################################################### # (none) newcategory: SGIX_fog_scale ############################################################################### # # Extension #162 - skipped # ############################################################################### ############################################################################### # # Extension #163 # SUNX_constant_data commands # ############################################################################### FinishTextureSUNX() return void category SUNX_constant_data version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #164 # SUN_global_alpha commands # ############################################################################### GlobalAlphaFactorbSUN(factor) return void param factor Int8 in value category SUN_global_alpha version 1.1 glxropcode ? offset ? GlobalAlphaFactorsSUN(factor) return void param factor Int16 in value category SUN_global_alpha version 1.1 glxropcode ? offset ? GlobalAlphaFactoriSUN(factor) return void param factor Int32 in value category SUN_global_alpha version 1.1 glxropcode ? offset ? GlobalAlphaFactorfSUN(factor) return void param factor Float32 in value category SUN_global_alpha version 1.1 glxropcode ? offset ? GlobalAlphaFactordSUN(factor) return void param factor Float64 in value category SUN_global_alpha version 1.1 glxropcode ? offset ? GlobalAlphaFactorubSUN(factor) return void param factor UInt8 in value category SUN_global_alpha version 1.1 glxropcode ? offset ? GlobalAlphaFactorusSUN(factor) return void param factor UInt16 in value category SUN_global_alpha version 1.1 glxropcode ? offset ? GlobalAlphaFactoruiSUN(factor) return void param factor UInt32 in value category SUN_global_alpha version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #165 # SUN_triangle_list commands # ############################################################################### ReplacementCodeuiSUN(code) return void param code UInt32 in value category SUN_triangle_list version 1.1 glxropcode ? offset ? ReplacementCodeusSUN(code) return void param code UInt16 in value category SUN_triangle_list version 1.1 glxropcode ? offset ? ReplacementCodeubSUN(code) return void param code UInt8 in value category SUN_triangle_list version 1.1 glxropcode ? offset ? ReplacementCodeuivSUN(code) return void param code UInt32 in array [COMPSIZE()] category SUN_triangle_list version 1.1 glxropcode ? offset ? ReplacementCodeusvSUN(code) return void param code UInt16 in array [COMPSIZE()] category SUN_triangle_list version 1.1 glxropcode ? offset ? ReplacementCodeubvSUN(code) return void param code UInt8 in array [COMPSIZE()] category SUN_triangle_list version 1.1 glxropcode ? offset ? ReplacementCodePointerSUN(type, stride, pointer) return void param type ReplacementCodeTypeSUN in value param stride SizeI in value param pointer VoidPointer in array [COMPSIZE(type/stride)] retained category SUN_triangle_list version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #166 # SUN_vertex commands # ############################################################################### Color4ubVertex2fSUN(r, g, b, a, x, y) return void param r UInt8 in value param g UInt8 in value param b UInt8 in value param a UInt8 in value param x Float32 in value param y Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? Color4ubVertex2fvSUN(c, v) return void param c UInt8 in array [4] param v Float32 in array [2] category SUN_vertex version 1.1 glxropcode ? offset ? Color4ubVertex3fSUN(r, g, b, a, x, y, z) return void param r UInt8 in value param g UInt8 in value param b UInt8 in value param a UInt8 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? Color4ubVertex3fvSUN(c, v) return void param c UInt8 in array [4] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? Color3fVertex3fSUN(r, g, b, x, y, z) return void param r Float32 in value param g Float32 in value param b Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? Color3fVertex3fvSUN(c, v) return void param c Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? Normal3fVertex3fSUN(nx, ny, nz, x, y, z) return void param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? Normal3fVertex3fvSUN(n, v) return void param n Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? Color4fNormal3fVertex3fSUN(r, g, b, a, nx, ny, nz, x, y, z) return void param r Float32 in value param g Float32 in value param b Float32 in value param a Float32 in value param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? Color4fNormal3fVertex3fvSUN(c, n, v) return void param c Float32 in array [4] param n Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fVertex3fSUN(s, t, x, y, z) return void param s Float32 in value param t Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fVertex3fvSUN(tc, v) return void param tc Float32 in array [2] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord4fVertex4fSUN(s, t, p, q, x, y, z, w) return void param s Float32 in value param t Float32 in value param p Float32 in value param q Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord4fVertex4fvSUN(tc, v) return void param tc Float32 in array [4] param v Float32 in array [4] category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fColor4ubVertex3fSUN(s, t, r, g, b, a, x, y, z) return void param s Float32 in value param t Float32 in value param r UInt8 in value param g UInt8 in value param b UInt8 in value param a UInt8 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fColor4ubVertex3fvSUN(tc, c, v) return void param tc Float32 in array [2] param c UInt8 in array [4] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fColor3fVertex3fSUN(s, t, r, g, b, x, y, z) return void param s Float32 in value param t Float32 in value param r Float32 in value param g Float32 in value param b Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fColor3fVertex3fvSUN(tc, c, v) return void param tc Float32 in array [2] param c Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fNormal3fVertex3fSUN(s, t, nx, ny, nz, x, y, z) return void param s Float32 in value param t Float32 in value param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fNormal3fVertex3fvSUN(tc, n, v) return void param tc Float32 in array [2] param n Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fColor4fNormal3fVertex3fSUN(s, t, r, g, b, a, nx, ny, nz, x, y, z) return void param s Float32 in value param t Float32 in value param r Float32 in value param g Float32 in value param b Float32 in value param a Float32 in value param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord2fColor4fNormal3fVertex3fvSUN(tc, c, n, v) return void param tc Float32 in array [2] param c Float32 in array [4] param n Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord4fColor4fNormal3fVertex4fSUN(s, t, p, q, r, g, b, a, nx, ny, nz, x, y, z, w) return void param s Float32 in value param t Float32 in value param p Float32 in value param q Float32 in value param r Float32 in value param g Float32 in value param b Float32 in value param a Float32 in value param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? TexCoord4fColor4fNormal3fVertex4fvSUN(tc, c, n, v) return void param tc Float32 in array [4] param c Float32 in array [4] param n Float32 in array [3] param v Float32 in array [4] category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiVertex3fSUN(rc, x, y, z) return void param rc ReplacementCodeSUN in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiVertex3fvSUN(rc, v) return void param rc ReplacementCodeSUN in array [1] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiColor4ubVertex3fSUN(rc, r, g, b, a, x, y, z) return void param rc ReplacementCodeSUN in value param r UInt8 in value param g UInt8 in value param b UInt8 in value param a UInt8 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiColor4ubVertex3fvSUN(rc, c, v) return void param rc ReplacementCodeSUN in array [1] param c UInt8 in array [4] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiColor3fVertex3fSUN(rc, r, g, b, x, y, z) return void param rc ReplacementCodeSUN in value param r Float32 in value param g Float32 in value param b Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiColor3fVertex3fvSUN(rc, c, v) return void param rc ReplacementCodeSUN in array [1] param c Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiNormal3fVertex3fSUN(rc, nx, ny, nz, x, y, z) return void param rc ReplacementCodeSUN in value param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiNormal3fVertex3fvSUN(rc, n, v) return void param rc ReplacementCodeSUN in array [1] param n Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiColor4fNormal3fVertex3fSUN(rc, r, g, b, a, nx, ny, nz, x, y, z) return void param rc ReplacementCodeSUN in value param r Float32 in value param g Float32 in value param b Float32 in value param a Float32 in value param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiColor4fNormal3fVertex3fvSUN(rc, c, n, v) return void param rc ReplacementCodeSUN in array [1] param c Float32 in array [4] param n Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiTexCoord2fVertex3fSUN(rc, s, t, x, y, z) return void param rc ReplacementCodeSUN in value param s Float32 in value param t Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiTexCoord2fVertex3fvSUN(rc, tc, v) return void param rc ReplacementCodeSUN in array [1] param tc Float32 in array [2] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN(rc, s, t, nx, ny, nz, x, y, z) return void param rc ReplacementCodeSUN in value param s Float32 in value param t Float32 in value param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN(rc, tc, n, v) return void param rc ReplacementCodeSUN in array [1] param tc Float32 in array [2] param n Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN(rc, s, t, r, g, b, a, nx, ny, nz, x, y, z) return void param rc ReplacementCodeSUN in value param s Float32 in value param t Float32 in value param r Float32 in value param g Float32 in value param b Float32 in value param a Float32 in value param nx Float32 in value param ny Float32 in value param nz Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category SUN_vertex version 1.1 glxropcode ? offset ? ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN(rc, tc, c, n, v) return void param rc ReplacementCodeSUN in array [1] param tc Float32 in array [2] param c Float32 in array [4] param n Float32 in array [3] param v Float32 in array [3] category SUN_vertex version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #167 - WGL_EXT_display_color_table # Extension #168 - WGL_EXT_extensions_string # Extension #169 - WGL_EXT_make_current_read # Extension #170 - WGL_EXT_pixel_format # Extension #171 - WGL_EXT_pbuffer # Extension #172 - WGL_EXT_swap_control # ############################################################################### ############################################################################### # # Extension #173 # EXT_blend_func_separate commands (also INGR_blend_func_separate) # ############################################################################### BlendFuncSeparateEXT(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha) return void param sfactorRGB BlendFuncSeparateParameterEXT in value param dfactorRGB BlendFuncSeparateParameterEXT in value param sfactorAlpha BlendFuncSeparateParameterEXT in value param dfactorAlpha BlendFuncSeparateParameterEXT in value category EXT_blend_func_separate glxropcode 4134 version 1.0 extension alias BlendFuncSeparate BlendFuncSeparateINGR(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha) return void param sfactorRGB BlendFuncSeparateParameterEXT in value param dfactorRGB BlendFuncSeparateParameterEXT in value param sfactorAlpha BlendFuncSeparateParameterEXT in value param dfactorAlpha BlendFuncSeparateParameterEXT in value category INGR_blend_func_separate glxropcode 4134 version 1.0 extension alias BlendFuncSeparateEXT ############################################################################### # # Extension #174 # INGR_color_clamp commands # ############################################################################### # (none) newcategory: INGR_color_clamp ############################################################################### # # Extension #175 # INGR_interlace_read commands # ############################################################################### # (none) newcategory: INGR_interlace_read ############################################################################### # # Extension #176 # EXT_stencil_wrap commands # ############################################################################### # (none) newcategory: EXT_stencil_wrap ############################################################################### # # Extension #177 - skipped # ############################################################################### ############################################################################### # # Extension #178 # EXT_422_pixels commands # ############################################################################### # (none) newcategory: EXT_422_pixels ############################################################################### # # Extension #179 # NV_texgen_reflection commands # ############################################################################### # (none) newcategory: NV_texgen_reflection ############################################################################### # # Extension #??? # @ EXT_texture_cube_map commands # ############################################################################### # (none) ############################################################################### # # Extension #180 - skipped # Extension #181 - skipped # ############################################################################### ############################################################################### # # Extension #182 # SUN_convolution_border_modes commands # ############################################################################### # (none) newcategory: SUN_convolution_border_modes ############################################################################### # # Extension #183 - GLX_SUN_get_transparent_index # Extension #184 - skipped # ############################################################################### ############################################################################### # # Extension #185 # EXT_texture_env_add commands # ############################################################################### # (none) newcategory: EXT_texture_env_add ############################################################################### # # Extension #186 # EXT_texture_lod_bias commands # ############################################################################### # (none) newcategory: EXT_texture_lod_bias ############################################################################### # # Extension #187 # EXT_texture_filter_anisotropic commands # ############################################################################### # (none) newcategory: EXT_texture_filter_anisotropic ############################################################################### # # Extension #188 # EXT_vertex_weighting commands # ############################################################################### # GLX stuff to be written VertexWeightfEXT(weight) return void param weight Float32 in value category EXT_vertex_weighting vectorequiv VertexWeightfvEXT version 1.1 extension soft WINSOFT NV10 glxflags ignore offset 494 VertexWeightfvEXT(weight) return void param weight Float32 in array [1] category EXT_vertex_weighting version 1.1 extension soft WINSOFT NV10 glxropcode 4135 glxflags ignore offset 495 VertexWeightPointerEXT(size, type, stride, pointer) return void param size SizeI in value param type VertexWeightPointerTypeEXT in value param stride SizeI in value param pointer Void in array [COMPSIZE(type/stride)] retained category EXT_vertex_weighting version 1.1 extension soft WINSOFT NV10 dlflags notlistable glxflags ignore offset 496 ############################################################################### # # Extension #189 # NV_light_max_exponent commands # ############################################################################### # (none) newcategory: NV_light_max_exponent ############################################################################### # # Extension #190 # NV_vertex_array_range commands # ############################################################################### FlushVertexArrayRangeNV() return void category NV_vertex_array_range version 1.1 extension soft WINSOFT NV10 dlflags notlistable glxflags client-handcode server-handcode ignore offset 497 VertexArrayRangeNV(length, pointer) return void param length SizeI in value param pointer Void in array [COMPSIZE(length)] retained category NV_vertex_array_range version 1.1 extension soft WINSOFT NV10 dlflags notlistable glxflags client-handcode server-handcode ignore offset 498 ############################################################################### # # Extension #191 # NV_register_combiners commands # ############################################################################### CombinerParameterfvNV(pname, params) return void param pname CombinerParameterNV in value param params CheckedFloat32 in array [COMPSIZE(pname)] category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxropcode 4137 glxflags ignore offset 499 CombinerParameterfNV(pname, param) return void param pname CombinerParameterNV in value param param Float32 in value category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxropcode 4136 glxflags ignore offset 500 CombinerParameterivNV(pname, params) return void param pname CombinerParameterNV in value param params CheckedInt32 in array [COMPSIZE(pname)] category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxropcode 4139 glxflags ignore offset 501 CombinerParameteriNV(pname, param) return void param pname CombinerParameterNV in value param param Int32 in value category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxropcode 4138 glxflags ignore offset 502 CombinerInputNV(stage, portion, variable, input, mapping, componentUsage) return void param stage CombinerStageNV in value param portion CombinerPortionNV in value param variable CombinerVariableNV in value param input CombinerRegisterNV in value param mapping CombinerMappingNV in value param componentUsage CombinerComponentUsageNV in value category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxropcode 4140 glxflags ignore offset 503 CombinerOutputNV(stage, portion, abOutput, cdOutput, sumOutput, scale, bias, abDotProduct, cdDotProduct, muxSum) return void param stage CombinerStageNV in value param portion CombinerPortionNV in value param abOutput CombinerRegisterNV in value param cdOutput CombinerRegisterNV in value param sumOutput CombinerRegisterNV in value param scale CombinerScaleNV in value param bias CombinerBiasNV in value param abDotProduct Boolean in value param cdDotProduct Boolean in value param muxSum Boolean in value category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxropcode 4141 glxflags ignore offset 504 FinalCombinerInputNV(variable, input, mapping, componentUsage) return void param variable CombinerVariableNV in value param input CombinerRegisterNV in value param mapping CombinerMappingNV in value param componentUsage CombinerComponentUsageNV in value category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxropcode 4142 glxflags ignore offset 505 GetCombinerInputParameterfvNV(stage, portion, variable, pname, params) return void param stage CombinerStageNV in value param portion CombinerPortionNV in value param variable CombinerVariableNV in value param pname CombinerParameterNV in value param params Float32 out array [COMPSIZE(pname)] dlflags notlistable category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxvendorpriv 1270 glxflags ignore offset 506 GetCombinerInputParameterivNV(stage, portion, variable, pname, params) return void param stage CombinerStageNV in value param portion CombinerPortionNV in value param variable CombinerVariableNV in value param pname CombinerParameterNV in value param params Int32 out array [COMPSIZE(pname)] dlflags notlistable category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxvendorpriv 1271 glxflags ignore offset 507 GetCombinerOutputParameterfvNV(stage, portion, pname, params) return void param stage CombinerStageNV in value param portion CombinerPortionNV in value param pname CombinerParameterNV in value param params Float32 out array [COMPSIZE(pname)] dlflags notlistable category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxvendorpriv 1272 glxflags ignore offset 508 GetCombinerOutputParameterivNV(stage, portion, pname, params) return void param stage CombinerStageNV in value param portion CombinerPortionNV in value param pname CombinerParameterNV in value param params Int32 out array [COMPSIZE(pname)] dlflags notlistable category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxvendorpriv 1273 glxflags ignore offset 509 GetFinalCombinerInputParameterfvNV(variable, pname, params) return void param variable CombinerVariableNV in value param pname CombinerParameterNV in value param params Float32 out array [COMPSIZE(pname)] dlflags notlistable category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxvendorpriv 1274 glxflags ignore offset 510 GetFinalCombinerInputParameterivNV(variable, pname, params) return void param variable CombinerVariableNV in value param pname CombinerParameterNV in value param params Int32 out array [COMPSIZE(pname)] dlflags notlistable category NV_register_combiners version 1.1 extension soft WINSOFT NV10 glxvendorpriv 1275 glxflags ignore offset 511 ############################################################################### # # Extension #192 # NV_fog_distance commands # ############################################################################### # (none) newcategory: NV_fog_distance ############################################################################### # # Extension #193 # NV_texgen_emboss commands # ############################################################################### # (none) newcategory: NV_texgen_emboss ############################################################################### # # Extension #194 # NV_blend_square commands # ############################################################################### # (none) newcategory: NV_blend_square ############################################################################### # # Extension #195 # NV_texture_env_combine4 commands # ############################################################################### # (none) newcategory: NV_texture_env_combine4 ############################################################################### # # Extension #196 # MESA_resize_buffers commands # ############################################################################### ResizeBuffersMESA() return void category MESA_resize_buffers version 1.0 glxropcode ? offset 512 ############################################################################### # # Extension #197 # MESA_window_pos commands # # Note that the 2- and 3-component versions are now aliases of ARB # entry points. # ############################################################################### WindowPos2dMESA(x, y) return void param x CoordD in value param y CoordD in value category MESA_window_pos vectorequiv WindowPos2dvMESA version 1.0 alias WindowPos2dARB WindowPos2dvMESA(v) return void param v CoordD in array [2] category MESA_window_pos version 1.0 glxropcode ? alias WindowPos2dvARB WindowPos2fMESA(x, y) return void param x CoordF in value param y CoordF in value category MESA_window_pos vectorequiv WindowPos2fvMESA version 1.0 alias WindowPos2fARB WindowPos2fvMESA(v) return void param v CoordF in array [2] category MESA_window_pos version 1.0 glxropcode ? alias WindowPos2fvARB WindowPos2iMESA(x, y) return void param x CoordI in value param y CoordI in value category MESA_window_pos vectorequiv WindowPos2ivMESA version 1.0 alias WindowPos2iARB WindowPos2ivMESA(v) return void param v CoordI in array [2] category MESA_window_pos version 1.0 glxropcode ? alias WindowPos2ivARB WindowPos2sMESA(x, y) return void param x CoordS in value param y CoordS in value category MESA_window_pos vectorequiv WindowPos2svMESA version 1.0 alias WindowPos2sARB WindowPos2svMESA(v) return void param v CoordS in array [2] category MESA_window_pos version 1.0 glxropcode ? alias WindowPos2svARB WindowPos3dMESA(x, y, z) return void param x CoordD in value param y CoordD in value param z CoordD in value vectorequiv WindowPos3dvMESA category MESA_window_pos version 1.0 alias WindowPos3dARB WindowPos3dvMESA(v) return void param v CoordD in array [3] category MESA_window_pos version 1.0 glxropcode ? alias WindowPos3dvARB WindowPos3fMESA(x, y, z) return void param x CoordF in value param y CoordF in value param z CoordF in value category MESA_window_pos vectorequiv WindowPos3fvMESA version 1.0 alias WindowPos3fARB WindowPos3fvMESA(v) return void param v CoordF in array [3] category MESA_window_pos version 1.0 glxropcode ? alias WindowPos3fvARB WindowPos3iMESA(x, y, z) return void param x CoordI in value param y CoordI in value param z CoordI in value category MESA_window_pos vectorequiv WindowPos3ivMESA version 1.0 alias WindowPos3iARB WindowPos3ivMESA(v) return void param v CoordI in array [3] category MESA_window_pos version 1.0 glxropcode ? alias WindowPos3ivARB WindowPos3sMESA(x, y, z) return void param x CoordS in value param y CoordS in value param z CoordS in value category MESA_window_pos vectorequiv WindowPos3svMESA version 1.0 alias WindowPos3sARB WindowPos3svMESA(v) return void param v CoordS in array [3] category MESA_window_pos version 1.0 glxropcode ? alias WindowPos3svARB WindowPos4dMESA(x, y, z, w) return void param x CoordD in value param y CoordD in value param z CoordD in value param w CoordD in value vectorequiv WindowPos4dvMESA category MESA_window_pos version 1.0 offset 529 WindowPos4dvMESA(v) return void param v CoordD in array [4] category MESA_window_pos version 1.0 glxropcode ? offset 530 WindowPos4fMESA(x, y, z, w) return void param x CoordF in value param y CoordF in value param z CoordF in value param w CoordF in value category MESA_window_pos vectorequiv WindowPos4fvMESA version 1.0 offset 531 WindowPos4fvMESA(v) return void param v CoordF in array [4] category MESA_window_pos version 1.0 glxropcode ? offset 532 WindowPos4iMESA(x, y, z, w) return void param x CoordI in value param y CoordI in value param z CoordI in value param w CoordI in value category MESA_window_pos vectorequiv WindowPos4ivMESA version 1.0 offset 533 WindowPos4ivMESA(v) return void param v CoordI in array [4] category MESA_window_pos version 1.0 glxropcode ? offset 534 WindowPos4sMESA(x, y, z, w) return void param x CoordS in value param y CoordS in value param z CoordS in value param w CoordS in value category MESA_window_pos vectorequiv WindowPos4svMESA version 1.0 offset 535 WindowPos4svMESA(v) return void param v CoordS in array [4] category MESA_window_pos version 1.0 glxropcode ? offset 536 ############################################################################### # # Extension #198 # EXT_texture_compression_s3tc commands # ############################################################################### #@@ (none yet) ############################################################################### # # Extension #199 # IBM_cull_vertex commands # ############################################################################### # (none) newcategory: IBM_cull_vertex ############################################################################### # # Extension #200 # IBM_multimode_draw_arrays commands # ############################################################################### MultiModeDrawArraysIBM(mode, first, count, primcount, modestride) return void param mode BeginMode in array [COMPSIZE(primcount)] param first Int32 in array [COMPSIZE(primcount)] param count SizeI in array [COMPSIZE(primcount)] param primcount SizeI in value param modestride Int32 in value category IBM_multimode_draw_arrays version 1.1 glxropcode ? offset 708 MultiModeDrawElementsIBM(mode, count, type, indices, primcount, modestride) return void param mode BeginMode in array [COMPSIZE(primcount)] param count SizeI in array [COMPSIZE(primcount)] param type DrawElementsType in value param indices ConstVoidPointer in array [COMPSIZE(primcount)] param primcount SizeI in value param modestride Int32 in value category IBM_multimode_draw_arrays version 1.1 glxropcode ? offset 709 ############################################################################### # # Extension #201 # IBM_vertex_array_lists commands # ############################################################################### ColorPointerListIBM(size, type, stride, pointer, ptrstride) return void param size Int32 in value param type ColorPointerType in value param stride Int32 in value param pointer VoidPointer in array [COMPSIZE(size/type/stride)] retained param ptrstride Int32 in value category IBM_vertex_array_lists version 1.1 glxropcode ? offset ? SecondaryColorPointerListIBM(size, type, stride, pointer, ptrstride) return void param size Int32 in value param type SecondaryColorPointerTypeIBM in value param stride Int32 in value param pointer VoidPointer in array [COMPSIZE(size/type/stride)] retained param ptrstride Int32 in value category IBM_vertex_array_lists version 1.1 glxropcode ? offset ? EdgeFlagPointerListIBM(stride, pointer, ptrstride) return void param stride Int32 in value param pointer BooleanPointer in array [COMPSIZE(stride)] retained param ptrstride Int32 in value category IBM_vertex_array_lists version 1.1 glxropcode ? offset ? FogCoordPointerListIBM(type, stride, pointer, ptrstride) return void param type FogPointerTypeIBM in value param stride Int32 in value param pointer VoidPointer in array [COMPSIZE(type/stride)] retained param ptrstride Int32 in value category IBM_vertex_array_lists version 1.1 glxropcode ? offset ? IndexPointerListIBM(type, stride, pointer, ptrstride) return void param type IndexPointerType in value param stride Int32 in value param pointer VoidPointer in array [COMPSIZE(type/stride)] retained param ptrstride Int32 in value category IBM_vertex_array_lists version 1.1 glxropcode ? offset ? NormalPointerListIBM(type, stride, pointer, ptrstride) return void param type NormalPointerType in value param stride Int32 in value param pointer VoidPointer in array [COMPSIZE(type/stride)] retained param ptrstride Int32 in value category IBM_vertex_array_lists version 1.1 glxropcode ? offset ? TexCoordPointerListIBM(size, type, stride, pointer, ptrstride) return void param size Int32 in value param type TexCoordPointerType in value param stride Int32 in value param pointer VoidPointer in array [COMPSIZE(size/type/stride)] retained param ptrstride Int32 in value category IBM_vertex_array_lists version 1.1 glxropcode ? offset ? VertexPointerListIBM(size, type, stride, pointer, ptrstride) return void param size Int32 in value param type VertexPointerType in value param stride Int32 in value param pointer VoidPointer in array [COMPSIZE(size/type/stride)] retained param ptrstride Int32 in value category IBM_vertex_array_lists version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #202 # SGIX_subsample commands # ############################################################################### # (none) newcategory: SGIX_subsample ############################################################################### # # Extension #203 # SGIX_ycrcba commands # ############################################################################### # (none) newcategory: SGIX_ycrcba ############################################################################### # # Extension #204 # SGIX_ycrcb_subsample commands # ############################################################################### # (none) newcategory: SGIX_ycrcb_subsample ############################################################################### # # Extension #205 # SGIX_depth_pass_instrument commands # ############################################################################### # (none) newcategory: SGIX_depth_pass_instrument ############################################################################### # # Extension #206 # 3DFX_texture_compression_FXT1 commands # ############################################################################### # (none) newcategory: 3DFX_texture_compression_FXT1 ############################################################################### # # Extension #207 # 3DFX_multisample commands # ############################################################################### # (none) newcategory: 3DFX_multisample ############################################################################### # # Extension #208 # 3DFX_tbuffer commands # ############################################################################### TbufferMask3DFX(mask) return void param mask UInt32 in value category 3DFX_tbuffer version 1.2 glxropcode ? offset 553 ############################################################################### # # Extension #209 # EXT_multisample commands # ############################################################################### SampleMaskEXT(value, invert) return void param value ClampedFloat32 in value param invert Boolean in value category EXT_multisample version 1.0 glxropcode ? extension offset 446 SamplePatternEXT(pattern) return void param pattern SamplePatternEXT in value category EXT_multisample version 1.0 glxropcode ? glxflags extension offset 447 ############################################################################### # # Extension #210 # SGIX_vertex_preclip commands # ############################################################################### # (none) newcategory: SGIX_vertex_preclip ############################################################################### # # Extension #211 # SGIX_convolution_accuracy commands # ############################################################################### # (none) newcategory: SGIX_convolution_accuracy ############################################################################### # # Extension #212 # SGIX_resample commands # ############################################################################### # (none) newcategory: SGIX_resample ############################################################################### # # Extension #213 # SGIS_point_line_texgen commands # ############################################################################### # (none) newcategory: SGIS_point_line_texgen ############################################################################### # # Extension #214 # SGIS_texture_color_mask commands # ############################################################################### TextureColorMaskSGIS(red, green, blue, alpha) return void param red Boolean in value param green Boolean in value param blue Boolean in value param alpha Boolean in value category SGIS_texture_color_mask version 1.1 glxropcode 2082 extension offset ? ############################################################################### # # Extension #215 - GLX_MESA_copy_sub_buffer # Extension #216 - GLX_MESA_pixmap_colormap # Extension #217 - GLX_MESA_release_buffers # Extension #218 - GLX_MESA_set_3dfx_mode # ############################################################################### ############################################################################### # # Extension #219 # SGIX_igloo_interface commands # ############################################################################### IglooInterfaceSGIX(pname, params) return void dlflags notlistable param pname IglooFunctionSelectSGIX in value param params IglooParameterSGIX in array [COMPSIZE(pname)] category SGIX_igloo_interface version 1.0 glxflags SGI ignore extension glxropcode 200 offset ? ############################################################################### # # Extension #220 # EXT_texture_env_dot3 commands # ############################################################################### # (none) newcategory: EXT_texture_env_dot3 ############################################################################### # # Extension #221 # ATI_texture_mirror_once commands # ############################################################################### # (none) newcategory: ATI_texture_mirror_once ############################################################################### # # Extension #222 # NV_fence commands # ############################################################################### DeleteFencesNV(n, fences) return void param n SizeI in value param fences FenceNV in array [n] category NV_fence dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1276 glxflags ignore offset 647 GenFencesNV(n, fences) return void param n SizeI in value param fences FenceNV out array [n] category NV_fence dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1277 glxflags ignore offset 648 IsFenceNV(fence) return Boolean param fence FenceNV in value category NV_fence dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1278 glxflags ignore offset 649 TestFenceNV(fence) return Boolean param fence FenceNV in value category NV_fence dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1279 glxflags ignore offset 650 GetFenceivNV(fence, pname, params) return void param fence FenceNV in value param pname FenceParameterNameNV in value param params Int32 out array [COMPSIZE(pname)] category NV_fence dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1280 glxflags ignore offset 651 FinishFenceNV(fence) return void param fence FenceNV in value category NV_fence dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1312 glxflags ignore offset 652 SetFenceNV(fence, condition) return void param fence FenceNV in value param condition FenceConditionNV in value category NV_fence version 1.2 extension soft WINSOFT NV10 glxflags ignore offset 653 ############################################################################### # # Extension #225 # NV_evaluators commands # ############################################################################### MapControlPointsNV(target, index, type, ustride, vstride, uorder, vorder, packed, points) return void param target EvalTargetNV in value param index UInt32 in value param type MapTypeNV in value param ustride SizeI in value param vstride SizeI in value param uorder CheckedInt32 in value param vorder CheckedInt32 in value param packed Boolean in value param points Void in array [COMPSIZE(target/uorder/vorder)] category NV_evaluators dlflags handcode version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? MapParameterivNV(target, pname, params) return void param target EvalTargetNV in value param pname MapParameterNV in value param params CheckedInt32 in array [COMPSIZE(target/pname)] category NV_evaluators version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? MapParameterfvNV(target, pname, params) return void param target EvalTargetNV in value param pname MapParameterNV in value param params CheckedFloat32 in array [COMPSIZE(target/pname)] category NV_evaluators version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? GetMapControlPointsNV(target, index, type, ustride, vstride, packed, points) return void param target EvalTargetNV in value param index UInt32 in value param type MapTypeNV in value param ustride SizeI in value param vstride SizeI in value param packed Boolean in value param points Void out array [COMPSIZE(target)] category NV_evaluators dlflags notlistable version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? GetMapParameterivNV(target, pname, params) return void param target EvalTargetNV in value param pname MapParameterNV in value param params Int32 out array [COMPSIZE(target/pname)] category NV_evaluators dlflags notlistable version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? GetMapParameterfvNV(target, pname, params) return void param target EvalTargetNV in value param pname MapParameterNV in value param params Float32 out array [COMPSIZE(target/pname)] category NV_evaluators dlflags notlistable version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? GetMapAttribParameterivNV(target, index, pname, params) return void param target EvalTargetNV in value param index UInt32 in value param pname MapAttribParameterNV in value param params Int32 out array [COMPSIZE(pname)] category NV_evaluators dlflags notlistable version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? GetMapAttribParameterfvNV(target, index, pname, params) return void param target EvalTargetNV in value param index UInt32 in value param pname MapAttribParameterNV in value param params Float32 out array [COMPSIZE(pname)] category NV_evaluators dlflags notlistable version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? EvalMapsNV(target, mode) return void param target EvalTargetNV in value param mode EvalMapsModeNV in value category NV_evaluators version 1.1 extension soft WINSOFT NV10 glxflags ignore offset ? ############################################################################### # # Extension #226 # NV_packed_depth_stencil commands # ############################################################################### # (none) newcategory: NV_packed_depth_stencil ############################################################################### # # Extension #227 # NV_register_combiners2 commands # ############################################################################### CombinerStageParameterfvNV(stage, pname, params) return void param stage CombinerStageNV in value param pname CombinerParameterNV in value param params CheckedFloat32 in array [COMPSIZE(pname)] category NV_register_combiners2 version 1.1 extension glxflags ignore offset ? GetCombinerStageParameterfvNV(stage, pname, params) return void param stage CombinerStageNV in value param pname CombinerParameterNV in value param params Float32 out array [COMPSIZE(pname)] dlflags notlistable category NV_register_combiners2 version 1.1 extension glxflags ignore offset ? ############################################################################### # # Extension #228 # NV_texture_compression_vtc commands # ############################################################################### # (none) newcategory: NV_texture_compression_vtc ############################################################################### # # Extension #229 # NV_texture_rectangle commands # ############################################################################### # (none) newcategory: NV_texture_rectangle ############################################################################### # # Extension #230 # NV_texture_shader commands # ############################################################################### # (none) newcategory: NV_texture_shader ############################################################################### # # Extension #231 # NV_texture_shader2 commands # ############################################################################### # (none) newcategory: NV_texture_shader2 ############################################################################### # # Extension #232 # NV_vertex_array_range2 commands # ############################################################################### # (none) newcategory: NV_vertex_array_range2 ############################################################################### # # Extension #233 # NV_vertex_program commands # ############################################################################### AreProgramsResidentNV(n, programs, residences) return Boolean param n SizeI in value param programs UInt32 in array [n] param residences Boolean out array [n] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxflags ignore glxvendorpriv 1293 offset 578 BindProgramNV(target, id) return void param target VertexAttribEnumNV in value param id UInt32 in value category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4180 alias BindProgramARB DeleteProgramsNV(n, programs) return void param n SizeI in value param programs UInt32 in array [n] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1294 alias DeleteProgramsARB ExecuteProgramNV(target, id, params) return void param target VertexAttribEnumNV in value param id UInt32 in value param params Float32 in array [4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxflags ignore glxropcode 4181 offset 581 GenProgramsNV(n, programs) return void param n SizeI in value param programs UInt32 out array [n] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1295 alias GenProgramsARB GetProgramParameterdvNV(target, index, pname, params) return void param target VertexAttribEnumNV in value param index UInt32 in value param pname VertexAttribEnumNV in value param params Float64 out array [4] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxflags ignore glxvendorpriv 1297 offset 583 GetProgramParameterfvNV(target, index, pname, params) return void param target VertexAttribEnumNV in value param index UInt32 in value param pname VertexAttribEnumNV in value param params Float32 out array [4] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxflags ignore glxvendorpriv 1296 offset 584 # GetProgramParameterSigneddvNV(target, index, pname, params) # return void # param target VertexAttribEnumNV in value # param index Int32 in value # param pname VertexAttribEnumNV in value # param params Float64 out array [4] # category NV_vertex_program1_1_dcc # dlflags notlistable # version 1.2 # extension soft WINSOFT NV20 # glxflags ignore # offset ? # # GetProgramParameterSignedfvNV(target, index, pname, params) # return void # param target VertexAttribEnumNV in value # param index Int32 in value # param pname VertexAttribEnumNV in value # param params Float32 out array [4] # category NV_vertex_program1_1_dcc # dlflags notlistable # version 1.2 # extension soft WINSOFT NV20 # glxflags ignore # offset ? GetProgramivNV(id, pname, params) return void param id UInt32 in value param pname VertexAttribEnumNV in value param params Int32 out array [4] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxflags ignore glxvendorpriv 1298 offset 585 GetProgramStringNV(id, pname, program) return void param id UInt32 in value param pname VertexAttribEnumNV in value param program ProgramCharacterNV out array [COMPSIZE(id/pname)] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxflags ignore glxvendorpriv 1299 offset 586 GetTrackMatrixivNV(target, address, pname, params) return void param target VertexAttribEnumNV in value param address UInt32 in value param pname VertexAttribEnumNV in value param params Int32 out array [1] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxflags ignore glxvendorpriv 1300 offset 587 GetVertexAttribdvNV(index, pname, params) return void param index UInt32 in value param pname VertexAttribEnumNV in value param params Float64 out array [1] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1301 alias GetVertexAttribdv GetVertexAttribfvNV(index, pname, params) return void param index UInt32 in value param pname VertexAttribEnumNV in value param params Float32 out array [1] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1302 alias GetVertexAttribfv GetVertexAttribivNV(index, pname, params) return void param index UInt32 in value param pname VertexAttribEnumNV in value param params Int32 out array [1] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1303 alias GetVertexAttribiv GetVertexAttribPointervNV(index, pname, pointer) return void param index UInt32 in value param pname VertexAttribEnumNV in value param pointer VoidPointer out array [1] category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxflags ignore alias GetVertexAttribPointerv IsProgramNV(id) return Boolean param id UInt32 in value category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxvendorpriv 1304 alias IsProgram LoadProgramNV(target, id, len, program) return void param target VertexAttribEnumNV in value param id UInt32 in value param len SizeI in value param program UInt8 in array [len] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4183 offset 593 ProgramParameter4dNV(target, index, x, y, z, w) return void param target VertexAttribEnumNV in value param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category NV_vertex_program version 1.2 vectorequiv ProgramParameter4dvNV extension soft WINSOFT NV10 offset 594 ProgramParameter4dvNV(target, index, v) return void param target VertexAttribEnumNV in value param index UInt32 in value param v Float64 in array [4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4185 offset 595 ProgramParameter4fNV(target, index, x, y, z, w) return void param target VertexAttribEnumNV in value param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category NV_vertex_program version 1.2 vectorequiv ProgramParameter4fvNV extension soft WINSOFT NV10 offset 596 ProgramParameter4fvNV(target, index, v) return void param target VertexAttribEnumNV in value param index UInt32 in value param v Float32 in array [4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4184 offset 597 #??? 'count' was SizeI in the latest NVIDIA gl.spec, but UInt32 in the #??? extension specification in the registry. ProgramParameters4dvNV(target, index, count, v) return void param target VertexAttribEnumNV in value param index UInt32 in value param count UInt32 in value param v Float64 in array [count*4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4187 offset 598 #??? 'count' was SizeI in the latest NVIDIA gl.spec, but UInt32 in the #??? extension specification in the registry. ProgramParameters4fvNV(target, index, count, v) return void param target VertexAttribEnumNV in value param index UInt32 in value param count UInt32 in value param v Float32 in array [count*4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4186 offset 599 # ProgramParameterSigned4dNV(target, index, x, y, z, w) # return void # param target VertexAttribEnumNV in value # param index Int32 in value # param x Float64 in value # param y Float64 in value # param z Float64 in value # param w Float64 in value # category NV_vertex_program1_1_dcc # version 1.2 # vectorequiv ProgramParameterSigned4dvNV # extension soft WINSOFT NV20 # offset ? # # ProgramParameterSigned4dvNV(target, index, v) # return void # param target VertexAttribEnumNV in value # param index Int32 in value # param v Float64 in array [4] # category NV_vertex_program1_1_dcc # version 1.2 # extension soft WINSOFT NV20 # glxflags ignore # offset ? # # ProgramParameterSigned4fNV(target, index, x, y, z, w) # return void # param target VertexAttribEnumNV in value # param index Int32 in value # param x Float32 in value # param y Float32 in value # param z Float32 in value # param w Float32 in value # category NV_vertex_program1_1_dcc # version 1.2 # vectorequiv ProgramParameterSigned4fvNV # extension soft WINSOFT NV20 # offset ? # # ProgramParameterSigned4fvNV(target, index, v) # return void # param target VertexAttribEnumNV in value # param index Int32 in value # param v Float32 in array [4] # category NV_vertex_program1_1_dcc # version 1.2 # extension soft WINSOFT NV20 # glxflags ignore # offset ? # # ProgramParametersSigned4dvNV(target, index, count, v) # return void # param target VertexAttribEnumNV in value # param index Int32 in value # param count SizeI in value # param v Float64 in array [count*4] # category NV_vertex_program1_1_dcc # version 1.2 # extension soft WINSOFT NV20 # glxflags ignore # offset ? # # ProgramParametersSigned4fvNV(target, index, count, v) # return void # param target VertexAttribEnumNV in value # param index Int32 in value # param count SizeI in value # param v Float32 in array [count*4] # category NV_vertex_program1_1_dcc # version 1.2 # extension soft WINSOFT NV20 # glxflags ignore # offset ? RequestResidentProgramsNV(n, programs) return void param n SizeI in value param programs UInt32 in array [n] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4182 offset 600 TrackMatrixNV(target, address, matrix, transform) return void param target VertexAttribEnumNV in value param address UInt32 in value param matrix VertexAttribEnumNV in value param transform VertexAttribEnumNV in value category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4188 offset 601 VertexAttribPointerNV(index, fsize, type, stride, pointer) return void param index UInt32 in value param fsize Int32 in value param type VertexAttribEnumNV in value param stride SizeI in value param pointer Void in array [COMPSIZE(fsize/type/stride)] retained category NV_vertex_program dlflags notlistable version 1.2 extension soft WINSOFT NV10 glxflags ignore offset 602 VertexAttrib1dNV(index, x) return void param index UInt32 in value param x Float64 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib1dvNV extension soft WINSOFT NV10 alias VertexAttrib1d VertexAttrib1dvNV(index, v) return void param index UInt32 in value param v Float64 in array [1] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4197 alias VertexAttrib1dv VertexAttrib1fNV(index, x) return void param index UInt32 in value param x Float32 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib1fvNV extension soft WINSOFT NV10 alias VertexAttrib1f VertexAttrib1fvNV(index, v) return void param index UInt32 in value param v Float32 in array [1] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4193 alias VertexAttrib1fv VertexAttrib1sNV(index, x) return void param index UInt32 in value param x Int16 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib1svNV extension soft WINSOFT NV10 alias VertexAttrib1s VertexAttrib1svNV(index, v) return void param index UInt32 in value param v Int16 in array [1] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4189 alias VertexAttrib1sv VertexAttrib2dNV(index, x, y) return void param index UInt32 in value param x Float64 in value param y Float64 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib2dvNV extension soft WINSOFT NV10 alias VertexAttrib2d VertexAttrib2dvNV(index, v) return void param index UInt32 in value param v Float64 in array [2] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4198 alias VertexAttrib2dv VertexAttrib2fNV(index, x, y) return void param index UInt32 in value param x Float32 in value param y Float32 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib2fvNV extension soft WINSOFT NV10 alias VertexAttrib2f VertexAttrib2fvNV(index, v) return void param index UInt32 in value param v Float32 in array [2] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4194 alias VertexAttrib2fv VertexAttrib2sNV(index, x, y) return void param index UInt32 in value param x Int16 in value param y Int16 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib2svNV extension soft WINSOFT NV10 alias VertexAttrib2s VertexAttrib2svNV(index, v) return void param index UInt32 in value param v Int16 in array [2] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4190 alias VertexAttrib2sv VertexAttrib3dNV(index, x, y, z) return void param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib3dvNV extension soft WINSOFT NV10 alias VertexAttrib3d VertexAttrib3dvNV(index, v) return void param index UInt32 in value param v Float64 in array [3] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4199 alias VertexAttrib3dv VertexAttrib3fNV(index, x, y, z) return void param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib3fvNV extension soft WINSOFT NV10 alias VertexAttrib3f VertexAttrib3fvNV(index, v) return void param index UInt32 in value param v Float32 in array [3] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4195 alias VertexAttrib3fv VertexAttrib3sNV(index, x, y, z) return void param index UInt32 in value param x Int16 in value param y Int16 in value param z Int16 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib3svNV extension soft WINSOFT NV10 alias VertexAttrib3s VertexAttrib3svNV(index, v) return void param index UInt32 in value param v Int16 in array [3] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4191 alias VertexAttrib3sv VertexAttrib4dNV(index, x, y, z, w) return void param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib4dvNV extension soft WINSOFT NV10 alias VertexAttrib4d VertexAttrib4dvNV(index, v) return void param index UInt32 in value param v Float64 in array [4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4200 alias VertexAttrib4dv VertexAttrib4fNV(index, x, y, z, w) return void param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib4fvNV extension soft WINSOFT NV10 alias VertexAttrib4f VertexAttrib4fvNV(index, v) return void param index UInt32 in value param v Float32 in array [4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4196 alias VertexAttrib4fv VertexAttrib4sNV(index, x, y, z, w) return void param index UInt32 in value param x Int16 in value param y Int16 in value param z Int16 in value param w Int16 in value category NV_vertex_program version 1.2 vectorequiv VertexAttrib4svNV extension soft WINSOFT NV10 alias VertexAttrib4s VertexAttrib4svNV(index, v) return void param index UInt32 in value param v Int16 in array [4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4192 alias VertexAttrib4sv VertexAttrib4ubNV(index, x, y, z, w) return void param index UInt32 in value param x ColorUB in value param y ColorUB in value param z ColorUB in value param w ColorUB in value category NV_vertex_program version 1.2 extension soft WINSOFT NV10 vectorequiv VertexAttrib4ubvNV alias VertexAttrib4Nub VertexAttrib4ubvNV(index, v) return void param index UInt32 in value param v ColorUB in array [4] category NV_vertex_program version 1.2 extension soft WINSOFT NV10 glxropcode 4201 alias VertexAttrib4Nubv VertexAttribs1dvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Float64 in array [count] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4210 offset 629 VertexAttribs1fvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Float32 in array [count] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4206 offset 630 VertexAttribs1svNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Int16 in array [count] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4202 offset 631 VertexAttribs2dvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Float64 in array [count*2] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4211 offset 632 VertexAttribs2fvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Float32 in array [count*2] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4207 offset 633 VertexAttribs2svNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Int16 in array [count*2] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4203 offset 634 VertexAttribs3dvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Float64 in array [count*3] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4212 offset 635 VertexAttribs3fvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Float32 in array [count*3] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4208 offset 636 VertexAttribs3svNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Int16 in array [count*3] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4204 offset 637 VertexAttribs4dvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Float64 in array [count*4] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4213 offset 638 VertexAttribs4fvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Float32 in array [count*4] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4209 offset 639 VertexAttribs4svNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v Int16 in array [count*4] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4205 offset 640 VertexAttribs4ubvNV(index, count, v) return void param index UInt32 in value param count SizeI in value param v ColorUB in array [count*4] category NV_vertex_program dlflags handcode version 1.2 extension soft WINSOFT NV10 glxropcode 4214 offset 641 ############################################################################### # # Extension #234 - GLX_SGIX_visual_select_group # ############################################################################### ############################################################################### # # Extension #235 # SGIX_texture_coordinate_clamp commands # ############################################################################### # (none) newcategory: SGIX_texture_coordinate_clamp ############################################################################### # # Extension #236 # SGIX_scalebias_hint commands # ############################################################################### # (none) newcategory: SGIX_scalebias_hint ############################################################################### # # Extension #237 - GLX_OML_swap_method commands # Extension #238 - GLX_OML_sync_control commands # ############################################################################### ############################################################################### # # Extension #239 # OML_interlace commands # ############################################################################### # (none) newcategory: OML_interlace ############################################################################### # # Extension #240 # OML_subsample commands # ############################################################################### # (none) newcategory: OML_subsample ############################################################################### # # Extension #241 # OML_resample commands # ############################################################################### # (none) newcategory: OML_resample ############################################################################### # # Extension #242 - WGL_OML_sync_control commands # ############################################################################### ############################################################################### # # Extension #243 # NV_copy_depth_to_color commands # ############################################################################### # (none) newcategory: NV_copy_depth_to_color ############################################################################### # # Extension #244 # ATI_envmap_bumpmap commands # ############################################################################### TexBumpParameterivATI(pname, param) return void param pname TexBumpParameterATI in value param param Int32 in array [COMPSIZE(pname)] category ATI_envmap_bumpmap version 1.2 extension glxropcode ? glxflags ignore offset ? TexBumpParameterfvATI(pname, param) return void param pname TexBumpParameterATI in value param param Float32 in array [COMPSIZE(pname)] category ATI_envmap_bumpmap version 1.2 extension glxropcode ? glxflags ignore offset ? GetTexBumpParameterivATI(pname, param) return void param pname GetTexBumpParameterATI in value param param Int32 out array [COMPSIZE(pname)] category ATI_envmap_bumpmap dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetTexBumpParameterfvATI(pname, param) return void param pname GetTexBumpParameterATI in value param param Float32 out array [COMPSIZE(pname)] category ATI_envmap_bumpmap dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #245 # ATI_fragment_shader commands # ############################################################################### GenFragmentShadersATI(range) return UInt32 param range UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? BindFragmentShaderATI(id) return void param id UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? DeleteFragmentShaderATI(id) return void param id UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? BeginFragmentShaderATI() return void category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? EndFragmentShaderATI() return void category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? PassTexCoordATI(dst, coord, swizzle) return void param dst UInt32 in value param coord UInt32 in value param swizzle SwizzleOpATI in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? SampleMapATI(dst, interp, swizzle) return void param dst UInt32 in value param interp UInt32 in value param swizzle SwizzleOpATI in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ColorFragmentOp1ATI(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod) return void param op FragmentOpATI in value param dst UInt32 in value param dstMask UInt32 in value param dstMod UInt32 in value param arg1 UInt32 in value param arg1Rep UInt32 in value param arg1Mod UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ColorFragmentOp2ATI(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod) return void param op FragmentOpATI in value param dst UInt32 in value param dstMask UInt32 in value param dstMod UInt32 in value param arg1 UInt32 in value param arg1Rep UInt32 in value param arg1Mod UInt32 in value param arg2 UInt32 in value param arg2Rep UInt32 in value param arg2Mod UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ColorFragmentOp3ATI(op, dst, dstMask, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod) return void param op FragmentOpATI in value param dst UInt32 in value param dstMask UInt32 in value param dstMod UInt32 in value param arg1 UInt32 in value param arg1Rep UInt32 in value param arg1Mod UInt32 in value param arg2 UInt32 in value param arg2Rep UInt32 in value param arg2Mod UInt32 in value param arg3 UInt32 in value param arg3Rep UInt32 in value param arg3Mod UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? AlphaFragmentOp1ATI(op, dst, dstMod, arg1, arg1Rep, arg1Mod) return void param op FragmentOpATI in value param dst UInt32 in value param dstMod UInt32 in value param arg1 UInt32 in value param arg1Rep UInt32 in value param arg1Mod UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? AlphaFragmentOp2ATI(op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod) return void param op FragmentOpATI in value param dst UInt32 in value param dstMod UInt32 in value param arg1 UInt32 in value param arg1Rep UInt32 in value param arg1Mod UInt32 in value param arg2 UInt32 in value param arg2Rep UInt32 in value param arg2Mod UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? AlphaFragmentOp3ATI(op, dst, dstMod, arg1, arg1Rep, arg1Mod, arg2, arg2Rep, arg2Mod, arg3, arg3Rep, arg3Mod) return void param op FragmentOpATI in value param dst UInt32 in value param dstMod UInt32 in value param arg1 UInt32 in value param arg1Rep UInt32 in value param arg1Mod UInt32 in value param arg2 UInt32 in value param arg2Rep UInt32 in value param arg2Mod UInt32 in value param arg3 UInt32 in value param arg3Rep UInt32 in value param arg3Mod UInt32 in value category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? SetFragmentShaderConstantATI(dst, value) return void param dst UInt32 in value param value ConstFloat32 in array [4] category ATI_fragment_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #246 # ATI_pn_triangles commands # ############################################################################### PNTrianglesiATI(pname, param) return void param pname PNTrianglesPNameATI in value param param Int32 in value category ATI_pn_triangles version 1.2 extension glxropcode ? glxflags ignore offset ? PNTrianglesfATI(pname, param) return void param pname PNTrianglesPNameATI in value param param Float32 in value category ATI_pn_triangles version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #247 # ATI_vertex_array_object commands # ############################################################################### NewObjectBufferATI(size, pointer, usage) return UInt32 param size SizeI in value param pointer ConstVoid in array [size] param usage ArrayObjectUsageATI in value category ATI_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore offset ? IsObjectBufferATI(buffer) return Boolean param buffer UInt32 in value category ATI_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore offset ? UpdateObjectBufferATI(buffer, offset, size, pointer, preserve) return void param buffer UInt32 in value param offset UInt32 in value param size SizeI in value param pointer ConstVoid in array [size] param preserve PreserveModeATI in value category ATI_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore offset ? GetObjectBufferfvATI(buffer, pname, params) return void param buffer UInt32 in value param pname ArrayObjectPNameATI in value param params Float32 out array [1] category ATI_vertex_array_object dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetObjectBufferivATI(buffer, pname, params) return void param buffer UInt32 in value param pname ArrayObjectPNameATI in value param params Int32 out array [1] category ATI_vertex_array_object dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? FreeObjectBufferATI(buffer) return void param buffer UInt32 in value category ATI_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore offset ? ArrayObjectATI(array, size, type, stride, buffer, offset) return void param array EnableCap in value param size Int32 in value param type ScalarType in value param stride SizeI in value param buffer UInt32 in value param offset UInt32 in value category ATI_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore offset ? GetArrayObjectfvATI(array, pname, params) return void param array EnableCap in value param pname ArrayObjectPNameATI in value param params Float32 out array [1] category ATI_vertex_array_object dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetArrayObjectivATI(array, pname, params) return void param array EnableCap in value param pname ArrayObjectPNameATI in value param params Int32 out array [1] category ATI_vertex_array_object dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? VariantArrayObjectATI(id, type, stride, buffer, offset) return void param id UInt32 in value param type ScalarType in value param stride SizeI in value param buffer UInt32 in value param offset UInt32 in value category ATI_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore offset ? GetVariantArrayObjectfvATI(id, pname, params) return void param id UInt32 in value param pname ArrayObjectPNameATI in value param params Float32 out array [1] category ATI_vertex_array_object dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVariantArrayObjectivATI(id, pname, params) return void param id UInt32 in value param pname ArrayObjectPNameATI in value param params Int32 out array [1] category ATI_vertex_array_object dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #248 # EXT_vertex_shader commands # ############################################################################### BeginVertexShaderEXT() return void category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? EndVertexShaderEXT() return void category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? BindVertexShaderEXT(id) return void param id UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? GenVertexShadersEXT(range) return UInt32 param range UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? DeleteVertexShaderEXT(id) return void param id UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ShaderOp1EXT(op, res, arg1) return void param op VertexShaderOpEXT in value param res UInt32 in value param arg1 UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ShaderOp2EXT(op, res, arg1, arg2) return void param op VertexShaderOpEXT in value param res UInt32 in value param arg1 UInt32 in value param arg2 UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ShaderOp3EXT(op, res, arg1, arg2, arg3) return void param op VertexShaderOpEXT in value param res UInt32 in value param arg1 UInt32 in value param arg2 UInt32 in value param arg3 UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? SwizzleEXT(res, in, outX, outY, outZ, outW) return void param res UInt32 in value param in UInt32 in value param outX VertexShaderCoordOutEXT in value param outY VertexShaderCoordOutEXT in value param outZ VertexShaderCoordOutEXT in value param outW VertexShaderCoordOutEXT in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? WriteMaskEXT(res, in, outX, outY, outZ, outW) return void param res UInt32 in value param in UInt32 in value param outX VertexShaderWriteMaskEXT in value param outY VertexShaderWriteMaskEXT in value param outZ VertexShaderWriteMaskEXT in value param outW VertexShaderWriteMaskEXT in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? InsertComponentEXT(res, src, num) return void param res UInt32 in value param src UInt32 in value param num UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? ExtractComponentEXT(res, src, num) return void param res UInt32 in value param src UInt32 in value param num UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? GenSymbolsEXT(datatype, storagetype, range, components) return UInt32 param datatype DataTypeEXT in value param storagetype VertexShaderStorageTypeEXT in value param range ParameterRangeEXT in value param components UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? SetInvariantEXT(id, type, addr) return void param id UInt32 in value param type ScalarType in value param addr Void in array [COMPSIZE(id/type)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? SetLocalConstantEXT(id, type, addr) return void param id UInt32 in value param type ScalarType in value param addr Void in array [COMPSIZE(id/type)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantbvEXT(id, addr) return void param id UInt32 in value param addr Int8 in array [COMPSIZE(id)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantsvEXT(id, addr) return void param id UInt32 in value param addr Int16 in array [COMPSIZE(id)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantivEXT(id, addr) return void param id UInt32 in value param addr Int32 in array [COMPSIZE(id)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantfvEXT(id, addr) return void param id UInt32 in value param addr Float32 in array [COMPSIZE(id)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantdvEXT(id, addr) return void param id UInt32 in value param addr Float64 in array [COMPSIZE(id)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantubvEXT(id, addr) return void param id UInt32 in value param addr UInt8 in array [COMPSIZE(id)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantusvEXT(id, addr) return void param id UInt32 in value param addr UInt16 in array [COMPSIZE(id)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantuivEXT(id, addr) return void param id UInt32 in value param addr UInt32 in array [COMPSIZE(id)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? VariantPointerEXT(id, type, stride, addr) return void param id UInt32 in value param type ScalarType in value param stride UInt32 in value param addr Void in array [COMPSIZE(id/type/stride)] category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? EnableVariantClientStateEXT(id) return void param id UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? DisableVariantClientStateEXT(id) return void param id UInt32 in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? BindLightParameterEXT(light, value) return UInt32 param light LightName in value param value LightParameter in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? BindMaterialParameterEXT(face, value) return UInt32 param face MaterialFace in value param value MaterialParameter in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? BindTexGenParameterEXT(unit, coord, value) return UInt32 param unit TextureUnit in value param coord TextureCoordName in value param value TextureGenParameter in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? BindTextureUnitParameterEXT(unit, value) return UInt32 param unit TextureUnit in value param value VertexShaderTextureUnitParameter in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? BindParameterEXT(value) return UInt32 param value VertexShaderParameterEXT in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? IsVariantEnabledEXT(id, cap) return Boolean param id UInt32 in value param cap VariantCapEXT in value category EXT_vertex_shader version 1.2 extension glxropcode ? glxflags ignore offset ? GetVariantBooleanvEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Boolean out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVariantIntegervEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Int32 out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVariantFloatvEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Float32 out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVariantPointervEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data VoidPointer out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetInvariantBooleanvEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Boolean out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetInvariantIntegervEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Int32 out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetInvariantFloatvEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Float32 out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetLocalConstantBooleanvEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Boolean out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetLocalConstantIntegervEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Int32 out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetLocalConstantFloatvEXT(id, value, data) return void param id UInt32 in value param value GetVariantValueEXT in value param data Float32 out array [COMPSIZE(id)] category EXT_vertex_shader dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #249 # ATI_vertex_streams commands # ############################################################################### VertexStream1sATI(stream, x) return void param stream VertexStreamATI in value param x Int16 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream1svATI(stream, coords) return void param stream VertexStreamATI in value param coords Int16 in array [1] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream1iATI(stream, x) return void param stream VertexStreamATI in value param x Int32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream1ivATI(stream, coords) return void param stream VertexStreamATI in value param coords Int32 in array [1] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream1fATI(stream, x) return void param stream VertexStreamATI in value param x Float32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream1fvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float32 in array [1] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream1dATI(stream, x) return void param stream VertexStreamATI in value param x Float64 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream1dvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float64 in array [1] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream2sATI(stream, x, y) return void param stream VertexStreamATI in value param x Int16 in value param y Int16 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream2svATI(stream, coords) return void param stream VertexStreamATI in value param coords Int16 in array [2] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream2iATI(stream, x, y) return void param stream VertexStreamATI in value param x Int32 in value param y Int32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream2ivATI(stream, coords) return void param stream VertexStreamATI in value param coords Int32 in array [2] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream2fATI(stream, x, y) return void param stream VertexStreamATI in value param x Float32 in value param y Float32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream2fvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float32 in array [2] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream2dATI(stream, x, y) return void param stream VertexStreamATI in value param x Float64 in value param y Float64 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream2dvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float64 in array [2] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream3sATI(stream, x, y, z) return void param stream VertexStreamATI in value param x Int16 in value param y Int16 in value param z Int16 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream3svATI(stream, coords) return void param stream VertexStreamATI in value param coords Int16 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream3iATI(stream, x, y, z) return void param stream VertexStreamATI in value param x Int32 in value param y Int32 in value param z Int32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream3ivATI(stream, coords) return void param stream VertexStreamATI in value param coords Int32 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream3fATI(stream, x, y, z) return void param stream VertexStreamATI in value param x Float32 in value param y Float32 in value param z Float32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream3fvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float32 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream3dATI(stream, x, y, z) return void param stream VertexStreamATI in value param x Float64 in value param y Float64 in value param z Float64 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream3dvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float64 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream4sATI(stream, x, y, z, w) return void param stream VertexStreamATI in value param x Int16 in value param y Int16 in value param z Int16 in value param w Int16 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream4svATI(stream, coords) return void param stream VertexStreamATI in value param coords Int16 in array [4] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream4iATI(stream, x, y, z, w) return void param stream VertexStreamATI in value param x Int32 in value param y Int32 in value param z Int32 in value param w Int32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream4ivATI(stream, coords) return void param stream VertexStreamATI in value param coords Int32 in array [4] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream4fATI(stream, x, y, z, w) return void param stream VertexStreamATI in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream4fvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float32 in array [4] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream4dATI(stream, x, y, z, w) return void param stream VertexStreamATI in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexStream4dvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float64 in array [4] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3bATI(stream, nx, ny, nz) return void param stream VertexStreamATI in value param nx Int8 in value param ny Int8 in value param nz Int8 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3bvATI(stream, coords) return void param stream VertexStreamATI in value param coords Int8 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3sATI(stream, nx, ny, nz) return void param stream VertexStreamATI in value param nx Int16 in value param ny Int16 in value param nz Int16 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3svATI(stream, coords) return void param stream VertexStreamATI in value param coords Int16 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3iATI(stream, nx, ny, nz) return void param stream VertexStreamATI in value param nx Int32 in value param ny Int32 in value param nz Int32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3ivATI(stream, coords) return void param stream VertexStreamATI in value param coords Int32 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3fATI(stream, nx, ny, nz) return void param stream VertexStreamATI in value param nx Float32 in value param ny Float32 in value param nz Float32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3fvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float32 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3dATI(stream, nx, ny, nz) return void param stream VertexStreamATI in value param nx Float64 in value param ny Float64 in value param nz Float64 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? NormalStream3dvATI(stream, coords) return void param stream VertexStreamATI in value param coords Float64 in array [3] category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? ClientActiveVertexStreamATI(stream) return void param stream VertexStreamATI in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexBlendEnviATI(pname, param) return void param pname VertexStreamATI in value param param Int32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? VertexBlendEnvfATI(pname, param) return void param pname VertexStreamATI in value param param Float32 in value category ATI_vertex_streams version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #250 - WGL_I3D_digital_video_control # Extension #251 - WGL_I3D_gamma # Extension #252 - WGL_I3D_genlock # Extension #253 - WGL_I3D_image_buffer # Extension #254 - WGL_I3D_swap_frame_lock # Extension #255 - WGL_I3D_swap_frame_usage # ############################################################################### ############################################################################### # # Extension #256 # ATI_element_array commands # ############################################################################### ElementPointerATI(type, pointer) return void param type ElementPointerTypeATI in value param pointer Void in array [COMPSIZE(type)] retained category ATI_element_array dlflags notlistable glxflags client-handcode client-intercept server-handcode version 1.2 offset ? DrawElementArrayATI(mode, count) return void param mode BeginMode in value param count SizeI in value category ATI_element_array dlflags handcode glxflags client-handcode client-intercept server-handcode version 1.2 offset ? DrawRangeElementArrayATI(mode, start, end, count) return void param mode BeginMode in value param start UInt32 in value param end UInt32 in value param count SizeI in value category ATI_element_array dlflags handcode glxflags client-handcode client-intercept server-handcode version 1.2 offset ? ############################################################################### # # Extension #257 # SUN_mesh_array commands # ############################################################################### DrawMeshArraysSUN(mode, first, count, width) return void param mode BeginMode in value param first Int32 in value param count SizeI in value param width SizeI in value category SUN_mesh_array dlflags handcode glxflags client-handcode client-intercept server-handcode version 1.1 glxropcode ? offset ? ############################################################################### # # Extension #258 # SUN_slice_accum commands # ############################################################################### # (none) newcategory: SUN_slice_accum ############################################################################### # # Extension #259 # NV_multisample_filter_hint commands # ############################################################################### # (none) newcategory: NV_multisample_filter_hint ############################################################################### # # Extension #260 # NV_depth_clamp commands # ############################################################################### # (none) newcategory: NV_depth_clamp ############################################################################### # # Extension #261 # NV_occlusion_query commands # ############################################################################### GenOcclusionQueriesNV(n, ids) return void param n SizeI in value param ids UInt32 out array [n] dlflags notlistable category NV_occlusion_query version 1.2 extension soft WINSOFT NV20 glxflags ignore DeleteOcclusionQueriesNV(n, ids) return void param n SizeI in value param ids UInt32 in array [n] dlflags notlistable category NV_occlusion_query version 1.2 extension soft WINSOFT NV20 glxflags ignore IsOcclusionQueryNV(id) return Boolean param id UInt32 in value dlflags notlistable category NV_occlusion_query version 1.2 extension soft WINSOFT NV20 glxflags ignore BeginOcclusionQueryNV(id) return void param id UInt32 in value category NV_occlusion_query version 1.2 extension soft WINSOFT NV20 glxflags ignore EndOcclusionQueryNV() return void category NV_occlusion_query version 1.2 extension soft WINSOFT NV20 glxflags ignore GetOcclusionQueryivNV(id, pname, params) return void param id UInt32 in value param pname OcclusionQueryParameterNameNV in value param params Int32 out array [COMPSIZE(pname)] dlflags notlistable category NV_occlusion_query version 1.2 extension soft WINSOFT NV20 glxflags ignore GetOcclusionQueryuivNV(id, pname, params) return void param id UInt32 in value param pname OcclusionQueryParameterNameNV in value param params UInt32 out array [COMPSIZE(pname)] dlflags notlistable category NV_occlusion_query version 1.2 extension soft WINSOFT NV20 glxflags ignore ############################################################################### # # Extension #262 # NV_point_sprite commands # ############################################################################### PointParameteriNV(pname, param) return void param pname PointParameterNameARB in value param param Int32 in value category NV_point_sprite version 1.2 extension soft WINSOFT NV20 glxropcode 4221 alias PointParameteri PointParameterivNV(pname, params) return void param pname PointParameterNameARB in value param params Int32 in array [COMPSIZE(pname)] category NV_point_sprite version 1.2 extension soft WINSOFT NV20 glxropcode 4222 alias PointParameteriv ############################################################################### # # Extension #263 - WGL_NV_render_depth_texture # Extension #264 - WGL_NV_render_texture_rectangle # ############################################################################### ############################################################################### # # Extension #265 # NV_texture_shader3 commands # ############################################################################### # (none) newcategory: NV_texture_shader3 ############################################################################### # # Extension #266 # NV_vertex_program1_1 commands # ############################################################################### # (none) newcategory: NV_vertex_program1_1 ############################################################################### # # Extension #267 # EXT_shadow_funcs commands # ############################################################################### # (none) newcategory: EXT_shadow_funcs ############################################################################### # # Extension #268 # EXT_stencil_two_side commands # ############################################################################### ActiveStencilFaceEXT(face) return void param face StencilFaceDirection in value category EXT_stencil_two_side version 1.3 glxropcode 4220 offset 646 ############################################################################### # # Extension #269 # ATI_text_fragment_shader commands # ############################################################################### # Uses ARB_vertex_program entry points newcategory: ATI_text_fragment_shader ############################################################################### # # Extension #270 # APPLE_client_storage commands # ############################################################################### # (none) newcategory: APPLE_client_storage ############################################################################### # # Extension #271 # APPLE_element_array commands # ############################################################################### # @@ Need to verify/add GLX protocol # @@@ like #256 ATI_element_array ElementPointerAPPLE(type, pointer) return void param type ElementPointerTypeATI in value param pointer Void in array [type] category APPLE_element_array version 1.2 extension glxropcode ? glxflags ignore offset ? DrawElementArrayAPPLE(mode, first, count) return void param mode BeginMode in value param first Int32 in value param count SizeI in value category APPLE_element_array version 1.2 extension glxropcode ? glxflags ignore offset ? DrawRangeElementArrayAPPLE(mode, start, end, first, count) return void param mode BeginMode in value param start UInt32 in value param end UInt32 in value param first Int32 in value param count SizeI in value category APPLE_element_array version 1.2 extension glxropcode ? glxflags ignore offset ? MultiDrawElementArrayAPPLE(mode, first, count, primcount) return void param mode BeginMode in value param first Int32 in array [primcount] param count SizeI in array [primcount] param primcount SizeI in value category APPLE_element_array version 1.2 extension glxropcode ? glxflags ignore offset ? MultiDrawRangeElementArrayAPPLE(mode, start, end, first, count, primcount) return void param mode BeginMode in value param start UInt32 in value param end UInt32 in value param first Int32 in array [primcount] param count SizeI in array [primcount] param primcount SizeI in value category APPLE_element_array version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #272 # APPLE_fence commands # ############################################################################### # @@ Need to verify/add GLX protocol # @@@ like #222 NV_fence GenFencesAPPLE(n, fences) return void param n SizeI in value param fences FenceNV out array [n] category APPLE_fence version 1.2 extension glxropcode ? glxflags ignore offset ? DeleteFencesAPPLE(n, fences) return void param n SizeI in value param fences FenceNV in array [n] category APPLE_fence version 1.2 extension glxropcode ? glxflags ignore offset ? SetFenceAPPLE(fence) return void param fence FenceNV in value category APPLE_fence version 1.2 extension glxropcode ? glxflags ignore offset ? IsFenceAPPLE(fence) return Boolean param fence FenceNV in value category APPLE_fence version 1.2 extension glxropcode ? glxflags ignore offset ? TestFenceAPPLE(fence) return Boolean param fence FenceNV in value category APPLE_fence version 1.2 extension glxropcode ? glxflags ignore offset ? FinishFenceAPPLE(fence) return void param fence FenceNV in value category APPLE_fence version 1.2 extension glxropcode ? glxflags ignore offset ? TestObjectAPPLE(object, name) return Boolean param object ObjectTypeAPPLE in value param name UInt32 in value category APPLE_fence version 1.2 extension glxropcode ? glxflags ignore offset ? FinishObjectAPPLE(object, name) return void param object ObjectTypeAPPLE in value param name Int32 in value category APPLE_fence version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #273 # APPLE_vertex_array_object commands # ############################################################################### BindVertexArrayAPPLE(array) return void param array UInt32 in value category APPLE_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore alias BindVertexArray DeleteVertexArraysAPPLE(n, arrays) return void param n SizeI in value param arrays UInt32 in array [n] category APPLE_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore alias DeleteVertexArrays GenVertexArraysAPPLE(n, arrays) return void param n SizeI in value param arrays UInt32 out array [n] category APPLE_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore alias GenVertexArray IsVertexArrayAPPLE(array) return Boolean param array UInt32 in value category APPLE_vertex_array_object version 1.2 extension glxropcode ? glxflags ignore alias IsVertexArray ############################################################################### # # Extension #274 # APPLE_vertex_array_range commands # ############################################################################### # @@ Need to verify/add GLX protocol # @@@ like #190 NV_vertex_array_range, VertexArrayRangeAPPLE(length, pointer) return void param length SizeI in value param pointer Void out array [length] category APPLE_vertex_array_range version 1.2 extension glxropcode ? glxflags ignore offset ? FlushVertexArrayRangeAPPLE(length, pointer) return void param length SizeI in value param pointer Void out array [length] category APPLE_vertex_array_range version 1.2 extension glxropcode ? glxflags ignore offset ? VertexArrayParameteriAPPLE(pname, param) return void param pname VertexArrayPNameAPPLE in value param param Int32 in value category APPLE_vertex_array_range version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #275 # APPLE_ycbcr_422 commands # ############################################################################### # (none) newcategory: APPLE_ycbcr_422 ############################################################################### # # Extension #276 # S3_s3tc commands # ############################################################################### # (none) newcategory: S3_s3tc ############################################################################### # # Extension #277 # ATI_draw_buffers commands # ############################################################################### DrawBuffersATI(n, bufs) return void param n SizeI in value param bufs DrawBufferModeATI in array [n] category ATI_draw_buffers version 1.2 extension glxropcode 233 alias DrawBuffers ############################################################################### # # Extension #278 - WGL_ATI_pixel_format_float # ############################################################################### newcategory: ATI_pixel_format_float passthru: /* This is really a WGL extension, but defines some associated GL enums. passthru: * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. passthru: */ ############################################################################### # # Extension #279 # ATI_texture_env_combine3 commands # ############################################################################### # (none) newcategory: ATI_texture_env_combine3 ############################################################################### # # Extension #280 # ATI_texture_float commands # ############################################################################### # (none) newcategory: ATI_texture_float ############################################################################### # # Extension #281 (also WGL_NV_float_buffer) # NV_float_buffer commands # ############################################################################### # (none) newcategory: NV_float_buffer ############################################################################### # # Extension #282 # NV_fragment_program commands # ############################################################################### # @@ Need to verify/add GLX protocol # Some NV_fragment_program entry points are shared with ARB_vertex_program, # and are only included in that #define block, for now. newcategory: NV_fragment_program passthru: /* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ ProgramNamedParameter4fNV(id, len, name, x, y, z, w) return void param id UInt32 in value param len SizeI in value param name UInt8 in array [1] param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category NV_fragment_program version 1.2 extension glxropcode ? glxflags ignore offset 682 ProgramNamedParameter4dNV(id, len, name, x, y, z, w) return void param id UInt32 in value param len SizeI in value param name UInt8 in array [1] param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category NV_fragment_program version 1.2 extension glxropcode ? glxflags ignore offset 683 ProgramNamedParameter4fvNV(id, len, name, v) return void param id UInt32 in value param len SizeI in value param name UInt8 in array [1] param v Float32 in array [4] category NV_fragment_program version 1.2 extension glxropcode ? glxflags ignore offset 684 ProgramNamedParameter4dvNV(id, len, name, v) return void param id UInt32 in value param len SizeI in value param name UInt8 in array [1] param v Float64 in array [4] category NV_fragment_program version 1.2 extension glxropcode ? glxflags ignore offset 685 GetProgramNamedParameterfvNV(id, len, name, params) return void param id UInt32 in value param len SizeI in value param name UInt8 in array [1] param params Float32 out array [4] category NV_fragment_program dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset 686 GetProgramNamedParameterdvNV(id, len, name, params) return void param id UInt32 in value param len SizeI in value param name UInt8 in array [1] param params Float64 out array [4] category NV_fragment_program dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset 687 ############################################################################### # # Extension #283 # NV_half_float commands # ############################################################################### # @@ Need to verify/add GLX protocol Vertex2hNV(x, y) return void param x Half16NV in value param y Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Vertex2hvNV(v) return void param v Half16NV in array [2] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Vertex3hNV(x, y, z) return void param x Half16NV in value param y Half16NV in value param z Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Vertex3hvNV(v) return void param v Half16NV in array [3] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Vertex4hNV(x, y, z, w) return void param x Half16NV in value param y Half16NV in value param z Half16NV in value param w Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Vertex4hvNV(v) return void param v Half16NV in array [4] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Normal3hNV(nx, ny, nz) return void param nx Half16NV in value param ny Half16NV in value param nz Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Normal3hvNV(v) return void param v Half16NV in array [3] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Color3hNV(red, green, blue) return void param red Half16NV in value param green Half16NV in value param blue Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Color3hvNV(v) return void param v Half16NV in array [3] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Color4hNV(red, green, blue, alpha) return void param red Half16NV in value param green Half16NV in value param blue Half16NV in value param alpha Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? Color4hvNV(v) return void param v Half16NV in array [4] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoord1hNV(s) return void param s Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoord1hvNV(v) return void param v Half16NV in array [1] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoord2hNV(s, t) return void param s Half16NV in value param t Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoord2hvNV(v) return void param v Half16NV in array [2] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoord3hNV(s, t, r) return void param s Half16NV in value param t Half16NV in value param r Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoord3hvNV(v) return void param v Half16NV in array [3] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoord4hNV(s, t, r, q) return void param s Half16NV in value param t Half16NV in value param r Half16NV in value param q Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoord4hvNV(v) return void param v Half16NV in array [4] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoord1hNV(target, s) return void param target TextureUnit in value param s Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoord1hvNV(target, v) return void param target TextureUnit in value param v Half16NV in array [1] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoord2hNV(target, s, t) return void param target TextureUnit in value param s Half16NV in value param t Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoord2hvNV(target, v) return void param target TextureUnit in value param v Half16NV in array [2] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoord3hNV(target, s, t, r) return void param target TextureUnit in value param s Half16NV in value param t Half16NV in value param r Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoord3hvNV(target, v) return void param target TextureUnit in value param v Half16NV in array [3] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoord4hNV(target, s, t, r, q) return void param target TextureUnit in value param s Half16NV in value param t Half16NV in value param r Half16NV in value param q Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? MultiTexCoord4hvNV(target, v) return void param target TextureUnit in value param v Half16NV in array [4] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? FogCoordhNV(fog) return void param fog Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? FogCoordhvNV(fog) return void param fog Half16NV in array [1] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? SecondaryColor3hNV(red, green, blue) return void param red Half16NV in value param green Half16NV in value param blue Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? SecondaryColor3hvNV(v) return void param v Half16NV in array [3] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexWeighthNV(weight) return void param weight Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexWeighthvNV(weight) return void param weight Half16NV in array [1] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttrib1hNV(index, x) return void param index UInt32 in value param x Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttrib1hvNV(index, v) return void param index UInt32 in value param v Half16NV in array [1] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttrib2hNV(index, x, y) return void param index UInt32 in value param x Half16NV in value param y Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttrib2hvNV(index, v) return void param index UInt32 in value param v Half16NV in array [2] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttrib3hNV(index, x, y, z) return void param index UInt32 in value param x Half16NV in value param y Half16NV in value param z Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttrib3hvNV(index, v) return void param index UInt32 in value param v Half16NV in array [3] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttrib4hNV(index, x, y, z, w) return void param index UInt32 in value param x Half16NV in value param y Half16NV in value param z Half16NV in value param w Half16NV in value category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttrib4hvNV(index, v) return void param index UInt32 in value param v Half16NV in array [4] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribs1hvNV(index, n, v) return void param index UInt32 in value param n SizeI in value param v Half16NV in array [n] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribs2hvNV(index, n, v) return void param index UInt32 in value param n SizeI in value param v Half16NV in array [n] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribs3hvNV(index, n, v) return void param index UInt32 in value param n SizeI in value param v Half16NV in array [n] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribs4hvNV(index, n, v) return void param index UInt32 in value param n SizeI in value param v Half16NV in array [n] category NV_half_float version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #284 # NV_pixel_data_range commands # ############################################################################### # @@ Need to verify/add GLX protocol PixelDataRangeNV(target, length, pointer) return void param target PixelDataRangeTargetNV in value param length SizeI in value param pointer Void out array [length] category NV_pixel_data_range version 1.2 extension glxropcode ? glxflags ignore offset ? FlushPixelDataRangeNV(target) return void param target PixelDataRangeTargetNV in value category NV_pixel_data_range version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #285 # NV_primitive_restart commands # ############################################################################### # @@ Need to verify/add GLX protocol PrimitiveRestartNV() return void category NV_primitive_restart version 1.2 extension glxropcode ? glxflags ignore offset ? PrimitiveRestartIndexNV(index) return void param index UInt32 in value category NV_primitive_restart version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #286 # NV_texture_expand_normal commands # ############################################################################### # (none) newcategory: NV_texture_expand_normal ############################################################################### # # Extension #287 # NV_vertex_program2 commands # ############################################################################### # (none) newcategory: NV_vertex_program2 ############################################################################### # # Extension #288 # ATI_map_object_buffer commands # ############################################################################### # @@ Need to verify/add GLX protocol MapObjectBufferATI(buffer) return VoidPointer param buffer UInt32 in value category ATI_map_object_buffer version 1.2 extension glxropcode ? glxflags ignore offset ? UnmapObjectBufferATI(buffer) return void param buffer UInt32 in value category ATI_map_object_buffer version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #289 # ATI_separate_stencil commands # ############################################################################### # @@ Need to verify/add GLX protocol StencilOpSeparateATI(face, sfail, dpfail, dppass) return void param face StencilFaceDirection in value param sfail StencilOp in value param dpfail StencilOp in value param dppass StencilOp in value category ATI_separate_stencil version 1.2 extension glxropcode ? glxflags ignore alias StencilOpSeparate StencilFuncSeparateATI(frontfunc, backfunc, ref, mask) return void param frontfunc StencilFunction in value param backfunc StencilFunction in value param ref ClampedStencilValue in value param mask MaskedStencilValue in value category ATI_separate_stencil version 1.2 extension glxropcode ? glxflags ignore alias StencilFuncSeparate ############################################################################### # # Extension #290 # ATI_vertex_attrib_array_object commands # ############################################################################### # @@ Need to verify/add GLX protocol VertexAttribArrayObjectATI(index, size, type, normalized, stride, buffer, offset) return void param index UInt32 in value param size Int32 in value param type VertexAttribPointerTypeARB in value param normalized Boolean in value param stride SizeI in value param buffer UInt32 in value param offset UInt32 in value category ATI_vertex_attrib_array_object version 1.2 extension glxropcode ? glxflags ignore offset ? GetVertexAttribArrayObjectfvATI(index, pname, params) return void param index UInt32 in value param pname ArrayObjectPNameATI in value param params Float32 out array [pname] category ATI_vertex_attrib_array_object dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVertexAttribArrayObjectivATI(index, pname, params) return void param index UInt32 in value param pname ArrayObjectPNameATI in value param params Int32 out array [pname] category ATI_vertex_attrib_array_object dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #291 - OpenGL ES only, not in glext.h # OES_byte_coordinates commands # ############################################################################### # void Vertex{234}bOES(T coords) # void Vertex{234}bvOES(T *coords) # void TexCoord{1234}bOES(T coords) # void TexCoord{1234}bvOES(T *coords) # void MultiTexCoord{1234}bOES(enum texture, T coords) # void MultiTexCoord{1234}bvOES(enum texture, T *coords) # All are handcode - mapped to non-byte GLX protocol on client side # newcategory: OES_byte_coordinates ############################################################################### # # Extension #292 - OpenGL ES only, not in glext.h # OES_fixed_point commands # ############################################################################### # Too many to list in just a comment - see spec in the extension registry # All are handcode - mapped to non-byte GLX protocol on client side # newcategory: OES_fixed_point ############################################################################### # # Extension #293 - OpenGL ES only, not in glext.h # OES_single_precision commands # ############################################################################### # void DepthRangefOES(clampf n, clampf f) # void FrustumfOES(float l, float r, float b, float t, float n, float f) # void OrthofOES(float l, float r, float b, float t, float n, float f) # void ClipPlanefOES(enum plane, const float* equation) # void glClearDepthfOES(clampd depth) # GLX ropcodes 4308-4312 (not respectively, see extension spec) # void GetClipPlanefOES(enum plane, float* equation) # GLX vendor private 1421 # newcategory: OES_single_precision ############################################################################### # # Extension #294 - OpenGL ES only, not in glext.h # OES_compressed_paletted_texture commands # ############################################################################### # (none) # newcategory: OES_compressed_paletted_texture ############################################################################### # # Extension #295 - This is an OpenGL ES extension, but also implemented in Mesa # OES_read_format commands # ############################################################################### # (none) newcategory: OES_read_format ############################################################################### # # Extension #296 - OpenGL ES only, not in glext.h # OES_query_matrix commands # ############################################################################### # bitfield queryMatrixxOES(fixed mantissa[16], int exponent[16]) # All are handcode - mapped to non-byte GLX protocol on client side # newcategory: OES_query_matrix ############################################################################### # # Extension #297 # EXT_depth_bounds_test commands # ############################################################################### DepthBoundsEXT(zmin, zmax) return void param zmin ClampedFloat64 in value param zmax ClampedFloat64 in value category EXT_depth_bounds_test version 1.2 extension glxropcode 4229 offset 699 ############################################################################### # # Extension #298 # EXT_texture_mirror_clamp commands # ############################################################################### # (none) newcategory: EXT_texture_mirror_clamp ############################################################################### # # Extension #299 # EXT_blend_equation_separate commands # ############################################################################### BlendEquationSeparateEXT(modeRGB, modeAlpha) return void param modeRGB BlendEquationModeEXT in value param modeAlpha BlendEquationModeEXT in value category EXT_blend_equation_separate version 1.2 extension glxropcode 4228 alias BlendEquationSeparate ############################################################################### # # Extension #300 # MESA_pack_invert commands # ############################################################################### # (none) newcategory: MESA_pack_invert ############################################################################### # # Extension #301 # MESA_ycbcr_texture commands # ############################################################################### # (none) newcategory: MESA_ycbcr_texture ############################################################################### # # Extension #301 # MESA_ycbcr_texture commands # ############################################################################### # (none) newcategory: MESA_ycbcr_texture ############################################################################### # # Extension #302 # EXT_pixel_buffer_object commands # ############################################################################### # (none) newcategory: EXT_pixel_buffer_object ############################################################################### # # Extension #303 # NV_fragment_program_option commands # ############################################################################### # (none) newcategory: NV_fragment_program_option ############################################################################### # # Extension #304 # NV_fragment_program2 commands # ############################################################################### # (none) newcategory: NV_fragment_program2 ############################################################################### # # Extension #305 # NV_vertex_program2_option commands # ############################################################################### # (none) newcategory: NV_vertex_program2_option ############################################################################### # # Extension #306 # NV_vertex_program3 commands # ############################################################################### # (none) newcategory: NV_vertex_program3 ############################################################################### # # Extension #307 - GLX_SGIX_hyperpipe commands # Extension #308 - GLX_MESA_agp_offset commands # Extension #309 - GL_EXT_texture_compression_dxt1 (OpenGL ES only, subset of _st3c version) # ############################################################################### ############################################################################### # # Extension #310 # EXT_framebuffer_object commands # ############################################################################### IsRenderbufferEXT(renderbuffer) return Boolean param renderbuffer UInt32 in value category EXT_framebuffer_object version 1.2 extension glxvendorpriv 1422 glxflags ignore alias IsRenderbuffer BindRenderbufferEXT(target, renderbuffer) return void param target RenderbufferTarget in value param renderbuffer UInt32 in value category EXT_framebuffer_object version 1.2 extension glxropcode 4316 glxflags ignore alias BindRenderbuffer DeleteRenderbuffersEXT(n, renderbuffers) return void param n SizeI in value param renderbuffers UInt32 in array [n] category EXT_framebuffer_object version 1.2 extension glxropcode 4317 glxflags ignore alias DeleteRenderbuffers GenRenderbuffersEXT(n, renderbuffers) return void param n SizeI in value param renderbuffers UInt32 out array [n] category EXT_framebuffer_object version 1.2 extension glxvendorpriv 1423 glxflags ignore alias GenRenderbuffers RenderbufferStorageEXT(target, internalformat, width, height) return void param target RenderbufferTarget in value param internalformat GLenum in value param width SizeI in value param height SizeI in value category EXT_framebuffer_object version 1.2 extension glxropcode 4318 glxflags ignore alias RenderbufferStorage GetRenderbufferParameterivEXT(target, pname, params) return void param target RenderbufferTarget in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category EXT_framebuffer_object dlflags notlistable version 1.2 extension glxvendorpriv 1424 glxflags ignore alias GetRenderbufferParameteriv IsFramebufferEXT(framebuffer) return Boolean param framebuffer UInt32 in value category EXT_framebuffer_object version 1.2 extension glxvendorpriv 1425 glxflags ignore alias IsFramebuffer BindFramebufferEXT(target, framebuffer) return void param target FramebufferTarget in value param framebuffer UInt32 in value category EXT_framebuffer_object version 1.2 extension glxropcode 4319 glxflags ignore alias BindFramebuffer DeleteFramebuffersEXT(n, framebuffers) return void param n SizeI in value param framebuffers UInt32 in array [n] category EXT_framebuffer_object version 1.2 extension glxropcode 4320 glxflags ignore alias DeleteFramebuffers GenFramebuffersEXT(n, framebuffers) return void param n SizeI in value param framebuffers UInt32 out array [n] category EXT_framebuffer_object version 1.2 extension glxvendorpriv 1426 glxflags ignore alias GenFramebuffers CheckFramebufferStatusEXT(target) return GLenum param target FramebufferTarget in value category EXT_framebuffer_object version 1.2 extension glxvendorpriv 1427 glxflags ignore alias CheckFramebufferStatus FramebufferTexture1DEXT(target, attachment, textarget, texture, level) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param textarget GLenum in value param texture UInt32 in value param level Int32 in value category EXT_framebuffer_object version 1.2 extension glxropcode 4321 glxflags ignore alias FramebufferTexture1D FramebufferTexture2DEXT(target, attachment, textarget, texture, level) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param textarget GLenum in value param texture UInt32 in value param level Int32 in value category EXT_framebuffer_object version 1.2 extension glxropcode 4322 glxflags ignore alias FramebufferTexture2D FramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param textarget GLenum in value param texture UInt32 in value param level Int32 in value param zoffset Int32 in value category EXT_framebuffer_object version 1.2 extension glxropcode 4323 glxflags ignore alias FramebufferTexture3D FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param renderbuffertarget RenderbufferTarget in value param renderbuffer UInt32 in value category EXT_framebuffer_object version 1.2 extension glxropcode 4324 glxflags ignore alias FramebufferRenderbuffer GetFramebufferAttachmentParameterivEXT(target, attachment, pname, params) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category EXT_framebuffer_object dlflags notlistable version 1.2 extension glxvendorpriv 1428 glxflags ignore alias GetFramebufferAttachmentParameteriv GenerateMipmapEXT(target) return void param target GLenum in value category EXT_framebuffer_object version 1.2 extension glxropcode 4325 glxflags ignore alias GenerateMipmap ############################################################################### # # Extension #311 # GREMEDY_string_marker commands # ############################################################################### StringMarkerGREMEDY(len, string) return void param len SizeI in value param string Void in array [len] category GREMEDY_string_marker version 1.0 extension glxflags ignore offset ? ############################################################################### # # Extension #312 # EXT_packed_depth_stencil commands # ############################################################################### # (none) newcategory: EXT_packed_depth_stencil ############################################################################### # # Extension #313 - WGL_3DL_stereo_control # ############################################################################### ############################################################################### # # Extension #314 # EXT_stencil_clear_tag commands # ############################################################################### StencilClearTagEXT(stencilTagBits, stencilClearTag) return void param stencilTagBits SizeI in value param stencilClearTag UInt32 in value category EXT_stencil_clear_tag version 1.5 extension glxropcode 4223 glxflags ignore offset ? ############################################################################### # # Extension #315 # EXT_texture_sRGB commands # ############################################################################### # (none) newcategory: EXT_texture_sRGB ############################################################################### # # Extension #316 # EXT_framebuffer_blit commands # ############################################################################### BlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter) return void param srcX0 Int32 in value param srcY0 Int32 in value param srcX1 Int32 in value param srcY1 Int32 in value param dstX0 Int32 in value param dstY0 Int32 in value param dstX1 Int32 in value param dstY1 Int32 in value param mask ClearBufferMask in value param filter GLenum in value category EXT_framebuffer_blit version 1.5 glxropcode 4330 alias BlitFramebuffer ############################################################################### # # Extension #317 # EXT_framebuffer_multisample commands # ############################################################################### RenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height) return void param target GLenum in value param samples SizeI in value param internalformat GLenum in value param width SizeI in value param height SizeI in value category EXT_framebuffer_multisample version 1.5 glxropcode 4331 alias RenderbufferStorageMultisample ############################################################################### # # Extension #318 # MESAX_texture_stack commands # ############################################################################### # (none) newcategory: MESAX_texture_stack ############################################################################### # # Extension #319 # EXT_timer_query commands # ############################################################################### GetQueryObjecti64vEXT(id, pname, params) return void param id UInt32 in value param pname GLenum in value param params Int64EXT out array [pname] category EXT_timer_query dlflags notlistable version 1.5 glxvendorpriv 1328 glxflags ignore offset ? GetQueryObjectui64vEXT(id, pname, params) return void param id UInt32 in value param pname GLenum in value param params UInt64EXT out array [pname] category EXT_timer_query dlflags notlistable version 1.5 glxvendorpriv 1329 glxflags ignore offset ? ############################################################################### # # Extension #320 # EXT_gpu_program_parameters commands # ############################################################################### ProgramEnvParameters4fvEXT(target, index, count, params) return void param target ProgramTargetARB in value param index UInt32 in value param count SizeI in value param params Float32 in array [count*4] category EXT_gpu_program_parameters version 1.2 glxropcode 4281 offset ? ProgramLocalParameters4fvEXT(target, index, count, params) return void param target ProgramTargetARB in value param index UInt32 in value param count SizeI in value param params Float32 in array [count*4] category EXT_gpu_program_parameters version 1.2 glxropcode 4282 offset ? ############################################################################### # # Extension #321 # APPLE_flush_buffer_range commands # ############################################################################### BufferParameteriAPPLE(target, pname, param) return void param target GLenum in value param pname GLenum in value param param Int32 in value category APPLE_flush_buffer_range version 1.5 extension glxropcode ? glxflags ignore offset ? FlushMappedBufferRangeAPPLE(target, offset, size) return void param target GLenum in value param offset BufferOffset in value param size BufferSize in value category APPLE_flush_buffer_range version 1.5 extension glxropcode ? glxflags ignore alias FlushMappedBufferRange ############################################################################### # # Extension #322 # NV_gpu_program4 commands # ############################################################################### ProgramLocalParameterI4iNV(target, index, x, y, z, w) return void param target ProgramTarget in value param index UInt32 in value param x Int32 in value param y Int32 in value param z Int32 in value param w Int32 in value category NV_gpu_program4 version 1.3 vectorequiv ProgramLocalParameterI4ivNV glxvectorequiv ProgramLocalParameterI4ivNV extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramLocalParameterI4ivNV(target, index, params) return void param target ProgramTarget in value param index UInt32 in value param params Int32 in array [4] category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramLocalParametersI4ivNV(target, index, count, params) return void param target ProgramTarget in value param index UInt32 in value param count SizeI in value param params Int32 in array [count*4] category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramLocalParameterI4uiNV(target, index, x, y, z, w) return void param target ProgramTarget in value param index UInt32 in value param x UInt32 in value param y UInt32 in value param z UInt32 in value param w UInt32 in value category NV_gpu_program4 version 1.3 vectorequiv ProgramLocalParameterI4uivNV glxvectorequiv ProgramLocalParameterI4uivNV extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramLocalParameterI4uivNV(target, index, params) return void param target ProgramTarget in value param index UInt32 in value param params UInt32 in array [4] category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramLocalParametersI4uivNV(target, index, count, params) return void param target ProgramTarget in value param index UInt32 in value param count SizeI in value param params UInt32 in array [count*4] category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramEnvParameterI4iNV(target, index, x, y, z, w) return void param target ProgramTarget in value param index UInt32 in value param x Int32 in value param y Int32 in value param z Int32 in value param w Int32 in value category NV_gpu_program4 version 1.3 vectorequiv ProgramEnvParameterI4ivNV glxvectorequiv ProgramEnvParameterI4ivNV extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramEnvParameterI4ivNV(target, index, params) return void param target ProgramTarget in value param index UInt32 in value param params Int32 in array [4] category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramEnvParametersI4ivNV(target, index, count, params) return void param target ProgramTarget in value param index UInt32 in value param count SizeI in value param params Int32 in array [count*4] category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramEnvParameterI4uiNV(target, index, x, y, z, w) return void param target ProgramTarget in value param index UInt32 in value param x UInt32 in value param y UInt32 in value param z UInt32 in value param w UInt32 in value category NV_gpu_program4 version 1.3 vectorequiv ProgramEnvParameterI4uivNV glxvectorequiv ProgramEnvParameterI4uivNV extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramEnvParameterI4uivNV(target, index, params) return void param target ProgramTarget in value param index UInt32 in value param params UInt32 in array [4] category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramEnvParametersI4uivNV(target, index, count, params) return void param target ProgramTarget in value param index UInt32 in value param count SizeI in value param params UInt32 in array [count*4] category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore GetProgramLocalParameterIivNV(target, index, params) return void param target ProgramTarget in value param index UInt32 in value param params Int32 out array [4] dlflags notlistable category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore GetProgramLocalParameterIuivNV(target, index, params) return void param target ProgramTarget in value param index UInt32 in value param params UInt32 out array [4] dlflags notlistable category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore GetProgramEnvParameterIivNV(target, index, params) return void param target ProgramTarget in value param index UInt32 in value param params Int32 out array [4] dlflags notlistable category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore GetProgramEnvParameterIuivNV(target, index, params) return void param target ProgramTarget in value param index UInt32 in value param params UInt32 out array [4] dlflags notlistable category NV_gpu_program4 version 1.3 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ############################################################################### # # Extension #323 # NV_geometry_program4 commands # ############################################################################### ProgramVertexLimitNV(target, limit) return void param target ProgramTarget in value param limit Int32 in value category NV_geometry_program4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore FramebufferTextureEXT(target, attachment, texture, level) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value category NV_geometry_program4 version 2.0 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore alias FramebufferTextureARB FramebufferTextureLayerEXT(target, attachment, texture, level, layer) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value param layer CheckedInt32 in value category NV_geometry_program4 version 2.0 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore alias FramebufferTextureLayer FramebufferTextureFaceEXT(target, attachment, texture, level, face) return void param target FramebufferTarget in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value param face TextureTarget in value category NV_geometry_program4 version 2.0 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore alias FramebufferTextureFaceARB ############################################################################### # # Extension #324 # EXT_geometry_shader4 commands # ############################################################################### ProgramParameteriEXT(program, pname, value) return void param program UInt32 in value param pname ProgramParameterPName in value param value Int32 in value category EXT_geometry_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias ProgramParameteriARB ############################################################################### # # Extension #325 # NV_vertex_program4 commands # ############################################################################### VertexAttribI1iEXT(index, x) return void param index UInt32 in value param x Int32 in value category NV_vertex_program4 beginend allow-inside vectorequiv VertexAttribI1ivEXT glxvectorequiv VertexAttribI1ivEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI1i VertexAttribI2iEXT(index, x, y) return void param index UInt32 in value param x Int32 in value param y Int32 in value category NV_vertex_program4 beginend allow-inside vectorequiv VertexAttribI2ivEXT glxvectorequiv VertexAttribI2ivEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI2i VertexAttribI3iEXT(index, x, y, z) return void param index UInt32 in value param x Int32 in value param y Int32 in value param z Int32 in value category NV_vertex_program4 beginend allow-inside vectorequiv VertexAttribI3ivEXT glxvectorequiv VertexAttribI3ivEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI3i VertexAttribI4iEXT(index, x, y, z, w) return void param index UInt32 in value param x Int32 in value param y Int32 in value param z Int32 in value param w Int32 in value category NV_vertex_program4 beginend allow-inside vectorequiv VertexAttribI4ivEXT glxvectorequiv VertexAttribI4ivEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI4i VertexAttribI1uiEXT(index, x) return void param index UInt32 in value param x UInt32 in value category NV_vertex_program4 beginend allow-inside vectorequiv VertexAttribI1uivEXT glxvectorequiv VertexAttribI1uivEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI1ui VertexAttribI2uiEXT(index, x, y) return void param index UInt32 in value param x UInt32 in value param y UInt32 in value category NV_vertex_program4 beginend allow-inside vectorequiv VertexAttribI2uivEXT glxvectorequiv VertexAttribI2uivEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI2ui VertexAttribI3uiEXT(index, x, y, z) return void param index UInt32 in value param x UInt32 in value param y UInt32 in value param z UInt32 in value category NV_vertex_program4 beginend allow-inside vectorequiv VertexAttribI3uivEXT glxvectorequiv VertexAttribI3uivEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI3ui VertexAttribI4uiEXT(index, x, y, z, w) return void param index UInt32 in value param x UInt32 in value param y UInt32 in value param z UInt32 in value param w UInt32 in value category NV_vertex_program4 beginend allow-inside vectorequiv VertexAttribI4uivEXT glxvectorequiv VertexAttribI4uivEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI4ui VertexAttribI1ivEXT(index, v) return void param index UInt32 in value param v Int32 in array [1] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI1iv VertexAttribI2ivEXT(index, v) return void param index UInt32 in value param v Int32 in array [2] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI2iv VertexAttribI3ivEXT(index, v) return void param index UInt32 in value param v Int32 in array [3] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI3iv VertexAttribI4ivEXT(index, v) return void param index UInt32 in value param v Int32 in array [4] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI4iv VertexAttribI1uivEXT(index, v) return void param index UInt32 in value param v UInt32 in array [1] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI1uiv VertexAttribI2uivEXT(index, v) return void param index UInt32 in value param v UInt32 in array [2] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI2uiv VertexAttribI3uivEXT(index, v) return void param index UInt32 in value param v UInt32 in array [3] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI3uiv VertexAttribI4uivEXT(index, v) return void param index UInt32 in value param v UInt32 in array [4] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI4uiv VertexAttribI4bvEXT(index, v) return void param index UInt32 in value param v Int8 in array [4] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI4bv VertexAttribI4svEXT(index, v) return void param index UInt32 in value param v Int16 in array [4] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI4sv VertexAttribI4ubvEXT(index, v) return void param index UInt32 in value param v UInt8 in array [4] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI4ubv VertexAttribI4usvEXT(index, v) return void param index UInt32 in value param v UInt16 in array [4] category NV_vertex_program4 beginend allow-inside extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribI4usv VertexAttribIPointerEXT(index, size, type, stride, pointer) return void param index UInt32 in value param size Int32 in value param type VertexAttribEnum in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained category NV_vertex_program4 dlflags notlistable extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias VertexAttribIPointer GetVertexAttribIivEXT(index, pname, params) return void param index UInt32 in value param pname VertexAttribEnum in value param params Int32 out array [1] category NV_vertex_program4 dlflags notlistable extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias GetVertexAttribIiv GetVertexAttribIuivEXT(index, pname, params) return void param index UInt32 in value param pname VertexAttribEnum in value param params UInt32 out array [1] category NV_vertex_program4 dlflags notlistable extension soft WINSOFT NV10 glfflags ignore glxflags ignore alias GetVertexAttribIuiv ############################################################################### # # Extension #326 # EXT_gpu_shader4 commands # ############################################################################### GetUniformuivEXT(program, location, params) return void param program UInt32 in value param location Int32 in value param params UInt32 out array [COMPSIZE(program/location)] category EXT_gpu_shader4 dlflags notlistable version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias GetUniformuiv BindFragDataLocationEXT(program, color, name) return void param program UInt32 in value param color UInt32 in value param name Char in array [COMPSIZE(name)] category EXT_gpu_shader4 dlflags notlistable version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias BindFragDataLocation GetFragDataLocationEXT(program, name) return Int32 param program UInt32 in value param name Char in array [COMPSIZE(name)] category EXT_gpu_shader4 dlflags notlistable version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias GetFragDataLocation Uniform1uiEXT(location, v0) return void param location Int32 in value param v0 UInt32 in value category EXT_gpu_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias Uniform1ui Uniform2uiEXT(location, v0, v1) return void param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value category EXT_gpu_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias Uniform2ui Uniform3uiEXT(location, v0, v1, v2) return void param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value param v2 UInt32 in value category EXT_gpu_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias Uniform3ui Uniform4uiEXT(location, v0, v1, v2, v3) return void param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value param v2 UInt32 in value param v3 UInt32 in value category EXT_gpu_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias Uniform4ui Uniform1uivEXT(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt32 in array [count] category EXT_gpu_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias Uniform1uiv Uniform2uivEXT(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt32 in array [count*2] category EXT_gpu_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias Uniform2uiv Uniform3uivEXT(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt32 in array [count*3] category EXT_gpu_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias Uniform3uiv Uniform4uivEXT(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt32 in array [count*4] category EXT_gpu_shader4 version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias Uniform4uiv ############################################################################### # # Extension #327 # EXT_draw_instanced commands # ############################################################################### DrawArraysInstancedEXT(mode, start, count, primcount) return void param mode BeginMode in value param start Int32 in value param count SizeI in value param primcount SizeI in value category EXT_draw_instanced version 2.0 extension soft WINSOFT dlflags notlistable vectorequiv ArrayElement glfflags ignore glxflags ignore alias DrawArraysInstancedARB DrawElementsInstancedEXT(mode, count, type, indices, primcount) return void param mode BeginMode in value param count SizeI in value param type DrawElementsType in value param indices Void in array [COMPSIZE(count/type)] param primcount SizeI in value category EXT_draw_instanced version 2.0 extension soft WINSOFT dlflags notlistable vectorequiv ArrayElement glfflags ignore glxflags ignore alias DrawElementsInstancedARB ############################################################################### # # Extension #328 # EXT_packed_float commands # ############################################################################### # (none) newcategory: EXT_packed_float ############################################################################### # # Extension #329 # EXT_texture_array commands # ############################################################################### # (none) newcategory: EXT_texture_array ############################################################################### # # Extension #330 # EXT_texture_buffer_object commands # ############################################################################### TexBufferEXT(target, internalformat, buffer) return void param target TextureTarget in value param internalformat GLenum in value param buffer UInt32 in value category EXT_texture_buffer_object version 2.0 extension soft WINSOFT NV50 glfflags ignore glxflags ignore alias TexBufferARB ############################################################################### # # Extension #331 # EXT_texture_compression_latc commands # ############################################################################### # (none) newcategory: EXT_texture_compression_latc ############################################################################### # # Extension #332 # EXT_texture_compression_rgtc commands # ############################################################################### # (none) newcategory: EXT_texture_compression_rgtc ############################################################################### # # Extension #333 # EXT_texture_shared_exponent commands # ############################################################################### # (none) newcategory: EXT_texture_shared_exponent ############################################################################### # # Extension #334 # NV_depth_buffer_float commands # ############################################################################### DepthRangedNV(zNear, zFar) return void param zNear Float64 in value param zFar Float64 in value category NV_depth_buffer_float extension soft WINSOFT NV50 version 2.0 glfflags ignore glxflags ignore ClearDepthdNV(depth) return void param depth Float64 in value category NV_depth_buffer_float extension soft WINSOFT NV50 version 2.0 glfflags ignore glxflags ignore DepthBoundsdNV(zmin, zmax) return void param zmin Float64 in value param zmax Float64 in value category NV_depth_buffer_float extension soft WINSOFT NV50 version 2.0 glfflags ignore glxflags ignore ############################################################################### # # Extension #335 # NV_fragment_program4 commands # ############################################################################### # (none) newcategory: NV_fragment_program4 ############################################################################### # # Extension #336 # NV_framebuffer_multisample_coverage commands # ############################################################################### RenderbufferStorageMultisampleCoverageNV(target, coverageSamples, colorSamples, internalformat, width, height) return void param target RenderbufferTarget in value param coverageSamples SizeI in value param colorSamples SizeI in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value category NV_framebuffer_multisample_coverage version 1.5 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore ############################################################################### # # Extension #337 # EXT_framebuffer_sRGB commands # ############################################################################### # (none) newcategory: EXT_framebuffer_sRGB ############################################################################### # # Extension #338 # NV_geometry_shader4 commands # ############################################################################### # (none) newcategory: NV_geometry_shader4 ############################################################################### # # Extension #339 # NV_parameter_buffer_object commands # ############################################################################### ProgramBufferParametersfvNV(target, buffer, index, count, params) return void param target ProgramTarget in value param buffer UInt32 in value param index UInt32 in value param count SizeI in value param params Float32 in array [count] category NV_parameter_buffer_object version 1.2 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramBufferParametersIivNV(target, buffer, index, count, params) return void param target ProgramTarget in value param buffer UInt32 in value param index UInt32 in value param count SizeI in value param params Int32 in array [count] category NV_parameter_buffer_object version 1.2 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ProgramBufferParametersIuivNV(target, buffer, index, count, params) return void param target ProgramTarget in value param buffer UInt32 in value param index UInt32 in value param count SizeI in value param params UInt32 in array [count] category NV_parameter_buffer_object version 1.2 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ############################################################################### # # Extension #340 # EXT_draw_buffers2 commands # ############################################################################### ColorMaskIndexedEXT(index, r, g, b, a) return void param index UInt32 in value param r Boolean in value param g Boolean in value param b Boolean in value param a Boolean in value category EXT_draw_buffers2 version 2.0 glxflags ignore glfflags ignore extension soft WINSOFT alias ColorMaski GetBooleanIndexedvEXT(target, index, data) return void param target GLenum in value param index UInt32 in value param data Boolean out array [COMPSIZE(target)] category EXT_draw_buffers2 version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias GetBooleani_v GetIntegerIndexedvEXT(target, index, data) return void param target GLenum in value param index UInt32 in value param data Int32 out array [COMPSIZE(target)] category EXT_draw_buffers2 version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias GetIntegeri_v EnableIndexedEXT(target, index) return void param target GLenum in value param index UInt32 in value category EXT_draw_buffers2 version 2.0 glxflags ignore glfflags ignore extension soft WINSOFT alias Enablei DisableIndexedEXT(target, index) return void param target GLenum in value param index UInt32 in value category EXT_draw_buffers2 version 2.0 glxflags ignore glfflags ignore extension soft WINSOFT alias Disablei IsEnabledIndexedEXT(target, index) return Boolean param target GLenum in value param index UInt32 in value category EXT_draw_buffers2 version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias IsEnabledi ############################################################################### # # Extension #341 # NV_transform_feedback commands # ############################################################################### BeginTransformFeedbackNV(primitiveMode) return void param primitiveMode GLenum in value category NV_transform_feedback version 1.5 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias BeginTransformFeedback EndTransformFeedbackNV() return void category NV_transform_feedback version 1.5 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias EndTransformFeedback TransformFeedbackAttribsNV(count, attribs, bufferMode) return void param count UInt32 in value param attribs Int32 in array [COMPSIZE(count)] param bufferMode GLenum in value category NV_transform_feedback version 1.5 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT BindBufferRangeNV(target, index, buffer, offset, size) return void param target GLenum in value param index UInt32 in value param buffer UInt32 in value param offset BufferOffset in value param size BufferSize in value category NV_transform_feedback version 1.5 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias BindBufferRange BindBufferOffsetNV(target, index, buffer, offset) return void param target GLenum in value param index UInt32 in value param buffer UInt32 in value param offset BufferOffset in value category NV_transform_feedback version 1.5 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias BindBufferOffsetEXT BindBufferBaseNV(target, index, buffer) return void param target GLenum in value param index UInt32 in value param buffer UInt32 in value category NV_transform_feedback version 1.5 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias BindBufferBase TransformFeedbackVaryingsNV(program, count, varyings, bufferMode) return void param program UInt32 in value param count SizeI in value param varyings CharPointer in array [count] param bufferMode GLenum in value category NV_transform_feedback version 1.5 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias TransformFeedbackVaryings ActiveVaryingNV(program, name) return void param program UInt32 in value param name Char in array [COMPSIZE(name)] category NV_transform_feedback version 1.5 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT GetVaryingLocationNV(program, name) return Int32 param program UInt32 in value param name Char in array [COMPSIZE(name)] category NV_transform_feedback dlflags notlistable version 1.5 glfflags ignore glxflags ignore extension soft WINSOFT GetActiveVaryingNV(program, index, bufSize, length, size, type, name) return void param program UInt32 in value param index UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param size SizeI out array [1] param type GLenum out array [1] param name Char out array [COMPSIZE(program/index/bufSize)] category NV_transform_feedback dlflags notlistable version 1.5 extension soft WINSOFT glfflags ignore glxflags ignore GetTransformFeedbackVaryingNV(program, index, location) return void param program UInt32 in value param index UInt32 in value param location Int32 out array [1] category NV_transform_feedback dlflags notlistable version 1.5 extension soft WINSOFT glfflags ignore glxflags ignore alias GetTransformFeedbackVarying ############################################################################### # # Extension #342 # EXT_bindable_uniform commands # ############################################################################### UniformBufferEXT(program, location, buffer) return void param program UInt32 in value param location Int32 in value param buffer UInt32 in value category EXT_bindable_uniform version 2.0 extension soft WINSOFT glxflags ignore glfflags ignore GetUniformBufferSizeEXT(program, location) return Int32 param program UInt32 in value param location Int32 in value category EXT_bindable_uniform dlflags notlistable version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore GetUniformOffsetEXT(program, location) return BufferOffset param program UInt32 in value param location Int32 in value category EXT_bindable_uniform dlflags notlistable version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore ############################################################################### # # Extension #343 # EXT_texture_integer extension commands # ############################################################################### TexParameterIivEXT(target, pname, params) return void param target TextureTarget in value param pname TextureParameterName in value param params Int32 in array [COMPSIZE(pname)] category EXT_texture_integer version 2.0 extension soft WINSOFT NV50 glfflags ignore glxflags ignore alias TexParameterIiv TexParameterIuivEXT(target, pname, params) return void param target TextureTarget in value param pname TextureParameterName in value param params UInt32 in array [COMPSIZE(pname)] category EXT_texture_integer version 2.0 extension soft WINSOFT NV50 glfflags ignore glxflags ignore alias TexParameterIuiv GetTexParameterIivEXT(target, pname, params) return void param target TextureTarget in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_texture_integer dlflags notlistable version 1.0 version 2.0 extension soft WINSOFT NV50 glfflags ignore glxflags ignore alias GetTexParameterIiv GetTexParameterIuivEXT(target, pname, params) return void param target TextureTarget in value param pname GetTextureParameter in value param params UInt32 out array [COMPSIZE(pname)] category EXT_texture_integer dlflags notlistable version 1.0 version 2.0 extension soft WINSOFT NV50 glfflags ignore glxflags ignore alias GetTexParameterIuiv ClearColorIiEXT(red, green, blue, alpha) return void param red Int32 in value param green Int32 in value param blue Int32 in value param alpha Int32 in value category EXT_texture_integer version 2.0 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ClearColorIuiEXT(red, green, blue, alpha) return void param red UInt32 in value param green UInt32 in value param blue UInt32 in value param alpha UInt32 in value category EXT_texture_integer version 2.0 extension soft WINSOFT NV50 glfflags ignore glxflags ignore ############################################################################### # # Extension #344 - GLX_EXT_texture_from_pixmap # ############################################################################### ############################################################################### # # Extension #345 # GREMEDY_frame_terminator commands # ############################################################################### FrameTerminatorGREMEDY() return void category GREMEDY_frame_terminator version 1.0 extension glxflags ignore offset ? ############################################################################### # # Extension #346 # NV_conditional_render commands # ############################################################################### BeginConditionalRenderNV(id, mode) return void param id UInt32 in value param mode TypeEnum in value category NV_conditional_render glfflags ignore glxflags ignore alias BeginConditionalRender EndConditionalRenderNV() return void category NV_conditional_render glfflags ignore glxflags ignore alias EndConditionalRender ############################################################################### # # Extension #347 # NV_present_video commands # ############################################################################### # TBD # void PresentFrameKeyedNV(uint video_slot, uint64EXT minPresentTime, # uint beginPresentTimeId, uint # presentDurationId, enum type, enum target0, # uint fill0, uint key0, enum target1, uint # fill1, uint key1); # # void PresentFrameDualFillNV(uint video_slot, uint64EXT # minPresentTime, uint beginPresentTimeId, # uint presentDurationId, enum type, enum # target0, uint fill0, enum target1, uint # fill1, enum target2, uint fill2, enum # target3, uint fill3); # # void GetVideoivNV(uint video_slot, enum pname, int *params); # void GetVideouivNV(uint video_slot, enum pname, uint *params); # void GetVideoi64vNV(uint video_slot, enum pname, int64EXT *params); # void GetVideoui64vNV(uint video_slot, enum pname, uint64EXT *params); # void VideoParameterivNV(uint video_slot, enum pname, const int *params); PresentFrameKeyedNV(video_slot, minPresentTime, beginPresentTimeId, presentDurationId, type, target0, fill0, key0, target1, fill1, key1) return void param video_slot UInt32 in value param minPresentTime UInt64EXT in value param beginPresentTimeId UInt32 in value param presentDurationId UInt32 in value param type GLenum in value param target0 GLenum in value param fill0 UInt32 in value param key0 UInt32 in value param target1 GLenum in value param fill1 UInt32 in value param key1 UInt32 in value category NV_present_video version 1.2 extension glxropcode ? glxflags ignore offset ? PresentFrameDualFillNV(video_slot, minPresentTime, beginPresentTimeId, presentDurationId, type, target0, fill0, target1, fill1, target2, fill2, target3, fill3) return void param video_slot UInt32 in value param minPresentTime UInt64EXT in value param beginPresentTimeId UInt32 in value param presentDurationId UInt32 in value param type GLenum in value param target0 GLenum in value param fill0 UInt32 in value param target1 GLenum in value param fill1 UInt32 in value param target2 GLenum in value param fill2 UInt32 in value param target3 GLenum in value param fill3 UInt32 in value category NV_present_video version 1.2 extension glxropcode ? glxflags ignore offset ? GetVideoivNV(video_slot, pname, params) return void param video_slot UInt32 in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category NV_present_video dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVideouivNV(video_slot, pname, params) return void param video_slot UInt32 in value param pname GLenum in value param params UInt32 out array [COMPSIZE(pname)] category NV_present_video dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVideoi64vNV(video_slot, pname, params) return void param video_slot UInt32 in value param pname GLenum in value param params Int64EXT out array [COMPSIZE(pname)] category NV_present_video dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVideoui64vNV(video_slot, pname, params) return void param video_slot UInt32 in value param pname GLenum in value param params UInt64EXT out array [COMPSIZE(pname)] category NV_present_video dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #348 - GLX_NV_video_out # Extension #349 - WGL_NV_video_out # Extension #350 - GLX_NV_swap_group # Extension #351 - WGL_NV_swap_group # ############################################################################### ############################################################################### # # Extension #352 # EXT_transform_feedback commands # ############################################################################### # From EXT_draw_buffers2: GetBooleanIndexedvEXT / GetIntegerIndexedvEXT BeginTransformFeedbackEXT(primitiveMode) return void param primitiveMode GLenum in value category EXT_transform_feedback version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias BeginTransformFeedback EndTransformFeedbackEXT() return void category EXT_transform_feedback version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias EndTransformFeedback BindBufferRangeEXT(target, index, buffer, offset, size) return void param target GLenum in value param index UInt32 in value param buffer UInt32 in value param offset BufferOffset in value param size BufferSize in value category EXT_transform_feedback version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias BindBufferRange # Not promoted to the OpenGL 3.0 core BindBufferOffsetEXT(target, index, buffer, offset) return void param target GLenum in value param index UInt32 in value param buffer UInt32 in value param offset BufferOffset in value category EXT_transform_feedback version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT BindBufferBaseEXT(target, index, buffer) return void param target GLenum in value param index UInt32 in value param buffer UInt32 in value category EXT_transform_feedback version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias BindBufferBase TransformFeedbackVaryingsEXT(program, count, varyings, bufferMode) return void param program UInt32 in value param count SizeI in value param varyings CharPointer in array [count] param bufferMode GLenum in value category EXT_transform_feedback version 2.0 dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT alias TransformFeedbackVaryings GetTransformFeedbackVaryingEXT(program, index, bufSize, length, size, type, name) return void param program UInt32 in value param index UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param size SizeI out array [1] param type GLenum out array [1] param name Char out array [COMPSIZE(length)] category EXT_transform_feedback dlflags notlistable version 2.0 extension soft WINSOFT glfflags ignore glxflags ignore alias GetTransformFeedbackVarying ############################################################################### # # Extension #353 # EXT_direct_state_access commands # ############################################################################### # New 1.1 client commands ClientAttribDefaultEXT(mask) return void param mask ClientAttribMask in value category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore ### client-handcode client-intercept server-handcode PushClientAttribDefaultEXT(mask) return void param mask ClientAttribMask in value category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore ### client-handcode client-intercept server-handcode # New 1.0 matrix commands MatrixLoadfEXT(mode, m) return void param mode MatrixMode in value param m Float32 in array [16] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixLoaddEXT(mode, m) return void param mode MatrixMode in value param m Float64 in array [16] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixMultfEXT(mode, m) return void param mode MatrixMode in value param m Float32 in array [16] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixMultdEXT(mode, m) return void param mode MatrixMode in value param m Float64 in array [16] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixLoadIdentityEXT(mode) return void param mode MatrixMode in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixRotatefEXT(mode, angle, x, y, z) return void param mode MatrixMode in value param angle Float32 in value param x Float32 in value param y Float32 in value param z Float32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixRotatedEXT(mode, angle, x, y, z) return void param mode MatrixMode in value param angle Float64 in value param x Float64 in value param y Float64 in value param z Float64 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixScalefEXT(mode, x, y, z) return void param mode MatrixMode in value param x Float32 in value param y Float32 in value param z Float32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixScaledEXT(mode, x, y, z) return void param mode MatrixMode in value param x Float64 in value param y Float64 in value param z Float64 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixTranslatefEXT(mode, x, y, z) return void param mode MatrixMode in value param x Float32 in value param y Float32 in value param z Float32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixTranslatedEXT(mode, x, y, z) return void param mode MatrixMode in value param x Float64 in value param y Float64 in value param z Float64 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixFrustumEXT(mode, left, right, bottom, top, zNear, zFar) return void param mode MatrixMode in value param left Float64 in value param right Float64 in value param bottom Float64 in value param top Float64 in value param zNear Float64 in value param zFar Float64 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixOrthoEXT(mode, left, right, bottom, top, zNear, zFar) return void param mode MatrixMode in value param left Float64 in value param right Float64 in value param bottom Float64 in value param top Float64 in value param zNear Float64 in value param zFar Float64 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixPopEXT(mode) return void param mode MatrixMode in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixPushEXT(mode) return void param mode MatrixMode in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore # New 1.3 matrix transpose commands MatrixLoadTransposefEXT(mode, m) return void param mode MatrixMode in value param m Float32 in array [16] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixLoadTransposedEXT(mode, m) return void param mode MatrixMode in value param m Float64 in array [16] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixMultTransposefEXT(mode, m) return void param mode MatrixMode in value param m Float32 in array [16] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MatrixMultTransposedEXT(mode, m) return void param mode MatrixMode in value param m Float64 in array [16] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore # New 1.1 texture object commands TextureParameterfEXT(texture, target, pname, param) return void param texture Texture in value param target TextureTarget in value param pname TextureParameterName in value param param CheckedFloat32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore vectorequiv TextureParameterfvEXT TextureParameterfvEXT(texture, target, pname, params) return void param texture Texture in value param target TextureTarget in value param pname TextureParameterName in value param params CheckedFloat32 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore TextureParameteriEXT(texture, target, pname, param) return void param texture Texture in value param target TextureTarget in value param pname TextureParameterName in value param param CheckedInt32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore vectorequiv TextureParameterivEXT TextureParameterivEXT(texture, target, pname, params) return void param texture Texture in value param target TextureTarget in value param pname TextureParameterName in value param params CheckedInt32 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore TextureImage1DEXT(texture, target, level, internalformat, width, border, format, type, pixels) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width)] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode extension soft WINSOFT glfflags capture-handcode decode-handcode pixel-unpack TextureImage2DEXT(texture, target, level, internalformat, width, height, border, format, type, pixels) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height)] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode extension soft WINSOFT glfflags capture-handcode decode-handcode pixel-unpack TextureSubImage1DEXT(texture, target, level, xoffset, width, format, type, pixels) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param width SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width)] category EXT_direct_state_access dlflags handcode glxflags ignore ### EXT client-handcode server-handcode glxflags ignore extension soft WINSOFT glfflags ignore TextureSubImage2DEXT(texture, target, level, xoffset, yoffset, width, height, format, type, pixels) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height)] category EXT_direct_state_access dlflags handcode glxflags ignore ### EXT client-handcode server-handcode extension soft WINSOFT glfflags ignore CopyTextureImage1DEXT(texture, target, level, internalformat, x, y, width, border) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param border CheckedInt32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT CopyTextureImage2DEXT(texture, target, level, internalformat, x, y, width, height, border) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT CopyTextureSubImage1DEXT(texture, target, level, xoffset, x, y, width) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT CopyTextureSubImage2DEXT(texture, target, level, xoffset, yoffset, x, y, width, height) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT # New 1.1 texture object queries GetTextureImageEXT(texture, target, level, format, type, pixels) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void out array [COMPSIZE(target/level/format/type)] category EXT_direct_state_access dlflags notlistable glxflags ignore ### client-handcode server-handcode extension soft WINSOFT glfflags capture-execute capture-handcode decode-handcode pixel-pack GetTextureParameterfvEXT(texture, target, pname, params) return void param texture Texture in value param target TextureTarget in value param pname GetTextureParameter in value param params Float32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetTextureParameterivEXT(texture, target, pname, params) return void param texture Texture in value param target TextureTarget in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetTextureLevelParameterfvEXT(texture, target, level, pname, params) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param pname GetTextureParameter in value param params Float32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetTextureLevelParameterivEXT(texture, target, level, pname, params) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum # New 1.2 3D texture object commands TextureImage3DEXT(texture, target, level, internalformat, width, height, depth, border, format, type, pixels) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param height SizeI in value param depth SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth)] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode EXT extension soft WINSOFT glfflags ignore TextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth)] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode EXT extension soft WINSOFT glfflags ignore CopyTextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, x, y, width, height) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category EXT_direct_state_access glxflags ignore ### EXT extension soft WINSOFT glfflags ignore # New 1.1 multitexture commands MultiTexParameterfEXT(texunit, target, pname, param) return void param texunit TextureUnit in value param target TextureTarget in value param pname TextureParameterName in value param param CheckedFloat32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore vectorequiv MultiTexParameterfvEXT MultiTexParameterfvEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param pname TextureParameterName in value param params CheckedFloat32 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MultiTexParameteriEXT(texunit, target, pname, param) return void param texunit TextureUnit in value param target TextureTarget in value param pname TextureParameterName in value param param CheckedInt32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore vectorequiv MultiTexParameterivEXT MultiTexParameterivEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param pname TextureParameterName in value param params CheckedInt32 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags ignore MultiTexImage1DEXT(texunit, target, level, internalformat, width, border, format, type, pixels) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width)] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode extension soft WINSOFT glfflags capture-handcode decode-handcode pixel-unpack MultiTexImage2DEXT(texunit, target, level, internalformat, width, height, border, format, type, pixels) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height)] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode extension soft WINSOFT glfflags capture-handcode decode-handcode pixel-unpack MultiTexSubImage1DEXT(texunit, target, level, xoffset, width, format, type, pixels) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param width SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width)] category EXT_direct_state_access dlflags handcode glxflags ignore ### EXT client-handcode server-handcode extension soft WINSOFT glfflags ignore MultiTexSubImage2DEXT(texunit, target, level, xoffset, yoffset, width, height, format, type, pixels) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height)] category EXT_direct_state_access dlflags handcode glxflags ignore ### EXT client-handcode server-handcode extension soft WINSOFT glfflags ignore CopyMultiTexImage1DEXT(texunit, target, level, internalformat, x, y, width, border) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param border CheckedInt32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT CopyMultiTexImage2DEXT(texunit, target, level, internalformat, x, y, width, height, border) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT CopyMultiTexSubImage1DEXT(texunit, target, level, xoffset, x, y, width) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT CopyMultiTexSubImage2DEXT(texunit, target, level, xoffset, yoffset, x, y, width, height) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT # New 1.1 multitexture queries GetMultiTexImageEXT(texunit, target, level, format, type, pixels) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void out array [COMPSIZE(target/level/format/type)] category EXT_direct_state_access dlflags notlistable glxflags ignore ### client-handcode server-handcode extension soft WINSOFT glfflags capture-execute capture-handcode decode-handcode pixel-pack GetMultiTexParameterfvEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param pname GetTextureParameter in value param params Float32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetMultiTexParameterivEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetMultiTexLevelParameterfvEXT(texunit, target, level, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param pname GetTextureParameter in value param params Float32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetMultiTexLevelParameterivEXT(texunit, target, level, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum # New 1.2 3D multitexture commands MultiTexImage3DEXT(texunit, target, level, internalformat, width, height, depth, border, format, type, pixels) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param height SizeI in value param depth SizeI in value param border CheckedInt32 in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth)] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode EXT extension soft WINSOFT glfflags ignore MultiTexSubImage3DEXT(texunit, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param format PixelFormat in value param type PixelType in value param pixels Void in array [COMPSIZE(format/type/width/height/depth)] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode EXT extension soft WINSOFT glfflags ignore CopyMultiTexSubImage3DEXT(texunit, target, level, xoffset, yoffset, zoffset, x, y, width, height) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param x WinCoord in value param y WinCoord in value param width SizeI in value param height SizeI in value category EXT_direct_state_access glxflags ignore ### EXT extension soft WINSOFT glfflags ignore # New 1.2.1 multitexture texture commands BindMultiTextureEXT(texunit, target, texture) return void param texunit TextureUnit in value param target TextureTarget in value param texture Texture in value category EXT_direct_state_access extension soft WINSOFT glxflags ignore ### EXT EnableClientStateIndexedEXT(array, index) return void param array EnableCap in value param index UInt32 in value category EXT_direct_state_access dlflags notlistable glxflags ignore ### client-handcode client-intercept server-handcode extension soft WINSOFT DisableClientStateIndexedEXT(array, index) return void param array EnableCap in value param index UInt32 in value category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore ### client-handcode client-intercept server-handcode MultiTexCoordPointerEXT(texunit, size, type, stride, pointer) return void param texunit TextureUnit in value param size Int32 in value param type TexCoordPointerType in value param stride SizeI in value param pointer Void in array [COMPSIZE(size/type/stride)] retained category EXT_direct_state_access dlflags notlistable glxflags ignore ### client-handcode client-intercept server-handcode extension soft WINSOFT glfflags ignore MultiTexEnvfEXT(texunit, target, pname, param) return void param texunit TextureUnit in value param target TextureEnvTarget in value param pname TextureEnvParameter in value param param CheckedFloat32 in value category EXT_direct_state_access extension soft WINSOFT vectorequiv MultiTexEnvfvEXT glxflags ignore glfflags gl-enum MultiTexEnvfvEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureEnvTarget in value param pname TextureEnvParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags gl-enum MultiTexEnviEXT(texunit, target, pname, param) return void param texunit TextureUnit in value param target TextureEnvTarget in value param pname TextureEnvParameter in value param param CheckedInt32 in value category EXT_direct_state_access extension soft WINSOFT vectorequiv MultiTexEnvivEXT glxflags ignore glfflags gl-enum MultiTexEnvivEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureEnvTarget in value param pname TextureEnvParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags gl-enum MultiTexGendEXT(texunit, coord, pname, param) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param param Float64 in value category EXT_direct_state_access extension soft WINSOFT vectorequiv MultiTexGendvEXT glxflags ignore glfflags gl-enum MultiTexGendvEXT(texunit, coord, pname, params) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param params Float64 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags gl-enum MultiTexGenfEXT(texunit, coord, pname, param) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param param CheckedFloat32 in value category EXT_direct_state_access extension soft WINSOFT vectorequiv MultiTexGenfvEXT glxflags ignore glfflags gl-enum MultiTexGenfvEXT(texunit, coord, pname, params) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param params CheckedFloat32 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags gl-enum MultiTexGeniEXT(texunit, coord, pname, param) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param param CheckedInt32 in value category EXT_direct_state_access extension soft WINSOFT vectorequiv MultiTexGenivEXT glxflags ignore glfflags gl-enum MultiTexGenivEXT(texunit, coord, pname, params) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param params CheckedInt32 in array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT glxflags ignore glfflags gl-enum # New 1.2.1 multitexture texture queries GetMultiTexEnvfvEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureEnvTarget in value param pname TextureEnvParameter in value param params Float32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetMultiTexEnvivEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureEnvTarget in value param pname TextureEnvParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetMultiTexGendvEXT(texunit, coord, pname, params) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param params Float64 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetMultiTexGenfvEXT(texunit, coord, pname, params) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param params Float32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum GetMultiTexGenivEXT(texunit, coord, pname, params) return void param texunit TextureUnit in value param coord TextureCoordName in value param pname TextureGenParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum # From EXT_draw_buffers2 # EnableIndexedEXT # DisableIndexedEXT # IsEnabledIndexedEXT GetFloatIndexedvEXT(target, index, data) return void param target TypeEnum in value param index UInt32 in value param data Float32 out array [COMPSIZE(target)] category EXT_direct_state_access dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT GetDoubleIndexedvEXT(target, index, data) return void param target TypeEnum in value param index UInt32 in value param data Float64 out array [COMPSIZE(target)] category EXT_direct_state_access dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT GetPointerIndexedvEXT(target, index, data) return void param target TypeEnum in value param index UInt32 in value param data VoidPointer out array [COMPSIZE(target)] category EXT_direct_state_access dlflags notlistable glxflags ignore glfflags ignore extension soft WINSOFT # New compressed texture commands CompressedTextureImage3DEXT(texture, target, level, internalformat, width, height, depth, border, imageSize, bits) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param height SizeI in value param depth SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedTextureImage2DEXT(texture, target, level, internalformat, width, height, border, imageSize, bits) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedTextureImage1DEXT(texture, target, level, internalformat, width, border, imageSize, bits) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedTextureSubImage3DEXT(texture, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param format PixelFormat in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedTextureSubImage2DEXT(texture, target, level, xoffset, yoffset, width, height, format, imageSize, bits) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param format PixelFormat in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedTextureSubImage1DEXT(texture, target, level, xoffset, width, format, imageSize, bits) return void param texture Texture in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param width SizeI in value param format PixelFormat in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT # New compressed texture query GetCompressedTextureImageEXT(texture, target, lod, img) return void param texture Texture in value param target TextureTarget in value param lod CheckedInt32 in value param img Void out array [COMPSIZE(target/lod)] category EXT_direct_state_access dlflags notlistable glxflags ignore ### server-handcode extension soft WINSOFT # New compressed multitexture commands CompressedMultiTexImage3DEXT(texunit, target, level, internalformat, width, height, depth, border, imageSize, bits) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param height SizeI in value param depth SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedMultiTexImage2DEXT(texunit, target, level, internalformat, width, height, border, imageSize, bits) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param height SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedMultiTexImage1DEXT(texunit, target, level, internalformat, width, border, imageSize, bits) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param internalformat TextureInternalFormat in value param width SizeI in value param border CheckedInt32 in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedMultiTexSubImage3DEXT(texunit, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bits) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param zoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param depth SizeI in value param format PixelFormat in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedMultiTexSubImage2DEXT(texunit, target, level, xoffset, yoffset, width, height, format, imageSize, bits) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param yoffset CheckedInt32 in value param width SizeI in value param height SizeI in value param format PixelFormat in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT CompressedMultiTexSubImage1DEXT(texunit, target, level, xoffset, width, format, imageSize, bits) return void param texunit TextureUnit in value param target TextureTarget in value param level CheckedInt32 in value param xoffset CheckedInt32 in value param width SizeI in value param format PixelFormat in value param imageSize SizeI in value param bits Void in array [imageSize] category EXT_direct_state_access dlflags handcode glxflags ignore ### client-handcode server-handcode glfflags ignore extension soft WINSOFT # New compressed multitexture query GetCompressedMultiTexImageEXT(texunit, target, lod, img) return void param texunit TextureUnit in value param target TextureTarget in value param lod CheckedInt32 in value param img Void out array [COMPSIZE(target/lod)] category EXT_direct_state_access dlflags notlistable glxflags ignore ### server-handcode extension soft WINSOFT # New ARB assembly program named commands NamedProgramStringEXT(program, target, format, len, string) return void param program UInt32 in value param target ProgramTarget in value param format ProgramFormat in value param len SizeI in value param string Void in array [len] category EXT_direct_state_access subcategory ARB_vertex_program extension soft WINSOFT glfflags ignore glxflags ignore ### client-handcode server-handcode EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program NamedProgramLocalParameter4dEXT(program, target, index, x, y, z, w) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param x Float64 in value param y Float64 in value param z Float64 in value param w Float64 in value category EXT_direct_state_access subcategory ARB_vertex_program vectorequiv NamedProgramLocalParameter4dvEXT glxvectorequiv NamedProgramLocalParameter4dvEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore ### EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program NamedProgramLocalParameter4dvEXT(program, target, index, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param params Float64 in array [4] category EXT_direct_state_access subcategory ARB_vertex_program extension soft WINSOFT NV10 glfflags ignore glxflags ignore ### EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program NamedProgramLocalParameter4fEXT(program, target, index, x, y, z, w) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param x Float32 in value param y Float32 in value param z Float32 in value param w Float32 in value category EXT_direct_state_access subcategory ARB_vertex_program vectorequiv NamedProgramLocalParameter4fvEXT glxvectorequiv NamedProgramLocalParameter4fvEXT extension soft WINSOFT NV10 glfflags ignore glxflags ignore ### EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program NamedProgramLocalParameter4fvEXT(program, target, index, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param params Float32 in array [4] category EXT_direct_state_access subcategory ARB_vertex_program extension soft WINSOFT NV10 glfflags ignore glxflags ignore ### EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program # New ARB assembly program named queries GetNamedProgramLocalParameterdvEXT(program, target, index, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param params Float64 out array [4] dlflags notlistable category EXT_direct_state_access subcategory ARB_vertex_program extension soft WINSOFT NV10 glfflags ignore glxflags ignore ### client-handcode server-handcode EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program GetNamedProgramLocalParameterfvEXT(program, target, index, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param params Float32 out array [4] dlflags notlistable category EXT_direct_state_access subcategory ARB_vertex_program extension soft WINSOFT NV10 glfflags ignore glxflags ignore ### client-handcode server-handcode EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program GetNamedProgramivEXT(program, target, pname, params) return void param program UInt32 in value param target ProgramTarget in value param pname ProgramProperty in value param params Int32 out array [1] dlflags notlistable category EXT_direct_state_access subcategory ARB_vertex_program extension soft WINSOFT NV10 glfflags ignore glxflags ignore ### client-handcode server-handcode EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program GetNamedProgramStringEXT(program, target, pname, string) return void param program UInt32 in value param target ProgramTarget in value param pname ProgramStringProperty in value param string Void out array [COMPSIZE(program,pname)] dlflags notlistable category EXT_direct_state_access subcategory ARB_vertex_program extension soft WINSOFT NV10 glfflags ignore glxflags ignore ### client-handcode server-handcode EXT glextmask GL_MASK_ARB_vertex_program|GL_MASK_ARB_fragment_program # New EXT_gpu_program_parameters command NamedProgramLocalParameters4fvEXT(program, target, index, count, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param count SizeI in value param params Float32 in array [count*4] category EXT_direct_state_access subcategory EXT_gpu_program_parameters extension soft WINSOFT NV10 glfflags ignore glxflags ignore glextmask GL_MASK_EXT_gpu_program_parameters # New NV_gpu_program4 commands NamedProgramLocalParameterI4iEXT(program, target, index, x, y, z, w) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param x Int32 in value param y Int32 in value param z Int32 in value param w Int32 in value category EXT_direct_state_access subcategory NV_gpu_program4 vectorequiv NamedProgramLocalParameterI4ivEXT glxvectorequiv NamedProgramLocalParameterI4ivEXT extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 NamedProgramLocalParameterI4ivEXT(program, target, index, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param params Int32 in array [4] category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 NamedProgramLocalParametersI4ivEXT(program, target, index, count, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param count SizeI in value param params Int32 in array [count*4] category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 NamedProgramLocalParameterI4uiEXT(program, target, index, x, y, z, w) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param x UInt32 in value param y UInt32 in value param z UInt32 in value param w UInt32 in value category EXT_direct_state_access subcategory NV_gpu_program4 vectorequiv NamedProgramLocalParameterI4uivEXT glxvectorequiv NamedProgramLocalParameterI4uivEXT extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 NamedProgramLocalParameterI4uivEXT(program, target, index, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param params UInt32 in array [4] category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 NamedProgramLocalParametersI4uivEXT(program, target, index, count, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param count SizeI in value param params UInt32 in array [count*4] category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 GetNamedProgramLocalParameterIivEXT(program, target, index, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param params Int32 out array [4] dlflags notlistable category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 GetNamedProgramLocalParameterIuivEXT(program, target, index, params) return void param program UInt32 in value param target ProgramTarget in value param index UInt32 in value param params UInt32 out array [4] dlflags notlistable category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 # New EXT_texture_integer texture object commands TextureParameterIivEXT(texture, target, pname, params) return void param texture Texture in value param target TextureTarget in value param pname TextureParameterName in value param params CheckedInt32 in array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_texture_integer extension soft WINSOFT glxflags ignore glfflags ignore glextmask GL_MASK_EXT_texture_integer TextureParameterIuivEXT(texture, target, pname, params) return void param texture Texture in value param target TextureTarget in value param pname TextureParameterName in value param params UInt32 in array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_texture_integer extension soft WINSOFT glxflags ignore glfflags ignore glextmask GL_MASK_EXT_texture_integer # New EXT_texture_integer texture object queries GetTextureParameterIivEXT(texture, target, pname, params) return void param texture Texture in value param target TextureTarget in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_texture_integer dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum glextmask GL_MASK_EXT_texture_integer GetTextureParameterIuivEXT(texture, target, pname, params) return void param texture Texture in value param target TextureTarget in value param pname GetTextureParameter in value param params UInt32 out array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_texture_integer dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum glextmask GL_MASK_EXT_texture_integer # New EXT_texture_integer multitexture commands MultiTexParameterIivEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param pname TextureParameterName in value param params CheckedInt32 in array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_texture_integer extension soft WINSOFT glxflags ignore glfflags ignore glextmask GL_MASK_EXT_texture_integer MultiTexParameterIuivEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param pname TextureParameterName in value param params UInt32 in array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_texture_integer extension soft WINSOFT glxflags ignore glfflags ignore glextmask GL_MASK_EXT_texture_integer # New EXT_texture_integer multitexture queries GetMultiTexParameterIivEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param pname GetTextureParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_texture_integer dlflags notlistable extension soft WINSOFT glfflags capture-execute gl-enum glxflags ignore glextmask GL_MASK_EXT_texture_integer GetMultiTexParameterIuivEXT(texunit, target, pname, params) return void param texunit TextureUnit in value param target TextureTarget in value param pname GetTextureParameter in value param params UInt32 out array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_texture_integer dlflags notlistable extension soft WINSOFT glfflags capture-execute gl-enum glxflags ignore glextmask GL_MASK_EXT_texture_integer # New GLSL 2.0 uniform commands ProgramUniform1fEXT(program, location, v0) return void param program UInt32 in value param location Int32 in value param v0 Float32 in value category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform2fEXT(program, location, v0, v1) return void param program UInt32 in value param location Int32 in value param v0 Float32 in value param v1 Float32 in value category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform3fEXT(program, location, v0, v1, v2) return void param program UInt32 in value param location Int32 in value param v0 Float32 in value param v1 Float32 in value param v2 Float32 in value category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform4fEXT(program, location, v0, v1, v2, v3) return void param program UInt32 in value param location Int32 in value param v0 Float32 in value param v1 Float32 in value param v2 Float32 in value param v3 Float32 in value category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform1iEXT(program, location, v0) return void param program UInt32 in value param location Int32 in value param v0 Int32 in value category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform2iEXT(program, location, v0, v1) return void param program UInt32 in value param location Int32 in value param v0 Int32 in value param v1 Int32 in value category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform3iEXT(program, location, v0, v1, v2) return void param program UInt32 in value param location Int32 in value param v0 Int32 in value param v1 Int32 in value param v2 Int32 in value category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform4iEXT(program, location, v0, v1, v2, v3) return void param program UInt32 in value param location Int32 in value param v0 Int32 in value param v1 Int32 in value param v2 Int32 in value param v3 Int32 in value category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform1fvEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Float32 in array [count] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform2fvEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Float32 in array [count*2] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform3fvEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Float32 in array [count*3] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform4fvEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Float32 in array [count*4] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform1ivEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Int32 in array [count] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform2ivEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Int32 in array [count*2] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform3ivEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Int32 in array [count*3] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform4ivEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value Int32 in array [count*4] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniformMatrix2fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*4] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniformMatrix3fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*9] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniformMatrix4fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*16] category EXT_direct_state_access subcategory VERSION_2_0 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 # New GLSL 2.1 uniform commands ProgramUniformMatrix2x3fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*6] category EXT_direct_state_access subcategory VERSION_2_1 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniformMatrix3x2fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*6] category EXT_direct_state_access subcategory VERSION_2_1 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniformMatrix2x4fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*8] category EXT_direct_state_access subcategory VERSION_2_1 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniformMatrix4x2fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*8] category EXT_direct_state_access subcategory VERSION_2_1 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniformMatrix3x4fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*12] category EXT_direct_state_access subcategory VERSION_2_1 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniformMatrix4x3fvEXT(program, location, count, transpose, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param transpose Boolean in value param value Float32 in array [count*12] category EXT_direct_state_access subcategory VERSION_2_1 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 # New EXT_gpu_shader4 commands ProgramUniform1uiEXT(program, location, v0) return void param program UInt32 in value param location Int32 in value param v0 UInt32 in value category EXT_direct_state_access subcategory EXT_gpu_shader4 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform2uiEXT(program, location, v0, v1) return void param program UInt32 in value param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value category EXT_direct_state_access subcategory EXT_gpu_shader4 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform3uiEXT(program, location, v0, v1, v2) return void param program UInt32 in value param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value param v2 UInt32 in value category EXT_direct_state_access subcategory EXT_gpu_shader4 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform4uiEXT(program, location, v0, v1, v2, v3) return void param program UInt32 in value param location Int32 in value param v0 UInt32 in value param v1 UInt32 in value param v2 UInt32 in value param v3 UInt32 in value category EXT_direct_state_access subcategory EXT_gpu_shader4 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform1uivEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value UInt32 in array [count] category EXT_direct_state_access subcategory EXT_gpu_shader4 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform2uivEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value UInt32 in array [count*2] category EXT_direct_state_access subcategory EXT_gpu_shader4 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform3uivEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value UInt32 in array [count*3] category EXT_direct_state_access subcategory EXT_gpu_shader4 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 ProgramUniform4uivEXT(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value UInt32 in array [count*4] category EXT_direct_state_access subcategory EXT_gpu_shader4 glfflags ignore glxflags ignore extension soft WINSOFT glextmask GL_MASK_OpenGL_2_0 # New named buffer commands NamedBufferDataEXT(buffer, size, data, usage) return void param buffer UInt32 in value param size Sizeiptr in value param data Void in array [COMPSIZE(size)] param usage VertexBufferObjectUsage in value category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore glfflags ignore NamedBufferSubDataEXT(buffer, offset, size, data) return void param buffer UInt32 in value param offset Intptr in value param size Sizeiptr in value param data Void in array [COMPSIZE(size)] category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore glfflags ignore MapNamedBufferEXT(buffer, access) return VoidPointer param buffer UInt32 in value param access VertexBufferObjectAccess in value category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore glfflags ignore UnmapNamedBufferEXT(buffer) return Boolean param buffer UInt32 in value category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore glfflags ignore # New named buffer queries GetNamedBufferParameterivEXT(buffer, pname, params) return void param buffer UInt32 in value param pname VertexBufferObjectParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore glfflags ignore GetNamedBufferPointervEXT(buffer, pname, params) return void param buffer UInt32 in value param pname VertexBufferObjectParameter in value param params VoidPointer out array [COMPSIZE(pname)] category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore glfflags ignore GetNamedBufferSubDataEXT(buffer, offset, size, data) return void param buffer UInt32 in value param offset Intptr in value param size Sizeiptr in value param data Void out array [COMPSIZE(size)] category EXT_direct_state_access extension soft WINSOFT dlflags notlistable glxflags ignore glfflags ignore # New named texture buffer texture object command TextureBufferEXT(texture, target, internalformat, buffer) return void param texture Texture in value param target TextureTarget in value param internalformat TypeEnum in value param buffer UInt32 in value category EXT_direct_state_access subcategory EXT_texture_buffer_object extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_EXT_texture_buffer_object dlflags notlistable # New named texture buffer multitexture command MultiTexBufferEXT(texunit, target, internalformat, buffer) return void param texunit TextureUnit in value param target TextureTarget in value param internalformat TypeEnum in value param buffer UInt32 in value category EXT_direct_state_access subcategory EXT_texture_buffer_object extension soft WINSOFT NV50 glfflags ignore glxflags ignore glextmask GL_MASK_EXT_texture_buffer_object dlflags notlistable # New named frame buffer object commands NamedRenderbufferStorageEXT(renderbuffer, internalformat, width, height) return void param renderbuffer Renderbuffer in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object GetNamedRenderbufferParameterivEXT(renderbuffer, pname, params) return void param renderbuffer Renderbuffer in value param pname RenderbufferParameterName in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object CheckNamedFramebufferStatusEXT(framebuffer, target) return FramebufferStatus param framebuffer Framebuffer in value param target FramebufferTarget in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object NamedFramebufferTexture1DEXT(framebuffer, attachment, textarget, texture, level) return void param framebuffer Framebuffer in value param attachment FramebufferAttachment in value param textarget TextureTarget in value param texture Texture in value param level CheckedInt32 in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object NamedFramebufferTexture2DEXT(framebuffer, attachment, textarget, texture, level) return void param framebuffer Framebuffer in value param attachment FramebufferAttachment in value param textarget TextureTarget in value param texture Texture in value param level CheckedInt32 in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object NamedFramebufferTexture3DEXT(framebuffer, attachment, textarget, texture, level, zoffset) return void param framebuffer Framebuffer in value param attachment FramebufferAttachment in value param textarget TextureTarget in value param texture Texture in value param level CheckedInt32 in value param zoffset CheckedInt32 in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object NamedFramebufferRenderbufferEXT(framebuffer, attachment, renderbuffertarget, renderbuffer) return void param framebuffer Framebuffer in value param attachment FramebufferAttachment in value param renderbuffertarget RenderbufferTarget in value param renderbuffer Renderbuffer in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object GetNamedFramebufferAttachmentParameterivEXT(framebuffer, attachment, pname, params) return void param framebuffer Framebuffer in value param attachment FramebufferAttachment in value param pname FramebufferAttachmentParameterName in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object GenerateTextureMipmapEXT(texture, target) return void param texture Texture in value param target TextureTarget in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object GenerateMultiTexMipmapEXT(texunit, target) return void param texunit TextureUnit in value param target TextureTarget in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object FramebufferDrawBufferEXT(framebuffer, mode) return void param framebuffer Framebuffer in value param mode DrawBufferMode in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object FramebufferDrawBuffersEXT(framebuffer, n, bufs) return void param framebuffer Framebuffer in value param n SizeI in value param bufs DrawBufferMode in array [n] category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object FramebufferReadBufferEXT(framebuffer, mode) return void param framebuffer Framebuffer in value param mode ReadBufferMode in value category EXT_direct_state_access subcategory EXT_framebuffer_object extension soft WINSOFT glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_object GetFramebufferParameterivEXT(framebuffer, pname, params) return void param framebuffer Framebuffer in value param pname GetFramebufferParameter in value param params Int32 out array [COMPSIZE(pname)] category EXT_direct_state_access subcategory EXT_framebuffer_object dlflags notlistable extension soft WINSOFT glxflags ignore glfflags capture-execute gl-enum # New named framebuffer multisample object commands NamedRenderbufferStorageMultisampleEXT(renderbuffer, samples, internalformat, width, height) return void param renderbuffer Renderbuffer in value param samples SizeI in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value category EXT_direct_state_access subcategory EXT_framebuffer_multisample extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_EXT_framebuffer_multisample # New named framebuffer multisample coverage object commands NamedRenderbufferStorageMultisampleCoverageEXT(renderbuffer, coverageSamples, colorSamples, internalformat, width, height) return void param renderbuffer Renderbuffer in value param coverageSamples SizeI in value param colorSamples SizeI in value param internalformat PixelInternalFormat in value param width SizeI in value param height SizeI in value category EXT_direct_state_access subcategory NV_framebuffer_multisample_coverage extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_NV_framebuffer_multisample_coverage # New named geometry program/shader frame buffer object commands NamedFramebufferTextureEXT(framebuffer, attachment, texture, level) return void param framebuffer Framebuffer in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 NamedFramebufferTextureLayerEXT(framebuffer, attachment, texture, level, layer) return void param framebuffer Framebuffer in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value param layer CheckedInt32 in value category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 NamedFramebufferTextureFaceEXT(framebuffer, attachment, texture, level, face) return void param framebuffer Framebuffer in value param attachment FramebufferAttachment in value param texture Texture in value param level CheckedInt32 in value param face TextureTarget in value category EXT_direct_state_access subcategory NV_gpu_program4 extension soft WINSOFT dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_NV_gpu_program4 # New explicit multisample query and commands TextureRenderbufferEXT(texture, target, renderbuffer) return void param texture Texture in value param target TextureTarget in value param renderbuffer UInt32 in value category EXT_direct_state_access subcategory NV_explicit_multisample extension soft WINSOFT NV50 dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_NV_explicit_multisample MultiTexRenderbufferEXT(texunit, target, renderbuffer) return void param texunit TextureUnit in value param target TextureTarget in value param renderbuffer UInt32 in value category EXT_direct_state_access subcategory NV_explicit_multisample extension soft WINSOFT NV50 dlflags notlistable glfflags ignore glxflags ignore glextmask GL_MASK_NV_explicit_multisample ############################################################################### # # Extension #354 # EXT_vertex_array_bgra commands # ############################################################################### # (none) newcategory: EXT_vertex_array_bgra ############################################################################### # # Extension #355 - WGL_NV_gpu_affinity # ############################################################################### ############################################################################### # # Extension #356 # EXT_texture_swizzle commands # ############################################################################### # (none) newcategory: EXT_texture_swizzle ############################################################################### # # Extension #357 # NV_explicit_multisample commands # ############################################################################### # From EXT_draw_buffers2: GetBooleanIndexedvEXT / GetIntegerIndexedvEXT GetMultisamplefvNV(pname, index, val) return void param pname GetMultisamplePNameNV in value param index UInt32 in value param val Float32 out array [2] category NV_explicit_multisample dlflags notlistable glfflags ignore glxflags ignore SampleMaskIndexedNV(index, mask) return void param index UInt32 in value param mask SampleMaskNV in value category NV_explicit_multisample glfflags ignore glxflags ignore TexRenderbufferNV(target, renderbuffer) return void param target TextureTarget in value param renderbuffer UInt32 in value category NV_explicit_multisample dlflags notlistable glfflags ignore glxflags ignore ############################################################################### # # Extension #358 # NV_transform_feedback2 commands # ############################################################################### BindTransformFeedbackNV(target, id) return void param target BufferTargetARB in value param id UInt32 in value category NV_transform_feedback2 glfflags ignore glxflags ignore DeleteTransformFeedbacksNV(n, ids) return void param n SizeI in value param ids UInt32 in array [n] category NV_transform_feedback2 dlflags notlistable glfflags ignore glxflags ignore GenTransformFeedbacksNV(n, ids) return void param n SizeI in value param ids UInt32 out array [n] category NV_transform_feedback2 dlflags notlistable glfflags ignore glxflags ignore IsTransformFeedbackNV(id) return Boolean param id UInt32 in value category NV_transform_feedback2 dlflags notlistable glfflags ignore glxflags ignore PauseTransformFeedbackNV() return void category NV_transform_feedback2 glfflags ignore glxflags ignore ResumeTransformFeedbackNV() return void category NV_transform_feedback2 glfflags ignore glxflags ignore DrawTransformFeedbackNV(mode, id) return void param mode GLenum in value param id UInt32 in value category NV_transform_feedback2 glfflags ignore glxflags ignore ############################################################################### # # Extension #359 # ATI_meminfo commands # ############################################################################### # (none) newcategory: ATI_meminfo ############################################################################### # # Extension #360 # AMD_performance_monitor commands # ############################################################################### GetPerfMonitorGroupsAMD(numGroups, groupsSize, groups) return void param numGroups Int32 out array [1] param groupsSize SizeI in value param groups UInt32 out array [groupsSize] category AMD_performance_monitor dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetPerfMonitorCountersAMD(group, numCounters, maxActiveCounters, counterSize, counters) return void param group UInt32 in value param numCounters Int32 out array [1] param maxActiveCounters Int32 out array [1] param counterSize SizeI in value param counters UInt32 out array [counterSize] category AMD_performance_monitor dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetPerfMonitorGroupStringAMD(group, bufSize, length, groupString) return void param group UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param groupString Char out array [bufSize] category AMD_performance_monitor dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetPerfMonitorCounterStringAMD(group, counter, bufSize, length, counterString) return void param group UInt32 in value param counter UInt32 in value param bufSize SizeI in value param length SizeI out array [1] param counterString Char out array [bufSize] category AMD_performance_monitor dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetPerfMonitorCounterInfoAMD(group, counter, pname, data) return void param group UInt32 in value param counter UInt32 in value param pname GLenum in value param data void out array [COMPSIZE(pname)] category AMD_performance_monitor dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GenPerfMonitorsAMD(n, monitors) return void param n SizeI in value param monitors UInt32 out array [n] category AMD_performance_monitor version 1.2 extension glxropcode ? glxflags ignore offset ? # 'monitors' is actually in, not out, but extension spec doesn't use const DeletePerfMonitorsAMD(n, monitors) return void param n SizeI in value param monitors UInt32 out array [n] category AMD_performance_monitor version 1.2 extension glxropcode ? glxflags ignore offset ? # 'counterList' is actually in, not out, but extension spec doesn't use const SelectPerfMonitorCountersAMD(monitor, enable, group, numCounters, counterList) return void param monitor UInt32 in value param enable Boolean in value param group UInt32 in value param numCounters Int32 in value param counterList UInt32 out array [numCounters] category AMD_performance_monitor version 1.2 extension glxropcode ? glxflags ignore offset ? BeginPerfMonitorAMD(monitor) return void param monitor UInt32 in value category AMD_performance_monitor version 1.2 extension glxropcode ? glxflags ignore offset ? EndPerfMonitorAMD(monitor) return void param monitor UInt32 in value category AMD_performance_monitor version 1.2 extension glxropcode ? glxflags ignore offset ? GetPerfMonitorCounterDataAMD(monitor, pname, dataSize, data, bytesWritten) return void param monitor UInt32 in value param pname GLenum in value param dataSize SizeI in value param data UInt32 out array [dataSize] param bytesWritten Int32 out array [1] category AMD_performance_monitor dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #361 - WGL_AMD_gpu_association # ############################################################################### ############################################################################### # # Extension #362 # AMD_texture_texture4 commands # ############################################################################### # (none) newcategory: AMD_texture_texture4 ############################################################################### # # Extension #363 # AMD_vertex_shader_tesselator commands # ############################################################################### TessellationFactorAMD(factor) return void param factor Float32 in value category AMD_vertex_shader_tesselator version 2.0 glxsingle ? glxflags ignore offset ? TessellationModeAMD(mode) return void param mode GLenum in value category AMD_vertex_shader_tesselator version 2.0 glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #364 # EXT_provoking_vertex commands # ############################################################################### ProvokingVertexEXT(mode) return void param mode GLenum in value category EXT_provoking_vertex version 2.1 glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #365 # EXT_texture_snorm commands # ############################################################################### # (none) newcategory: EXT_texture_snorm ############################################################################### # # Extension #366 # AMD_draw_buffers_blend commands # ############################################################################### # void BlendFuncIndexedAMD(uint buf, enum src, enum dst) # void BlendFuncSeparateIndexedAMD(uint buf, enum srcRGB, enum dstRGB, enum srcAlpha, enum dstAlpha) # void BlendEquationIndexedAMD(uint buf, enum mode) # void BlendEquationSeparateIndexedAMD(uint buf, enum modeRGB, enum modeAlpha) BlendFuncIndexedAMD(buf, src, dst) return void param buf UInt32 in value param src GLenum in value param dst GLenum in value category AMD_draw_buffers_blend version 2.0 extension glxropcode ? glxflags ignore offset ? BlendFuncSeparateIndexedAMD(buf, srcRGB, dstRGB, srcAlpha, dstAlpha) return void param buf UInt32 in value param srcRGB GLenum in value param dstRGB GLenum in value param srcAlpha GLenum in value param dstAlpha GLenum in value category AMD_draw_buffers_blend version 2.0 extension glxropcode ? glxflags ignore offset ? BlendEquationIndexedAMD(buf, mode) return void param buf UInt32 in value param mode GLenum in value category AMD_draw_buffers_blend version 2.0 extension glxropcode ? glxflags ignore offset ? BlendEquationSeparateIndexedAMD(buf, modeRGB, modeAlpha) return void param buf UInt32 in value param modeRGB GLenum in value param modeAlpha GLenum in value category AMD_draw_buffers_blend version 2.0 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #367 # APPLE_texture_range commands # ############################################################################### TextureRangeAPPLE(target, length, pointer) return void param target GLenum in value param length SizeI in value param pointer Void in array [length] category APPLE_texture_range version 1.2 extension glxropcode ? glxflags ignore offset ? GetTexParameterPointervAPPLE(target, pname, params) return void param target GLenum in value param pname GLenum in value param params VoidPointer out array [1] category APPLE_texture_range dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #368 # APPLE_float_pixels commands # ############################################################################### # (none) newcategory: APPLE_float_pixels ############################################################################### # # Extension #369 # APPLE_vertex_program_evaluators commands # ############################################################################### EnableVertexAttribAPPLE(index, pname) return void param index UInt32 in value param pname GLenum in value category APPLE_vertex_program_evaluators version 1.5 extension glxropcode ? glxflags ignore offset ? DisableVertexAttribAPPLE(index, pname) return void param index UInt32 in value param pname GLenum in value category APPLE_vertex_program_evaluators version 1.5 extension glxropcode ? glxflags ignore offset ? IsVertexAttribEnabledAPPLE(index, pname) return Boolean param index UInt32 in value param pname GLenum in value category APPLE_vertex_program_evaluators version 1.5 extension glxropcode ? glxflags ignore offset ? MapVertexAttrib1dAPPLE(index, size, u1, u2, stride, order, points) return void param index UInt32 in value param size UInt32 in value param u1 CoordD in value param u2 CoordD in value param stride Int32 in value param order CheckedInt32 in value param points CoordD in array [COMPSIZE(size/stride/order)] category APPLE_vertex_program_evaluators version 1.5 extension glxropcode ? glxflags ignore offset ? MapVertexAttrib1fAPPLE(index, size, u1, u2, stride, order, points) return void param index UInt32 in value param size UInt32 in value param u1 CoordF in value param u2 CoordF in value param stride Int32 in value param order CheckedInt32 in value param points CoordF in array [COMPSIZE(size/stride/order)] category APPLE_vertex_program_evaluators version 1.5 extension glxropcode ? glxflags ignore offset ? MapVertexAttrib2dAPPLE(index, size, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points) return void param index UInt32 in value param size UInt32 in value param u1 CoordD in value param u2 CoordD in value param ustride Int32 in value param uorder CheckedInt32 in value param v1 CoordD in value param v2 CoordD in value param vstride Int32 in value param vorder CheckedInt32 in value param points CoordD in array [COMPSIZE(size/ustride/uorder/vstride/vorder)] category APPLE_vertex_program_evaluators version 1.5 extension glxropcode ? glxflags ignore offset ? MapVertexAttrib2fAPPLE(index, size, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points) return void param index UInt32 in value param size UInt32 in value param u1 CoordF in value param u2 CoordF in value param ustride Int32 in value param uorder CheckedInt32 in value param v1 CoordF in value param v2 CoordF in value param vstride Int32 in value param vorder CheckedInt32 in value param points CoordF in array [COMPSIZE(size/ustride/uorder/vstride/vorder)] category APPLE_vertex_program_evaluators version 1.5 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #370 # APPLE_aux_depth_stencil commands # ############################################################################### # (none) newcategory: APPLE_aux_depth_stencil ############################################################################### # # Extension #371 # APPLE_object_purgeable commands # ############################################################################### ObjectPurgeableAPPLE(objectType, name, option) return GLenum param objectType GLenum in value param name UInt32 in value param option GLenum in value category APPLE_object_purgeable version 1.5 extension glxropcode ? glxflags ignore offset ? ObjectUnpurgeableAPPLE(objectType, name, option) return GLenum param objectType GLenum in value param name UInt32 in value param option GLenum in value category APPLE_object_purgeable version 1.5 extension glxropcode ? glxflags ignore offset ? GetObjectParameterivAPPLE(objectType, name, pname, params) return void param objectType GLenum in value param name UInt32 in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category APPLE_object_purgeable dlflags notlistable version 1.5 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #372 # APPLE_row_bytes commands # ############################################################################### # (none) newcategory: APPLE_row_bytes ############################################################################### # # Extension #373 # APPLE_rgb_422 commands # ############################################################################### # (none) newcategory: APPLE_rgb_422 ############################################################################### # # Extension #374 # NV_video_capture commands # ############################################################################### BeginVideoCaptureNV(video_capture_slot) return void param video_capture_slot UInt32 in value category NV_video_capture version 1.2 extension glxropcode ? glxflags ignore offset ? BindVideoCaptureStreamBufferNV(video_capture_slot, stream, frame_region, offset) return void param video_capture_slot UInt32 in value param stream UInt32 in value param frame_region GLenum in value param offset BufferOffsetARB in value category NV_video_capture version 1.2 extension glxropcode ? glxflags ignore offset ? BindVideoCaptureStreamTextureNV(video_capture_slot, stream, frame_region, target, texture) return void param video_capture_slot UInt32 in value param stream UInt32 in value param frame_region GLenum in value param target GLenum in value param texture UInt32 in value category NV_video_capture version 1.2 extension glxropcode ? glxflags ignore offset ? EndVideoCaptureNV(video_capture_slot) return void param video_capture_slot UInt32 in value category NV_video_capture version 1.2 extension glxropcode ? glxflags ignore offset ? GetVideoCaptureivNV(video_capture_slot, pname, params) return void param video_capture_slot UInt32 in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category NV_video_capture dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVideoCaptureStreamivNV(video_capture_slot, stream, pname, params) return void param video_capture_slot UInt32 in value param stream UInt32 in value param pname GLenum in value param params Int32 out array [COMPSIZE(pname)] category NV_video_capture dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVideoCaptureStreamfvNV(video_capture_slot, stream, pname, params) return void param video_capture_slot UInt32 in value param stream UInt32 in value param pname GLenum in value param params Float32 out array [COMPSIZE(pname)] category NV_video_capture dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetVideoCaptureStreamdvNV(video_capture_slot, stream, pname, params) return void param video_capture_slot UInt32 in value param stream UInt32 in value param pname GLenum in value param params Float64 out array [COMPSIZE(pname)] category NV_video_capture dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? VideoCaptureNV(video_capture_slot, sequence_num, capture_time) return GLenum param video_capture_slot UInt32 in value param sequence_num UInt32 out reference param capture_time UInt64EXT out reference category NV_video_capture version 1.2 extension glxropcode ? glxflags ignore offset ? VideoCaptureStreamParameterivNV(video_capture_slot, stream, pname, params) return void param video_capture_slot UInt32 in value param stream UInt32 in value param pname GLenum in value param params Int32 in array [COMPSIZE(pname)] category NV_video_capture version 1.2 extension glxropcode ? glxflags ignore offset ? VideoCaptureStreamParameterfvNV(video_capture_slot, stream, pname, params) return void param video_capture_slot UInt32 in value param stream UInt32 in value param pname GLenum in value param params Float32 in array [COMPSIZE(pname)] category NV_video_capture version 1.2 extension glxropcode ? glxflags ignore offset ? VideoCaptureStreamParameterdvNV(video_capture_slot, stream, pname, params) return void param video_capture_slot UInt32 in value param stream UInt32 in value param pname GLenum in value param params Float64 in array [COMPSIZE(pname)] category NV_video_capture version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #375 - GLX_EXT_swap_control # ############################################################################### ############################################################################### # # Extension #376 - also GLX_NV_copy_image, WGL_NV_copy_image # NV_copy_image commands # ############################################################################### CopyImageSubDataNV(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth) return void param srcName UInt32 in value param srcTarget GLenum in value param srcLevel Int32 in value param srcX Int32 in value param srcY Int32 in value param srcZ Int32 in value param dstName UInt32 in value param dstTarget GLenum in value param dstLevel Int32 in value param dstX Int32 in value param dstY Int32 in value param dstZ Int32 in value param width SizeI in value param height SizeI in value param depth SizeI in value category NV_copy_image version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #377 # EXT_separate_shader_objects commands # ############################################################################### UseShaderProgramEXT(type, program) return void param type GLenum in value param program UInt32 in value category EXT_separate_shader_objects version 1.2 extension glxropcode ? glxflags ignore offset ? ActiveProgramEXT(program) return void param program UInt32 in value category EXT_separate_shader_objects version 1.2 extension glxropcode ? glxflags ignore offset ? CreateShaderProgramEXT(type, string) return UInt32 param type GLenum in value param string Char in array [] category EXT_separate_shader_objects version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #378 # NV_parameter_buffer_object2 commands # ############################################################################### newcategory: NV_parameter_buffer_object2 ############################################################################### # # Extension #379 # NV_shader_buffer_load commands # ############################################################################### MakeBufferResidentNV(target, access) return void param target GLenum in value param access GLenum in value category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? MakeBufferNonResidentNV(target) return void param target GLenum in value category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? IsBufferResidentNV(target) return Boolean param target GLenum in value category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? MakeNamedBufferResidentNV(buffer, access) return void param buffer UInt32 in value param access GLenum in value category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? MakeNamedBufferNonResidentNV(buffer) return void param buffer UInt32 in value category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? IsNamedBufferResidentNV(buffer) return Boolean param buffer UInt32 in value category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? GetBufferParameterui64vNV(target, pname, params) return void param target GLenum in value param pname GLenum in value param params UInt64EXT out array [COMPSIZE(pname)] category NV_shader_buffer_load dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetNamedBufferParameterui64vNV(buffer, pname, params) return void param buffer UInt32 in value param pname GLenum in value param params UInt64EXT out array [COMPSIZE(pname)] category NV_shader_buffer_load dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? GetIntegerui64vNV(value, result) return void param value GLenum in value param result UInt64EXT out array [COMPSIZE(value)] category NV_shader_buffer_load dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? Uniformui64NV(location, value) return void param location Int32 in value param value UInt64EXT in value category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? Uniformui64vNV(location, count, value) return void param location Int32 in value param count SizeI in value param value UInt64EXT in array [count] category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? GetUniformui64vNV(program, location, params) return void param program UInt32 in value param location Int32 in value param params UInt64EXT out array [COMPSIZE(program/location)] category NV_shader_buffer_load dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ProgramUniformui64NV(program, location, value) return void param program UInt32 in value param location Int32 in value param value UInt64EXT in value category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? ProgramUniformui64vNV(program, location, count, value) return void param program UInt32 in value param location Int32 in value param count SizeI in value param value UInt64EXT in array [count] category NV_shader_buffer_load version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #380 # NV_vertex_buffer_unified_memory commands # ############################################################################### BufferAddressRangeNV(pname, index, address, length) return void param pname GLenum in value param index UInt32 in value param address UInt64EXT in value param length BufferSize in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? VertexFormatNV(size, type, stride) return void param size Int32 in value param type GLenum in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? NormalFormatNV(type, stride) return void param type GLenum in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? ColorFormatNV(size, type, stride) return void param size Int32 in value param type GLenum in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? IndexFormatNV(type, stride) return void param type GLenum in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? TexCoordFormatNV(size, type, stride) return void param size Int32 in value param type GLenum in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? EdgeFlagFormatNV(stride) return void param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? SecondaryColorFormatNV(size, type, stride) return void param size Int32 in value param type GLenum in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? FogCoordFormatNV(type, stride) return void param type GLenum in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribFormatNV(index, size, type, normalized, stride) return void param index UInt32 in value param size Int32 in value param type GLenum in value param normalized Boolean in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? VertexAttribIFormatNV(index, size, type, stride) return void param index UInt32 in value param size Int32 in value param type GLenum in value param stride SizeI in value category NV_vertex_buffer_unified_memory version 1.2 extension glxropcode ? glxflags ignore offset ? GetIntegerui64i_vNV(value, index, result) return void param value GLenum in value param index UInt32 in value param result UInt64EXT out array [COMPSIZE(value)] category NV_vertex_buffer_unified_memory dlflags notlistable version 1.2 extension glxsingle ? glxflags ignore offset ? ############################################################################### # # Extension #381 # NV_texture_barrier commands # ############################################################################### TextureBarrierNV() return void category NV_texture_barrier version 1.2 extension glxropcode ? glxflags ignore offset ? ############################################################################### # # Extension #382 # AMD_shader_stencil_export commands # ############################################################################### newcategory: AMD_shader_stencil_export ############################################################################### # # Extension #383 # AMD_seamless_cubemap_per_texture commands # ############################################################################### newcategory: AMD_seamless_cubemap_per_texture ############################################################################### # # Extension #384 - GLX_INTEL_swap_event # ############################################################################### ================================================ FILE: k3dsdk/gl/gl.tm ================================================ AccumOp,*,*, GLenum,*,* AlphaFunction,*,*, GLenum,*,* AttribMask,*,*, GLbitfield,*,* BeginMode,*,*, GLenum,*,* BinormalPointerTypeEXT,*,*, GLenum,*,* BlendEquationMode,*,*, GLenum,*,* BlendEquationModeEXT,*,*, GLenum,*,* BlendFuncSeparateParameterEXT,*,*, GLenum,*,* BlendingFactorDest,*,*, GLenum,*,* BlendingFactorSrc,*,*, GLenum,*,* Boolean,*,*, GLboolean,*,* BooleanPointer,*,*, GLboolean*,*,* Char,*,*, GLchar,*,* CharPointer,*,*, GLchar*,*,* CheckedFloat32,*,*, GLfloat,*,* CheckedInt32,*,*, GLint,*,* ClampColorTargetARB,*,*, GLenum,*,* ClampColorModeARB,*,*, GLenum,*,* ClampedColorF,*,*, GLclampf,*,* ClampedFloat32,*,*, GLclampf,*,* ClampedFloat64,*,*, GLclampd,*,* ClampedStencilValue,*,*, GLint,*,* ClearBufferMask,*,*, GLbitfield,*,* ClientAttribMask,*,*, GLbitfield,*,* ClipPlaneName,*,*, GLenum,*,* ColorB,*,*, GLbyte,*,* ColorD,*,*, GLdouble,*,* ColorF,*,*, GLfloat,*,* ColorI,*,*, GLint,*,* ColorIndexValueD,*,*, GLdouble,*,* ColorIndexValueF,*,*, GLfloat,*,* ColorIndexValueI,*,*, GLint,*,* ColorIndexValueS,*,*, GLshort,*,* ColorIndexValueUB,*,*, GLubyte,*,* ColorMaterialParameter,*,*, GLenum,*,* ColorPointerType,*,*, GLenum,*,* ColorS,*,*, GLshort,*,* ColorTableParameterPName,*,*, GLenum,*,* ColorTableParameterPNameSGI,*,*, GLenum,*,* ColorTableTarget,*,*, GLenum,*,* ColorTableTargetSGI,*,*, GLenum,*,* ColorUB,*,*, GLubyte,*,* ColorUI,*,*, GLuint,*,* ColorUS,*,*, GLushort,*,* CombinerBiasNV,*,*, GLenum,*,* CombinerComponentUsageNV,*,*, GLenum,*,* CombinerMappingNV,*,*, GLenum,*,* CombinerParameterNV,*,*, GLenum,*,* CombinerPortionNV,*,*, GLenum,*,* CombinerRegisterNV,*,*, GLenum,*,* CombinerScaleNV,*,*, GLenum,*,* CombinerStageNV,*,*, GLenum,*,* CombinerVariableNV,*,*, GLenum,*,* CompressedTextureARB,*,*, GLvoid,*,* ControlPointNV,*,*, GLvoid,*,* ControlPointTypeNV,*,*, GLenum,*,* ConvolutionParameter,*,*, GLenum,*,* ConvolutionParameterEXT,*,*, GLenum,*,* ConvolutionTarget,*,*, GLenum,*,* ConvolutionTargetEXT,*,*, GLenum,*,* CoordD,*,*, GLdouble,*,* CoordF,*,*, GLfloat,*,* CoordI,*,*, GLint,*,* CoordS,*,*, GLshort,*,* CullFaceMode,*,*, GLenum,*,* CullParameterEXT,*,*, GLenum,*,* DepthFunction,*,*, GLenum,*,* DrawBufferMode,*,*, GLenum,*,* DrawBufferName,*,*, GLint,*,* DrawElementsType,*,*, GLenum,*,* ElementPointerTypeATI,*,*, GLenum,*,* EnableCap,*,*, GLenum,*,* ErrorCode,*,*, GLenum,*,* EvalMapsModeNV,*,*, GLenum,*,* EvalTargetNV,*,*, GLenum,*,* FeedbackElement,*,*, GLfloat,*,* FeedbackType,*,*, GLenum,*,* FenceNV,*,*, GLuint,*,* FenceConditionNV,*,*, GLenum,*,* FenceParameterNameNV,*,*, GLenum,*,* FfdMaskSGIX,*,*, GLbitfield,*,* FfdTargetSGIX,*,*, GLenum,*,* Float32,*,*, GLfloat,*,* Float32Pointer,*,*, GLfloat*,*,* Float64,*,*, GLdouble,*,* Float64Pointer,*,*, GLdouble*,*,* FogParameter,*,*, GLenum,*,* FogPointerTypeEXT,*,*, GLenum,*,* FogPointerTypeIBM,*,*, GLenum,*,* FragmentLightModelParameterSGIX,*,*,GLenum,*,* FragmentLightNameSGIX,*,*, GLenum,*,* FragmentLightParameterSGIX,*,*, GLenum,*,* FramebufferAttachment,*,*, GLenum,*,* FramebufferTarget,*,*, GLenum,*,* FrontFaceDirection,*,*, GLenum,*,* FunctionPointer,*,*, _GLfuncptr,*,* GetColorTableParameterPName,*,*, GLenum,*,* GetColorTableParameterPNameSGI,*,*, GLenum,*,* GetConvolutionParameterPName,*,*, GLenum,*,* GetHistogramParameterPName,*,*, GLenum,*,* GetHistogramParameterPNameEXT,*,*, GLenum,*,* GetMapQuery,*,*, GLenum,*,* GetMinmaxParameterPName,*,*, GLenum,*,* GetMinmaxParameterPNameEXT,*,*, GLenum,*,* GetPName,*,*, GLenum,*,* GetPointervPName,*,*, GLenum,*,* GetTextureParameter,*,*, GLenum,*,* HintMode,*,*, GLenum,*,* HintTarget,*,*, GLenum,*,* HintTargetPGI,*,*, GLenum,*,* HistogramTarget,*,*, GLenum,*,* HistogramTargetEXT,*,*, GLenum,*,* IglooFunctionSelectSGIX,*,*, GLenum,*,* IglooParameterSGIX,*,*, GLvoid,*,* ImageTransformPNameHP,*,*, GLenum,*,* ImageTransformTargetHP,*,*, GLenum,*,* IndexFunctionEXT,*,*, GLenum,*,* IndexMaterialParameterEXT,*,*, GLenum,*,* IndexPointerType,*,*, GLenum,*,* Int16,*,*, GLshort,*,* Int32,*,*, GLint,*,* Int8,*,*, GLbyte,*,* InterleavedArrayFormat,*,*, GLenum,*,* LightEnvParameterSGIX,*,*, GLenum,*,* LightModelParameter,*,*, GLenum,*,* LightName,*,*, GLenum,*,* LightParameter,*,*, GLenum,*,* LightTextureModeEXT,*,*, GLenum,*,* LightTexturePNameEXT,*,*, GLenum,*,* LineStipple,*,*, GLushort,*,* List,*,*, GLuint,*,* ListMode,*,*, GLenum,*,* ListNameType,*,*, GLenum,*,* ListParameterName,*,*, GLenum,*,* LogicOp,*,*, GLenum,*,* MapAttribParameterNV,*,*, GLenum,*,* MapParameterNV,*,*, GLenum,*,* MapTarget,*,*, GLenum,*,* MapTargetNV,*,*, GLenum,*,* MapTypeNV,*,*, GLenum,*,* MaskedColorIndexValueF,*,*, GLfloat,*,* MaskedColorIndexValueI,*,*, GLuint,*,* MaskedStencilValue,*,*, GLuint,*,* MaterialFace,*,*, GLenum,*,* MaterialParameter,*,*, GLenum,*,* MatrixIndexPointerTypeARB,*,*, GLenum,*,* MatrixMode,*,*, GLenum,*,* MatrixTransformNV,*,*, GLenum,*,* MeshMode1,*,*, GLenum,*,* MeshMode2,*,*, GLenum,*,* MinmaxTarget,*,*, GLenum,*,* MinmaxTargetEXT,*,*, GLenum,*,* NormalPointerType,*,*, GLenum,*,* NurbsCallback,*,*, GLenum,*,* NurbsObj,*,*, GLUnurbs*,*,* NurbsProperty,*,*, GLenum,*,* NurbsTrim,*,*, GLenum,*,* OcclusionQueryParameterNameNV,*,*, GLenum,*,* PixelCopyType,*,*, GLenum,*,* PixelFormat,*,*, GLenum,*,* PixelInternalFormat,*,*, GLenum,*,* PixelMap,*,*, GLenum,*,* PixelStoreParameter,*,*, GLenum,*,* PixelTexGenModeSGIX,*,*, GLenum,*,* PixelTexGenParameterNameSGIS,*,*, GLenum,*,* PixelTransferParameter,*,*, GLenum,*,* PixelTransformPNameEXT,*,*, GLenum,*,* PixelTransformTargetEXT,*,*, GLenum,*,* PixelType,*,*, GLenum,*,* PointParameterNameARB,*,*, GLenum,*,* PolygonMode,*,*, GLenum,*,* ProgramNV,*,*, GLuint,*,* ProgramCharacterNV,*,*, GLubyte,*,* ProgramParameterNV,*,*, GLenum,*,* ProgramParameterPName,*,*, GLenum,*,* QuadricCallback,*,*, GLenum,*,* QuadricDrawStyle,*,*, GLenum,*,* QuadricNormal,*,*, GLenum,*,* QuadricObj,*,*, GLUquadric*,*,* QuadricOrientation,*,*, GLenum,*,* ReadBufferMode,*,*, GLenum,*,* RenderbufferTarget,*,*, GLenum,*,* RenderingMode,*,*, GLenum,*,* ReplacementCodeSUN,*,*, GLuint,*,* ReplacementCodeTypeSUN,*,*, GLenum,*,* SamplePassARB,*,*, GLenum,*,* SamplePatternEXT,*,*, GLenum,*,* SamplePatternSGIS,*,*, GLenum,*,* SecondaryColorPointerTypeIBM,*,*, GLenum,*,* SelectName,*,*, GLuint,*,* SeparableTarget,*,*, GLenum,*,* SeparableTargetEXT,*,*, GLenum,*,* ShadingModel,*,*, GLenum,*,* SizeI,*,*, GLsizei,*,* SpriteParameterNameSGIX,*,*, GLenum,*,* StencilFunction,*,*, GLenum,*,* StencilFaceDirection,*,*, GLenum,*,* StencilOp,*,*, GLenum,*,* StencilValue,*,*, GLint,*,* String,*,*, const GLubyte *,*,* StringName,*,*, GLenum,*,* TangentPointerTypeEXT,*,*, GLenum,*,* TessCallback,*,*, GLenum,*,* TessContour,*,*, GLenum,*,* TessProperty,*,*, GLenum,*,* TesselatorObj,*,*, GLUtesselator*,*,* TexCoordPointerType,*,*, GLenum,*,* Texture,*,*, GLuint,*,* TextureComponentCount,*,*, GLint,*,* TextureCoordName,*,*, GLenum,*,* TextureEnvParameter,*,*, GLenum,*,* TextureEnvTarget,*,*, GLenum,*,* TextureFilterSGIS,*,*, GLenum,*,* TextureGenParameter,*,*, GLenum,*,* TextureNormalModeEXT,*,*, GLenum,*,* TextureParameterName,*,*, GLenum,*,* TextureTarget,*,*, GLenum,*,* TextureUnit,*,*, GLenum,*,* UInt16,*,*, GLushort,*,* UInt32,*,*, GLuint,*,* UInt8,*,*, GLubyte,*,* VertexAttribEnum,*,*, GLenum,*,* VertexAttribEnumNV,*,*, GLenum,*,* VertexAttribPointerTypeNV,*,*, GLenum,*,* VertexPointerType,*,*, GLenum,*,* VertexWeightPointerTypeEXT,*,*, GLenum,*,* Void,*,*, GLvoid,*,* VoidPointer,*,*, GLvoid*,*,* ConstVoidPointer,*,*, GLvoid* const,*,* WeightPointerTypeARB,*,*, GLenum,*,* WinCoord,*,*, GLint,*,* void,*,*, *,*,* ArrayObjectPNameATI,*,*, GLenum,*,* ArrayObjectUsageATI,*,*, GLenum,*,*, ConstFloat32,*,*, GLfloat,*,* ConstInt32,*,*, GLint,*,* ConstUInt32,*,*, GLuint,*,* ConstVoid,*,*, GLvoid,*,* DataTypeEXT,*,*, GLenum,*,* FragmentOpATI,*,*, GLenum,*,* GetTexBumpParameterATI,*,*, GLenum,*,* GetVariantValueEXT,*,*, GLenum,*,* ParameterRangeEXT,*,*, GLenum,*,* PreserveModeATI,*,*, GLenum,*,* ProgramFormatARB,*,*, GLenum,*,* ProgramTargetARB,*,*, GLenum,*,* ProgramTarget,*,*, GLenum,*,* ProgramPropertyARB,*,*, GLenum,*,* ProgramStringPropertyARB,*,*, GLenum,*,* ScalarType,*,*, GLenum,*,* SwizzleOpATI,*,*, GLenum,*,* TexBumpParameterATI,*,*, GLenum,*,* VariantCapEXT,*,*, GLenum,*,* VertexAttribPointerPropertyARB,*,*, GLenum,*,* VertexAttribPointerTypeARB,*,*, GLenum,*,* VertexAttribPropertyARB,*,*, GLenum,*,* VertexShaderCoordOutEXT,*,*, GLenum,*,* VertexShaderOpEXT,*,*, GLenum,*,* VertexShaderParameterEXT,*,*, GLenum,*,* VertexShaderStorageTypeEXT,*,*, GLenum,*,* VertexShaderTextureUnitParameter,*,*, GLenum,*,* VertexShaderWriteMaskEXT,*,*, GLenum,*,* VertexStreamATI,*,*, GLenum,*,* PNTrianglesPNameATI,*,*, GLenum,*,* # ARB_vertex_buffer_object types and core equivalents for new types BufferOffset,*,*, GLintptr,*,* BufferSize,*,*, GLsizeiptr,*,* BufferAccessARB,*,*, GLenum,*,* BufferOffsetARB,*,*, GLintptrARB,*,* BufferPNameARB,*,*, GLenum,*,* BufferPointerNameARB,*,*, GLenum,*,* BufferSizeARB,*,*, GLsizeiptrARB,*,* BufferTargetARB,*,*, GLenum,*,* BufferUsageARB,*,*, GLenum,*,* # APPLE_fence ObjectTypeAPPLE,*,*, GLenum,*,* # APPLE_vertex_array_range VertexArrayPNameAPPLE,*,*, GLenum,*,* # ATI_draw_buffers DrawBufferModeATI,*,*, GLenum,*,* # NV_half Half16NV,*,*, GLhalfNV,*,* # NV_pixel_data_range PixelDataRangeTargetNV,*,*, GLenum,*,* # Generic types for as-yet-unspecified enums TypeEnum,*,*, GLenum,*,* GLbitfield,*,*, GLbitfield,*,* GLenum,*,*, GLenum,*,* Int64,*,*, GLint64,*,* UInt64,*,*, GLuint64,*,* # Object handle & data pointers handleARB,*,*, GLhandleARB,*,* charARB,*,*, GLcharARB,*,* charPointerARB,*,*, GLcharARB*,*,* sync,*,*, GLsync,*,*, # EXT_timer_query Int64EXT,*,*, GLint64EXT,*,* UInt64EXT,*,*, GLuint64EXT,*,* # EXT_direct_state_access FramebufferAttachment,*,*, GLenum,*,* FramebufferAttachmentParameterName,*,*, GLenum,*,* Framebuffer,*,*, GLuint,*,* FramebufferStatus,*,*, GLenum,*,* FramebufferTarget,*,*, GLenum,*,* GetFramebufferParameter,*,*, GLenum,*,* Intptr,*,*, GLintptr,*,* ProgramFormat,*,*, GLenum,*,* ProgramProperty,*,*, GLenum,*,* ProgramStringProperty,*,*, GLenum,*,* ProgramTarget,*,*, GLenum,*,* Renderbuffer,*,*, GLuint,*,* RenderbufferParameterName,*,*, GLenum,*,* Sizeiptr,*,*, GLsizeiptr,*,* TextureInternalFormat,*,*, GLenum,*,* VertexBufferObjectAccess,*,*, GLenum,*,* VertexBufferObjectParameter,*,*, GLenum,*,* VertexBufferObjectUsage,*,*, GLenum,*,* # ARB_map_buffer_range BufferAccessMask,*,*, GLbitfield,*,* # NV_explicit_multisample GetMultisamplePNameNV,*,*, GLenum,*,* SampleMaskNV,*,*, GLbitfield,*,* ================================================ FILE: k3dsdk/gl/offscreen_context.h ================================================ #ifndef K3DSDK_GL_OFFSCREEN_CONTEXT_H #define K3DSDK_GL_OFFSCREEN_CONTEXT_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace gl { class api; /// Abstract interface implemented by OpenGL context objects class offscreen_context : public context { public: virtual ~offscreen_context() {} /// Returns a half-open range of bytes that store the offscreen buffer. virtual const uint8_t* buffer_begin() = 0; /// Returns a half-open range of bytes that store the offscreen buffer. virtual const uint8_t* buffer_end() = 0; protected: offscreen_context() {} offscreen_context(const offscreen_context&) {} offscreen_context& operator=(const offscreen_context&) { return *this; } }; } // namespace gl } // namespace k3d #endif // !K3DSDK_GL_OFFSCREEN_CONTEXT_H ================================================ FILE: k3dsdk/gl/offscreen_context_factory.h ================================================ #ifndef K3DSDK_GL_OFFSCREEN_CONTEXT_FACTORY_H #define K3DSDK_GL_OFFSCREEN_CONTEXT_FACTORY_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace gl { class offscreen_context; /// Abstract interface implemented by objects that can create OpenGL render context objects, class offscreen_context_factory : public virtual iunknown { public: virtual ~offscreen_context_factory() {} /// Creates a new offscreen OpenGL render context with the given width and height in pixels. /// The caller is responsible for the lifetime of the returned object. virtual offscreen_context* create(const uint_t Width, const uint_t Height) = 0; protected: offscreen_context_factory() {} offscreen_context_factory(const offscreen_context_factory&) {} offscreen_context_factory& operator=(const offscreen_context_factory&) { return *this; } }; } // namespace gl } // namespace k3d #endif // !K3DSDK_GL_OFFSCREEN_CONTEXT_FACTORY_H ================================================ FILE: k3dsdk/gl.h ================================================ #ifndef K3DSDK_GL_H #define K3DSDK_GL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #if defined K3D_API_WIN32 #include #endif // !K3D_API_WIN32 #define GLEW_MX // multiple-context glew as per http://glew.sourceforge.net/advanced.html #include // Needed for cross-platform OpenGL > 1.1 #endif // !K3DSDK_GL_H ================================================ FILE: k3dsdk/graph.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { namespace graph { namespace detail { static void print(std::ostream& Stream, const pipeline_data& Topology) { if(!Topology) return; Stream << " vertices: (" << boost::num_vertices(*Topology) << ")\n"; Stream << " edges: (" << boost::num_edges(*Topology) << ")\n"; for(std::pair edges = boost::edges(*Topology); edges.first != edges.second; ++edges.first) Stream << " index: " << (*Topology)[*edges.first].index << " edge: " << *edges.first << "\n"; } template static bool print(std::ostream& Stream, const array& Array) { if(const array_t* const concrete_array = dynamic_cast(&Array)) { std::copy(concrete_array->begin(), concrete_array->end(), std::ostream_iterator(Stream, " ")); return true; } return false; } static void print(std::ostream& Stream, const std::string& Name, const pipeline_data& Array) { Stream << " " << Name << ": "; if(Array) { Stream << "(" << Array->size() << ") "; if(print(Stream, *Array)) { } else if(print(Stream, *Array)) { } else if(print(Stream, *Array)) { } else if(print(Stream, *Array)) { } else if(print(Stream, *Array)) { } else if(print(Stream, *Array)) { } else if(print(Stream, *Array)) { } else if(print(Stream, *Array)) { } else { Stream << "unsupported type [" << k3d::demangle(typeid(*Array)) << "]" << std::endl; } } Stream << "\n"; } static void print(std::ostream& Stream, const k3d::graph::table_t& Arrays) { for(k3d::graph::table_t::const_iterator array = Arrays.begin(); array != Arrays.end(); ++array) print(Stream, array->first, array->second); } } // namespace detail //////////////////////////////////////////////////////////////////////////////////// // undirected undirected::undirected() { } /** \todo Print the topology */ std::ostream& operator<<(std::ostream& Stream, const undirected& RHS) { Stream << "topology:" << "\n"; detail::print(Stream, RHS.topology); Stream << "graph data:" << "\n"; detail::print(Stream, RHS.graph_data); Stream << "vertex data:" << "\n"; detail::print(Stream, RHS.vertex_data); Stream << "edge data:" << "\n"; detail::print(Stream, RHS.edge_data); return Stream; } } // namespace graph } // namespace k3d ================================================ FILE: k3dsdk/graph.h ================================================ #ifndef K3DSDK_GRAPH_H #define K3DSDK_GRAPH_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { class inode; namespace graph { /// Defines storage for a generic collection of boolean values typedef typed_array bools_t; /// Defines storage for a generic collection of integer values typedef typed_array integers_t; /// Defines storage for a generic collection of index values typedef uint_t_array indices_t; /// Defines storage for a generic collection of floating-point values typedef typed_array doubles_t; /// Defines storage for a generic collection of string values typedef typed_array strings_t; /// Defines storage for a generic collection of two-dimensional points typedef typed_array points_2d_t; /// Defines storage for a generic collection of two-dimensional vectors typedef typed_array vectors_2d_t; /// Defines storage for a generic collection of inode objects typedef typed_array nodes_t; /// Defines a heterogeneous collection of named, shared arrays typedef k3d::table table_t; //////////////////////////////////////////////////////////////////////////////// // undirected /// Encapsulates an undirected graph with arbitrary vertex and edge attributes class undirected { public: undirected(); struct vertex { }; struct edge { edge() : index(0) {} uint_t index; }; /// Defines storage for a generic graph topology typedef boost::adjacency_list adjacency_list_t; typedef boost::graph_traits::vertex_descriptor vertex_descriptor_t; typedef boost::graph_traits::edge_descriptor edge_descriptor_t; typedef boost::graph_traits::vertex_iterator vertex_iterator_t; typedef boost::graph_traits::edge_iterator edge_iterator_t; typedef boost::graph_traits::out_edge_iterator out_edge_iterator_t; typedef boost::graph_traits::in_edge_iterator in_edge_iterator_t; /// Stores the graph topology pipeline_data topology; /// Stores user-defined per-graph data table_t graph_data; /// Stores user-defined per-vertex data table_t vertex_data; /// Stores user-defined per-edge data table_t edge_data; }; /// Stream serialization std::ostream& operator<<(std::ostream& Stream, const undirected& RHS); } // namespace graph } // namespace k3d #endif // !K3DSDK_GRAPH_H ================================================ FILE: k3dsdk/gzstream.cpp ================================================ // ============================================================================ // gzstream, C++ iostream classes wrapping the zlib compression library. // Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // ============================================================================ // // File : gzstream.C // Revision : $Revision: 1.3 $ // Revision_date : $Date: 2007/02/17 01:35:57 $ // Author(s) : Deepak Bandyopadhyay, Lutz Kettner // // Standard streambuf implementation following Nicolai Josuttis, "The // Standard C++ Library". // ============================================================================ #include #include #include #include #include // for EOF namespace k3d { namespace filesystem { /////////////////////////////////////////////////////////////////////////////////// // gzstreambuf class gzstreambuf : public std::streambuf { private: static const int bufferSize = 47+256; // size of data buff totals 512 bytes under g++ for igzstream at the end. gzFile file; // file handle for compressed file char buffer[bufferSize]; // data buffer char opened; // open/close state of stream int mode; // I/O mode int flush_buffer(); public: gzstreambuf() : opened(0) { setp( buffer, buffer + (bufferSize-1)); setg( buffer + 4, // beginning of putback area buffer + 4, // read position buffer + 4); // end position // ASSERT: both input & output capabilities will not be used together } int is_open() { return opened; } gzstreambuf* open(const filesystem::path& name, int open_mode); gzstreambuf* close(); ~gzstreambuf() { close(); } virtual int overflow( int c = EOF); virtual int underflow(); virtual int sync(); }; gzstreambuf* gzstreambuf::open(const filesystem::path& name, int open_mode) { if ( is_open()) return (gzstreambuf*)0; mode = open_mode; // no append nor read/write mode if ((mode & std::ios::ate) || (mode & std::ios::app) || ((mode & std::ios::in) && (mode & std::ios::out))) return (gzstreambuf*)0; char fmode[10]; char* fmodeptr = fmode; if ( mode & std::ios::in) *fmodeptr++ = 'r'; else if ( mode & std::ios::out) *fmodeptr++ = 'w'; *fmodeptr++ = 'b'; *fmodeptr = '\0'; file = gzopen( name.native_filesystem_string().c_str(), fmode); if (file == 0) return (gzstreambuf*)0; opened = 1; return this; } gzstreambuf * gzstreambuf::close() { if ( is_open()) { sync(); opened = 0; if ( gzclose( file) == Z_OK) return this; } return (gzstreambuf*)0; } int gzstreambuf::underflow() { // used for input buffer only if ( gptr() && ( gptr() < egptr())) return * reinterpret_cast( gptr()); if ( ! (mode & std::ios::in) || ! opened) return EOF; // Josuttis' implementation of inbuf int n_putback = gptr() - eback(); if ( n_putback > 4) n_putback = 4; memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback); int num = gzread( file, buffer+4, bufferSize-4); if (num <= 0) // ERROR or EOF return EOF; // reset buffer pointers setg( buffer + (4 - n_putback), // beginning of putback area buffer + 4, // read position buffer + 4 + num); // end of buffer // return next character return * reinterpret_cast( gptr()); } int gzstreambuf::flush_buffer() { // Separate the writing of the buffer from overflow() and // sync() operation. int w = pptr() - pbase(); if ( gzwrite( file, pbase(), w) != w) return EOF; pbump( -w); return w; } int gzstreambuf::overflow( int c) { // used for output buffer only if ( ! ( mode & std::ios::out) || ! opened) return EOF; if (c != EOF) { *pptr() = c; pbump(1); } if ( flush_buffer() == EOF) return EOF; return c; } int gzstreambuf::sync() { // Changed to use flush_buffer() instead of overflow( EOF) // which caused improper behavior with std::endl and flush(), // bug reported by Vincent Ricard. if ( pptr() && pptr() > pbase()) { if ( flush_buffer() == EOF) return -1; } return 0; } //////////////////////////////////////////////////////////////////// // gzstreambase gzstreambase::gzstreambase() : buf(new gzstreambuf()) { init(buf); } gzstreambase::gzstreambase(const filesystem::path& name, int mode) : buf(new gzstreambuf()) { init(buf); open(name, mode); } gzstreambase::~gzstreambase() { buf->close(); delete buf; } void gzstreambase::open(const filesystem::path& name, int open_mode) { if(!buf->open(name, open_mode)) clear(rdstate() | std::ios::badbit); } void gzstreambase::close() { if(buf->is_open()) { if(!buf->close()) clear(rdstate() | std::ios::badbit); } } std::streambuf* gzstreambase::rdbuf() { return buf; } /////////////////////////////////////////////////////////////////// // igzstream igzstream::igzstream() : gzstreambase(), std::istream(buf) { } igzstream::igzstream(const filesystem::path& name) : gzstreambase(name, std::ios::in), std::istream(buf) { } std::streambuf* igzstream::rdbuf() { return gzstreambase::rdbuf(); } void igzstream::open(const filesystem::path& name) { gzstreambase::open(name, std::ios::in); } //////////////////////////////////////////////////////////////////// // ogzstream ogzstream::ogzstream() : gzstreambase(), std::ostream(buf) { } ogzstream::ogzstream(const filesystem::path& name) : gzstreambase(name, std::ios::out), std::ostream(buf) { } std::streambuf* ogzstream::rdbuf() { return gzstreambase::rdbuf(); } void ogzstream::open(const filesystem::path& name) { gzstreambase::open(name, std::ios::out); } } // namespace filesystem } // namespace k3d ================================================ FILE: k3dsdk/gzstream.h ================================================ #ifndef K3DSDK_GZSTREAM_H #define K3DSDK_GZSTREAM_H // ============================================================================ // gzstream, C++ iostream classes wrapping the zlib compression library. // Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // ============================================================================ // // File : gzstream.h // Revision : $Revision: 1.3 $ // Revision_date : $Date: 2007/02/17 01:35:57 $ // Author(s) : Deepak Bandyopadhyay, Lutz Kettner // // Standard streambuf implementation following Nicolai Josuttis, "The // Standard C++ Library". // ============================================================================ // Integrated into the K-3D SDK by Tim Shead, April 2006 #include namespace k3d { namespace filesystem { class gzstreambuf; class path; class gzstreambase : virtual public std::ios { protected: gzstreambuf* const buf; public: gzstreambase(); gzstreambase(const filesystem::path& name, int open_mode); ~gzstreambase(); void open(const filesystem::path& name, int open_mode); void close(); std::streambuf* rdbuf(); }; /// ifstream replacement that can read files with gzip compression /** \todo Implement this using boost::iostreams */ class igzstream : public gzstreambase, public std::istream { public: igzstream(); igzstream(const filesystem::path& name); std::streambuf* rdbuf(); void open(const filesystem::path& name); }; /// ofstream replacement that writes files with gzip compression /** \todo Implement this using boost::iostreams */ class ogzstream : public gzstreambase, public std::ostream { public: ogzstream(); ogzstream(const filesystem::path& name); std::streambuf* rdbuf(); void open(const filesystem::path& name); }; } // namespace filesystem } // namespace k3d #endif // !K3DSDK_GZSTREAM_H ================================================ FILE: k3dsdk/high_res_timer.h ================================================ #ifndef K3DSDK_HIGH_RES_TIMER_H #define K3DSDK_HIGH_RES_TIMER_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares timer classes for performance tuning \author Ed Millard (emillard@direcway.com) */ #include #include #include #include #include #ifdef K3D_API_WIN32 #include #else #include #endif // K3D_API_WIN32 namespace k3d { //////////////////////////////////////////////////////////////////////////////////////////////// // nanotime /* Un-comment this if you require more accurate timing for profiling purposes /// Retrieves a timestamp using an x86-specific CPU counter. Note that because we are dividing by a fixed number instead of the actual CPU frequency, the result doesn't represent real-world units, but it can still be used to obtain accurate relative timing for profiling. inline double nanotime() { #if defined K3D_HAVE_X86 unsigned long long int val; __asm__ __volatile__("rdtsc" : "=A" (val) : ); return static_cast(val) / 1000000000.0; #endif } */ #ifdef K3D_API_WIN32 /// Retrieves a timestamp in seconds using the Win32 high performance counters inline double nanotime() { LARGE_INTEGER timestamp; LARGE_INTEGER frequency; return_val_if_fail(QueryPerformanceCounter(×tamp) && QueryPerformanceFrequency(&frequency), 0.0); return static_cast(timestamp.QuadPart) / static_cast(frequency.QuadPart); } #else // K3D_API_WIN32 /// Retrieves a timestamp in seconds using gettimeofday() for portable timing inline double nanotime() { timeval tv; gettimeofday(&tv, 0); return tv.tv_sec + static_cast(tv.tv_usec) / 1000000; } #endif // !K3D_API_WIN32 //////////////////////////////////////////////////////////////////////////////////////////////// // timer /// Measures elapsed time using a high-resolution timer. Intentionally modelled on boost::timer class timer { public: timer() : m_start(nanotime()) { } void restart() { m_start = nanotime(); } double elapsed() const { return nanotime() - m_start; } private: double m_start; }; ///////////////////////////////////////////////////////////////////////////////////////////////// // progress_timer /// Measures elapsed time using a high-resolution timer, printing the results to a stream on destruction. Intentionally modelled on boost::progress_timer class progress_timer : public timer, public boost::noncopyable { public: progress_timer(std::ostream& Stream = log()) : m_stream(Stream) { } ~progress_timer() { m_stream << elapsed() << " s\n"; } private: std::ostream& m_stream; }; } // namespace k3d #endif // !K3DSDK_HIGH_RES_TIMER_H ================================================ FILE: k3dsdk/hints.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace hint { ////////////////////////////////////////////////////////////////////////////// // bitmap_dimensions_changed ihint* bitmap_dimensions_changed::clone() { return new bitmap_dimensions_changed(*this); } void bitmap_dimensions_changed::print(std::ostream& Stream) { Stream << "bitmap_dimensions_changed"; } bitmap_dimensions_changed* bitmap_dimensions_changed::instance() { static bitmap_dimensions_changed hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // bitmap_pixels_changed ihint* bitmap_pixels_changed::clone() { return new bitmap_pixels_changed(*this); } void bitmap_pixels_changed::print(std::ostream& Stream) { Stream << "bitmap_pixels_changed"; } bitmap_pixels_changed* bitmap_pixels_changed::instance() { static bitmap_pixels_changed hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // selection_changed ihint* selection_changed::clone() { return new selection_changed(*this); } void selection_changed::print(std::ostream& Stream) { Stream << "selection_changed"; } selection_changed* selection_changed::instance() { static selection_changed hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // mesh_geometry_changed ihint* mesh_geometry_changed::clone() { return new mesh_geometry_changed(*this); } void mesh_geometry_changed::print(std::ostream& Stream) { Stream << "mesh_geometry_changed"; } mesh_geometry_changed* mesh_geometry_changed::instance() { static mesh_geometry_changed hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // mesh_topology_changed ihint* mesh_topology_changed::clone() { return new mesh_topology_changed(*this); } void mesh_topology_changed::print(std::ostream& Stream) { Stream << "mesh_topology_changed"; } mesh_topology_changed* mesh_topology_changed::instance() { static mesh_topology_changed hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // mesh_deleted ihint* mesh_deleted::clone() { return new mesh_deleted(*this); } void mesh_deleted::print(std::ostream& Stream) { Stream << "mesh_deleted"; } mesh_deleted* mesh_deleted::instance() { static mesh_deleted hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // file_changed ihint* file_changed::clone() { return new file_changed(*this); } void file_changed::print(std::ostream& Stream) { Stream << "file_changed"; } file_changed* file_changed::instance() { static file_changed hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // graph_topology_changed ihint* graph_topology_changed::clone() { return new graph_topology_changed(*this); } void graph_topology_changed::print(std::ostream& Stream) { Stream << "graph_topology_changed"; } graph_topology_changed* graph_topology_changed::instance() { static graph_topology_changed hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // graph_attributes_changed ihint* graph_attributes_changed::clone() { return new graph_attributes_changed(*this); } void graph_attributes_changed::print(std::ostream& Stream) { Stream << "graph_topology_changed"; } graph_attributes_changed* graph_attributes_changed::instance() { static graph_attributes_changed hint; return &hint; } ////////////////////////////////////////////////////////////////////////////// // print print::print(ihint* Hint) : hint(Hint) { } std::ostream& operator<<(std::ostream& Stream, const print& RHS) { if(RHS.hint) RHS.hint->print(Stream); else Stream << "(none)"; return Stream; } } // namespace hint } // namespace k3d ================================================ FILE: k3dsdk/hints.h ================================================ #ifndef K3DSDK_HINTS_H #define K3DSDK_HINTS_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { /// Namespace reserved for "hints" that pass metadata about an upstream change to downstream nodes namespace hint { ////////////////////////////////////////////////////////////////////////////// // slot_t /// iostream-compatible manipulator object that serializes information about a hint object class print { public: print(ihint* Hint); ihint* const hint; }; /// Stream serialization std::ostream& operator<<(std::ostream& Stream, const print& RHS); ////////////////////////////////////////////////////////////////////////////// // slot_t /// Defines a standard slot that receives a hint typedef sigc::slot slot_t; ////////////////////////////////////////////////////////////////////////////// // bitmap_dimensions_changed /// Hint passed to downstream nodes to indicate that the pixel dimensions of a bitmap have changed (and thus its internal memory). class bitmap_dimensions_changed : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static bitmap_dimensions_changed* instance(); }; ////////////////////////////////////////////////////////////////////////////// // bitmap_pixels_changed /// Hint passed to downstream nodes to indicate that the pixel values of a bitmap have changed (i.e. one-or-more pixels have changed color). class bitmap_pixels_changed : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static bitmap_pixels_changed* instance(); }; ////////////////////////////////////////////////////////////////////////////// // selection_changed /// Hint object that indicates that an object's selection state has changed class selection_changed : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static selection_changed* instance(); }; ////////////////////////////////////////////////////////////////////////////// // mesh_geometry_changed /// Hint object that indicates that a mesh's geometry (the locations of its points) has changed class mesh_geometry_changed : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static mesh_geometry_changed* instance(); /// Indices of the points affected by the change k3d::mesh::indices_t changed_points; /// Transformation matrix used for the change k3d::matrix4 transformation_matrix; }; ////////////////////////////////////////////////////////////////////////////// // mesh_topology_changed /// Hint object that indicates that a mesh's topology has changed class mesh_topology_changed : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static mesh_topology_changed* instance(); }; ////////////////////////////////////////////////////////////////////////////// // mesh_deleted /// Hint object that indicates a mesh was deleted class mesh_deleted : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static mesh_deleted* instance(); }; ////////////////////////////////////////////////////////////////////////////// // file_changed /// Hint object that indicates a file was changed class file_changed : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static file_changed* instance(); }; ////////////////////////////////////////////////////////////////////////////// // graph_topology_changed /// Hint object that indicates that a graph's topology has changed class graph_topology_changed : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static graph_topology_changed* instance(); }; ////////////////////////////////////////////////////////////////////////////// // graph_attributes_changed /// Hint object that indicates that a graph's attributes have changed class graph_attributes_changed : public ihint { public: ihint* clone(); void print(std::ostream& Stream); static graph_attributes_changed* instance(); }; ////////////////////////////////////////////////////////////////////////////// // any /// Used when creating a hint-mapping that matches any incoming hint type. class any { public: }; ////////////////////////////////////////////////////////////////////////////// // none /// Used when creating a hint-mapping that maps to a NULL ("none") hint. class none { public: }; ////////////////////////////////////////////////////////////////////////////// // unchanged /// Used when creating a hint-mapping that does not convert hints. class unchanged { public: }; ////////////////////////////////////////////////////////////////////////////// // hint_traits /// Hint traits template responsible for matching and converting hints. template class hint_traits { public: }; template<> class hint_traits { public: static bool_t match(ihint* Hint) { return dynamic_cast(Hint); } static ihint* convert(ihint*) { static bitmap_dimensions_changed hint; return &hint; } }; template<> class hint_traits { public: static bool_t match(ihint* Hint) { return dynamic_cast(Hint); } static ihint* convert(ihint*) { static bitmap_pixels_changed hint; return &hint; } }; template<> class hint_traits { public: static bool_t match(ihint* Hint) { return dynamic_cast(Hint); } static ihint* convert(ihint*) { static selection_changed hint; return &hint; } }; template<> class hint_traits { public: static bool_t match(ihint* Hint) { return dynamic_cast(Hint); } static ihint* convert(ihint*) { static mesh_topology_changed hint; return &hint; } }; template<> class hint_traits { public: static bool_t match(ihint* Hint) { return dynamic_cast(Hint); } static ihint* convert(ihint*) { static mesh_geometry_changed hint; return &hint; } }; template<> class hint_traits { public: static bool_t match(ihint* Hint) { return dynamic_cast(Hint); } static ihint* convert(ihint*) { static graph_topology_changed hint; return &hint; } }; template<> class hint_traits { public: static bool_t match(ihint* Hint) { return dynamic_cast(Hint); } static ihint* convert(ihint*) { static graph_attributes_changed hint; return &hint; } }; template<> class hint_traits { public: static bool_t match(ihint*) { return true; } }; template<> class hint_traits { public: static bool_t match(ihint*) { return false; } static ihint* convert(ihint*) { return 0; } }; template<> class hint_traits { public: static ihint* convert(ihint* Hint) { return Hint; } }; ////////////////////////////////////////////////////////////////////////////// // last_conversion class last_conversion { }; ////////////////////////////////////////////////////////////////////////////// // convert template struct convert { typedef SourceT Source; typedef TargetT Target; typedef NextT Next; }; namespace detail { template void execute(ihint* const Hint, const slot_t& Slot) { if(hint_traits::match(Hint)) { Slot(hint_traits::convert(Hint)); } else { execute(Hint, Slot); } } template<> inline void execute(ihint* const Hint, const slot_t&) { std::cerr << "unhandled hint: " << print(Hint) << std::endl; } template class converter { public: converter(const slot_t& Slot) : slot(Slot) { } void operator()(ihint* const Hint) { execute(Hint, slot); } private: slot_t slot; }; } // namespace detail ////////////////////////////////////////////////////////////////////////////// // converter /// Factory function for creating hint-converter objects. You can pass the /// result from converter() to the connect() method of a signal, to establish /// a hint-mapping. template detail::converter converter(const sigc::slot& Slot) { return detail::converter(Slot); } } // namespace hint } // namespace k3d #endif // !K3DSDK_HINTS_H ================================================ FILE: k3dsdk/hyperboloid.cpp ================================================ // K-3D // Copyright (c) 1995-200 7, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { namespace hyperboloid { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::points_t& StartPoints, const mesh::points_t& EndPoints, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), start_points(StartPoints), end_points(EndPoints), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::points_t& StartPoints, mesh::points_t& EndPoints, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), start_points(StartPoints), end_points(EndPoints), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("hyperboloid"); primitive* const result = new primitive( generic_primitive.structure["surface"].create("matrices"), generic_primitive.structure["surface"].create("materials"), generic_primitive.structure["surface"].create("start_points"), generic_primitive.structure["surface"].create("end_points"), generic_primitive.structure["surface"].create("sweep_angles"), generic_primitive.structure["surface"].create("selections"), generic_primitive.attributes["constant"], generic_primitive.attributes["surface"], generic_primitive.attributes["parameter"] ); result->selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "hyperboloid") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& surface_structure = require_structure(Primitive, "surface"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); const mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); const mesh::points_t& start_points = require_array(Primitive, surface_structure, "start_points"); const mesh::points_t& end_points = require_array(Primitive, surface_structure, "end_points"); const mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); const mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new const_primitive(matrices, materials, start_points, end_points, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "hyperboloid") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& surface_structure = require_structure(Primitive, "surface"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); mesh::points_t& start_points = require_array(Primitive, surface_structure, "start_points"); mesh::points_t& end_points = require_array(Primitive, surface_structure, "end_points"); mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new primitive(matrices, materials, start_points, end_points, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "hyperboloid") return 0; return validate(Mesh, Primitive.writable()); } } // namespace hyperboloid } // namespace k3d ================================================ FILE: k3dsdk/hyperboloid.h ================================================ #ifndef K3DSDK_HYPERBOLOID_H #define K3DSDK_HYPERBOLOID_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace hyperboloid { /// Gathers the member arrays of a hyperboloid primitive into a convenient package class const_primitive { public: const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::points_t& StartPoints, const mesh::points_t& EndPoints, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes); const mesh::matrices_t& matrices; const mesh::materials_t& materials; const mesh::points_t& start_points; const mesh::points_t& end_points; const mesh::doubles_t& sweep_angles; const mesh::selection_t& selections; const mesh::table_t& constant_attributes; const mesh::table_t& surface_attributes; const mesh::table_t& parameter_attributes; }; /// Gathers the member arrays of a hyperboloid primitive into a convenient package class primitive { public: primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::points_t& StartPoints, mesh::points_t& EndPoints, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes); mesh::matrices_t& matrices; mesh::materials_t& materials; mesh::points_t& start_points; mesh::points_t& end_points; mesh::doubles_t& sweep_angles; mesh::selection_t& selections; mesh::table_t& constant_attributes; mesh::table_t& surface_attributes; mesh::table_t& parameter_attributes; }; /// Creates a new hyperboloid mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid hyperboloid primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid hyperboloid primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid hyperboloid primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace hyperboloid } // namespace k3d #endif // !K3DSDK_HYPERBOLOID_H ================================================ FILE: k3dsdk/i3d_2d_mapping.h ================================================ #ifndef K3DSDK_I3D_2D_MAPPING_H #define K3DSDK_I3D_2D_MAPPING_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class point3; class bounding_box3; class i3d_2d_mapping : public virtual iunknown { public: virtual const point2 map_3d_to_2d(const point3& Position, const bounding_box3& Bounds) = 0; protected: i3d_2d_mapping() {} i3d_2d_mapping(const i3d_2d_mapping& Other) : iunknown(Other) {} i3d_2d_mapping& operator = (const i3d_2d_mapping&) { return *this; } virtual ~i3d_2d_mapping() {} }; } // namespace k3d #endif // !K3DSDK_I3D_2D_MAPPING_H ================================================ FILE: k3dsdk/iapplication.h ================================================ #ifndef K3DSDK_IAPPLICATION_H #define K3DSDK_IAPPLICATION_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class idocument; /// Abstract interface for the global K-3D Application object class iapplication : public virtual iunknown { public: /// Exit K-3D if safe to do so virtual bool exit() = 0; /// Creates a new K-3D document (could return NULL) virtual idocument* create_document() = 0; /// Closes an open K-3D document virtual void close_document(idocument& Document) = 0; /// A collection of idocument objects typedef std::vector document_collection_t; /// Returns the collection of open documents virtual const document_collection_t documents() = 0; // Signals /// Defines a signal emitted to display progress messages to the user during application startup typedef sigc::signal startup_message_signal_t; virtual startup_message_signal_t& startup_message_signal() = 0; /// Connects a slot to a signal emitted when the application is closing virtual sigc::connection connect_close_signal(const sigc::slot& Slot) = 0; /// Connects a slot to a signal emitted when an existing document is closed virtual sigc::connection connect_close_document_signal(const sigc::slot& Slot) = 0; protected: iapplication() {} iapplication(const iapplication& Other) : iunknown(Other) {} iapplication& operator = (const iapplication&) { return *this; } virtual ~iapplication() {} }; } // namespace k3d #endif // !K3DSDK_IAPPLICATION_H ================================================ FILE: k3dsdk/iapplication_plugin_factory.h ================================================ #ifndef K3DSDK_IAPPLICATION_PLUGIN_FACTORY_H #define K3DSDK_IAPPLICATION_PLUGIN_FACTORY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares iapplication_plugin_factory, an abstract factory interface for application-context plugin objects \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iapplication; /// Abstract factory interface for plugin objects class iapplication_plugin_factory : public virtual iunknown { public: /// Creates a new instance of a plugin object virtual iunknown* create_plugin() = 0; protected: iapplication_plugin_factory() {} iapplication_plugin_factory(const iapplication_plugin_factory& Other) : iunknown(Other) {} iapplication_plugin_factory& operator=(const iapplication_plugin_factory&) { return *this; } virtual ~iapplication_plugin_factory() {} }; } // namespace k3d #endif // !K3DSDK_IAPPLICATION_PLUGIN_FACTORY_H ================================================ FILE: k3dsdk/iattribute_property_ri.h ================================================ #ifndef K3DSDK_IATTRIBUTE_PROPERTY_RI_H #define K3DSDK_IATTRIBUTE_PROPERTY_RI_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ri { /// Abstract interface for discovering information about a RenderMan attribute property class iattribute_property : public virtual iunknown { public: virtual const string_t property_attribute_name() = 0; protected: iattribute_property() {} iattribute_property(const iattribute_property& Other) : iunknown(Other) {} iattribute_property& operator = (const iattribute_property&) { return *this; } virtual ~iattribute_property() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IATTRIBUTE_PROPERTY_RI_H ================================================ FILE: k3dsdk/ibitmap_exporter.h ================================================ #ifndef K3DSDK_IBITMAP_EXPORTER_H #define K3DSDK_IBITMAP_EXPORTER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace filesystem { class path; } /// Abstract interface for objects capable of exporting bitmap images class ibitmap_exporter : public virtual k3d::iunknown { public: virtual ~ibitmap_exporter() {} virtual bool write_file(const filesystem::path& File, const bitmap& Bitmap) = 0; protected: ibitmap_exporter() {} ibitmap_exporter(const ibitmap_exporter&) {} ibitmap_exporter& operator = (const ibitmap_exporter&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IBITMAP_EXPORTER_H ================================================ FILE: k3dsdk/ibitmap_importer.h ================================================ #ifndef K3DSDK_IBITMAP_IMPORTER_H #define K3DSDK_IBITMAP_IMPORTER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace filesystem { class path; } /// Abstract interface for objects capable of importing bitmaps from a filesystem class ibitmap_importer : public virtual iunknown { public: virtual ~ibitmap_importer() {} virtual bool read_file(const filesystem::path& File, bitmap& Bitmap) = 0; protected: ibitmap_importer() {} ibitmap_importer(const ibitmap_importer&) {} ibitmap_importer& operator=(const ibitmap_importer&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IBITMAP_IMPORTER_H ================================================ FILE: k3dsdk/ibitmap_sink.h ================================================ #ifndef K3DSDK_IBITMAP_SINK_H #define K3DSDK_IBITMAP_SINK_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares ibitmap_sink, an interface for objects that can consume bitmap data \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for objects that can consume bitmap data class ibitmap_sink : public virtual iunknown { public: virtual iproperty& bitmap_sink_input() = 0; protected: ibitmap_sink() {} ibitmap_sink(const ibitmap_sink&) {} ibitmap_sink& operator=(const ibitmap_sink&) { return *this; } virtual ~ibitmap_sink() {} }; } // namespace k3d #endif // !K3DSDK_IBITMAP_SINK_H ================================================ FILE: k3dsdk/ibitmap_source.h ================================================ #ifndef K3DSDK_IBITMAP_SOURCE_H #define K3DSDK_IBITMAP_SOURCE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares ibitmap_source, an interface for objects that can act as a source of bitmapes \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iproperty; /// Abstract interface for objects that can act as a source of bitmapes class ibitmap_source : public virtual iunknown { public: virtual iproperty& bitmap_source_output() = 0; protected: ibitmap_source() {} ibitmap_source(const ibitmap_source&) {} ibitmap_source& operator=(const ibitmap_source&) { return *this; } virtual ~ibitmap_source() {} }; } // namespace k3d #endif // !K3DSDK_IBITMAP_SOURCE_H ================================================ FILE: k3dsdk/ibounded.h ================================================ #ifndef K3DSDK_IBOUNDED_H #define K3DSDK_IBOUNDED_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface for quickly determining the bounding box of objects that fill a 3D volume class ibounded : public virtual iunknown { public: /// Returns the bounding box of an object (within its local coordinate system) virtual const bounding_box3 extents() = 0; protected: ibounded() {} ibounded(const ibounded&) {} ibounded& operator=(const ibounded&) { return *this; } virtual ~ibounded() {} }; } // namespace k3d #endif // !K3DSDK_IBOUNDED_H ================================================ FILE: k3dsdk/icamera.h ================================================ #ifndef K3DSDK_ICAMERA_H #define K3DSDK_ICAMERA_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares k3d::icamera, an abstract interface for an object that can act as a camera (provide location and viewing frustum data) \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class icrop_window; class iprojection; class iproperty; class imatrix_source; /// Abstract interface for objects that can host (provide position and projection information to) a viewport class icamera : public virtual iunknown { public: /// Returns the required position data for this camera virtual imatrix_source& transformation() = 0; /// Returns the required viewing projection for this camera virtual iprojection& projection() = 0; /// Returns the required crop-window for this camera virtual icrop_window& crop_window() = 0; /// Returns the transformable object that should be altered during interactive user navigation virtual imatrix_source& navigation_target() = 0; /// Retuns the camera's world target, a point (in world coordinates) around which the viewport orbits virtual iproperty& world_target() = 0; protected: icamera() {} icamera(const icamera& Other) : iunknown(Other) {} icamera& operator=(const icamera&) { return *this; } virtual ~icamera() {} }; } // namespace k3d #endif // !K3DSDK_ICAMERA_H ================================================ FILE: k3dsdk/icolor_source.h ================================================ #ifndef K3DSDK_ICOLOR_SOURCE_H #define K3DSDK_ICOLOR_SOURCE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares icolor_source, an interface for objects that can act as a source of color values \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for objects that can act as a source of color values class icolor_source : public virtual iunknown { public: virtual iproperty& color_source_output() = 0; protected: icolor_source() {} icolor_source(const icolor_source&) {} icolor_source& operator=(const icolor_source&) { return *this; } virtual ~icolor_source() {} }; } // namespace k3d #endif // !K3DSDK_ICOLOR_SOURCE_H ================================================ FILE: k3dsdk/icrop_window.h ================================================ #ifndef K3DSDK_ICROP_WINDOW_H #define K3DSDK_ICROP_WINDOW_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for an object whose output can be cropped (units are in projection-space) class icrop_window : public virtual iunknown { public: virtual iproperty& crop_left() = 0; virtual iproperty& crop_right() = 0; virtual iproperty& crop_top() = 0; virtual iproperty& crop_bottom() = 0; protected: icrop_window() {} icrop_window(const icrop_window&) {} icrop_window& operator=(const icrop_window&) { return *this; } virtual ~icrop_window() {} }; } // namespace k3d #endif // !K3DSDK_ICROP_WINDOW_H ================================================ FILE: k3dsdk/idependencies.h ================================================ #ifndef K3DSDK_IDEPENDENCIES_H #define K3DSDK_IDEPENDENCIES_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares k3d::idependencies, an abstract interface that allows objects to register inter-object dependencies for serialization \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward class references class inode; /// Abstract interface that allows objects to register dependencies for serialization /** \note Currently unused */ class idependencies : public virtual iunknown { public: virtual void register_object_dependency(inode& Object, const bool CopyByReference) = 0; protected: idependencies() {} idependencies(const idependencies& Other) : iunknown(Other) {} idependencies& operator=(const idependencies&) { return *this; } virtual ~idependencies() {} }; } // namespace k3d #endif // !K3DSDK_IDEPENDENCIES_H ================================================ FILE: k3dsdk/idisplacement_shader_ri.h ================================================ #ifndef K3DSDK_IDISPLACEMENT_SHADER_RI_H #define K3DSDK_IDISPLACEMENT_SHADER_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ri { class render_state; /// Abstract interface implemented by objects that encapsulate a RenderMan displacement shader class idisplacement_shader : public virtual iunknown { public: virtual void setup_renderman_displacement_shader(const render_state& State) = 0; protected: idisplacement_shader() {} idisplacement_shader(const idisplacement_shader&) {} idisplacement_shader& operator=(const idisplacement_shader&) { return *this; } virtual ~idisplacement_shader() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IDISPLACEMENT_SHADER_RI_H ================================================ FILE: k3dsdk/idocument.h ================================================ #ifndef K3DSDK_IDOCUMENT_H #define K3DSDK_IDOCUMENT_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares idocument, an abstract interface for an open K-3D document \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { class ipipeline; class inode_collection; class inode_name_map; class ipipeline_profiler; class iproperty; class istate_recorder; /// Abstract interface for an open K-3D document class idocument : public virtual iunknown { public: /// Returns the collection of K-3D objects within this document virtual inode_collection& nodes() = 0; /// Returns the directed acyclic graph of dependencies between object properties within this document virtual ipipeline& pipeline() = 0; /// Returns an object that can be used to collect and distribute profiling data for the visualization pipeline virtual ipipeline_profiler& pipeline_profiler() = 0; /// Returns the istate_recorder interface for this document virtual istate_recorder& state_recorder() = 0; /// Returns an interface that provides a mapping of nodes to unique names virtual inode_name_map& unique_node_names() = 0; /// Returns a property that will store the document filepath (could be empty) virtual iproperty& path() = 0; /// Returns a property that will store the document title (could be empty string) virtual iproperty& title() = 0; /// Defines a signal emitted when the document closes typedef sigc::signal close_signal_t; virtual close_signal_t& close_signal() = 0; protected: idocument() {} idocument(const idocument& Other) : iunknown(Other) {} idocument& operator=(const idocument&) { return *this; } virtual ~idocument() {} }; } // namespace k3d #endif // !K3DSDK_IDOCUMENT_H ================================================ FILE: k3dsdk/idocument_exporter.h ================================================ #ifndef K3DSDK_IDOCUMENT_EXPORTER_H #define K3DSDK_IDOCUMENT_EXPORTER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class idocument; namespace filesystem { class path; } /// Abstract interface implemented by objects that can export data from a K-3D document class idocument_exporter : public virtual iunknown { public: virtual ~idocument_exporter() {} virtual bool write_file(idocument& Document, const filesystem::path& File) = 0; protected: idocument_exporter() {} idocument_exporter(const idocument_exporter&) {} idocument_exporter& operator = (const idocument_exporter&) { return *this; } }; } //namespace k3d #endif // !K3DSDK_IDOCUMENT_EXPORTER_H ================================================ FILE: k3dsdk/idocument_importer.h ================================================ #ifndef K3DSDK_IDOCUMENT_IMPORTER_H #define K3DSDK_IDOCUMENT_IMPORTER_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class idocument; namespace filesystem { class path; } /// Abstract interface for objects that can import data into an existing K-3D document class idocument_importer : public virtual iunknown { public: virtual ~idocument_importer() {} /// Return metadata extracted from the file. virtual imetadata::metadata_t get_file_metadata(const filesystem::path& File) = 0; /// Read the file data into a document. virtual bool_t read_file(const filesystem::path& File, idocument& Document) = 0; protected: idocument_importer() {} idocument_importer(const idocument_importer&) {} idocument_importer& operator = (const idocument_importer&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IDOCUMENT_IMPORTER_H ================================================ FILE: k3dsdk/idocument_plugin_factory.h ================================================ #ifndef K3DSDK_IDOCUMENT_PLUGIN_FACTORY_H #define K3DSDK_IDOCUMENT_PLUGIN_FACTORY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares idocument_plugin_factory, an abstract factory interface for document-context plugin objects \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class idocument; class inode; class iplugin_factory; /// Abstract factory interface for plugin objects class idocument_plugin_factory : public virtual iunknown { public: /// Creates a new instance of a plugin object virtual inode* create_plugin(iplugin_factory& Factory, idocument& Document) = 0; protected: idocument_plugin_factory() {} idocument_plugin_factory(const idocument_plugin_factory& Other) : iunknown(Other) {} idocument_plugin_factory& operator=(const idocument_plugin_factory&) { return *this; } virtual ~idocument_plugin_factory() {} }; } // namespace k3d #endif // !K3DSDK_IDOCUMENT_PLUGIN_FACTORY_H ================================================ FILE: k3dsdk/idocument_sink.h ================================================ #ifndef K3DSDK_IDOCUMENT_SINK_H #define K3DSDK_IDOCUMENT_SINK_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class idocument; /// Abstract interface for objects that can be optionally 'bound' to a specific document class idocument_sink : public virtual iunknown { public: virtual ~idocument_sink() {} virtual void set_document(idocument* Document) = 0; protected: idocument_sink() {} idocument_sink(const idocument_sink&) {} idocument_sink& operator = (const idocument_sink&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IDOCUMENT_SINK_H ================================================ FILE: k3dsdk/idouble_source.h ================================================ #ifndef K3DSDK_IDOUBLE_SOURCE_H #define K3DSDK_IDOUBLE_SOURCE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for objects that can act as a source of k3d::double_t values class idouble_source : public virtual iunknown { public: virtual iproperty& double_source_output() = 0; protected: idouble_source() {} idouble_source(const idouble_source&) {} idouble_source& operator=(const idouble_source&) { return *this; } virtual ~idouble_source() {} }; } // namespace k3d #endif // !K3DSDK_IDOUBLE_SOURCE_H ================================================ FILE: k3dsdk/ienumeration_property.h ================================================ #ifndef K3DSDK_IENUMERATION_PROPERTY_H #define K3DSDK_IENUMERATION_PROPERTY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares ienumeration_property, an abstract interface for discovering information about an enumerated property \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { /// Abstract interface for discovering information about an enumerated property class ienumeration_property : public virtual iunknown { public: /// Stores information about an individual enumeration value struct enumeration_value_t { enumeration_value_t(const k3d::string_t& Label, const k3d::string_t& Value, const k3d::string_t& Description) : label(Label), value(Value), description(Description) { } k3d::string_t label; k3d::string_t value; k3d::string_t description; }; /// Defines a collection of enumeration values typedef std::vector enumeration_values_t; /// Returns the set of all valid values for this property virtual enumeration_values_t enumeration_values() = 0; /// Connects a slot to a signal that will be emitted whenever the set of enumeration values changes virtual sigc::connection connect_enumeration_values_changed(const sigc::slot& Slot) = 0; protected: ienumeration_property() {} ienumeration_property(const ienumeration_property& Other) : iunknown(Other) {} ienumeration_property& operator = (const ienumeration_property&) { return *this; } virtual ~ienumeration_property() {} }; } // namespace k3d #endif // !K3DSDK_IENUMERATION_PROPERTY_H ================================================ FILE: k3dsdk/ievent_loop.h ================================================ #ifndef K3DSDK_IEVENT_LOOP_H #define K3DSDK_IEVENT_LOOP_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace boost { namespace filesystem { class path; } } namespace boost { namespace program_options { class options_description; } } namespace k3d { /// Abstract interface for event loop (user interface) plugins class ievent_loop : public virtual iunknown { public: virtual ~ievent_loop() {} /// Called by the host application to retrieve descriptions of command-line arguments for this plugin virtual void get_command_line_arguments(boost::program_options::options_description& Description) = 0; /// Defines storage for parsed command-line arguments typedef std::vector > arguments_t; /// Called by the host application so the plugin can handle command-line arguments during startup virtual const arguments_t parse_startup_arguments(const arguments_t& Arguments, bool& Quit, bool& Error) = 0; /// Called by the host application to display informational messages during startup virtual void startup_message_handler(const std::string& Message) = 0; /// Called by the host application to display the "normal" user interface (and hide any startup / splash screens, etc) virtual void display_user_interface() = 0; /// Called by the host application so the plugin can handle command-line arguments after startup is complete virtual const arguments_t parse_runtime_arguments(const arguments_t& Arguments, bool& Quit, bool& Error) = 0; /// Called by the host application to start the main event-loop (if any) virtual void start_event_loop() = 0; /// Called by the host application to stop the main event-loop (if any) virtual void stop_event_loop() = 0; protected: ievent_loop() {} ievent_loop(const ievent_loop&) {} ievent_loop& operator = (const ievent_loop&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IEVENT_LOOP_H ================================================ FILE: k3dsdk/ifile_change_notifier.h ================================================ #ifndef K3DSDK_IFILE_CHANGE_NOTIFIER_H #define K3DSDK_IFILE_CHANGE_NOTIFIER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file ifile_change_notifier.h \author Tim Shead (tshead@k-3d.com) \author Bart Janssens (bart.janssens@lid.kviv.be) \created Dec 17, 2008 */ #include #include #include namespace k3d { namespace filesystem { class path; } /// Interface implemented by objects that can signal changes to files. class ifile_change_notifier : public virtual iunknown { public: virtual ~ifile_change_notifier() {} /// Call a slot whenever given filesystem path is modified. /** * Note that we are watching the * path, not an inode, so it isn't an error to specify a path for a nonexistent file. * The slot will be called when a file is created / modified / renamed / deleted at that * location. Returns a nonzero watch identifier that can be used to cancel the watch later-on, * or 0 if there is an error. */ virtual uint_t watch_file(const filesystem::path& Path, const sigc::slot& Slot) = 0; /// Stop watching the given path. virtual void unwatch_file(const uint_t WatchID) = 0; /// Blocks indefinitely until there is at least one file change ready to be signalled. virtual void wait_for_changes() = 0; /// Returns the number of file changes that are pending and ready to be signalled. This method never blocks. virtual const uint_t change_count() = 0; /// Handles signalling for the next file change that is pending, if any. This method never blocks. virtual void signal_change() = 0; protected: ifile_change_notifier() {} ifile_change_notifier(const ifile_change_notifier&) {} ifile_change_notifier& operator=(const ifile_change_notifier&) {return *this;} }; } // namespace k3d #endif // !K3DSDK_IFILE_CHANGE_NOTIFIER_H ================================================ FILE: k3dsdk/ihint.h ================================================ #ifndef K3DSDK_IHINT_H #define K3DSDK_IHINT_H #include #include namespace k3d { /// Abstract interface implemented by objects that can act as "hints" for change events class ihint : public virtual iunknown { public: virtual ~ihint() {} virtual ihint* clone() = 0; virtual void print(std::ostream& Stream) = 0; protected: ihint() {} ihint(const ihint& Other) : iunknown(Other) {} ihint& operator=(const ihint&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IHINT_H ================================================ FILE: k3dsdk/iimager_shader_ri.h ================================================ #ifndef K3DSDK_IIMAGER_SHADER_RI_H #define K3DSDK_IIMAGER_SHADER_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ri { class render_state; /// Abstract interface implemented by objects that encapsulate a RenderMan imager shader class iimager_shader : public virtual iunknown { public: virtual void setup_renderman_imager_shader(const render_state& State) = 0; protected: iimager_shader() {} iimager_shader(const iimager_shader&) {} iimager_shader& operator=(const iimager_shader&) { return *this; } virtual ~iimager_shader() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IIMAGER_SHADER_RI_H ================================================ FILE: k3dsdk/iint32_source.h ================================================ #ifndef K3DSDK_IINT32_SOURCE_H #define K3DSDK_IINT32_SOURCE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License aint32 with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for objects that can act as a source of k3d::int32_t values class iint32_source : public virtual iunknown { public: virtual iproperty& int32_source_output() = 0; protected: iint32_source() {} iint32_source(const iint32_source&) {} iint32_source& operator=(const iint32_source&) { return *this; } virtual ~iint32_source() {} }; } // namespace k3d #endif // !K3DSDK_IINT32_SOURCE_H ================================================ FILE: k3dsdk/ikeyframer.h ================================================ #ifndef K3DSDK_IKEYFRAMER_H #define K3DSDK_IKEYFRAMER_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Abstract interface for objects that set keyframes \author Bart Janssens (bart.janssens@lid.kviv.be) */ #include namespace k3d { /// Abstract interface for objects that set keyframes. class ikeyframer { public: /// List of the available keys typedef std::list keys_t; /// Set a keyframe. Inputs are implementation-dependent, and may come from properties. virtual void keyframe() = 0; /// Delete the keyframe placed at the given time property virtual void delete_key(iproperty* TimeProperty) = 0; /// Get the property that inputs key values virtual iproperty& input_property() = 0; /// List with all the properties containing keytimes virtual keys_t get_keys() = 0; typedef sigc::signal keys_changed_signal_t; /// Emitted when the list of keys changed virtual keys_changed_signal_t& keys_changed_signal() = 0; virtual ~ikeyframer() {} }; } #endif // !K3DSDK_IKEYFRAMER_H ================================================ FILE: k3dsdk/ilight_gl.h ================================================ #ifndef K3DSDK_ILIGHT_GL_H #define K3DSDK_ILIGHT_GL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace gl { /// Abstract interface for objects that act as a light source while drawing OpenGL graphics class ilight : public virtual iunknown { public: virtual void setup_gl_light(const unsigned long LightNumber) = 0; protected: ilight() {} ilight(const ilight&) {} ilight& operator=(const ilight&) { return *this; } virtual ~ilight() {} }; } // namespace gl } // namespace k3d #endif // !K3DSDK_ILIGHT_GL_H ================================================ FILE: k3dsdk/ilight_ri.h ================================================ #ifndef K3DSDK_ILIGHT_RI_H #define K3DSDK_ILIGHT_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ri { class render_state; /// Abstract interface for objects that can act as light sources while drawing RenderMan graphics class ilight : public virtual iunknown { public: virtual void setup_renderman_light(const render_state& State) = 0; protected: ilight() {} ilight(const ilight& ) {} ilight& operator=(const ilight& ) { return *this; } virtual ~ilight() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_ILIGHT_RI_H ================================================ FILE: k3dsdk/ilight_shader_ri.h ================================================ #ifndef K3DSDK_ILIGHT_SHADER_RI_H #define K3DSDK_ILIGHT_SHADER_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ri { class render_state; /// Abstract interface implemented by objects that encapsulate a RenderMan light shader class ilight_shader : public virtual iunknown { public: virtual void setup_renderman_light_shader(const render_state& State) = 0; virtual void setup_renderman_area_light_shader(const render_state& State) = 0; protected: ilight_shader() {} ilight_shader(const ilight_shader&) {} ilight_shader& operator=(const ilight_shader&) { return *this; } virtual ~ilight_shader() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_ILIGHT_SHADER_RI_H ================================================ FILE: k3dsdk/ilight_yafray.h ================================================ #ifndef K3DSDK_ILIGHT_YAFRAY_H #define K3DSDK_ILIGHT_YAFRAY_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead */ #include #include namespace k3d { namespace yafray { /// Abstract interface for YafRay light sources class ilight : public virtual k3d::iunknown { public: virtual void setup_light(const k3d::string_t& Name, std::ostream& Stream) = 0; protected: ilight() {} ilight(const ilight& ) {} ilight& operator=(const ilight& ) { return *this; } virtual ~ilight() {} }; } // namespace yafray } // namespace k3d #endif // !K3DSDK_ILIGHT_YAFRAY_H ================================================ FILE: k3dsdk/ilist_property.h ================================================ #ifndef K3DSDK_ILIST_PROPERTY_H #define K3DSDK_ILIST_PROPERTY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares ilist_property, an abstract interface for discovering information about an enumerated property \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Abstract interface for discovering information about a list property (a property for which there is a set of predefined values, but other values are allowed) template class ilist_property : public virtual iunknown { public: /// Defines a collection of list values typedef std::vector values_t; /// Returns the (non-exclusive) set of predefined values for this property virtual values_t property_values() = 0; protected: ilist_property() {} ilist_property(const ilist_property&) {} ilist_property& operator = (const ilist_property&) { return *this; } virtual ~ilist_property() {} }; } // namespace k3d #endif // !K3DSDK_ILIST_PROPERTY_H ================================================ FILE: k3dsdk/imaterial.h ================================================ #ifndef K3DSDK_IMATERIAL_H #define K3DSDK_IMATERIAL_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface implemented by objects that can act as geometric surface materials class imaterial : public virtual iunknown { protected: imaterial() {} imaterial(const imaterial& Other) : iunknown(Other) {} imaterial& operator=(const imaterial&) { return *this; } virtual ~imaterial() {} }; /// Specialization of difference::test that tests imaterial pointers for equality namespace difference { inline void test(imaterial* const A, imaterial* const B, accumulator& Result) { Result.exact(A == B); } } // namespace difference } // namespace k3d #endif // !K3DSDK_IMATERIAL_H ================================================ FILE: k3dsdk/imaterial_ri.h ================================================ #ifndef K3DSDK_IMATERIAL_RI_H #define K3DSDK_IMATERIAL_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ri { class render_state; /// Abstract interface implemented by objects that can act as a surface material while drawing RenderMan graphics class imaterial : public virtual iunknown { public: virtual void setup_renderman_material(const render_state& State) = 0; protected: imaterial() {} imaterial(const imaterial& ) {} imaterial& operator=(const imaterial& ) { return *this; } virtual ~imaterial() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IMATERIAL_RI_H ================================================ FILE: k3dsdk/imaterial_sink.h ================================================ #ifndef K3DSDK_IMATERIAL_SINK_H #define K3DSDK_IMATERIAL_SINK_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for objects that can "consume" an imaterial class imaterial_sink : public virtual iunknown { public: virtual iproperty& material_sink_input() = 0; protected: imaterial_sink() {} imaterial_sink(const imaterial_sink&) {} imaterial_sink& operator=(const imaterial_sink&) { return *this; } virtual ~imaterial_sink() {} }; } // namespace k3d #endif // !K3DSDK_IMATERIAL_SINK_H ================================================ FILE: k3dsdk/imaterial_yafray.h ================================================ #ifndef K3DSDK_IMATERIAL_YAFRAY_H #define K3DSDK_IMATERIAL_YAFRAY_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead */ #include #include namespace k3d { namespace yafray { /// Abstract interface for Yafray material objects class imaterial : public virtual k3d::iunknown { public: virtual void setup_material(const k3d::string_t& Name, std::ostream& Stream) = 0; protected: imaterial() {} imaterial(const imaterial&) {} imaterial& operator=(const imaterial&) { return *this; } virtual ~imaterial() {} }; } // namespace yafray } // namespace k3d #endif // !K3DSDK_IMATERIAL_YAFRAY_H ================================================ FILE: k3dsdk/imatrix_sink.h ================================================ #ifndef K3DSDK_IMATRIX_SINK_H #define K3DSDK_IMATRIX_SINK_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares imatrix_sink, an interface for objects that can act as consumers of transform data \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iproperty; /// Abstract interface for objects that can act as consumers of transformation data class imatrix_sink : public virtual iunknown { public: virtual iproperty& matrix_sink_input() = 0; protected: imatrix_sink() {} imatrix_sink(const imatrix_sink& Other) : iunknown(Other) {} imatrix_sink& operator=(const imatrix_sink&) { return *this; } virtual ~imatrix_sink() {} }; } // namespace k3d #endif // !K3DSDK_IMATRIX_SINK_H ================================================ FILE: k3dsdk/imatrix_source.h ================================================ #ifndef K3DSDK_IMATRIX_SOURCE_H #define K3DSDK_IMATRIX_SOURCE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares imatrix_source, an interface for objects that can act as a source of transformation data \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iproperty; /// Abstract interface for objects that can act as a source of transformation data class imatrix_source : public virtual iunknown { public: virtual iproperty& matrix_source_output() = 0; protected: imatrix_source() {} imatrix_source(const imatrix_source& Other) : iunknown(Other) {} imatrix_source& operator=(const imatrix_source&) { return *this; } virtual ~imatrix_source() {} }; } // namespace k3d #endif // !K3DSDK_IMATRIX_SOURCE_H ================================================ FILE: k3dsdk/imeasurement_property.h ================================================ #ifndef K3DSDK_IMEASUREMENT_PROPERTY_H #define K3DSDK_IMEASUREMENT_PROPERTY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares imeasurement_property, an abstract interface for discovering information about a property that uses real-world units-of-measure \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { /// Abstract interface for discovering information about a property that uses real-world units-of-measure class imeasurement_property : public virtual iunknown { public: /// Returns the suggested step increment to use when modifying the property value virtual double property_step_increment() = 0; /// Returns the real-world units-of-measure stored by the property virtual const std::type_info& property_units() = 0; protected: imeasurement_property() {} imeasurement_property(const imeasurement_property& Other) : iunknown(Other) {} imeasurement_property& operator = (const imeasurement_property&) { return *this; } virtual ~imeasurement_property() {} }; } // namespace k3d #endif // !K3DSDK_IMEASUREMENT_PROPERTY_H ================================================ FILE: k3dsdk/imesh_painter_gl.h ================================================ #ifndef K3DSDK_IMESH_PAINTER_GL_H #define K3DSDK_IMESH_PAINTER_GL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class ihint; class mesh; namespace gl { class painter_render_state; class painter_selection_state; /// Abstract interface implemented by painter objects that can render a mesh using OpenGL class imesh_painter : public virtual iunknown { public: /// Called to render a mesh for on-screen display /** * The ChangedSignal argument is a signal that is emitted when the supplied mesh changes. It could be used by painters caching data * to notify them when the cache needs updating */ virtual void paint_mesh(const mesh& Mesh, const painter_render_state& RenderState, iproperty::changed_signal_t& ChangedSignal) = 0; /// Called to render a mesh for interactive selection virtual void select_mesh(const mesh& Mesh, const painter_render_state& RenderState, const painter_selection_state& SelectionState, iproperty::changed_signal_t& ChangedSignal) = 0; }; } // namespace gl } // namespace k3d #endif // !K3DSDK_IMESH_PAINTER_GL_H ================================================ FILE: k3dsdk/imesh_painter_ri.h ================================================ #ifndef K3DSDK_IMESH_PAINTER_RI_H #define K3DSDK_IMESH_PAINTER_RI_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class mesh; namespace ri { class render_state; /// Abstract interface implemented by painter objects that can render a mesh using RenderMan class imesh_painter : public virtual iunknown { public: /// Called to render a mesh using RenderMan virtual void paint_mesh(const mesh& Mesh, const render_state& RenderState) = 0; /// Called once rendering is complete, so painters can release resources virtual void paint_complete(const mesh& Mesh, const render_state& RenderState) = 0; }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IMESH_PAINTER_RI_H ================================================ FILE: k3dsdk/imesh_selection_algorithm.h ================================================ #ifndef K3DSDK_IMESH_SELECTION_ALGORITHM_H #define K3DSDK_IMESH_SELECTION_ALGORITHM_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Abstract interface for objects that can create mesh selections class imesh_selection_algorithm : public virtual iunknown { public: virtual const selection::set create_mesh_selection(const mesh& Mesh) = 0; protected: imesh_selection_algorithm() {} imesh_selection_algorithm(const imesh_selection_algorithm& Other) : iunknown(Other) {} imesh_selection_algorithm& operator=(const imesh_selection_algorithm&) { return *this; } virtual ~imesh_selection_algorithm() {} }; } // namespace k3d #endif // !K3DSDK_IMESH_SELECTION_ALGORITHM_H ================================================ FILE: k3dsdk/imesh_selection_sink.h ================================================ #ifndef K3DSDK_IMESH_SELECTION_SINK_H #define K3DSDK_IMESH_SELECTION_SINK_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares imesh_selection_sink, an interface for objects that can consume mesh data \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iproperty; /// Abstract interface for objects that can consume mesh data class imesh_selection_sink : public virtual iunknown { public: virtual iproperty& mesh_selection_sink_input() = 0; protected: imesh_selection_sink() {} imesh_selection_sink(const imesh_selection_sink& Other) : iunknown(Other) {} imesh_selection_sink& operator=(const imesh_selection_sink&) { return *this; } virtual ~imesh_selection_sink() {} }; } // namespace k3d #endif // !K3DSDK_IMESH_SELECTION_SINK_H ================================================ FILE: k3dsdk/imesh_sink.h ================================================ #ifndef K3DSDK_IMESH_SINK_H #define K3DSDK_IMESH_SINK_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares imesh_sink, an interface for objects that can consume mesh data \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iproperty; /// Abstract interface for objects that can consume mesh data class imesh_sink : public virtual iunknown { public: virtual iproperty& mesh_sink_input() = 0; protected: imesh_sink() {} imesh_sink(const imesh_sink& Other) : iunknown(Other) {} imesh_sink& operator=(const imesh_sink&) { return *this; } virtual ~imesh_sink() {} }; } // namespace k3d #endif // !K3DSDK_IMESH_SINK_H ================================================ FILE: k3dsdk/imesh_source.h ================================================ #ifndef K3DSDK_IMESH_SOURCE_H #define K3DSDK_IMESH_SOURCE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares imesh_source, an interface for objects that can act as a source of meshes \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iproperty; /// Abstract interface for objects that can act as a source of meshes class imesh_source : public virtual iunknown { public: virtual iproperty& mesh_source_output() = 0; /// Hint for the type of change the creation of this source entails virtual ihint* hint() const { return 0; } protected: imesh_source() {} imesh_source(const imesh_source& Other) : iunknown(Other) {} imesh_source& operator=(const imesh_source&) { return *this; } virtual ~imesh_source() {} }; } // namespace k3d #endif // !K3DSDK_IMESH_SOURCE_H ================================================ FILE: k3dsdk/imesh_storage.h ================================================ #ifndef K3DSDK_IMESH_STORAGE_H #define K3DSDK_IMESH_STORAGE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares imesh_storage, an interface for objects that can provide persistent storage of meshes \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class mesh; /// Abstract interface for objects that can provide persistent storage of meshes (the FrozenMesh object being the canonical example) class imesh_storage : public virtual iunknown { public: /// Replaces any existing stored mesh with the given object, assuming responsibility for its lifetime virtual void reset_mesh(mesh* const Mesh) = 0; protected: imesh_storage() {} imesh_storage(const imesh_storage& Other) : iunknown(Other) {} imesh_storage& operator=(const imesh_storage&) { return *this; } virtual ~imesh_storage() {} }; } // namespace k3d #endif // !K3DSDK_IMESH_STORAGE_H ================================================ FILE: k3dsdk/imeta_object.cpp ================================================ // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { const boost::any imeta_object::execute(const string_t& Method) { std::vector arguments; return execute(Method, arguments); } const boost::any imeta_object::execute(const string_t& Method, const boost::any& Argument1) { std::vector arguments; arguments.push_back(Argument1); return execute(Method, arguments); } const boost::any imeta_object::execute(const string_t& Method, const boost::any& Argument1, const boost::any& Argument2) { std::vector arguments; arguments.push_back(Argument1); arguments.push_back(Argument2); return execute(Method, arguments); } const boost::any imeta_object::execute(const string_t& Method, const boost::any& Argument1, const boost::any& Argument2, const boost::any& Argument3) { std::vector arguments; arguments.push_back(Argument1); arguments.push_back(Argument2); arguments.push_back(Argument3); return execute(Method, arguments); } } // namespace k3d ================================================ FILE: k3dsdk/imeta_object.h ================================================ #ifndef K3DSDK_IMETA_OBJECT_H #define K3DSDK_IMETA_OBJECT_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { /// Abstract interface for objects that can accept commands from external entities class imeta_object : public virtual iunknown { public: /// Executes an object method that takes zero arguments. const boost::any execute(const string_t& Method); /// Executes an object method that takes one argument. const boost::any execute(const string_t& Method, const boost::any& Argument1); /// Executes an object method that takes two arguments. const boost::any execute(const string_t& Method, const boost::any& Argument1, const boost::any& Argument2); /// Executes an object method that takes three arguments. const boost::any execute(const string_t& Method, const boost::any& Argument1, const boost::any& Argument2, const boost::any& Argument3); /// Executes an object method with an arbitrary number of arguments. virtual const boost::any execute(const string_t& Method, const std::vector& Arguments) = 0; protected: imeta_object() {} imeta_object(const imeta_object& Other) : iunknown(Other) {} imeta_object& operator=(const imeta_object&) { return *this; } virtual ~imeta_object() {} }; } // namespace k3d #endif // !K3DSDK_IMETA_OBJECT_H ================================================ FILE: k3dsdk/imetadata.h ================================================ #ifndef K3DSDK_IMETADATA_H #define K3DSDK_IMETADATA_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { /// Abstract interface for objects that can store arbitrary metadata (name-value pairs). class imetadata : public virtual iunknown { public: /// Defines storage for an arbitrary collection of name-value pairs typedef std::map metadata_t; /// Sets a new name-value pair, overwriting the value if the name already exists virtual void set_metadata_value(const string_t& Name, const string_t& Value) = 0; /// Sets a collection of name-value pair, overwriting any existing values virtual void set_metadata(const metadata_t& Values) = 0; /// Returns the set of existing name-value pairs virtual metadata_t get_metadata() = 0; /// Returns a value by name, or empty-string if the name doesn't exist virtual const string_t get_metadata_value(const string_t& Name) = 0; /// Erases an existing name-value pair virtual void erase_metadata_value(const string_t& Name) = 0; /// Connects a slot to a signal that will be emitted whenever the metadata contents change virtual sigc::connection connect_metadata_changed_signal(const sigc::slot& Slot) = 0; protected: imetadata() {} imetadata(const imetadata& Other) : iunknown(Other) {} imetadata& operator = (const imetadata&) { return *this; } virtual ~imetadata() {} }; } // namespace k3d #endif // !K3DSDK_IMETADATA_H ================================================ FILE: k3dsdk/imime_type_handler.h ================================================ #ifndef K3DSDK_IMIME_TYPE_HANDLER_H #define K3DSDK_IMIME_TYPE_HANDLER_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace filesystem { class path; } /// Abstract interface for objects that can identify the MIME Type of a file class imime_type_handler : public virtual iunknown { public: /// Called to identify the MIME Type of a file. Returns true iff the MIME Type was successfully identified. virtual bool_t identify_mime_type(const filesystem::path& File, string_t& FileType) = 0; /// Called to identify the MIME Type of a data stream. Returns true iff the MIME Type was successfully identified. virtual bool_t identify_mime_type(const string_t& Data, string_t& DataType) = 0; protected: imime_type_handler() {} imime_type_handler(const imime_type_handler&) {} imime_type_handler& operator=(const imime_type_handler&) { return *this; } virtual ~imime_type_handler() {} }; } // namespace k3d #endif // !K3DSDK_IMIME_TYPE_HANDLER_H ================================================ FILE: k3dsdk/imulti_mesh_sink.h ================================================ #ifndef K3DSDK_IMULTI_MESH_SINK_H #define K3DSDK_IMULTI_MESH_SINK_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares imulti_mesh_sink, an interface for objects that can consume multiple meshes \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// Abstract interface for objects that can consume multiple meshes class imulti_mesh_sink : public virtual iunknown { protected: imulti_mesh_sink() {} imulti_mesh_sink(const imulti_mesh_sink& Other) : iunknown(Other) {} imulti_mesh_sink& operator=(const imulti_mesh_sink&) { return *this; } virtual ~imulti_mesh_sink() {} }; } // namespace k3d #endif // !K3DSDK_IMULTI_MESH_SINK_H ================================================ FILE: k3dsdk/inetwork_render_farm.h ================================================ #ifndef K3DSDK_INETWORK_RENDER_FARM_H #define K3DSDK_INETWORK_RENDER_FARM_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class inetwork_render_job; /// Abstract interface that encapsulates a "render farm" capable of executing render jobs class inetwork_render_farm : public virtual iunknown { public: /// Creates a new job, in a "waiting" state virtual inetwork_render_job& create_job(const string_t& JobName) = 0; /// Tells the render farm to begin executing the given job virtual void start_job(inetwork_render_job& Job) = 0; protected: inetwork_render_farm() {} inetwork_render_farm(const inetwork_render_farm&) {} inetwork_render_farm& operator=(const inetwork_render_farm&) { return *this; } virtual ~inetwork_render_farm() {} }; } // namespace k3d #endif // !K3DSDK_INETWORK_RENDER_FARM_H ================================================ FILE: k3dsdk/inetwork_render_frame.h ================================================ #ifndef K3DSDK_INETWORK_RENDER_FRAME_H #define K3DSDK_INETWORK_RENDER_FRAME_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace filesystem { class path; } /// Abstract interface that encapsulates all of the work required to render a "frame". /// All of the steps ("commands") required to render the frame will be executed in the /// order that they were added using add_exec_command(), add_copy_command(), and add_view_command(). class inetwork_render_frame : public virtual iunknown { public: /// Defines storage for an environment variable class variable { public: variable() { } variable(const string_t& Name, const string_t& Value) : name(Name), value(Value) { } string_t name; string_t value; }; /// Defines storage for a collection of environment variables typedef std::vector environment; /// Defines storage for a command-line argument class argument { public: argument() { } argument(const string_t& Value) : value(Value) { } string_t value; }; /// Defines storage for a collection of command-line arguments typedef std::vector arguments; /// Returns a unique filepath that can be used as an input/output file for this frame virtual const filesystem::path add_file(const string_t& Name) = 0; /// Sets-up an arbitrary command to be executed. Supplied environment variables will supplement the application environment. virtual void add_exec_command(const string_t& Binary, const environment& Environment, const arguments& Arguments) = 0; /// Sets-up a copy operation from one filesystem location to another virtual void add_copy_command(const filesystem::path& Source, const filesystem::path& Target) = 0; /// Sets-up an view operation that will display a file to the user virtual void add_view_command(const filesystem::path& File) = 0; protected: inetwork_render_frame() {} inetwork_render_frame(const inetwork_render_frame&) {} inetwork_render_frame& operator=(const inetwork_render_frame&) { return *this; } virtual ~inetwork_render_frame() {} }; } // namespace k3d #endif // !K3DSDK_INETWORK_RENDER_FRAME_H ================================================ FILE: k3dsdk/inetwork_render_job.h ================================================ #ifndef K3DSDK_INETWORK_RENDER_JOB_H #define K3DSDK_INETWORK_RENDER_JOB_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class inetwork_render_frame; /// Abstract interface encapsulating a render job containing zero-to-many frames to be rendered class inetwork_render_job : public virtual iunknown { public: /// Adds a new "frame" to the job, to be rendered when the job is run virtual inetwork_render_frame& create_frame(const string_t& FrameName) = 0; protected: inetwork_render_job() {} inetwork_render_job(const inetwork_render_job&) {} inetwork_render_job& operator=(const inetwork_render_job&) { return *this; } virtual ~inetwork_render_job() {} }; } // namespace k3d #endif // !K3DSDK_INETWORK_RENDER_JOB_H ================================================ FILE: k3dsdk/inode.h ================================================ #ifndef K3DSDK_INODE_H #define K3DSDK_INODE_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares inode, an abstract interface which MUST be implemented by ALL document nodes \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class idocument; class iplugin_factory; ///////////////////////////////////////////////////////////////////////////// // inode /// Abstract interface which MUST be implemented by ALL document nodes class inode : public virtual iunknown { public: virtual ~inode() {} /// Sets the node name (could fail or be overridden) virtual void set_name(const std::string Name) = 0; /// Returns the node name virtual const std::string name() = 0; /// Returns a reference to the factory that created this node virtual iplugin_factory& factory() = 0; /// Returns a reference to the document that owns this node virtual idocument& document() = 0; /// Defines a signal that will be emitted iff the node is deleted typedef sigc::signal deleted_signal_t; virtual deleted_signal_t& deleted_signal() = 0; /// Defines a signal that will be emitted if the node name changes (including via undo / redo) typedef sigc::signal name_changed_signal_t; virtual name_changed_signal_t& name_changed_signal() = 0; protected: inode() {} inode(const inode& Other) : iunknown(Other) {} inode& operator=(const inode&) { return *this; } }; namespace difference { /// Specialization of difference::test that tests inode pointers for equality inline void test(inode* const A, inode* const B, accumulator& Result) { Result.exact(A == B); } } // namespace difference } // namespace k3d #endif // !K3DSDK_INODE_H ================================================ FILE: k3dsdk/inode_change_signal.h ================================================ #ifndef K3DSDK_INODE_CHANGE_SIGNAL_H #define K3DSDK_INODE_CHANGE_SIGNAL_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class inode; /// Abstract interface for nodes that broadcast a change signal to observers when their state is modified class inode_change_signal : public virtual iunknown { public: /// Connects a slot to a signal that will be emitted whenever the node state is modified, including an optional "hint" that describes the change. virtual sigc::connection connect_node_changed_signal(const sigc::slot& Slot) = 0; protected: inode_change_signal() {} inode_change_signal(const inode_change_signal& Other) : iunknown(Other) {} inode_change_signal& operator = (const inode_change_signal&) { return *this; } virtual ~inode_change_signal() {} }; } // namespace k3d #endif // !K3DSDK_INODE_CHANGE_SIGNAL_H ================================================ FILE: k3dsdk/inode_collection.h ================================================ #ifndef K3DSDK_INODE_COLLECTION_H #define K3DSDK_INODE_COLLECTION_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares inode_collection, a container of inode instances \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class inode; /// Abstract interface for a collection of document nodes class inode_collection : public virtual iunknown { public: /// Defines a collection of nodes typedef std::vector nodes_t; /// Adds new nodes to the collection virtual void add_nodes(const nodes_t& Objects) = 0; /// Returns the set of all nodes in the collection virtual const nodes_t& collection() = 0; /// Removes nodes from the collection virtual void remove_nodes(const nodes_t& Objects) = 0; /// Defines a signal that will be emitted whenever nodes are added to the collection typedef sigc::signal add_nodes_signal_t; virtual add_nodes_signal_t& add_nodes_signal() = 0; /// Defines a signal that will be emitted whenever nodes are removed from the collection typedef sigc::signal remove_nodes_signal_t; virtual remove_nodes_signal_t& remove_nodes_signal() = 0; /// Defines a signal that will be emitted whenever an node is renamed typedef sigc::signal rename_node_signal_t; virtual rename_node_signal_t& rename_node_signal() = 0; protected: inode_collection() {} inode_collection(const inode_collection& Other) : iunknown(Other) {} inode_collection& operator = (const inode_collection&) { return *this; } virtual ~inode_collection() {} }; } // namespace #endif // !K3DSDK_INODE_COLLECTION_H ================================================ FILE: k3dsdk/inode_collection_property.h ================================================ #ifndef K3DSDK_INODE_COLLECTION_PROPERTY_H #define K3DSDK_INODE_COLLECTION_PROPERTY_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class inode; /// Provides domain-specific methods for a property that stores a collection of nodes as its value class inode_collection_property : public virtual iunknown { public: virtual bool property_allow(inode& Object) = 0; typedef std::vector nodes_t; protected: inode_collection_property() {} inode_collection_property(const inode_collection_property& Other) : iunknown(Other) {} inode_collection_property& operator = (const inode_collection_property&) { return *this; } virtual ~inode_collection_property() {} }; } // namespace k3d #endif // !K3DSDK_INODE_COLLECTION_PROPERTY_H ================================================ FILE: k3dsdk/inode_collection_sink.h ================================================ #ifndef K3DSDK_INODE_COLLECTION_SINK_H #define K3DSDK_INODE_COLLECTION_SINK_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class iproperty; /// Abstract interface for objects that have one-or-more inode_collection_property properties. /// /// Typically, inode_collection_sink is implemented by "render engine" objects that maintain /// explicit lists of "visible" nodes, "enabled" lights, etc. class inode_collection_sink : public virtual iunknown { public: /// Defines a collection of properties typedef std::vector properties_t; /// Returns a set of inode_collection_property properties virtual const properties_t node_collection_properties() = 0; protected: inode_collection_sink() {} inode_collection_sink(const inode_collection_sink&) {} inode_collection_sink& operator=(const inode_collection_sink&) { return *this; } virtual ~inode_collection_sink() {} }; } // namespace k3d #endif // !K3DSDK_INODE_COLLECTION_SINK_H ================================================ FILE: k3dsdk/inode_name_map.h ================================================ #ifndef K3DSDK_INODE_NAME_MAP_H #define K3DSDK_INODE_NAME_MAP_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class inode; /// Abstract interface for a collection of document node names class inode_name_map : public virtual iunknown { public: /// Returns the name for a given node (could return empty string) virtual const std::string name(inode& Node) = 0; /// Returns the node for a given name (could return NULL) virtual inode* node(const std::string& Name) = 0; protected: inode_name_map() {} inode_name_map(const inode_name_map&) {} inode_name_map& operator = (const inode_name_map&) { return *this; } virtual ~inode_name_map() {} }; } // namespace k3d #endif // !K3DSDK_INODE_NAME_MAP_H ================================================ FILE: k3dsdk/inode_property.h ================================================ #ifndef K3DSDK_INODE_PROPERTY_H #define K3DSDK_INODE_PROPERTY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares inode_property, an abstract interface for discovering information about a property that references a document node \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Abstract interface for discovering information about a property that references another node class inode_property : public virtual iunknown { public: virtual bool property_allow_none() = 0; virtual bool property_allow(k3d::iplugin_factory& Factory) = 0; virtual bool property_allow(inode& Object) = 0; protected: inode_property() {} inode_property(const inode_property& Other) : iunknown(Other) {} inode_property& operator = (const inode_property&) { return *this; } virtual ~inode_property() {} }; } // namespace k3d #endif // !K3DSDK_INODE_PROPERTY_H ================================================ FILE: k3dsdk/inode_selection.h ================================================ #ifndef K3DSDK_INODE_SELECTION_H #define K3DSDK_INODE_SELECTION_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares inode_selection, an abstract interface for objects storing a list of selected nodes with their selection weight \author Bart Janssens (bart.janssens@lid.kviv.be) */ #include #include #include #include namespace k3d { class inode; class ihint; /// Abstract interface for objects that store document node selections and their weights class inode_selection : public virtual iunknown { public: /// Storage for a list of selected nodes /** * Note: we use a list for fast removal at any position. Fast random access is not needed */ typedef std::list selected_nodes_t; /// Selects a node /** * \param Node the node to select * \param Weight The selection weight. Setting this to 0 removes the node from the selection */ virtual void select(inode& Node, const double_t Weight) = 0; /// Return the selection weight of the given node virtual double_t selection_weight(inode& Node) = 0; /// List of selected nodes, in the order they were selected virtual const selected_nodes_t selected_nodes() = 0; /// Deselect all nodes virtual void deselect_all() = 0; /// Changed signal emitted when the selection changed typedef sigc::signal changed_signal_t; virtual changed_signal_t& selection_changed_signal() = 0; protected: inode_selection() {} inode_selection(const inode_selection& Other) : iunknown(Other) {} inode_selection& operator=(const inode_selection&) { return *this; } virtual ~inode_selection() {} }; } // namespace k3d #endif // !K3DSDK_INODE_SELECTION_H ================================================ FILE: k3dsdk/int32_source.h ================================================ #ifndef K3DSDK_INT32_SOURCE_H #define K3DSDK_INT32_SOURCE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License aint32 with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { template class int32_source : public iint32_source { public: iproperty& int32_source_output() { return m_output_int32; } sigc::slot make_update_int32_slot() { return m_output_int32.make_slot(); } protected: int32_source() : m_output_int32( init_owner(*static_cast(this)) + init_name("output_int32") + init_label(_("Output Int32")) + init_description("Output int32") + init_value(0)) { m_output_int32.set_update_slot(sigc::mem_fun(*this, &int32_source::execute)); } private: k3d_data(k3d::int32_t, data::immutable_name, data::change_signal, data::no_undo, data::value_demand_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_output_int32; /// Called whenever the output has been modified and needs to be updated. void execute(const std::vector& Hints, int32_t& Output) { // We can safely ignore any hints ... on_update_int32(Output); } virtual void on_update_int32(int32_t& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_INT32_SOURCE_H ================================================ FILE: k3dsdk/interface_list.h ================================================ #ifndef K3DSDK_INTERFACE_LIST_H #define K3DSDK_INTERFACE_LIST_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Defines a null interface type for marking the ends of an interface list class null_interface { }; /// Used to create compile-time lists of interfaces (i.e. typelists - see Alexandrescu "Modern C++ Design") template struct interface_list { typedef head_t head; typedef tail_t tail; }; ///////////////////////////////////////////////////////////////////////////// // implements_interface /// Generates code at compile-time that test whether an interface_list contains a specific interface type template struct implements_interface; /// Generates code at compile-time that test whether an interface_list contains a specific interface type template<> struct implements_interface { bool operator()(const std::type_info& InterfaceType) { return false; } }; /// Generates code at compile-time that test whether an interface_list contains a specific interface type template struct implements_interface > { bool operator()(const std::type_info& InterfaceType) { if(typeid(head_t) == InterfaceType) return true; return implements_interface()(InterfaceType); } }; /// Generates code at compile-time that returns a list of interface types template struct get_interfaces; /// Generates code at compile-time that returns a list of interface types template<> struct get_interfaces { void operator()(iplugin_factory::interfaces_t& Interfaces) { } }; /// Generates code at compile-time that returns a list of interface types template struct get_interfaces > { void operator()(iplugin_factory::interfaces_t& Interfaces) { Interfaces.push_back(&typeid(head_t)); get_interfaces()(Interfaces); } }; } // namespace k3d #endif // !K3DSDK_INTERFACE_LIST_H ================================================ FILE: k3dsdk/iomanip.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { //////////////////////////////////////////////////////////////////////////////////////////// // current_indent long& current_indent(std::ios& Stream) { static const int index = std::ios::xalloc(); return Stream.iword(index); } //////////////////////////////////////////////////////////////////////////////////////////// // push_indent std::ostream& push_indent(std::ostream& Stream) { current_indent(Stream)++; return Stream; } //////////////////////////////////////////////////////////////////////////////////////////// // pop_indent std::ostream& pop_indent(std::ostream& Stream) { if(current_indent(Stream) != 0) current_indent(Stream)--; return Stream; } //////////////////////////////////////////////////////////////////////////////////////////// // standard_indent std::ostream& standard_indent(std::ostream& Stream) { Stream << std::string(2 * current_indent(Stream), ' '); return Stream; } //////////////////////////////////////////////////////////////////////////////////////////// // block_size static long& block_size(std::ios& Stream) { static const int index = std::ios::xalloc(); return Stream.iword(index); } //////////////////////////////////////////////////////////////////////////////////////////// // block_index static long& block_index(std::ios& Stream) { static const int index = std::ios::xalloc(); return Stream.iword(index); } //////////////////////////////////////////////////////////////////////////////////////////// // start_block start_block::start_block(const uint_t BlockSize) : block_size(BlockSize) { } std::ostream& operator<<(std::ostream& Stream, const start_block& RHS) { block_size(Stream) = RHS.block_size; block_index(Stream) = 0; return Stream; } //////////////////////////////////////////////////////////////////////////////////////////// // block_delimiter std::ostream& block_delimiter(std::ostream& Stream) { if(block_size(Stream)) { if(0 == (block_index(Stream) % block_size(Stream))) { if(block_index(Stream)) Stream << "\n"; Stream << standard_indent; } else { Stream << " "; } block_index(Stream) += 1; } else { Stream << " "; } return Stream; } //////////////////////////////////////////////////////////////////////////////////////////// // finish_block std::ostream& finish_block(std::ostream& Stream) { block_size(Stream) = 0; return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/iomanip.h ================================================ #ifndef K3DSDK_IOMANIP_H #define K3DSDK_IOMANIP_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Returns the current indentation for a stream long& current_indent(std::ios& Stream); /// Increments a stream's indentation std::ostream& push_indent(std::ostream& Stream); /// Decrements a stream's indentation std::ostream& pop_indent(std::ostream& Stream); /// Inserts whitespace into a stream, proportional to its indentation level std::ostream& standard_indent(std::ostream& Stream); struct start_block { start_block(const uint_t BlockSize = 8); uint_t block_size; }; std::ostream& operator<<(std::ostream& Stream, const start_block& RHS); std::ostream& block_delimiter(std::ostream& Stream); std::ostream& finish_block(std::ostream& Stream); } // namespace k3d #endif // !K3DSDK_IOMANIP_H ================================================ FILE: k3dsdk/ioption_property_ri.h ================================================ #ifndef K3DSDK_IOPTION_PROPERTY_RI_H #define K3DSDK_IOPTION_PROPERTY_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ri { /// Abstract interface for discovering information about a RenderMan option property class ioption_property : public virtual iunknown { public: virtual const string_t property_option_name() = 0; protected: ioption_property() {} ioption_property(const ioption_property&) {} ioption_property& operator = (const ioption_property&) { return *this; } virtual ~ioption_property() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IOPTION_PROPERTY_RI_H ================================================ FILE: k3dsdk/iparentable.h ================================================ #ifndef K3DSDK_IPARENTABLE_H #define K3DSDK_IPARENTABLE_H #include namespace k3d { class iproperty; /// Abstract interface for an object that can be "parented" to another. Note: parenting implies, but does not require, that the child's transformations be related to the parent's class iparentable : public virtual iunknown { public: /// Returns the object's parent, if any (could be NULL) virtual iproperty& parent() = 0; protected: iparentable() {} iparentable(const iparentable&) {} iparentable& operator=(const iparentable&) { return *this; } virtual ~iparentable() {} }; } // namespace k3d #endif // !K3DSDK_IPARENTABLE_H ================================================ FILE: k3dsdk/ipath_property.h ================================================ #ifndef K3DSDK_IPATH_PROPERTY_H #define K3DSDK_IPATH_PROPERTY_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares ipath_property, an abstract interface for discovering information about a property that stores filesystem paths \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { /// Abstract interface for properties that represent external filesystem resources (typically used to alter presentation) class ipath_property : public virtual iunknown { public: /// Enumerates the mode of the underlying file typedef enum { READ, WRITE, } mode_t; /// Enumerates how the external resource should be referenced - by absolute path, relative path, or inline typedef enum { ABSOLUTE_REFERENCE, RELATIVE_REFERENCE, INLINE_REFERENCE } reference_t; /// Defines a "pattern filter" that the UI layer can use to filter files using GLOB style syntax struct pattern_filter { pattern_filter() { } pattern_filter(const std::string& Name, const std::string& Pattern) : name(Name), pattern(Pattern) { } /// Stores a human-readable name for the pattern std::string name; /// Stores s pattern using GLOB syntax std::string pattern; }; typedef std::vector pattern_filters_t; /// Returns the path "mode", which indicates whether the path will be used for an input or an output file virtual mode_t property_path_mode() = 0; /// Returns the path "type", used to categorize the purpose of the path and store most-recent-used paths virtual const std::string property_path_type() = 0; /// Returns the path "reference", which indicates how the external resource will be referenced - by absolute path, relative path, or inline virtual reference_t property_path_reference() = 0; virtual void set_property_path_reference(const reference_t) = 0; /// Defines a signal that will be emitted anytime the path reference is modified typedef sigc::signal path_reference_changed_signal_t; virtual path_reference_changed_signal_t& property_path_reference_changed_signal() = 0; /// Returns a collection of pattern filters to be (optionally) used by the UI when prompting the user for a file virtual const pattern_filters_t pattern_filters() = 0; protected: ipath_property() {} ipath_property(const ipath_property& Other) : iunknown(Other) {} ipath_property& operator=(const ipath_property&) { return *this; } virtual ~ipath_property() {} }; std::ostream& operator<<(std::ostream&, const ipath_property::reference_t&); std::istream& operator>>(std::istream&, ipath_property::reference_t&); } // namespace k3d #endif // !K3DSDK_IPATH_PROPERTY_H ================================================ FILE: k3dsdk/ipersistent.h ================================================ #ifndef K3DSDK_IPERSISTENT_H #define K3DSDK_IPERSISTENT_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares ipersistent, an abstract interface implemented by all objects that can be serialized to/from a K-3D document \author Tim Shead (tshead@k-3d.com) */ #include #include /** The methods in ipersistent will be called in a specific order at various stages of an object's lifetime: When the object is saved as part of a document: 1. save() When the object is reloaded from a document: 1. load() - called only after all objects have been instantiated Important note: Although all document objects exist before load() is called, their load() methods are not called in any particular order. Thus, you should not access any member methods of an external object in your load() implementation. */ namespace k3d { class idependencies; class ipersistent_lookup; namespace xml { class element; } /// Abstract interface implemented by objects that can be serialized to/from a K-3D document class ipersistent : public virtual iunknown { public: /// Placeholder for arguments passed at save time class save_context { public: save_context(const filesystem::path& RootPath, idependencies& Dependencies, ipersistent_lookup& Lookup) : root_path(RootPath), dependencies(Dependencies), lookup(Lookup) { } const filesystem::path& root_path; idependencies& dependencies; ipersistent_lookup& lookup; }; /// Called once during document save virtual void save(xml::element& Element, const save_context& Context) = 0; /// Placeholder for arguments passed at load time class load_context { public: load_context(const filesystem::path& RootPath, ipersistent_lookup& Lookup) : root_path(RootPath), lookup(Lookup) { } const filesystem::path& root_path; ipersistent_lookup& lookup; }; /// Called once during document loading virtual void load(xml::element& Element, const load_context& Context) = 0; protected: ipersistent() {} ipersistent(const ipersistent& Other) : iunknown(Other) {} ipersistent& operator=(const ipersistent&) { return *this; } virtual ~ipersistent() {} }; } // namespace k3d #endif // !K3DSDK_IPERSISTENT_H ================================================ FILE: k3dsdk/ipersistent_collection.h ================================================ #ifndef K3DSDK_IPERSISTENT_COLLECTION_H #define K3DSDK_IPERSISTENT_COLLECTION_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class ipersistent; /// Encapsulates a collection of named, serializable objects. class ipersistent_collection : public virtual iunknown { public: /// Add a serializable object to the collection, specifying its name. Note that names are constrained to be unique within the collection. virtual void enable_serialization(const string_t& Name, ipersistent& Object) = 0; /// Remove a serializable object from the collection. virtual void disable_serialization(ipersistent& Object) = 0; /// Returns the set of serializable objects and their names, in the order they were added. virtual const std::vector > persistent_objects() = 0; protected: ipersistent_collection() {} ipersistent_collection(const ipersistent_collection& Other) : iunknown(Other) {} ipersistent_collection& operator=(const ipersistent_collection&) { return *this; } virtual ~ipersistent_collection() {} }; } // namespace k3d #endif // !K3DSDK_IPERSISTENT_COLLECTION_H ================================================ FILE: k3dsdk/ipersistent_lookup.h ================================================ #ifndef K3DSDK_IPERSISTENT_LOOKUP_H #define K3DSDK_IPERSISTENT_LOOKUP_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares ipersistent_lookup lookup, an abstract interface to assign/lookup unique identifiers for object serialization \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// Abstract interface to assign / lookup unique identifiers for object serialization class ipersistent_lookup : public virtual iunknown { public: /// Defines a unique identifier that can be serialized typedef unsigned long id_type; /// Returns a unique identifier for the given object that can be used in serialization virtual id_type lookup_id(iunknown* Object) = 0; /// Given a unique identifier, returns the corresponding object (could return NULL) virtual iunknown* lookup_object(const id_type ID) = 0; protected: ipersistent_lookup() {} ipersistent_lookup(const ipersistent_lookup& Other) : iunknown(Other) {} ipersistent_lookup& operator=(const ipersistent_lookup&) { return *this; } virtual ~ipersistent_lookup() {} }; } // namespace k3d #endif // !K3DSDK_IPERSISTENT_LOOKUP_H ================================================ FILE: k3dsdk/ipipeline.h ================================================ #ifndef K3DSDK_IPIPELINE_H #define K3DSDK_IPIPELINE_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class iproperty; /// Abstract interface for maintaining a collection of dependencies among properties ... a "pipeline" class ipipeline : public virtual iunknown { public: /// Defines a dependency between two properties typedef std::pair dependency_t; /// Defines a set of dependencies between properties - the map key is the dependent property and must not be NULL. The map value is the property it depends upon, and may be NULL. typedef std::map dependencies_t; /// Updates dependencies between a set of properties virtual void set_dependencies(dependencies_t& Dependencies, ihint* Hint = 0) = 0; /// Returns the dependency for a given property - may return NULL for no dependency virtual iproperty* dependency(iproperty& Target) = 0; /// Returns the set of all dependencies between properties virtual const dependencies_t& dependencies() = 0; /// Defines a signal that will be emitted whenever a set of dependencies are altered typedef sigc::signal dependency_signal_t; virtual dependency_signal_t& dependency_signal() = 0; protected: ipipeline() {} ipipeline(const ipipeline& Other) : iunknown(Other) {} ipipeline& operator=(const ipipeline&) { return *this; } virtual ~ipipeline() {} }; } // namespace k3d #endif // !K3DSDK_IPIPELINE_H ================================================ FILE: k3dsdk/ipipeline_profiler.h ================================================ #ifndef K3DSDK_IPIPELINE_PROFILER_H #define K3DSDK_IPIPELINE_PROFILER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class inode; /// Abstract interface for an object that collects and distributes profiling data for the K-3D visualization pipeline class ipipeline_profiler : public virtual iunknown { public: /// Called by a node to indicate that it has begun processing the given task. Note: it is critical that every call to start_execution() is balanced with a call to finish_execution(). virtual void start_execution(inode& Node, const string_t& Task) = 0; /// Called by a node to indicate that it has finished processing the given task. Note: it is critical that every call to finish_execution() matches a call to start_execution(). virtual void finish_execution(inode& Node, const string_t& Task) = 0; /// Called by a node to manually add a profiling entry. virtual void add_timing_entry(inode& Node, const string_t& Task, const double TimingValue) = 0; /// Connects a slot that will be called to report the time in seconds that a node spent processing a given task virtual sigc::connection connect_node_execution_signal(const sigc::slot& Slot) = 0; /// RAII helper class that records profile information for the current scope with return- and exception-safety class profile { public: profile(ipipeline_profiler& Profiler, inode& Node, const string_t& Task) : profiler(Profiler), node(Node), task(Task) { profiler.start_execution(node, task); } ~profile() { profiler.finish_execution(node, task); } private: profile(const profile&); profile& operator=(const profile&); ipipeline_profiler& profiler; inode& node; const string_t task; }; protected: ipipeline_profiler() {} ipipeline_profiler(const ipipeline_profiler& Other) : iunknown(Other) {} ipipeline_profiler& operator=(const ipipeline_profiler&) { return *this; } virtual ~ipipeline_profiler() {} }; } // namespace k3d #endif // !K3DSDK_IPIPELINE_PROFILER_H ================================================ FILE: k3dsdk/iplugin_factory.h ================================================ #ifndef K3DSDK_IPLUGIN_FACTORY_H #define K3DSDK_IPLUGIN_FACTORY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares iplugin_factory, an abstract factory interface for plugin objects \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { /// Abstract factory interface for plugin objects class iplugin_factory : public virtual iunknown { public: /// Marks a plugin "stable", "experimental", or "deprecated", typically used to provide appropriate warnings in the UI typedef enum { STABLE, EXPERIMENTAL, DEPRECATED } quality_t; /// Defines a collection of "categories" used to group plugins within the UI typedef std::vector categories_t; /// Defines a collection of interfaces implemented by the underlying plugin instance typedef std::vector interfaces_t; /// Defines an arbitrary collection of name-value pair metadata describing the underlying plugin instance typedef std::map metadata_t; /// Returns a guaranteed-unique factory ID virtual const k3d::uuid& factory_id() = 0; /// Returns the internal name for a plugin virtual const std::string name() = 0; /// Returns a short, human-readable description of the plugin virtual const std::string short_description() = 0; /// Returns a default category for ordering this plugin within the UI virtual const categories_t& categories() = 0; /// Returns the plugin quality (stable or experimental) virtual quality_t quality() = 0; /// Returns true iff a plugin implements the requested interface virtual bool implements(const std::type_info& InterfaceType) = 0; /// Returns the set of interfaces implemented by the plugin virtual const interfaces_t interfaces() = 0; /// Returns metadata describing the plugin virtual metadata_t metadata() = 0; protected: iplugin_factory() {} iplugin_factory(const iplugin_factory& Other) : iunknown(Other) {} iplugin_factory& operator = (const iplugin_factory&) { return *this; } virtual ~iplugin_factory() {} }; std::ostream& operator<<(std::ostream&, const iplugin_factory::quality_t&); std::istream& operator>>(std::istream&, iplugin_factory::quality_t&); } // namespace k3d #endif // !K3DSDK_IPLUGIN_FACTORY_H ================================================ FILE: k3dsdk/iplugin_factory_collection.h ================================================ #ifndef K3DSDK_IPLUGIN_FACTORY_COLLECTION_H #define K3DSDK_IPLUGIN_FACTORY_COLLECTION_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class iplugin_factory; /// Abstract factory interface for plugin objects class iplugin_factory_collection : public virtual iunknown { public: /// Defines a collection of plugin factories typedef std::set factories_t; /// Returns the set of available plugin factories virtual const factories_t& factories() = 0; protected: iplugin_factory_collection() {} iplugin_factory_collection(const iplugin_factory_collection& Other) : iunknown(Other) {} iplugin_factory_collection& operator=(const iplugin_factory_collection&) { return *this; } virtual ~iplugin_factory_collection() {} }; } // namespace k3d #endif // !K3DSDK_IPLUGIN_FACTORY_COLLECTION_H ================================================ FILE: k3dsdk/iplugin_registry.h ================================================ #ifndef K3DSDK_IPLUGIN_REGISTRY_H #define K3DSDK_IPLUGIN_REGISTRY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares iplugin_registry, an abstract interface passed to plugin module entry points so they may register their plugin factories \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations ... class iplugin_factory; /** \brief Abstract interface passed to plugin module entry points so they may register their plugin factories \note Your K-3D plugin module should export a function named "register_k3d_plugins" with the module_entry_point signature, which will be called at program startup. In the implementation of "register_k3d_plugins", call register_factory() once for every plugin type your module provides. */ class iplugin_registry : public virtual iunknown { public: /// Called to register a new plugin factory object virtual void register_factory(iplugin_factory& Factory) = 0; protected: iplugin_registry() {} iplugin_registry(const iplugin_registry&) {} iplugin_registry& operator=(const iplugin_registry&) { return *this; } virtual ~iplugin_registry() {} }; } // namespace k3d #endif // !K3DSDK_IPLUGIN_REGISTRY_H ================================================ FILE: k3dsdk/iprojection.h ================================================ #ifndef K3DSDK_IPROJECTION_H #define K3DSDK_IPROJECTION_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares abstract interfaces that encapsulate viewing projections \author Tim Shead (tshead@k-3d.com) */ #include #include #ifdef K3D_API_WIN32 #ifdef near #undef near #endif // near #ifdef far #undef far #endif // far #endif // K3D_API_WIN32 namespace k3d { // Forward declarations class iproperty; ///////////////////////////////////////////////////////////////////////////// // iprojection /// Abstract interface encapsulating a 3D-to-2D viewing projection class iprojection : public virtual k3d::iunknown { public: protected: iprojection() {} iprojection(const iprojection& Other) : iunknown(Other) {} iprojection& operator=(const iprojection&) { return *this; } virtual ~iprojection() {} }; /// Abstract interface encapsulating a standard perspective (truncated pyramid, or frustum) transformation class iperspective : public iprojection { public: virtual iproperty& left() = 0; virtual iproperty& right() = 0; virtual iproperty& top() = 0; virtual iproperty& bottom() = 0; virtual iproperty& near() = 0; virtual iproperty& far() = 0; protected: iperspective() {} iperspective(const iperspective& Other) : iunknown(Other) {} iperspective& operator=(const iperspective&) { return *this; } virtual ~iperspective() {} }; /// Abstract interface encapsulating a standard orthographic transformation class iorthographic : public iprojection { public: virtual iproperty& left() = 0; virtual iproperty& right() = 0; virtual iproperty& top() = 0; virtual iproperty& bottom() = 0; virtual iproperty& near() = 0; virtual iproperty& far() = 0; protected: iorthographic() {} iorthographic(const iorthographic& Other) : iunknown(Other) {} iorthographic& operator=(const iorthographic&) { return *this; } virtual ~iorthographic() {} }; } // namespace k3d #endif // !K3DSDK_IPROJECTION_H ================================================ FILE: k3dsdk/iproperty.h ================================================ #ifndef K3DSDK_IPROPERTY_H #define K3DSDK_IPROPERTY_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class inode; /// Abstract interface for a name-value pair with fixed type (note - if you want to write to a property, query for iwritable_property and be prepared for it to fail for read-only properties) class iproperty : public virtual iunknown { public: virtual ~iproperty() {} /// Returns the property name, which will be used as a unique identifier for programmatic access to the property (i.e. through scripting) virtual const string_t property_name() = 0; /// Returns a human-readable lable for the property, which should be localized for display in UI code virtual const string_t property_label() = 0; /// Returns a human-readable "one-liner" description of the property, which should be localized for display in the UI (e.g. as a tooltip) virtual const string_t property_description() = 0; /// Returns the property type virtual const std::type_info& property_type() = 0; /// Returns the value stored internally by the property. Note that most code that uses properties should retrieve the pipeline value instead. virtual const boost::any property_internal_value() = 0; /// Returns the property value, accounting for any connections in the pipeline. The result may-or-may-not be the same as the internal value. virtual const boost::any property_pipeline_value() = 0; /// Returns a reference to the object that owns the property (if any) virtual inode* property_node() = 0; /// Defines a signal that will be emitted if the property value changes. The signal includes a pointer to an optional "hint" object that may provide additional information about what changed. typedef sigc::signal changed_signal_t; virtual changed_signal_t& property_changed_signal() = 0; /// Defines a signal that will be emitted when the property is destroyed typedef sigc::signal deleted_signal_t; virtual deleted_signal_t& property_deleted_signal() = 0; /// Returns this property's pipeline dependency, if any. Note: there may be dependency cycles, don't use this to perform lookups directly, use k3d::property_lookup() instead virtual iproperty* property_dependency() = 0; /// Sets this property's pipeline dependency. Note: never call this directly, use a k3d::pipeline object to manage pipeline dependencies virtual void property_set_dependency(iproperty*) = 0; protected: iproperty() {} iproperty(const iproperty& Other) : iunknown(Other) {} iproperty& operator = (const iproperty&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IPROPERTY_H ================================================ FILE: k3dsdk/iproperty_collection.h ================================================ #ifndef K3DSDK_IPROPERTY_COLLECTION_H #define K3DSDK_IPROPERTY_COLLECTION_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares iproperty_collection, an abstract interface for wrapping a collection of iproperty objects \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class iproperty; /// Abstract interface for a collection of iproperty objects class iproperty_collection : public virtual iunknown { public: /// Defines a collection of properties typedef std::vector properties_t; /// Registers a property with the collection - note: the collection will assume responsibility for the lifetime of user properties only virtual void register_property(iproperty& Property) = 0; /// Registers a set of properties with the collection - note: the collection will assume responsibility for the lifetime of user properties only virtual void register_properties(const properties_t& Properties) = 0; /// Removes a property from the collection virtual void unregister_property(iproperty& Property) = 0; /// Removes a set of properties from the collection virtual void unregister_properties(const properties_t& Properties) = 0; /// Returns the set of all properties in the collection virtual const properties_t& properties() = 0; /// Connects a slot to a signal emitted whenever the collection changes - note: the signal is emitted when the collection changes (properties are registered and unregistered), not when individual property values are changed virtual sigc::connection connect_properties_changed_signal(const sigc::slot& Slot) = 0; protected: iproperty_collection() {} iproperty_collection(const iproperty_collection& Other) : iunknown(Other) {} iproperty_collection& operator=(const iproperty_collection&) { return *this; } virtual ~iproperty_collection() {} }; } // namespace k3d #endif // !K3DSDK_IPROPERTY_COLLECTION_H ================================================ FILE: k3dsdk/iproperty_group_collection.h ================================================ #ifndef K3DSDK_IPROPERTY_GROUP_COLLECTION_H #define K3DSDK_IPROPERTY_GROUP_COLLECTION_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Provides an abstract interface grouping a collection of iproperty objects (for UI purposes) class iproperty_group_collection : public virtual iunknown { public: /// Defines a grouped collection of properties struct group { group() { } group(const string_t& Name) : name(Name) { } group(const string_t& Name, const iproperty_collection::properties_t& Properties) : name(Name), properties(Properties) { } /// Stores a human-readable name for the group string_t name; /// Stores references to the properties within the group iproperty_collection::properties_t properties; }; /// Defines a collection of property groups typedef std::vector groups_t; /// Returns the set of property groups within the object virtual const groups_t property_groups() = 0; protected: iproperty_group_collection() {} iproperty_group_collection(const iproperty_group_collection&) {} iproperty_group_collection& operator=(const iproperty_group_collection&) { return *this; } virtual ~iproperty_group_collection() {} }; } // namespace k3d #endif // !K3DSDK_IPROPERTY_GROUP_COLLECTION_H ================================================ FILE: k3dsdk/iproperty_sink.h ================================================ #ifndef K3DSDK_IPROPERTY_SINK_H #define K3DSDK_IPROPERTY_SINK_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for objects that can be optionally 'bound' to a specific property class iproperty_sink : public virtual iunknown { public: virtual ~iproperty_sink() {} virtual void set_property(iproperty* const Property) = 0; protected: iproperty_sink() {} iproperty_sink(const iproperty_sink&) {} iproperty_sink& operator = (const iproperty_sink&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IPROPERTY_SINK_H ================================================ FILE: k3dsdk/irender_animation.h ================================================ #ifndef K3DSDK_IRENDER_ANIMATION_H #define K3DSDK_IRENDER_ANIMATION_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class iproperty; /// Abstract interface implemented by objects that can render a sequence of still images class irender_animation : public virtual iunknown { public: virtual bool render_animation(iproperty& Time, const frames& Frames, const bool ViewCompletedImages) = 0; protected: irender_animation() {} irender_animation(const irender_animation&) {} irender_animation& operator = (const irender_animation&) { return *this; } virtual ~irender_animation() {} }; } // namespace k3d #endif // !K3DSDK_IRENDER_ANIMATION_H ================================================ FILE: k3dsdk/irender_camera_animation.h ================================================ #ifndef K3DSDK_IRENDER_CAMERA_ANIMATION_H #define K3DSDK_IRENDER_CAMERA_ANIMATION_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class icamera; class iproperty; /// Abstract interface implemented by objects that can render a sequence of still images using a camera class irender_camera_animation : public virtual iunknown { public: virtual bool render_camera_animation(icamera& Camera, iproperty& Time, const frames& Frames, const bool ViewCompletedImages) = 0; protected: irender_camera_animation() {} irender_camera_animation(const irender_camera_animation& Other) : iunknown(Other) {} irender_camera_animation& operator = (const irender_camera_animation&) { return *this; } virtual ~irender_camera_animation() {} }; } // namespace k3d #endif // !K3DSDK_IRENDER_CAMERA_ANIMATION_H ================================================ FILE: k3dsdk/irender_camera_frame.h ================================================ #ifndef K3DSDK_IRENDER_CAMERA_FRAME_H #define K3DSDK_IRENDER_CAMERA_FRAME_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class icamera; namespace filesystem { class path; } /// Abstract interface implemented by objects that can render a still image using a camera class irender_camera_frame : public virtual k3d::iunknown { public: virtual bool_t render_camera_frame(icamera& Camera, const filesystem::path& OutputImage, const bool_t ViewCompletedImage) = 0; protected: irender_camera_frame() {} irender_camera_frame(const irender_camera_frame& Other) : iunknown(Other) {} irender_camera_frame& operator = (const irender_camera_frame&) { return *this; } virtual ~irender_camera_frame() {} }; } // namespace k3d #endif // !K3DSDK_IRENDER_CAMERA_FRAME_H ================================================ FILE: k3dsdk/irender_camera_preview.h ================================================ #ifndef K3DSDK_IRENDER_CAMERA_PREVIEW_H #define K3DSDK_IRENDER_CAMERA_PREVIEW_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class icamera; /// Abstract interface implemented by objects that can create a "preview" render of a scene using a camera class irender_camera_preview : public virtual iunknown { public: virtual bool_t render_camera_preview(icamera& Camera) = 0; protected: irender_camera_preview() {} irender_camera_preview(const irender_camera_preview& Other) : iunknown(Other) {} irender_camera_preview& operator = (const irender_camera_preview&) { return *this; } virtual ~irender_camera_preview() {} }; } // namespace k3d #endif // !K3DSDK_IRENDER_CAMERA_PREVIEW_H ================================================ FILE: k3dsdk/irender_engine_ri.h ================================================ #ifndef K3DSDK_IRENDER_ENGINE_RI_H #define K3DSDK_IRENDER_ENGINE_RI_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace filesystem { class path; } class inetwork_render_frame; namespace ri { /// Abstract interface for objects that provide an interface to specific RenderMan implementations class irender_engine : public virtual iunknown { public: virtual ~irender_engine() {} /// Returns true iff the underlying RenderMan engine is installed and usable virtual bool_t installed() = 0; /// Compiles the given shader source code, placing the results into the global shader cache virtual bool_t compile_shader(const filesystem::path& Shader) = 0; /// Renders the given RIB file virtual bool_t render(inetwork_render_frame& Frame, const filesystem::path& RIB) = 0; protected: irender_engine() {} irender_engine(const irender_engine& Other) : iunknown(Other) {} irender_engine& operator=(const irender_engine& ) { return *this; } }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IRENDER_ENGINE_RI_H ================================================ FILE: k3dsdk/irender_frame.h ================================================ #ifndef K3DSDK_IRENDER_FRAME_H #define K3DSDK_IRENDER_FRAME_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace filesystem { class path; } /// Abstract interface implemented by objects that can render a still image class irender_frame : public virtual k3d::iunknown { public: virtual bool render_frame(const filesystem::path& OutputImage, const bool ViewCompletedImage) = 0; protected: irender_frame() {} irender_frame(const irender_frame&) {} irender_frame& operator = (const irender_frame&) { return *this; } virtual ~irender_frame() {} }; } // namespace k3d #endif // !K3DSDK_IRENDER_FRAME_H ================================================ FILE: k3dsdk/irender_preview.h ================================================ #ifndef K3DSDK_IRENDER_PREVIEW_H #define K3DSDK_IRENDER_PREVIEW_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// Abstract interface implemented by objects that can render a "preview" image class irender_preview : public virtual iunknown { public: virtual bool render_preview() = 0; protected: irender_preview() {} irender_preview(const irender_preview&) {} irender_preview& operator = (const irender_preview&) { return *this; } virtual ~irender_preview() {} }; } // namespace k3d #endif // !K3DSDK_IRENDER_PREVIEW_H ================================================ FILE: k3dsdk/irender_viewport_gl.h ================================================ #ifndef K3DSDK_IRENDER_VIEWPORT_GL_H #define K3DSDK_IRENDER_VIEWPORT_GL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class icamera; class rectangle; namespace gl { class selection_state; /// Abstract interface for objects that can render using OpenGL class irender_viewport : public virtual iunknown { public: /// Returns the normalized device coordinates for the viewport, allowing for mismatches between the aspect ratio of the window and the camera virtual bool get_ndc(icamera& Camera, const unsigned long PixelWidth, const unsigned long PixelHeight, rectangle& CameraRect, rectangle& WindowRect) = 0; /** \brief Redraws the document \note The caller must setup an OpenGL render context before calling this method, and must call glFlush() after it returns */ virtual void render_viewport(icamera& Camera, const unsigned long PixelWidth, const unsigned long PixelHeight, GLdouble ViewMatrix[16], GLdouble ProjectionMatrix[16], GLint Viewport[4]) = 0; /** \brief Draws the document in OpenGL selection mode, so selection "hits" can be extracted \param SelectionState The geometry components to be drawn \param PixelWidth The width of the viewport in pixels \param PixelHeight The width of the viewport in pixels \param FontListBase \param Rectangle Defines the selection region as a rectangle in screen (pixel coordinates) \param ViewMatrix Returns the OpenGL view matrix used for drawing (the camera-to-world matrix) \param ProjectionMatrix Returns the OpenGL projection matrix used for drawing \param Viewport Returns the OpenGL viewport used for drawing \note The caller must setup the OpenGL render context, allocate the selection buffer, put OpenGL in selection mode, and call glFlush() when done */ virtual void render_viewport_selection(const selection_state& SelectionState, icamera& Camera, const unsigned long PixelWidth, const unsigned long PixelHeight, const rectangle& Rectangle, GLdouble ViewMatrix[16], GLdouble ProjectionMatrix[16], GLint Viewport[4]) = 0; /// Enumerates redraw request types typedef enum { SYNCHRONOUS, ASYNCHRONOUS } redraw_type_t; /// Used to signal any connected user interface components that a redraw is requested typedef sigc::signal redraw_request_signal_t; virtual redraw_request_signal_t& redraw_request_signal() = 0; protected: irender_viewport() {} irender_viewport(const irender_viewport& Other) : iunknown(Other) {} irender_viewport& operator=(const irender_viewport&) { return *this; } virtual ~irender_viewport() {} }; } // namespace gl } // namespace k3d #endif // !K3DSDK_IRENDER_VIEWPORT_GL_H ================================================ FILE: k3dsdk/irenderable_gl.h ================================================ #ifndef K3DSDK_IRENDERABLE_GL_H #define K3DSDK_IRENDERABLE_GL_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace gl { class render_state; class selection_state; /// Abstract interface implemented by objects that can render themselves using the OpenGL API class irenderable : public virtual iunknown { public: /// Returns the layer on which this renderable should be drawn. Lower-numbered layers are rendered earlier than higher-numbered layers. /// The (arbitrary) default layer for most 3D objects is 1024. Layer zero is reserved for the viewport background. virtual uint_t gl_layer() = 0; virtual void gl_draw(const render_state& State) = 0; virtual void gl_select(const render_state& State, const selection_state& SelectState) = 0; protected: irenderable() {} irenderable(const irenderable&) {} irenderable& operator=(const irenderable&) { return *this; } virtual ~irenderable() {} }; } // namespace gl } // namespace k3d #endif // !K3DSDK_IRENDERABLE_GL_H ================================================ FILE: k3dsdk/irenderable_ri.h ================================================ #ifndef K3DSDK_IRENDERABLE_RI_H #define K3DSDK_IRENDERABLE_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ri { class render_state; /// Abstract interface for objects that can render themselves using the RenderMan API class irenderable : public virtual iunknown { public: virtual void renderman_render(const render_state& State) = 0; virtual void renderman_render_complete(const render_state& State) = 0; protected: irenderable() {} irenderable(const irenderable& ) {} irenderable& operator=(const irenderable& ) { return *this; } virtual ~irenderable() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IRENDERABLE_RI_H ================================================ FILE: k3dsdk/ireset_properties.h ================================================ #ifndef K3DSDK_IRESET_PROPERTIES_H #define K3DSDK_IRESET_PROPERTIES_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// All nodes must provide sensible default values for properties, but some /// nodes may be able to provide better default values depending on their inputs. /// /// For example, a node that manipulates NURBS knot vectors may set an initial vector /// based on the order of an input curve. A node that modifies mesh texture coordinates /// would pick a default coordinate array to modify, out of the arrays available in an /// input mesh, etc. class ireset_properties : public virtual iunknown { public: /// Implementations should update property values using whatever logic is appropriate. /// Note that this is the only time (other than in a constructor) when a node is allowed /// to modify one of its own properties! virtual void reset_properties() = 0; protected: ireset_properties() {} ireset_properties(const ireset_properties&) {} ireset_properties& operator=(const ireset_properties&) { return *this; } virtual ~ireset_properties() {} }; } // namespace k3d #endif // !K3DSDK_IRESET_PROPERTIES_H ================================================ FILE: k3dsdk/iscript_engine.h ================================================ #ifndef K3DSDK_ISCRIPT_ENGINE_H #define K3DSDK_ISCRIPT_ENGINE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include namespace k3d { class iplugin_factory; /// Abstract interface implemented by objects that can execute scripts written in a specific scripting language /** \note: The Script arguments to execute() have bounced back-and-forth between * string and stream representations several times. The original rationale for making them streams was * to avoid having to buffer the source code to a script in memory; the new rationale for making them strings * is that in practice you always end-up having to buffer the source code anyway, for one of two reasons: * first, very few script APIs are likely to support C++ streams * C++ streams, so we will likely have to buffer the source before using it anyway; second, determining * the MIME type of a script and calling execute() in sequence (the most common use-case) requires random access to the source stream, * which isn't available for compressed streams or socket-based streams. */ class iscript_engine : public virtual iunknown { public: virtual ~iscript_engine() {} /// Returns a reference to the factory that created this object virtual iplugin_factory& factory() = 0; /** \brief Returns the human-readable name of the scripting language this engine implements */ virtual const string_t language() = 0; /// Defines a collection of name-value pairs passed to a script that define its context (its execution environment) - how they are used is implementation-dependent (note that the names are merely suggestions, and may be changed or ignored at the whim of the implementation) class context : public std::map { }; /// Defines a slot that can be called to redirect script output. typedef sigc::slot output_t; /** \brief Executes a script \param ScriptName A human readable identifier for the script, which should be used in error messages, etc. \param Script The complete source code of the script to be executed \param Context Collection of objects that define the context/execution environment of the script - how they are used is implementation-dependent. Note that the script engine may alter context objects before returning. \param Stdout Optional slot that will be called with script output. \param Stderr Optional slot that will be called with script output. \return true, iff the script was successfully executed without errors (either syntax or runtime) */ virtual bool_t execute(const string_t& ScriptName, const string_t& Script, context& Context, output_t* Stdout = 0, output_t* Stderr = 0) = 0; /** \brief Requests a cancellation of all running scripts. \return true, iff script cancellation is supported by this engine. \note Cancellation may be asynchronous, i.e. scripts may still be running when the call returns, and may continue to run for an indefinite period before shutting down, if at all. */ virtual bool_t halt() = 0; protected: iscript_engine() {} iscript_engine(const iscript_engine& Other) : iunknown(Other) {} iscript_engine& operator = (const iscript_engine&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_ISCRIPT_ENGINE_H ================================================ FILE: k3dsdk/iscript_property.h ================================================ #ifndef K3DSDK_ISCRIPT_PROPERTY_H #define K3DSDK_ISCRIPT_PROPERTY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares iscript_property, an abstract interface for discovering information about a property that uses real-world units-of-measure \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// Abstract interface for properties that represent scripts (typically used to alter presentation) class iscript_property : public virtual iunknown { public: protected: iscript_property() {} iscript_property(const iscript_property& Other) : iunknown(Other) {} iscript_property& operator = (const iscript_property&) { return *this; } virtual ~iscript_property() {} }; } // namespace k3d #endif // !K3DSDK_ISCRIPT_PROPERTY_H ================================================ FILE: k3dsdk/iscripted_action.h ================================================ #ifndef K3DSDK_ISCRIPTED_ACTION_H #define K3DSDK_ISCRIPTED_ACTION_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface implemented by objects that can execute a script on-demand class iscripted_action : public virtual iunknown { public: /// When called, the underlying object will execute a script using the given context virtual bool_t execute(iscript_engine::context& Context) = 0; protected: iscripted_action() {} iscripted_action(const iscripted_action&) {} iscripted_action& operator = (const iscripted_action&) { return *this; } virtual ~iscripted_action() {} }; } // namespace k3d #endif // !K3DSDK_ISCRIPTED_ACTION_H ================================================ FILE: k3dsdk/iselectable.h ================================================ #ifndef K3DSDK_ISELECTABLE_H #define K3DSDK_ISELECTABLE_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares iselectable, an abstract interface for selectable objects \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// Abstract interface for an object that supports the "selection" concept, affecting downstream editing operations /** \deprecated Get rid of this once k3d::legacy::mesh is gone */ class iselectable : public virtual iunknown { public: /// Returns the selection weight of the object, 0 == not selected, non-zero == selected, modifiers may interpret the weight as a boolean, or use linear-interpolation. Weights may be negative or greater than 1. virtual double get_selection_weight() = 0; /// Sets the selection weight of the object virtual void set_selection_weight(const double Weight) = 0; protected: iselectable() {} iselectable(const iselectable& Other) : iunknown(Other) {} iselectable& operator=(const iselectable&) { return *this; } virtual ~iselectable() {} }; } // namespace k3d #endif // !K3DSDK_ISELECTABLE_H ================================================ FILE: k3dsdk/ishader_collection_ri.h ================================================ #ifndef K3DSDK_ISHADER_COLLECTION_RI_H_H #define K3DSDK_ISHADER_COLLECTION_RI_H_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ri { /// Abstract interface to a collection of RenderMan shaders stored by source path (used to keep track of shaders that need to be compiled) class ishader_collection : public virtual iunknown { public: virtual void use_shader(const path& Path) = 0; protected: ishader_collection() {} ishader_collection(const ishader_collection& ) {} ishader_collection& operator=(const ishader_collection& ) { return *this; } virtual ~ishader_collection() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_ISHADER_COLLECTION_RI_H ================================================ FILE: k3dsdk/isnap_source.h ================================================ #ifndef K3DSDK_ISNAP_SOURCE_H #define K3DSDK_ISNAP_SOURCE_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class vector3; /// Abstract interface for a "source" on a snappable object class isnap_source : public virtual iunknown { public: virtual ~isnap_source() {} /// Defines a collection of "snap groups" typedef std::vector groups_t; /// Returns a human-readable label that describes this source virtual const string_t label() = 0; /// Returns a collection of groups that this source is a member of virtual const groups_t groups() = 0; /// Returns the position of this source in local coordinates virtual const point3 source_position() = 0; /// Returns the (optional, could return false) orientation of this source in local coordinates virtual bool source_orientation(vector3& SourceLook, vector3& SourceUp) = 0; protected: isnap_source() {} isnap_source(const isnap_source&) {} isnap_source& operator=(const isnap_source&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_ISNAP_SOURCE_H ================================================ FILE: k3dsdk/isnap_target.h ================================================ #ifndef K3DSDK_ISNAP_TARGET_H #define K3DSDK_ISNAP_TARGET_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class vector3; class point3; /// Abstract interface for a "target" on a snappable object class isnap_target : public virtual iunknown { public: virtual ~isnap_target() {} /// Defines a collection of "snap groups" typedef std::vector groups_t; /// Returns a human-readable label that describes this target virtual const string_t label() = 0; /// Returns a collection of groups that this target is a member of virtual const groups_t groups() = 0; /// Given a set of local coordinates, returns the (optional, could return false) corresponding target position in local coordiantes virtual bool target_position(const point3& Position, point3& TargetPosition) = 0; /// Given a set of local coordinates, returns the (optional, could return false) corresponding target orientation in local coordinates virtual bool target_orientation(const point3& Position, vector3& TargetLook, vector3& TargetUp) = 0; protected: isnap_target() {} isnap_target(const isnap_target&) {} isnap_target& operator=(const isnap_target&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_ISNAP_TARGET_H ================================================ FILE: k3dsdk/isnappable.h ================================================ #ifndef K3DSDK_ISNAPPABLE_H #define K3DSDK_ISNAPPABLE_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares isnappable, an abstract interface implemented by objects to which other objects can be interactively "snapped" \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class isnap_source; class isnap_target; /// Abstract interface implemented by objects to which other objects can be interactively "snapped" class isnappable : public virtual iunknown { public: virtual ~isnappable() {} /// Defines a collection of "snap sources" that describe what parts of this object can be snapped typedef std::vector snap_sources_t; virtual const snap_sources_t snap_sources() = 0; /// Defines a collection of "snap targets" that describe what parts of this object can be snapped-to typedef std::vector snap_targets_t; virtual const snap_targets_t snap_targets() = 0; /// Adds a new snap source to the object (which takes control of the lifetime of the new source) virtual void add_snap_source(isnap_source* const SnapSource) = 0; /// Adds a new snap target to the object (which takes control of the lifetime of the new target) virtual void add_snap_target(isnap_target* const SnapTarget) = 0; protected: isnappable() {} isnappable(const isnappable&) {} isnappable& operator=(const isnappable&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_ISNAPPABLE_H ================================================ FILE: k3dsdk/istate_container.h ================================================ #ifndef K3DSDK_ISTATE_CONTAINER_H #define K3DSDK_ISTATE_CONTAINER_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { /// Abstract interface for an object that stores state and can restore it on demand (memento design pattern) class istate_container { public: virtual ~istate_container() { } /// When called, the implementation should restore whatever state it encapsulates virtual void restore_state() = 0; protected: istate_container() {} istate_container(const istate_container&) {} istate_container& operator = (const istate_container&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_ISTATE_CONTAINER_H ================================================ FILE: k3dsdk/istate_recorder.h ================================================ #ifndef K3DSDK_ISTATE_RECORDER_H #define K3DSDK_ISTATE_RECORDER_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { class state_change_set; /// Abstract interface for an object that can store a hierarchical tree of state changes to the document class istate_recorder : public virtual iunknown { public: /// Called by clients to register a change set for recording subsequent state changes (the recorder assumes responsibility for the lifetime of the changeset) virtual void start_recording(std::unique_ptr ChangeSet, const char* const DebugLabel) = 0; /// Returns the current change set being recorded (if any - could return NULL) virtual state_change_set* current_change_set() = 0; /// Called by clients to stop recording a set of state changes (the recorder relinquishes responsibility for the lifetime of the returned changeset) virtual std::unique_ptr stop_recording(const char* const DebugLabel) = 0; /// Called by clients once a set of changes is complete, to make them a part of the undo/redo tree (the recorder assumes responsibility for the lifetime of the change set) virtual void commit_change_set(std::unique_ptr ChangeSet, const std::string& Label, const char* const DebugLabel) = 0; /// Defines a collection of "nodes" in the hierarchy of recorded state changes struct node; typedef std::vector nodes_t; /// Encapsulates a single "node" in the hierarchy of recorded state changes struct node { node(const std::string& Label, state_change_set* const ChangeSet, node* const Parent) : label(Label), change_set(ChangeSet), parent(Parent) { } /// Stores the human-readable label for this node const std::string label; /// Points to the change set owned by this node state_change_set* const change_set; /// Points to this node's parent (NULL for the root node) node* const parent; /// Points to this node's children nodes_t children; }; /// Returns the root node(s) in the hierarchy of recorded state changes (could return an empty collection if no recording has taken place) virtual const nodes_t& root_nodes() = 0; /// Returns the current node - the node that will become the parent of any subsequently recorded nodes (could return NULL) virtual const node* current_node() = 0; /// Returns the newest (most-recently-created) node, which is typically the node that should be the "goal" of redo operations (could return NULL if nothing's been recorded yet) virtual const node* newest_node() = 0; /// Returns the most-recently-saved node in the hierarchy of recorded state changes (could return NULL if no save has taken place) virtual const node* last_saved_node() = 0; /// Called to set the current node virtual void set_current_node(const node* const Node) = 0; /// Called to mark the current node as saved virtual void mark_saved() = 0; /// Connects a slot that will be called when recording finishes virtual sigc::connection connect_recording_done_signal(const sigc::slot& Slot) = 0; /// Connects a slot that will be called after a node is added to the hierarchy virtual sigc::connection connect_node_added_signal(const sigc::slot& Slot) = 0; /// Connects a slot that will be called when the current node has changed virtual sigc::connection connect_current_node_changed_signal(const sigc::slot& Slot) = 0; /// Connects a slot that will be called when the last saved node has changed virtual sigc::connection connect_last_saved_node_changed_signal(const sigc::slot& Slot) = 0; protected: istate_recorder() {} istate_recorder(const istate_recorder& Other) : iunknown(Other) {} istate_recorder& operator = (const istate_recorder&) { return *this; } virtual ~istate_recorder() {} }; } // namespace k3d #endif // !K3DSDK_ISTATE_RECORDER_H ================================================ FILE: k3dsdk/istate_recorder_sink.h ================================================ #ifndef K3DSDK_ISTATE_RECORDER_SINK_H #define K3DSDK_ISTATE_RECORDER_SINK_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class istate_recorder; /// Abstract interface for objects that can be optionally 'bound' to a specific state recorder class istate_recorder_sink : public virtual iunknown { public: virtual ~istate_recorder_sink() {} virtual void set_state_recorder(istate_recorder* StateRecorder) = 0; protected: istate_recorder_sink() {} istate_recorder_sink(const istate_recorder_sink&) {} istate_recorder_sink& operator = (const istate_recorder_sink&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_ISTATE_RECORDER_SINK_H ================================================ FILE: k3dsdk/istream_ri.h ================================================ #ifndef K3DSDK_ISTREAM_RI_H #define K3DSDK_ISTREAM_RI_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace ri { /// Abstract binding to the Pixar RenderMan interface class istream : public virtual iunknown { public: virtual bool set_inline_types(const bool Inline) = 0; virtual const light_handle RiAreaLightSourceV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiAtmosphereV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiAttributeBegin() = 0; virtual void RiAttributeEnd() = 0; virtual void RiAttributeV(const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiBasis(const matrix& UBasis, const unsigned_integer UStep, const matrix& VBasis, const unsigned_integer VStep) = 0; virtual void RiBasis(const string& UBasis, const unsigned_integer UStep, const string& VBasis, const unsigned_integer VStep) = 0; virtual void RiBlobbyV(const unsigned_integer NLeaf, const unsigned_integers& Codes, const reals& Floats, const strings& Strings, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiBound(const boost::array& Bound) = 0; virtual void RiClipping(const real Hither, const real Yon) = 0; virtual void RiColor(const color& Color) = 0; virtual void RiColorSamples(const unsigned_integer ParameterCount, const reals& nRGB, const reals& RGBn) = 0; virtual void RiComment(const string& Comment) = 0; virtual void RiConcatTransform(const matrix& Transform) = 0; virtual void RiConeV(const real Height, const real Radius, const real ThetaMax, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiCoordSysTransform(const string& Space) = 0; virtual void RiCoordinateSystem(const string& Space) = 0; virtual void RiCropWindow(const real XMin, const real XMax, const real YMin, const real YMax) = 0; virtual void RiCurvesV(const string& Type, const unsigned_integers& VertexCounts, const string& Wrap, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiCylinderV(const real Radius, const real ZMin, const real ZMax, const real ThetaMax, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiDeclare(const string& Name, const string& Type) = 0; virtual void RiDeformationV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiDepthOfField(const real FStop, const real FocalLength, const real FocalDistance) = 0; virtual void RiDetail(const boost::array& Bound) = 0; virtual void RiDetailRange(const real MinVis, const real LowTran, const real UpTran, const real MaxVis) = 0; virtual void RiDiskV(real Height, real Radius, real ThetaMax, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiDisplacementV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiDisplayV(const string& Name, const string& Type, const string& Mode, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiErrorHandler(const string& Style) = 0; virtual void RiExposure(const real Gain, const real Gamma) = 0; virtual void RiExteriorV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiFormat(const unsigned_integer XResolution, const unsigned_integer YResolution, const real AspectRatio) = 0; virtual void RiFrameAspectRatio(const real AspectRatio) = 0; virtual void RiFrameBegin(const unsigned_integer FrameNumber) = 0; virtual void RiFrameEnd() = 0; virtual void RiGeneralPolygonV(const unsigned_integers& VertexCounts, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiGeometricApproximation(const string& Type, const real Value) = 0; virtual void RiGeometricRepresentation(const string& Type) = 0; virtual void RiGeometryV(const string& Type, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiHiderV(const string& Type, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiHyperboloidV(const point& Point1, const point& Point2, const real ThetaMax, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiIdentity() = 0; virtual void RiIlluminate(const light_handle LightHandle, const bool OnOff) = 0; virtual void RiImagerV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiInteriorV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual const light_handle RiLightSourceV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiMakeCubeFaceEnvironmentV(const string& px, const string& nx, const string& py, const string& ny, const string& pz, const string& nz, const string& texturename, const real fov, const string& swrap, const string& twrap, const string& filterfunc, const real swidth, const real twidth, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiMakeLatLongEnvironmentV(const string& picturename, const string& texturename, const string& filterfunc, const real swidth, const real twidth, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiMakeShadowV(const string& picturename, const string& texturename, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiMakeTextureV(const string& picturename, const string& texturename, const string& swrap, const string& twrap, const string& filterfunc, const real swidth, const real twidth, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiMatte(const bool OnOff) = 0; virtual void RiMotionBeginV(const sample_times_t& Times) = 0; virtual void RiMotionEnd() = 0; virtual void RiNewline() = 0; virtual void RiNuPatchV(const unsigned_integer UCount, const unsigned_integer UOrder, const reals& UKnot, const real UMin, const real UMax, const unsigned_integer VCount, const unsigned_integer VOrder, const reals& VKnot, const real VMin, const real VMax, const parameter_list& Parameters = parameter_list()) = 0; virtual const object_handle RiObjectBegin() = 0; virtual void RiObjectEnd() = 0; virtual void RiObjectInstance(const object_handle Object) = 0; virtual void RiOpacity(const color& Opacity) = 0; virtual void RiOptionV(const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiOrientation(const string& Orientation) = 0; virtual void RiParaboloidV(const real RMax, const real ZMin, const real ZMax, const real ThetaMax, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiPatchMeshV(const string& Type, const unsigned_integer UCount, const string& UWrap, const unsigned_integer VCount, const string& VWrap, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiPatchV(const string& Type, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiPerspective(const real FieldOfView) = 0; virtual void RiPixelFilter(const string& FilterName, const real XWidth, const real YWidth) = 0; virtual void RiPixelSamples(const real XSamples, const real YSamples) = 0; virtual void RiPixelVariance(const real Variation) = 0; virtual void RiPointsGeneralPolygonsV(const unsigned_integers& LoopCounts, const unsigned_integers& VertexCounts, const unsigned_integers& VertexIDs, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiPointsPolygonsV(const unsigned_integers& VertexCounts, const unsigned_integers& VertexIDs, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiPointsV(const unsigned_integer VertexCount, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiPolygonV(const unsigned_integer VertexCount, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiProcDelayedReadArchive(const path& Archive, const bound& BoundingBox) = 0; virtual void RiProjectionV(const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiQuantize(const string& Type, const integer One, const integer QMin, const integer QMax, const real Amplitude) = 0; virtual void RiReadArchive(const path& Archive) = 0; virtual void RiRelativeDetail(const real RelativeDetail) = 0; virtual void RiReverseOrientation() = 0; virtual void RiRotate(const real angle, const real DX, const real DY, const real DZ) = 0; virtual void RiScale(const real DX, const real DY, const real DZ) = 0; virtual void RiScreenWindow(const real Left, const real Right, const real Bottom, const real Top) = 0; virtual void RiShadingInterpolation(const string& Type) = 0; virtual void RiShadingRate(const real Size) = 0; virtual void RiShutter(const real SMin, const real SMax) = 0; virtual void RiSides(const unsigned_integer Sides) = 0; virtual void RiSkew(const real Angle, const real DX1, const real DY1, const real DZ1, const real DX2, const real DY2, const real DZ2) = 0; virtual void RiSolidBegin(const string& Type) = 0; virtual void RiSolidEnd() = 0; virtual void RiSphereV(const real Radius, const real ZMin, const real ZMax, const real ThetaMax, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiStructure(const string& Structure) = 0; virtual void RiSubdivisionMeshV(const string& Scheme, const unsigned_integers& VertexCounts, const unsigned_integers& VertexIDs, const strings& Tags, const unsigned_integers& ArgCounts, const integers& IntegerArgs, const reals& FloatArgs, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiSurfaceV(const path& Path, const string& Name, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiTextureCoordinates(const real S1, const real T1, const real S2, const real T2, const real S3, const real T3, const real S4, const real T4) = 0; virtual void RiTorusV(const real MajorRadius, const real MinorRadius, const real PhiMin, const real PhiMax, const real ThetaMax, const parameter_list& Parameters = parameter_list()) = 0; virtual void RiTransform(const matrix& Transform) = 0; virtual void RiTransformBegin() = 0; virtual void RiTransformEnd() = 0; virtual void RiTranslate(const real DX, const real DY, const real DZ) = 0; virtual void RiTrimCurve(const unsigned_integers& CurveCounts, const unsigned_integers& Orders, const reals& Knots, const reals& Minimums, const reals& Maximums, const unsigned_integers& PointCounts, const reals& U, const reals& V, const reals& W) = 0; virtual void RiWorldBegin() = 0; virtual void RiWorldEnd() = 0; // New Aqsis-specific calls introduced to support layered shaders // /** \todo Come up with a better way to handle non-standard calls */ virtual void RiShaderLayerV(const std::string& type, const path& Path, const std::string& name, const std::string& layername, const parameter_list& Parameters = parameter_list()) = 0; /** \todo Come up with a better way to handle non-standard calls */ virtual void RiConnectShaderLayers(const std::string& type, const std::string& layer1, const std::string& variable1, const std::string& layer2, const std::string& variable2) = 0; protected: istream() {} istream(const istream& ) {} istream& operator=(const istream& ) { return *this; } virtual ~istream() {} }; /// Provide definitions for the "standard" RenderMan tokens inline const std::string RI_A() { return "a"; } inline const std::string RI_ABORT() { return "abort"; } inline const std::string RI_AMBIENTLIGHT() { return "ambientlight"; } inline const std::string RI_AMPLITUDE() { return "amplitude"; } inline const std::string RI_AZ() { return "az"; } inline const std::string RI_BACKGROUND() { return "background"; } inline const std::string RI_BEAMDISTRIBUTION() { return "beamdistribution"; } inline const std::string RI_BICUBIC() { return "bicubic"; } inline const std::string RI_BILINEAR() { return "bilinear"; } inline const std::string RI_BLACK() { return "black"; } inline const std::string RI_BOX() { return "box"; } inline const std::string RI_BUMPY() { return "bumpy"; } inline const std::string RI_CAMERA() { return "camera"; } inline const std::string RI_CATMULL_ROM() { return "catmull-rom"; } inline const std::string RI_CLAMP() { return "clamp"; } inline const std::string RI_COMMENT() { return "comment"; } inline const std::string RI_CONEANGLE() { return "coneangle"; } inline const std::string RI_CONEDELTAANGLE() { return "conedeltaangle"; } inline const std::string RI_CONSTANT() { return "constant"; } inline const std::string RI_CONSTANTWIDTH() { return "constantwidth"; } inline const std::string RI_CS() { return "Cs"; } inline const std::string RI_CUBIC() { return "cubic"; } inline const std::string RI_DEPTHCUE() { return "depthcue"; } inline const std::string RI_DIFFERENCE() { return "difference"; } inline const std::string RI_DISTANCE() { return "distance"; } inline const std::string RI_DISTANTLIGHT() { return "distantlight"; } inline const std::string RI_FILE() { return "file"; } inline const std::string RI_FLATNESS() { return "flatness"; } inline const std::string RI_FOG() { return "fog"; } inline const std::string RI_FOV() { return "fov"; } inline const std::string RI_FRAMEBUFFER() { return "framebuffer"; } inline const std::string RI_FROM() { return "from"; } inline const std::string RI_GAUSSIAN() { return "gaussian"; } inline const std::string RI_HANDLER() { return "handler"; } inline const std::string RI_HIDDEN() { return "hidden"; } inline const std::string RI_IDENTIFIER() { return "identifier"; } inline const std::string RI_IGNORE() { return "ignore"; } inline const std::string RI_INSIDE() { return "inside"; } inline const std::string RI_INTENSITY() { return "intensity"; } inline const std::string RI_INTERSECTION() { return "intersection"; } inline const std::string RI_KA() { return "Ka"; } inline const std::string RI_KD() { return "Kd"; } inline const std::string RI_KR() { return "Kr"; } inline const std::string RI_KS() { return "Ks"; } inline const std::string RI_LH() { return "lh"; } inline const std::string RI_LIGHTCOLOR() { return "lightcolor"; } inline const std::string RI_LINEAR() { return "linear"; } inline const std::string RI_MATTE() { return "matte"; } inline const std::string RI_MAXDISTANCE() { return "maxdistance"; } inline const std::string RI_METAL() { return "metal"; } inline const std::string RI_MINDISTANCE() { return "mindistance"; } inline const std::string RI_N() { return "N"; } inline const std::string RI_NAME() { return "name"; } inline const std::string RI_NONPERIODIC() { return "nonperiodic"; } inline const std::string RI_NP() { return "Np"; } inline const std::string RI_OBJECT() { return "object"; } inline const std::string RI_ORIGIN() { return "origin"; } inline const std::string RI_ORTHOGRAPHIC() { return "orthographic"; } inline const std::string RI_OS() { return "Os"; } inline const std::string RI_OUTSIDE() { return "outside"; } inline const std::string RI_P() { return "P"; } inline const std::string RI_PAINT() { return "paint"; } inline const std::string RI_PAINTEDPLASTIC() { return "paintedplastic"; } inline const std::string RI_PERIODIC() { return "periodic"; } inline const std::string RI_PERSPECTIVE() { return "perspective"; } inline const std::string RI_PLASTIC() { return "plastic"; } inline const std::string RI_POINTLIGHT() { return "pointlight"; } inline const std::string RI_PRIMITIVE() { return "primitive"; } inline const std::string RI_PRINT() { return "print"; } inline const std::string RI_PW() { return "Pw"; } inline const std::string RI_PZ() { return "Pz"; } inline const std::string RI_RASTER() { return "raster"; } inline const std::string RI_RGB() { return "rgb"; } inline const std::string RI_RGBA() { return "rgba"; } inline const std::string RI_RGBAZ() { return "rgbaz"; } inline const std::string RI_RGBZ() { return "rgbz"; } inline const std::string RI_RH() { return "rh"; } inline const std::string RI_ROUGHNESS() { return "roughness"; } inline const std::string RI_S() { return "s"; } inline const std::string RI_SCREEN() { return "screen"; } inline const std::string RI_SHINYMETAL() { return "shinymetal"; } inline const std::string RI_SINC() { return "sinc"; } inline const std::string RI_SMOOTH() { return "smooth"; } inline const std::string RI_SPECULARCOLOR() { return "specularcolor"; } inline const std::string RI_SPOTLIGHT() { return "spotlight"; } inline const std::string RI_ST() { return "st"; } inline const std::string RI_STRUCTURE() { return "structure"; } inline const std::string RI_T() { return "t"; } inline const std::string RI_TEXTURENAME() { return "texturename"; } inline const std::string RI_TO() { return "to"; } inline const std::string RI_TRIANGLE() { return "triangle"; } inline const std::string RI_UNION() { return "union"; } inline const std::string RI_WIDTH() { return "width"; } inline const std::string RI_WORLD() { return "world"; } inline const std::string RI_Z() { return "z"; } } // namespace ri } // namespace k3d #endif // !K3DSDK_ISTREAM_RI_H ================================================ FILE: k3dsdk/istreaming_bitmap_source.h ================================================ #ifndef K3DSDK_ISTREAMING_BITMAP_SOURCE_H #define K3DSDK_ISTREAMING_BITMAP_SOURCE_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #if BOOST_VERSION < 106900 #include #else #include #endif namespace k3d { class inode; /// Abstract interface for an object that collects and distributes profiling data for the K-3D visualization pipeline class istreaming_bitmap_source : public virtual iunknown { public: /// Defines a standard pixel as floating-point RGBA typedef boost::gil::pixel pixel; /// Defines a standard bitmap as half-precision floating-point RGBA typedef boost::gil::image bitmap; /// Defines a standard bitmap as half-precision floating-point RGBA typedef bitmap::const_view_t bucket; /// Define storage for a pixel coordinate typedef bitmap::coord_t coordinate; /// Connects a slot that will be called when streaming begins virtual sigc::connection connect_bitmap_start_signal(const sigc::slot& Slot) = 0; /// Connects a slot that will be called when streaming begins virtual sigc::connection connect_bitmap_bucket_signal(const sigc::slot& Slot) = 0; /// Connects a slot that will be called when streaming finishes virtual sigc::connection connect_bitmap_finish_signal(const sigc::slot& Slot) = 0; protected: istreaming_bitmap_source() {} istreaming_bitmap_source(const istreaming_bitmap_source& Other) : iunknown(Other) {} istreaming_bitmap_source& operator=(const istreaming_bitmap_source&) { return *this; } virtual ~istreaming_bitmap_source() {} }; } // namespace k3d #endif // !K3DSDK_ISTREAMING_BITMAP_SOURCE_H ================================================ FILE: k3dsdk/istring_source.h ================================================ #ifndef K3DSDK_ISTRING_SOURCE_H #define K3DSDK_ISTRING_SOURCE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares istring_source, an interface for objects that can act as a source of string values \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for objects that can act as a source of string values class istring_source : public virtual iunknown { public: virtual iproperty& string_source_output() = 0; protected: istring_source() {} istring_source(const istring_source&) {} istring_source& operator=(const istring_source&) { return *this; } virtual ~istring_source() {} }; } // namespace k3d #endif // !K3DSDK_ISTRING_SOURCE_H ================================================ FILE: k3dsdk/isurface_shader_ri.h ================================================ #ifndef K3DSDK_ISURFACE_SHADER_RI_H #define K3DSDK_ISURFACE_SHADER_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares interfaces for rendering within the Pixar RenderMan specification \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ri { class render_state; /// Abstract interface implemented by objects that encapsulate a RenderMan surface shader class isurface_shader : public virtual iunknown { public: virtual void setup_renderman_surface_shader(const render_state& State) = 0; protected: isurface_shader() {} isurface_shader(const isurface_shader&) {} isurface_shader& operator=(const isurface_shader&) { return *this; } virtual ~isurface_shader() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_ISURFACE_SHADER_RI_H ================================================ FILE: k3dsdk/itexture.h ================================================ #ifndef K3DSDK_ITEXTURE_H #define K3DSDK_ITEXTURE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface implemented by objects that can act as geometric surface materials class itexture : public virtual iunknown { protected: itexture() {} itexture(const itexture& Other) : iunknown(Other) {} itexture& operator=(const itexture&) { return *this; } virtual ~itexture() {} }; /// Specialization of difference::test that tests itexture pointers for equality namespace difference { inline void test(itexture* const A, itexture* const B, accumulator& Result) { Result.exact(A == B); } } // namespace difference } // namespace k3d #endif // !K3DSDK_ITEXTURE_H ================================================ FILE: k3dsdk/itexture_ri.h ================================================ #ifndef K3DSDK_ITEXTURE_RI_H #define K3DSDK_ITEXTURE_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class inetwork_render_frame; namespace filesystem { class path; } namespace ri { class istream; class ishader_collection; class render_state; /// Abstract interface implemented by objects that can act as texture sources while drawing RenderMan graphics class itexture : public virtual iunknown { public: virtual void setup_renderman_texture(inetwork_render_frame& Frame, istream& Stream, ishader_collection& Shaders) = 0; virtual const filesystem::path renderman_texture_path(const render_state& State) = 0; protected: itexture() {} itexture(const itexture& ) {} itexture& operator=(const itexture& ) { return *this; } virtual ~itexture() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_ITEXTURE_RI_H ================================================ FILE: k3dsdk/itime_sink.h ================================================ #ifndef K3DSDK_ITIME_SINK_H #define K3DSDK_ITIME_SINK_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares itime_sink, an interface for objects that can consume time data \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations class iproperty; /// Abstract interface for objects that can consume time data class itime_sink : public virtual iunknown { public: virtual iproperty& time_sink_input() = 0; protected: itime_sink() {} itime_sink(const itime_sink&) {} itime_sink& operator=(const itime_sink&) { return *this; } virtual ~itime_sink() {} }; } // namespace k3d #endif // !K3DSDK_ITIME_SINK_H ================================================ FILE: k3dsdk/itransform_array_1d.h ================================================ #ifndef K3DSDK_ITRANSFORM_ARRAY_1D_H #define K3DSDK_ITRANSFORM_ARRAY_1D_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface for a node that defines a 1-dimensional array of transformation matrices class itransform_array_1d : public virtual iunknown { public: virtual const matrix4 get_element(unsigned long Index1, unsigned long Count1) = 0; protected: itransform_array_1d() {} itransform_array_1d(const itransform_array_1d&) {} itransform_array_1d& operator = (const itransform_array_1d&) { return *this; } virtual ~itransform_array_1d() {} }; } // namespace k3d #endif // !K3DSDK_ITRANSFORM_ARRAY_1D_H ================================================ FILE: k3dsdk/itransform_array_2d.h ================================================ #ifndef K3DSDK_ITRANSFORM_ARRAY_2D_H #define K3DSDK_ITRANSFORM_ARRAY_2D_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface for a node that defines a 2-dimensional array of transformation matrices class itransform_array_2d : public virtual iunknown { public: virtual const matrix4 get_element(unsigned long Index1, unsigned long Count1, unsigned long Index2, unsigned long Count2) = 0; protected: itransform_array_2d() {} itransform_array_2d(const itransform_array_2d&) {} itransform_array_2d& operator = (const itransform_array_2d&) { return *this; } virtual ~itransform_array_2d() {} }; } // namespace k3d #endif // !K3DSDK_ITRANSFORM_ARRAY_2D_H ================================================ FILE: k3dsdk/itransform_array_3d.h ================================================ #ifndef K3DSDK_ITRANSFORM_ARRAY_3D_H #define K3DSDK_ITRANSFORM_ARRAY_3D_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface for a node that defines a 3-dimensional array of transformation matrices class itransform_array_3d : public virtual iunknown { public: virtual const matrix4 get_element(unsigned long Index1, unsigned long Count1, unsigned long Index2, unsigned long Count2, unsigned long Index3, unsigned long Count3) = 0; protected: itransform_array_3d() {} itransform_array_3d(const itransform_array_3d&) {} itransform_array_3d& operator = (const itransform_array_3d&) { return *this; } virtual ~itransform_array_3d() {} }; } // namespace k3d #endif // !K3DSDK_ITRANSFORM_ARRAY_3D_H ================================================ FILE: k3dsdk/iunknown.h ================================================ #ifndef K3DSDK_IUNKNOWN_H #define K3DSDK_IUNKNOWN_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares k3d::iunknown, the base for all other K-3D interface classes \author Tim Shead (tshead@k-3d.com) */ namespace k3d { /// Interface from which all other K-3D interfaces derive class iunknown { public: virtual ~iunknown() {} }; } // namespace k3d #endif // !K3DSDK_IUNKNOWN_H ================================================ FILE: k3dsdk/iuri_handler.h ================================================ #ifndef K3DSDK_IURI_HANDLER_H #define K3DSDK_IURI_HANDLER_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface for manipulating documents referenced by URI class iuri_handler : public virtual iunknown { public: virtual ~iuri_handler() {} /// Called to display a document in an application (presumably controlled by MIME-TYPE) virtual bool open_uri(const string_t& URI) = 0; protected: iuri_handler() {} iuri_handler(const iuri_handler&) {} iuri_handler& operator=(const iuri_handler&) { return *this; } }; } // namespace k3d #endif // !K3DSDK_IURI_HANDLER_H ================================================ FILE: k3dsdk/iuser_interface.h ================================================ #ifndef K3DSDK_IUSER_INTERFACE_H #define K3DSDK_IUSER_INTERFACE_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { namespace filesystem { class path; } /// Abstract interface to common graphical-user-interface operations for use by objects class iuser_interface : public virtual iunknown { public: /// Displays a URI in the user's preferred application. virtual void open_uri(const string_t& URI) = 0; /// Displays an informational message. virtual void message(const string_t& Message) = 0; /// Displays a warning message. virtual void warning_message(const string_t& Message) = 0; /// Displays an error message. virtual void error_message(const string_t& Message) = 0; /** \brief Prompts the user to choose one of several options \param Message text to be displayed \param DefaultOption one-based index of the option that is selected by default. If DefaultOption is 0, no option is selected by default. \return one-based index of the option selected by the user, or "0" if a choice was not made (e.g. user clicked WM "close" button) */ virtual uint_t query_message(const string_t& Message, const uint_t DefaultOption, const std::vector& Options) = 0; /// Displays an informational "nag" message that users can choose to suppress. virtual void nag_message(const string_t& Type, const ustring& Message, const ustring& SecondaryMessage = ustring()) = 0; /** \brief Prompts the user for a filepath, checking for old choices, and storing the current choice for reuse \param Prompt message to display in the file selection dialog \param OldPath initial file path to display in the file selection dialog \param Result returns the chosen file path \return true iff the user confirms the file path choice, false if they wish to cancel the pending operation */ virtual bool_t get_file_path(const ipath_property::mode_t Mode, const string_t& Type, const string_t& Prompt, const filesystem::path& OldPath, filesystem::path& Result) = 0; /// Displays the given object using a graphical user interface virtual bool_t show(iunknown& Object) = 0; /// Runs the user interface loop (if any) until it is synchronized with the current document state virtual void synchronize() = 0; /// Returns a connection to a signal that will be emitted at the requested frame rate (could return an empty connection, if the UI doesn't support timers) virtual sigc::connection get_timer(const double_t FrameRate, sigc::slot Slot) = 0; /// Call a slot whenever given filesystem path is modified. Note that we are watching the /// path, not an inode, so it isn't an error to specify a path for a nonexistent file. /// The slot will be called when a file is created / modified / renamed / deleted at that /// location. Returns a nonzero watch identifier that is used to cancel the watch later-on, /// or 0 if there is an error or the implementation does not support path-watching. virtual uint_t watch_path(const filesystem::path& Path, const sigc::slot& Slot) = 0; /// Stop watching the given path. virtual void unwatch_path(const uint_t WatchID) = 0; protected: iuser_interface() {} iuser_interface(const iuser_interface&) {} iuser_interface& operator = (const iuser_interface&) { return *this; } virtual ~iuser_interface() {} }; } // namespace k3d #endif // !K3DSDK_IUSER_INTERFACE_H ================================================ FILE: k3dsdk/iuser_property.h ================================================ #ifndef K3DSDK_IUSER_PROPERTY_H #define K3DSDK_IUSER_PROPERTY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// Abstract interface for properties that are custom (user) properties class iuser_property : public virtual iunknown { public: protected: iuser_property() {} iuser_property(const iuser_property& Other) : iunknown(Other) {} iuser_property& operator=(const iuser_property&) { return *this; } virtual ~iuser_property() {} }; } // namespace k3d #endif // !K3DSDK_IUSER_PROPERTY_H ================================================ FILE: k3dsdk/ivector3_source.h ================================================ #ifndef K3DSDK_IVECTOR3_SOURCE_H #define K3DSDK_IVECTOR3_SOURCE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares ivector3_source, an interface for objects that can act as a source of vector3 values \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class iproperty; /// Abstract interface for objects that can act as a source of vector3 values class ivector3_source : public virtual iunknown { public: virtual iproperty& vector3_source_output() = 0; protected: ivector3_source() {} ivector3_source(const ivector3_source&) {} ivector3_source& operator=(const ivector3_source&) { return *this; } virtual ~ivector3_source() {} }; } // namespace k3d #endif // !K3DSDK_IVECTOR3_SOURCE_H ================================================ FILE: k3dsdk/ivolume_shader_ri.h ================================================ #ifndef K3DSDK_IVOLUME_SHADER_RI_H #define K3DSDK_IVOLUME_SHADER_RI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ri { class render_state; /// Abstract interface implemented by objects that encapsulate a RenderMan volume shader class ivolume_shader : public virtual iunknown { public: virtual void setup_renderman_atmosphere_shader(const render_state& State) = 0; virtual void setup_renderman_interior_shader(const render_state& State) = 0; virtual void setup_renderman_exterior_shader(const render_state& State) = 0; protected: ivolume_shader() {} ivolume_shader(const ivolume_shader&) {} ivolume_shader& operator=(const ivolume_shader&) { return *this; } virtual ~ivolume_shader() {} }; } // namespace ri } // namespace k3d #endif // !K3DSDK_IVOLUME_SHADER_RI_H ================================================ FILE: k3dsdk/iwatched_path_property.h ================================================ #ifndef K3DSDK_IWATCHED_PATH_PROPERTY_H #define K3DSDK_IWATCHED_PATH_PROPERTY_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares iwatched_path_property, an abstract interface for discovering information about a property that stores filesystem paths \author Tim Shead (tshead@k-3d.com) \author Bart Janssens (bart.janssens@lid.kviv.be) */ #include #include #include #include namespace k3d { /// Abstract interface for properties that represent external filesystem resources (typically used to alter presentation) class iwatched_path_property : public virtual iunknown { public: /// Set if the associated path should be watched virtual void watch(const bool_t Watch) = 0; /// Returns true if the associated path is being watched, false otherwise virtual const bool_t is_watched() const = 0; protected: iwatched_path_property() {} iwatched_path_property(const iwatched_path_property&) {} iwatched_path_property& operator=(const iwatched_path_property&) { return *this; } virtual ~iwatched_path_property() {} }; } // namespace k3d #endif // !K3DSDK_IWATCHED_PATH_PROPERTY_H ================================================ FILE: k3dsdk/iwritable_property.h ================================================ #ifndef K3DSDK_IWRITABLE_PROPERTY_H #define K3DSDK_IWRITABLE_PROPERTY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares iwritable_property, an abstract interface for a name-value pair with fixed type that can be written \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Abstract interface for a property that can be written (see iproperty if you need to read the value of a property) class iwritable_property : public virtual iunknown { public: /// Sets the property value (note - could fail and return false if there's a type-mismatch or other problem with the input data). The optional Hint will be passed to observers and can provide additional information about what changed. virtual bool property_set_value(const boost::any Value, ihint* const Hint = 0) = 0; protected: iwritable_property() {} iwritable_property(const iwritable_property& Other) : iunknown(Other) {} iwritable_property& operator = (const iwritable_property&) { return *this; } virtual ~iwritable_property() {} }; } // namespace k3d #endif // !K3DSDK_IWRITABLE_PROPERTY_H ================================================ FILE: k3dsdk/k3d-i18n-config.h.in ================================================ #ifndef K3DSDK_I18N_CONFIG_H #define K3DSDK_I18N_CONFIG_H // Generated file, do not edit! Make changes to k3d-i18n-config.h.in instead. #cmakedefine K3D_ENABLE_NLS #ifdef K3D_ENABLE_NLS #include #define _(String) gettext(String) #else // K3D_ENABLE_NLS #define _(String) (String) #endif // !K3D_ENABLE_NLS #endif // K3DSDK_I18N_CONFIG_H ================================================ FILE: k3dsdk/k3d-ngui-config.h.in ================================================ #ifndef K3DSDK_NGUI_CONFIG_H #define K3DSDK_NGUI_CONFIG_H // Generated file, do not edit! Make changes to k3d-ngui-config.h.in instead. #cmakedefine K3D_BUILD_NGUI_MODULE #endif // !K3DSDK_NGUI_CONFIG_H ================================================ FILE: k3dsdk/k3d-parallel-config.h.in ================================================ #ifndef K3DSDK_PARALLEL_CONFIG_H #define K3DSDK_PARALLEL_CONFIG_H // Generated file, do not edit! Make changes to k3d-parallel-config.h.in instead. #cmakedefine K3D_ENABLE_PARALLEL #endif // !K3DSDK_PARALLEL_CONFIG_H ================================================ FILE: k3dsdk/k3d-platform-config.h.in ================================================ #ifndef K3DSDK_PLATFORM_CONFIG_H #define K3DSDK_PLATFORM_CONFIG_H // Generated file, do not edit! Make changes to k3d-platform-config.h.in instead. #cmakedefine K3D_COMPILER_GCC #cmakedefine K3D_COMPILER_MSVC #cmakedefine K3D_API_WIN32 #cmakedefine K3D_API_DARWIN #cmakedefine K3D_ENABLE_SYMBOL_VISIBILITY #cmakedefine K3D_UINT_T_32_BITS #cmakedefine K3D_UINT_T_64_BITS #define K3D_GLEW_MAJOR_VERSION @K3D_GLEW_MAJOR_VERSION@ #define K3D_OSX_MAJOR_VERSION @K3D_OSX_MAJOR_VERSION@ #define K3D_OSX_MINOR_VERSION @K3D_OSX_MINOR_VERSION@ #if defined K3D_COMPILER_GCC #define K3D_COMPILER_NAME __VERSION__ #elif defined K3D_COMPILER_MSVC #define K3D_COMPILER_NAME "Visual Studio " #_MSC_VER #else #error("Unknown compiler") #endif #endif // !K3DSDK_PLATFORM_CONFIG_H ================================================ FILE: k3dsdk/k3d-version-config.h.in ================================================ #ifndef K3DSDK_VERSION_CONFIG_H #define K3DSDK_VERSION_CONFIG_H // Generated file, do not edit! Make changes to k3d-version-config.h.in instead. #define K3D_PACKAGE "@K3D_PACKAGE@" #define K3D_COPYRIGHT "@K3D_COPYRIGHT@" #define K3D_VERSION "@K3D_VERSION@" #define K3D_HOST "@K3D_HOST@" #endif // !K3DSDK_VERSION_CONFIG_H ================================================ FILE: k3dsdk/keyboard.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include namespace k3d { ////////////////////////////////////////////////////////////////////////////////////////////// // key_modifiers key_modifiers& key_modifiers::set() { m_storage.set(); return *this; } key_modifiers& key_modifiers::set_shift(bool val) { m_storage.set(0, val); return *this; } key_modifiers& key_modifiers::set_lock(bool val) { m_storage.set(1, val); return *this; } key_modifiers& key_modifiers::set_control(bool val) { m_storage.set(2, val); return *this; } key_modifiers& key_modifiers::set_mod1(bool val) { m_storage.set(3, val); return *this; } key_modifiers& key_modifiers::set_mod2(bool val) { m_storage.set(4, val); return *this; } key_modifiers& key_modifiers::set_mod3(bool val) { m_storage.set(5, val); return *this; } key_modifiers& key_modifiers::set_mod4(bool val) { m_storage.set(6, val); return *this; } key_modifiers& key_modifiers::set_mod5(bool val) { m_storage.set(7, val); return *this; } key_modifiers& key_modifiers::set_button1(bool val) { m_storage.set(8, val); return *this; } key_modifiers& key_modifiers::set_button2(bool val) { m_storage.set(9, val); return *this; } key_modifiers& key_modifiers::set_button3(bool val) { m_storage.set(10, val); return *this; } key_modifiers& key_modifiers::set_button4(bool val) { m_storage.set(11, val); return *this; } key_modifiers& key_modifiers::set_button5(bool val) { m_storage.set(12, val); return *this; } key_modifiers& key_modifiers::set_release(bool val) { m_storage.set(13, val); return *this; } key_modifiers& key_modifiers::reset() { m_storage.reset(); return *this; } key_modifiers& key_modifiers::reset_shift() { m_storage.reset(0); return *this; } key_modifiers& key_modifiers::reset_lock() { m_storage.reset(1); return *this; } key_modifiers& key_modifiers::reset_control() { m_storage.reset(2); return *this; } key_modifiers& key_modifiers::reset_mod1() { m_storage.reset(3); return *this; } key_modifiers& key_modifiers::reset_mod2() { m_storage.reset(4); return *this; } key_modifiers& key_modifiers::reset_mod3() { m_storage.reset(5); return *this; } key_modifiers& key_modifiers::reset_mod4() { m_storage.reset(6); return *this; } key_modifiers& key_modifiers::reset_mod5() { m_storage.reset(7); return *this; } key_modifiers& key_modifiers::reset_button1() { m_storage.reset(8); return *this; } key_modifiers& key_modifiers::reset_button2() { m_storage.reset(9); return *this; } key_modifiers& key_modifiers::reset_button3() { m_storage.reset(10); return *this; } key_modifiers& key_modifiers::reset_button4() { m_storage.reset(11); return *this; } key_modifiers& key_modifiers::reset_button5() { m_storage.reset(12); return *this; } key_modifiers& key_modifiers::reset_release() { m_storage.reset(13); return *this; } key_modifiers& key_modifiers::flip() { m_storage.flip(); return *this; } key_modifiers& key_modifiers::flip_shift() { m_storage.set(0); return *this; } key_modifiers& key_modifiers::flip_lock() { m_storage.set(1); return *this; } key_modifiers& key_modifiers::flip_control() { m_storage.flip(2); return *this; } key_modifiers& key_modifiers::flip_mod1() { m_storage.flip(3); return *this; } key_modifiers& key_modifiers::flip_mod2() { m_storage.flip(4); return *this; } key_modifiers& key_modifiers::flip_mod3() { m_storage.flip(5); return *this; } key_modifiers& key_modifiers::flip_mod4() { m_storage.flip(6); return *this; } key_modifiers& key_modifiers::flip_mod5() { m_storage.flip(7); return *this; } key_modifiers& key_modifiers::flip_button1() { m_storage.flip(8); return *this; } key_modifiers& key_modifiers::flip_button2() { m_storage.flip(9); return *this; } key_modifiers& key_modifiers::flip_button3() { m_storage.flip(10); return *this; } key_modifiers& key_modifiers::flip_button4() { m_storage.flip(11); return *this; } key_modifiers& key_modifiers::flip_button5() { m_storage.flip(12); return *this; } key_modifiers& key_modifiers::flip_release() { m_storage.flip(13); return *this; } bool key_modifiers::any() const { return m_storage.any(); } bool key_modifiers::none() const { return m_storage.none(); } bool key_modifiers::shift() const { return m_storage[0]; } bool key_modifiers::lock() const { return m_storage[1]; } bool key_modifiers::control() const { return m_storage[2]; } bool key_modifiers::mod1() const { return m_storage[3]; } bool key_modifiers::mod2() const { return m_storage[4]; } bool key_modifiers::mod3() const { return m_storage[5]; } bool key_modifiers::mod4() const { return m_storage[6]; } bool key_modifiers::mod5() const { return m_storage[7]; } bool key_modifiers::button1() const { return m_storage[8]; } bool key_modifiers::button2() const { return m_storage[9]; } bool key_modifiers::button3() const { return m_storage[10]; } bool key_modifiers::button4() const { return m_storage[11]; } bool key_modifiers::button5() const { return m_storage[12]; } bool key_modifiers::release() const { return m_storage[13]; } bool key_modifiers::operator==(const key_modifiers& RHS) const { return m_storage == RHS.m_storage; } bool key_modifiers::operator!=(const key_modifiers& RHS) const { return m_storage != RHS.m_storage; } bool key_modifiers::operator<(const key_modifiers& RHS) const { return m_storage.to_ulong() < RHS.m_storage.to_ulong(); } key_modifiers& key_modifiers::operator&=(const key_modifiers& RHS) { m_storage &= RHS.m_storage; return *this; } key_modifiers& key_modifiers::operator|=(const key_modifiers& RHS) { m_storage |= RHS.m_storage; return *this; } const key_modifiers operator&(const key_modifiers& LHS, const key_modifiers& RHS) { key_modifiers temp(LHS); temp &= RHS; return temp; } const key_modifiers operator|(const key_modifiers& LHS, const key_modifiers& RHS) { key_modifiers temp(LHS); temp |= RHS; return temp; } namespace { void save_state(std::ostream& Stream, const std::string& Serialized, const bool State, bool& AnySoFar) { if(!State) return; if(AnySoFar) Stream << "+"; Stream << Serialized; AnySoFar = true; } } // namespace std::ostream& operator<<(std::ostream& Stream, const k3d::key_modifiers& RHS) { bool any_so_far = false; save_state(Stream, "shift", RHS.shift(), any_so_far); save_state(Stream, "lock", RHS.lock(), any_so_far); save_state(Stream, "control", RHS.control(), any_so_far); save_state(Stream, "mod1", RHS.mod1(), any_so_far); save_state(Stream, "mod2", RHS.mod2(), any_so_far); save_state(Stream, "mod3", RHS.mod3(), any_so_far); save_state(Stream, "mod4", RHS.mod4(), any_so_far); save_state(Stream, "mod5", RHS.mod5(), any_so_far); save_state(Stream, "button1", RHS.button1(), any_so_far); save_state(Stream, "button2", RHS.button2(), any_so_far); save_state(Stream, "button3", RHS.button3(), any_so_far); save_state(Stream, "button4", RHS.button4(), any_so_far); save_state(Stream, "button5", RHS.button5(), any_so_far); save_state(Stream, "release", RHS.release(), any_so_far); if(!any_so_far) Stream << "none"; return Stream; } std::istream& operator>>(std::istream& Stream, k3d::key_modifiers& RHS) { RHS.reset(); std::string buffer; Stream >> buffer; RHS.set_shift(buffer.find("shift") != std::string::npos); RHS.set_lock(buffer.find("lock") != std::string::npos); RHS.set_control(buffer.find("control") != std::string::npos); RHS.set_mod1(buffer.find("mod1") != std::string::npos); RHS.set_mod2(buffer.find("mod2") != std::string::npos); RHS.set_mod3(buffer.find("mod3") != std::string::npos); RHS.set_mod4(buffer.find("mod4") != std::string::npos); RHS.set_mod5(buffer.find("mod5") != std::string::npos); RHS.set_button1(buffer.find("button1") != std::string::npos); RHS.set_button2(buffer.find("button2") != std::string::npos); RHS.set_button3(buffer.find("button3") != std::string::npos); RHS.set_button4(buffer.find("button4") != std::string::npos); RHS.set_button5(buffer.find("button5") != std::string::npos); RHS.set_release(buffer.find("release") != std::string::npos); return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/keyboard.h ================================================ #ifndef K3DSDK_KEYBOARD_H #define K3DSDK_KEYBOARD_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { class key_modifiers { public: key_modifiers& set(); key_modifiers& set_shift(bool val = true); key_modifiers& set_lock(bool val = true); key_modifiers& set_control(bool val = true); key_modifiers& set_mod1(bool val = true); key_modifiers& set_mod2(bool val = true); key_modifiers& set_mod3(bool val = true); key_modifiers& set_mod4(bool val = true); key_modifiers& set_mod5(bool val = true); key_modifiers& set_button1(bool val = true); key_modifiers& set_button2(bool val = true); key_modifiers& set_button3(bool val = true); key_modifiers& set_button4(bool val = true); key_modifiers& set_button5(bool val = true); key_modifiers& set_release(bool val = true); key_modifiers& reset(); key_modifiers& reset_shift(); key_modifiers& reset_lock(); key_modifiers& reset_control(); key_modifiers& reset_mod1(); key_modifiers& reset_mod2(); key_modifiers& reset_mod3(); key_modifiers& reset_mod4(); key_modifiers& reset_mod5(); key_modifiers& reset_button1(); key_modifiers& reset_button2(); key_modifiers& reset_button3(); key_modifiers& reset_button4(); key_modifiers& reset_button5(); key_modifiers& reset_release(); key_modifiers& flip(); key_modifiers& flip_shift(); key_modifiers& flip_lock(); key_modifiers& flip_control(); key_modifiers& flip_mod1(); key_modifiers& flip_mod2(); key_modifiers& flip_mod3(); key_modifiers& flip_mod4(); key_modifiers& flip_mod5(); key_modifiers& flip_button1(); key_modifiers& flip_button2(); key_modifiers& flip_button3(); key_modifiers& flip_button4(); key_modifiers& flip_button5(); key_modifiers& flip_release(); bool any() const; bool none() const; bool shift() const; bool lock() const; bool control() const; bool mod1() const; bool mod2() const; bool mod3() const; bool mod4() const; bool mod5() const; bool button1() const; bool button2() const; bool button3() const; bool button4() const; bool button5() const; bool release() const; bool operator==(const key_modifiers& RHS) const; bool operator!=(const key_modifiers& RHS) const; bool operator<(const key_modifiers& RHS) const; key_modifiers& operator&=(const key_modifiers& RHS); key_modifiers& operator|=(const key_modifiers& RHS); friend const key_modifiers operator&(const key_modifiers& LHS, const key_modifiers& RHS); friend const key_modifiers operator|(const key_modifiers& LHS, const key_modifiers& RHS); friend std::ostream& operator<<(std::ostream& Stream, const k3d::key_modifiers& RHS); friend std::istream& operator>>(std::istream& Stream, k3d::key_modifiers& RHS); private: std::bitset<14> m_storage; }; } // namespace k3d #endif // !K3DSDK_KEYBOARD_H ================================================ FILE: k3dsdk/line2.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // line2 line2::line2(const vector2& Direction, const point2& Point) : direction(Direction), point(Point) { } line2::line2(const point2& Point1, const point2& Point2) : direction(Point2 - Point1), point(Point1) { } } // namespace k3d ================================================ FILE: k3dsdk/line2.h ================================================ #ifndef K3DSDK_LINE2_H #define K3DSDK_LINE2_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // line2 /// Encapsulates a 2D line class line2 { public: /// Constructs a line from its direction vector and a point on the line line2(const vector2& Direction, const point2& Point); /// Constructs a line from two points on the line line2(const point2& Point1, const point2& Point2); /// Stores the line's direction vector vector2 direction; /// Stores a point on the line point2 point; }; } // namespace k3d #endif // !K3DSDK_LINE2_H ================================================ FILE: k3dsdk/line3.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // line3 line3::line3(const vector3& Direction, const point3& Point) : direction(Direction), point(Point) { } line3::line3(const point3& Point1, const point3& Point2) : direction(Point2 - Point1), point(Point1) { } } // namespace k3d ================================================ FILE: k3dsdk/line3.h ================================================ #ifndef K3DSDK_LINE3_H #define K3DSDK_LINE3_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // line3 /// Encapsulates a 3D line class line3 { public: /// Constructs a line from its direction vector and a point on the line line3(const vector3& Direction, const point3& Point); /// Constructs a line from two points on the line line3(const point3& Point1, const point3& Point2); /// Stores the line's direction vector vector3 direction; /// Stores a point on the line point3 point; }; } // namespace k3d #endif // !K3DSDK_LINE3_H ================================================ FILE: k3dsdk/linear_curve.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include namespace k3d { namespace linear_curve { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::bools_t& Periodic, const mesh::materials_t& Material, const mesh::indices_t& CurveFirstPoints, const mesh::counts_t& CurvePointCounts, const mesh::selection_t& CurveSelections, const mesh::indices_t& CurvePoints, const mesh::table_t& ConstantAttributes, const mesh::table_t& CurveAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ) : periodic(Periodic), material(Material), curve_first_points(CurveFirstPoints), curve_point_counts(CurvePointCounts), curve_selections(CurveSelections), curve_points(CurvePoints), constant_attributes(ConstantAttributes), curve_attributes(CurveAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::bools_t& Periodic, mesh::materials_t& Material, mesh::indices_t& CurveFirstPoints, mesh::counts_t& CurvePointCounts, mesh::selection_t& CurveSelections, mesh::indices_t& CurvePoints, mesh::table_t& ConstantAttributes, mesh::table_t& CurveAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ) : periodic(Periodic), material(Material), curve_first_points(CurveFirstPoints), curve_point_counts(CurvePointCounts), curve_selections(CurveSelections), curve_points(CurvePoints), constant_attributes(ConstantAttributes), curve_attributes(CurveAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("linear_curve"); primitive* const result = new primitive( generic_primitive.structure["constant"].create("periodic"), generic_primitive.structure["constant"].create("material"), generic_primitive.structure["curve"].create("curve_first_points"), generic_primitive.structure["curve"].create("curve_point_counts"), generic_primitive.structure["curve"].create("curve_selections"), generic_primitive.structure["vertex"].create("curve_points"), generic_primitive.attributes["constant"], generic_primitive.attributes["curve"], generic_primitive.attributes["parameter"], generic_primitive.attributes["vertex"] ); result->curve_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->curve_points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "linear_curve") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& constant_structure = require_structure(Primitive, "constant"); const mesh::table_t& curve_structure = require_structure(Primitive, "curve"); const mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& curve_attributes = require_attributes(Primitive, "curve"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); const mesh::bools_t& periodic = require_array(Primitive, constant_structure, "periodic"); const mesh::materials_t& material = require_array(Primitive, constant_structure, "material"); const mesh::indices_t& curve_first_points = require_array(Primitive, curve_structure, "curve_first_points"); const mesh::counts_t& curve_point_counts = require_array(Primitive, curve_structure, "curve_point_counts"); const mesh::selection_t& curve_selections = require_array(Primitive, curve_structure, "curve_selections"); const mesh::indices_t& curve_points = require_array(Primitive, vertex_structure, "curve_points"); require_metadata(Primitive, curve_selections, "curve_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, curve_points, "curve_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", std::accumulate(curve_point_counts.begin(), curve_point_counts.end(), 0)); require_table_row_count(Primitive, parameter_attributes, "parameter", curve_structure.row_count() * 2); return new const_primitive(periodic, material, curve_first_points, curve_point_counts, curve_selections, curve_points, constant_attributes, curve_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "linear_curve") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& constant_structure = require_structure(Primitive, "constant"); mesh::table_t& curve_structure = require_structure(Primitive, "curve"); mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& curve_attributes = require_attributes(Primitive, "curve"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); mesh::bools_t& periodic = require_array(Primitive, constant_structure, "periodic"); mesh::materials_t& material = require_array(Primitive, constant_structure, "material"); mesh::indices_t& curve_first_points = require_array(Primitive, curve_structure, "curve_first_points"); mesh::counts_t& curve_point_counts = require_array(Primitive, curve_structure, "curve_point_counts"); mesh::selection_t& curve_selections = require_array(Primitive, curve_structure, "curve_selections"); mesh::indices_t& curve_points = require_array(Primitive, vertex_structure, "curve_points"); require_metadata(Primitive, curve_selections, "curve_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, curve_points, "curve_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", std::accumulate(curve_point_counts.begin(), curve_point_counts.end(), 0)); require_table_row_count(Primitive, parameter_attributes, "parameter", curve_structure.row_count() * 2); return new primitive(periodic, material, curve_first_points, curve_point_counts, curve_selections, curve_points, constant_attributes, curve_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "linear_curve") return 0; return validate(Mesh, Primitive.writable()); } } // namespace linear_curve } // namespace k3d ================================================ FILE: k3dsdk/linear_curve.h ================================================ #ifndef K3DSDK_LINEAR_CURVE_H #define K3DSDK_LINEAR_CURVE_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace linear_curve { /// Gathers the member arrays of a linear_curve primitive into a convenient package class const_primitive { public: const_primitive( const mesh::bools_t& Periodic, const mesh::materials_t& Material, const mesh::indices_t& CurveFirstPoints, const mesh::counts_t& CurvePointCounts, const mesh::selection_t& CurveSelections, const mesh::indices_t& CurvePoints, const mesh::table_t& ConstantAttributes, const mesh::table_t& CurveAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ); const mesh::bools_t& periodic; const mesh::materials_t& material; const mesh::indices_t& curve_first_points; const mesh::counts_t& curve_point_counts; const mesh::selection_t& curve_selections; const mesh::indices_t& curve_points; const mesh::table_t& constant_attributes; const mesh::table_t& curve_attributes; const mesh::table_t& parameter_attributes; const mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a linear_curve primitive into a convenient package class primitive { public: primitive( mesh::bools_t& Periodic, mesh::materials_t& Material, mesh::indices_t& CurveFirstPoints, mesh::counts_t& CurvePointCounts, mesh::selection_t& CurveSelections, mesh::indices_t& CurvePoints, mesh::table_t& ConstantAttributes, mesh::table_t& CurveAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ); mesh::bools_t& periodic; mesh::materials_t& material; mesh::indices_t& curve_first_points; mesh::counts_t& curve_point_counts; mesh::selection_t& curve_selections; mesh::indices_t& curve_points; mesh::table_t& constant_attributes; mesh::table_t& curve_attributes; mesh::table_t& parameter_attributes; mesh::table_t& vertex_attributes; }; /// Creates a new linear_curve mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid linear_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid linear_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid linear_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace linear_curve } // namespace k3d #endif // !K3DSDK_LINEAR_CURVE_H ================================================ FILE: k3dsdk/log.cpp ================================================ // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include #include #ifdef K3D_API_WIN32 #include #include #elif defined K3D_API_DARWIN #include #else #include #include #endif namespace k3d { namespace detail { /////////////////////////////////////////////////////////// // log_level_index int log_level_index() { static int index = std::ios::xalloc(); return index; } /////////////////////////////////////////////////////////// // log_level long& log_level(std::ostream& Stream) { return Stream.iword(log_level_index()); } bool g_log_show_timestamp = false; std::string g_log_tag; bool g_log_color_level = false; bool g_log_show_level = false; bool g_log_syslog = false; int g_log_minimum_level = K3D_LOG_LEVEL_WARNING; std::vector g_log_timestamp_cache; std::vector g_log_level_cache; std::vector g_log_message_cache; /////////////////////////////////////////////////////////// // log_cerr void log_cerr(const time_t Timestamp, const log_level_t Level, const std::string& Message) { if(Level > g_log_minimum_level) return; if(g_log_show_timestamp) { std::string buffer(256, '\0'); buffer.resize(strftime(&buffer[0], buffer.size(), "%m/%d/%Y %H:%M:%S ", localtime(&Timestamp))); std::cerr << buffer; } if(!g_log_tag.empty()) { std::cerr << g_log_tag; } if(g_log_color_level) { switch(Level) { case K3D_LOG_LEVEL_CRITICAL: std::cerr << "\e[1;31m"; break; case K3D_LOG_LEVEL_ERROR: std::cerr << "\e[1;31m"; break; case K3D_LOG_LEVEL_WARNING: std::cerr << "\e[1;33m"; break; case K3D_LOG_LEVEL_INFO: std::cerr << "\e[0m"; break; case K3D_LOG_LEVEL_DEBUG: std::cerr << "\e[1;32m"; break; } } if(g_log_show_level) { switch(Level) { case K3D_LOG_LEVEL_CRITICAL: std::cerr << "CRITICAL: "; break; case K3D_LOG_LEVEL_ERROR: std::cerr << "ERROR: "; break; case K3D_LOG_LEVEL_WARNING: std::cerr << "WARNING: "; break; case K3D_LOG_LEVEL_INFO: std::cerr << "INFO: "; break; case K3D_LOG_LEVEL_DEBUG: std::cerr << "DEBUG: "; break; } } std::cerr << Message; if(g_log_color_level) { std::cerr << "\e[0m"; } std::cerr << std::flush; } /////////////////////////////////////////////////////////// // log_file void log_file(const time_t Timestamp, const log_level_t Level, const std::string& Message) { static std::ofstream logfile((system::get_home_directory() / k3d::filesystem::generic_path(".k3d") / k3d::filesystem::generic_path("k3d.log")).native_filesystem_string().c_str()); if(Level > g_log_minimum_level) return; if(g_log_show_timestamp) { std::string buffer(256, '\0'); buffer.resize(strftime(&buffer[0], buffer.size(), "%m/%d/%Y %H:%M:%S ", localtime(&Timestamp))); logfile << buffer; } if(!g_log_tag.empty()) { logfile << g_log_tag; } if(g_log_show_level) { switch(Level) { case K3D_LOG_LEVEL_CRITICAL: logfile << "CRITICAL: "; break; case K3D_LOG_LEVEL_ERROR: logfile << "ERROR: "; break; case K3D_LOG_LEVEL_WARNING: logfile << "WARNING: "; break; case K3D_LOG_LEVEL_INFO: logfile << "INFO: "; break; case K3D_LOG_LEVEL_DEBUG: logfile << "DEBUG: "; break; } } logfile << Message; logfile << std::flush; } /////////////////////////////////////////////////////////// // log_cache void log_cache(const time_t Timestamp, const log_level_t Level, const std::string& Message) { g_log_timestamp_cache.push_back(Timestamp); g_log_level_cache.push_back(Level); g_log_message_cache.push_back(Message); } /////////////////////////////////////////////////////////// // log_syslog #ifndef K3D_API_WIN32 void log_syslog(const time_t, const log_level_t Level, const std::string& Message) { if(!g_log_syslog) return; int priority = LOG_INFO; switch(Level) { case K3D_LOG_LEVEL_CRITICAL: priority = LOG_CRIT; break; case K3D_LOG_LEVEL_ERROR: priority = LOG_ERR; break; case K3D_LOG_LEVEL_WARNING: priority = LOG_WARNING; break; case K3D_LOG_LEVEL_INFO: priority = LOG_INFO; break; case K3D_LOG_LEVEL_DEBUG: priority = LOG_DEBUG; break; } syslog(LOG_USER | priority, "%s", Message.c_str()); } #endif // !K3D_API_WIN32 /////////////////////////////////////////////////////////// // log_output_debug_string #ifdef K3D_API_WIN32 void log_output_debug_string(const time_t Timestamp, const log_level_t Level, const std::string& Message) { OutputDebugString((Message).c_str()); } #endif // !K3D_API_WIN32 /////////////////////////////////////////////////////////// // signal_buf /// When attached to an output stream, emits a signal containing each line of output class signal_buf : public std::streambuf { public: signal_buf() : m_stream(0) { connect(sigc::ptr_fun(log_cerr)); connect(sigc::ptr_fun(log_cache)); connect(sigc::ptr_fun(log_file)); #ifdef K3D_API_WIN32 connect(sigc::ptr_fun(log_output_debug_string)); #else // K3D_API_WIN32 connect(sigc::ptr_fun(log_syslog)); #endif // !K3D_API_WIN32 } void init(std::ostream& Stream) { m_stream = &Stream; } sigc::connection connect(const sigc::slot& Slot) { return m_signal.connect(Slot); } protected: int overflow(int c) { if(traits_type::eq_int_type(c, traits_type::eof())) return traits_type::eof(); m_buffer.push_back(c); if(c == '\n') { const time_t current_time = time(0); const log_level_t current_log_level = static_cast(log_level(*m_stream)); m_signal.emit(current_time, current_log_level, m_buffer); m_buffer.clear(); log_level(*m_stream) = 0; } return traits_type::not_eof(c); } private: std::ostream* m_stream; std::string m_buffer; sigc::signal m_signal; }; /////////////////////////////////////////////////////////// // log_stream_init class log_stream_init { public: signal_buf* buf() { return &m_signal_buffer; } private: signal_buf m_signal_buffer; }; /////////////////////////////////////////////////////////// // log_stream class log_stream : private virtual log_stream_init, public std::ostream { public: static log_stream& instance() { static log_stream m_instance; return m_instance; } sigc::connection connect(const sigc::slot& Slot) { return log_stream_init::buf()->connect(Slot); } private: log_stream() : log_stream_init(), std::ostream(log_stream_init::buf()) { log_stream_init::buf()->init(*this); } }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // log std::ostream& log() { return detail::log_stream::instance(); } ///////////////////////////////////////////////////////////////////////////// // critical std::ostream& critical(std::ostream& Stream) { detail::log_level(Stream) = K3D_LOG_LEVEL_CRITICAL; return Stream; } ///////////////////////////////////////////////////////////////////////////// // error std::ostream& error(std::ostream& Stream) { detail::log_level(Stream) = K3D_LOG_LEVEL_ERROR; return Stream; } ///////////////////////////////////////////////////////////////////////////// // warning std::ostream& warning(std::ostream& Stream) { detail::log_level(Stream) = K3D_LOG_LEVEL_WARNING; return Stream; } ///////////////////////////////////////////////////////////////////////////// // info std::ostream& info(std::ostream& Stream) { detail::log_level(Stream) = K3D_LOG_LEVEL_INFO; return Stream; } ///////////////////////////////////////////////////////////////////////////// // debug std::ostream& debug(std::ostream& Stream) { detail::log_level(Stream) = K3D_LOG_LEVEL_DEBUG; return Stream; } ///////////////////////////////////////////////////////////////////////////// // print_debug void print_debug(const std::string& Message) { log() << debug << Message << std::endl; } void log_show_timestamps(bool Enable) { detail::g_log_show_timestamp = Enable; } void log_set_tag(const std::string& Tag) { detail::g_log_tag = Tag + " "; } void log_color_level(bool Enable) { detail::g_log_color_level = Enable; } void log_show_level(bool Enable) { detail::g_log_show_level = Enable; } void log_syslog(bool Enable) { detail::g_log_syslog = Enable; } void log_minimum_level(const log_level_t Level) { detail::g_log_minimum_level = Level; } ///////////////////////////////////////////////////////////////////////////// // connect_log_message sigc::connection connect_log_message(const sigc::slot& Slot) { return detail::log_stream::instance().connect(Slot); } ///////////////////////////////////////////////////////////////////////////// // get_log_cache void get_log_cache(const sigc::slot& Slot) { for(size_t i = 0; i != detail::g_log_timestamp_cache.size(); ++i) Slot(detail::g_log_timestamp_cache[i], detail::g_log_level_cache[i], detail::g_log_message_cache[i]); } } // namespace k3d ================================================ FILE: k3dsdk/log.h ================================================ #ifndef K3DSDK_LOG_H #define K3DSDK_LOG_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include namespace k3d { /// Returns an output stream to be used for logging std::ostream& log(); /// iostream manipulator that indicates a critical error has occurred, from which the application cannot recover std::ostream& critical(std::ostream&); /// iostream manipulator that indicates definite invalid input or unexpected behavior - the current operation will not succeed std::ostream& error(std::ostream&); /// iostream manipulator that indicates possible invalid input or incorrect behavior - the current operation may not succeed std::ostream& warning(std::ostream&); /// iostream manipulator that indicates an optional, informational message std::ostream& info(std::ostream&); /// iostream manipulator that indicates messages used for internal debugging by developers std::ostream& debug(std::ostream&); /// Convenience function that prints a debug message to the log stream ... intended mainly for use with signals void print_debug(const std::string& Message); } // namespace k3d using k3d::critical; using k3d::error; using k3d::warning; using k3d::info; using k3d::debug; #define k3d_file_reference __FILE__ << " line " << __LINE__ #endif // !K3DSDK_LOG_H ================================================ FILE: k3dsdk/log_control.h ================================================ #ifndef K3DSDK_LOG_CONTROL_H #define K3DSDK_LOG_CONTROL_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include namespace k3d { /// Enumerates available log levels typedef enum { K3D_LOG_LEVEL_CRITICAL = 1, K3D_LOG_LEVEL_ERROR = 2, K3D_LOG_LEVEL_WARNING = 3, K3D_LOG_LEVEL_INFO = 4, K3D_LOG_LEVEL_DEBUG = 5 } log_level_t; /// Enables logging of timestamps (default: off) void log_show_timestamps(bool_t Enable); /// Sets a "tag" that will be prepended to log messages (default: empty) void log_set_tag(const string_t& Tag); /// Enables color output based on log level (default: off) void log_color_level(bool_t Enable); /// Prepends the log level to messages (default: off) void log_show_level(bool_t Enable); /// Enables logging to the syslog on systems that support it (default: off) void log_syslog(bool_t Enable); /// Sets the minimum level of message to be logged (default: K3D_LOG_LEVEL_WARNING) void log_minimum_level(const log_level_t Level); /// Connects a slot to a signal that will be emitted whenever messages are added to the log sigc::connection connect_log_message(const sigc::slot& Slot); /// Retrieves the current contents of the log cache by repeatedly calling the given slot void get_log_cache(const sigc::slot& Slot); } // namespace k3d #endif // !K3DSDK_LOG_CONTROL_H ================================================ FILE: k3dsdk/material.h ================================================ #ifndef K3DSDK_MATERIAL_H #define K3DSDK_MATERIAL_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { class iunknown; namespace material { /// Given a generic material object, return a specific material type (could return NULL). template InterfaceT* lookup(iunknown* const Material) { if(InterfaceT* const interface = dynamic_cast(Material)) return interface; if(inode* const node = dynamic_cast(Material)) { if(node->factory().factory_id() == classes::MultiMaterial()) { if(iproperty_collection* const property_collection = dynamic_cast(Material)) { const iproperty_collection::properties_t& properties = property_collection->properties(); for(iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { if((**property).property_type() == typeid(inode*)) { if(InterfaceT* const interface = dynamic_cast(k3d::property::pipeline_value(**property))) return interface; } } } } } return 0; } } // namespace material } // namespace k3d #endif // !K3DSDK_MATERIAL_H ================================================ FILE: k3dsdk/material_sink.h ================================================ #ifndef K3DSDK_MATERIAL_SINK_H #define K3DSDK_MATERIAL_SINK_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class idocument; /// Adds a boilerplate implementation of k3d::imaterial_sink to a base class, using the parameterized-inheritance idiom template class material_sink : public base_t, public imaterial_sink { public: material_sink(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_material(init_owner(*this) + init_name("material") + init_label(_("Surface Material")) + init_description(_("Surface material")) + init_value(static_cast(0))) { } iproperty& material_sink_input() { return m_material; } protected: k3d_data(imaterial*, data::immutable_name, data::change_signal, data::with_undo, data::node_storage, data::no_constraint, data::node_property, data::node_serialization) m_material; }; } // namespace k3d #endif // !K3DSDK_MATERIAL_SINK_H ================================================ FILE: k3dsdk/matrix_source.h ================================================ #ifndef K3DSDK_MATRIX_SOURCE_H #define K3DSDK_MATRIX_SOURCE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { template class matrix_source : public base_t, public imatrix_source { public: matrix_source(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_output_matrix(init_owner(*this) + init_name("output_matrix") + init_label(_("Output Matrix")) + init_description("Output Matrix") + init_value(identity3())) { m_output_matrix.set_update_slot(sigc::mem_fun(*this, &matrix_source::execute)); } iproperty& matrix_source_output() { return m_output_matrix; } /// Returns a slot that should be connected to input properties to signal that the output has changed sigc::slot make_update_matrix_slot() { return m_output_matrix.make_slot(); } private: k3d_data(k3d::matrix4, data::immutable_name, data::change_signal, data::no_undo, data::value_demand_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_output_matrix; /// Called whenever the output has been modified and needs to be updated. void execute(const std::vector& Hints, matrix4& Output) { // We can safely ignore any hints ... on_update_matrix(Output); } /// Override this in derived classes, to return a new transformation matrix. virtual void on_update_matrix(matrix4& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_MATRIX_SOURCE_H ================================================ FILE: k3dsdk/measurement.cpp ================================================ // K3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements a framework for doing real-world unit-of-measure conversion \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace measurement { using namespace boost::spirit; bool parse(std::istream& Stream, double&Value, std::string& Units) { std::string buffer; std::copy(std::istreambuf_iterator(Stream), std::istreambuf_iterator(), std::back_inserter(buffer)); return parse(buffer, Value, Units); } bool parse(const std::string& Buffer, double& Value, std::string& Units) { std::stack stack; std::string units; if(!parse(Buffer.c_str(), k3d::expression::expression_grammar(stack) >>!(alpha_p >> *graph_p)[assign(units)], space_p).full) return false; assert(!stack.empty()); Value = stack.top(); Units = units; return true; } bool parse(const std::string& Buffer, double&Value, const std::type_info* const Units) { // Parse the input expression into value and unit-of-measure (it can do mathematical expressions, too, for fun) double value; std::string units; if(!parse(Buffer, value, units)) return false; // If the caller didn't specify the type of units, they're scalar (no unit of measurement) ... if(!Units) { // In this case, if the user entered units, it's an error ... if(!units.empty()) return false; // Just return the value ... Value = value; return true; } // As a special-case, if the user didn't enter units, and the unit type is "angle", we assume the input is in degrees, not radians if(units.empty() && *Units == typeid(angle)) units = "deg"; // No units specified, so we can assume that input is already in the internal (SI) units if(units.empty()) { Value = value; return true; } // Attempt converting the value to its internal (SI) units ... try { if(*Units == typeid(angle)) Value = convert(quantity(value, angle_units(units)), angle_units("rad")); else if(*Units == typeid(area)) Value = convert(quantity(value, area_units(units)), area_units("m^2")); else if(*Units == typeid(distance)) Value = convert(quantity(value, distance_units(units)), distance_units("m")); else if(*Units == typeid(force)) Value = convert(quantity(value, force_units(units)), force_units("N")); else if(*Units == typeid(mass)) Value = convert(quantity(value, mass_units(units)), mass_units("Kg")); else if(*Units == typeid(pressure)) Value = convert(quantity(value, pressure_units(units)), pressure_units("Pa")); else if(*Units == typeid(k3d::measurement::time)) Value = convert(quantity(value, time_units(units)), time_units("s")); else if(*Units == typeid(volume)) Value = convert(quantity(value, volume_units(units)), volume_units("m^3")); return true; } catch(...) { } return false; } const angle_units_t& angle_units() { static angle_units_t units; if(units.empty()) { units.insert(std::make_pair("d", angle("Degree", "degrees", 0.01745329252))); units.insert(std::make_pair("deg", angle("Degree", "degrees", 0.01745329252))); units.insert(std::make_pair("degree", angle("Degree", "degrees", 0.01745329252))); units.insert(std::make_pair("arcmin", angle("Minute of arc", "Minutes of arc", 0.00290888209))); units.insert(std::make_pair("arcs", angle("Second of arc", "Seconds of arc", 0.00000484814))); units.insert(std::make_pair("g", angle("Grade", "Grades", 0.01570796327))); units.insert(std::make_pair("grad", angle("Grade", "Grades", 0.01570796327))); units.insert(std::make_pair("r", angle("Radian", "radians", 1.0))); units.insert(std::make_pair("rad", angle("Radian", "radians", 1.0))); units.insert(std::make_pair("radian", angle("Radian", "radians", 1.0))); } return units; } const area_units_t& area_units() { static area_units_t units; if(units.empty()) { units.insert(std::make_pair("m^2", area("Square Meter", "Square Meters", 1.0))); units.insert(std::make_pair("a", area("Are", "Ares", 100.0))); units.insert(std::make_pair("acre", area("Acre", "Acres", 4046.87260987))); units.insert(std::make_pair("b", area("Barn", "Barns", 1e-28))); } return units; } const distance_units_t& distance_units() { static distance_units_t units; if(units.empty()) { units.insert(std::make_pair("m", distance("Meter", "Meters", 1.0))); units.insert(std::make_pair("au", distance("Astronomical Unit", "Astronomical Units", 1.495979e11))); units.insert(std::make_pair("A", distance("Angstrom", "Angstroms", 0.0000000001))); units.insert(std::make_pair("angstrom", distance("Angstrom", "Angstroms", 0.0000000001))); units.insert(std::make_pair("chain", distance("Chain", "Chains", 20.1168402337))); units.insert(std::make_pair("fath", distance("Fathom", "Fathoms", 1.82880365761))); units.insert(std::make_pair("fathom", distance("Fathom", "Fathoms", 1.82880365761))); units.insert(std::make_pair("fermi", distance("Fermi", "Fermis", 1e-15))); units.insert(std::make_pair("ftintl", distance("International Foot", "International Feet", 0.3048))); units.insert(std::make_pair("ft", distance("Survey Foot", "Survey Feet", 0.304800609601))); units.insert(std::make_pair("foot", distance("Survey Foot", "Survey Feet", 0.304800609601))); units.insert(std::make_pair("ftUS", distance("Survey Foot", "Survey Feet", 0.304800609601))); units.insert(std::make_pair("in", distance("Inch", "Inches", 0.0254))); units.insert(std::make_pair("inch", distance("Inch", "Inches", 0.0254))); units.insert(std::make_pair("ly", distance("Light Year", "Light Years", 9.46052840488e15))); units.insert(std::make_pair("lyr", distance("Light Year", "Light Years", 9.46052840488e15))); units.insert(std::make_pair("lightyear", distance("Light Year", "Light Years", 9.46052840488e15))); units.insert(std::make_pair("Em", distance("Exameter", "Exameters", 1e18))); units.insert(std::make_pair("Pm", distance("Petemeter", "Petemeters", 1e15))); units.insert(std::make_pair("Tm", distance("Terameter", "Terameters", 1e12))); units.insert(std::make_pair("Gm", distance("Gigameter", "Gigameters", 1e9))); units.insert(std::make_pair("Mm", distance("Megameter", "Megameters", 1e6))); units.insert(std::make_pair("Km", distance("Kilometer", "Kilometers", 1e3))); units.insert(std::make_pair("km", distance("Kilometer", "Kilometers", 1e3))); units.insert(std::make_pair("Hm", distance("Hectometer", "Hectometers", 1e2))); units.insert(std::make_pair("hm", distance("Hectometer", "Hectometers", 1e2))); units.insert(std::make_pair("Dm", distance("Dekameter", "Dekameters", 1e1))); units.insert(std::make_pair("meter", distance("Meter", "Meters", 1.0))); units.insert(std::make_pair("dm", distance("Decimeter", "Decimeters", 1e-1))); units.insert(std::make_pair("cm", distance("Centimeter", "Centimeters", 1e-2))); units.insert(std::make_pair("mm", distance("Millimeter", "Millimeters", 1e-3))); units.insert(std::make_pair("um", distance("Micrometer", "Micrometers", 1e-6))); units.insert(std::make_pair("nm", distance("Nanometer", "Nanometers", 1e-9))); units.insert(std::make_pair("pm", distance("Picometer", "Picometers", 1e-12))); units.insert(std::make_pair("fm", distance("Femtometer", "Femtometers", 1e-15))); units.insert(std::make_pair("am", distance("Attometer", "Attometers", 1e-18))); units.insert(std::make_pair("miIntl", distance("International Mile", "International Miles", 1609.344))); units.insert(std::make_pair("mil", distance("Mil", "Mils", 0.0000254))); units.insert(std::make_pair("mi", distance("US Statute Mile", "US Statute Miles", 1609.34721869))); units.insert(std::make_pair("mile", distance("US Statute Mile", "US Statute Miles", 1609.34721869))); units.insert(std::make_pair("mileUS", distance("US Statute Mile", "US Statute Miles", 1609.34721869))); units.insert(std::make_pair("nmi", distance("Nautical Mile", "Nautical Miles", 1852.0))); units.insert(std::make_pair("pc", distance("Parsec", "Parsecs", 3.08567818585e16))); units.insert(std::make_pair("parsec", distance("Parsec", "Parsecs", 3.08567818585e16))); units.insert(std::make_pair("rd", distance("Rod", "Rods", 5.02921005842))); units.insert(std::make_pair("rod", distance("Rod", "Rods", 5.02921005842))); units.insert(std::make_pair("yd", distance("Yard", "Yards", 0.9144))); units.insert(std::make_pair("yard", distance("Yard", "Yards", 0.9144))); } return units; } const force_units_t& force_units() { static force_units_t units; if(units.empty()) { units.insert(std::make_pair("N", force("Newton", "Newtons", 1.0))); units.insert(std::make_pair("dyn", force("Dyne", "Dynes", 0.00001))); units.insert(std::make_pair("dyne", force("Dyne", "Dynes", 0.00001))); units.insert(std::make_pair("gf", force("Gram-Force", "Grams-Force", 0.00980665))); units.insert(std::make_pair("kip", force("Kilopound-Force", "Kilopounds-Force", 4448.22161526))); units.insert(std::make_pair("lbf", force("Point-Force", "Points-Force", 4.44822161526))); units.insert(std::make_pair("Newton", force("Newton", "Newtons", 1.0))); units.insert(std::make_pair("pdl", force("Poundal", "Poundals", 0.138254954376))); } return units; } const mass_units_t& mass_units() { static mass_units_t units; if(units.empty()) { units.insert(std::make_pair("Kg", mass("Kilogram", "Kilograms", 1.0))); units.insert(std::make_pair("ct", mass("Carat", "Carats", 0.0002))); units.insert(std::make_pair("g", mass("Gram", "Grams", 0.001))); units.insert(std::make_pair("gram", mass("Gram", "Grams", 0.001))); units.insert(std::make_pair("grain", mass("Grain", "Grains", 0.00006479891))); units.insert(std::make_pair("lb", mass("Avoirdupois Pound", "Avoirdupois Pounds", 0.45359237))); units.insert(std::make_pair("lbt", mass("Troy Pound", "Troy Pounds", 0.3732417))); units.insert(std::make_pair("oz", mass("Ounce", "Ounces", 0.028349523125))); units.insert(std::make_pair("ounce", mass("Ounce", "Ounces", 0.028349523125))); units.insert(std::make_pair("ozt", mass("Troy Ounce", "Troy Ounces", 0.031103475))); units.insert(std::make_pair("slug", mass("Slug", "Slugs", 14.5939029372))); units.insert(std::make_pair("t", mass("Metric Ton", "Metric Tons", 1000.0))); units.insert(std::make_pair("ton", mass("Short Ton", "Short Tons", 907.18474))); units.insert(std::make_pair("tonUK", mass("Long Ton", "Long Tons", 1016.0469088))); units.insert(std::make_pair("u", mass("Unified Atomic Mass", "Unified Atomic Masses", 1.66057e-27))); } return units; } const pressure_units_t& pressure_units() { static pressure_units_t units; if(units.empty()) { units.insert(std::make_pair("Pa", pressure("Pascal", "Pascal", 1.0))); units.insert(std::make_pair("atm", pressure("Atmosphere", "Atmospheres", 101325.0))); units.insert(std::make_pair("bar", pressure("Bar", "Bars", 100000.0))); units.insert(std::make_pair("inHG", pressure("Inch of Mercury", "Inches of Mercury", 3386.38815789))); units.insert(std::make_pair("inH2O", pressure("Inch of Water", "Inches of Water", 248.84))); units.insert(std::make_pair("mmHG", pressure("Millimeter of Mercury", "Millimeters of Mercury", 133.322368421))); units.insert(std::make_pair("Pascal", pressure("Pascal", "Pascals", 1.0))); units.insert(std::make_pair("psi", pressure("Pound per Square Inch", "Pounds per Square Inch", 6894.75729317))); units.insert(std::make_pair("torr", pressure("Torr", "Torrs", 133.322368421))); } return units; } const time_units_t& time_units() { static time_units_t units; if(units.empty()) { units.insert(std::make_pair("s", time("Second", "Seconds", 1.0))); units.insert(std::make_pair("d", time("Day", "Days", 86400.0))); units.insert(std::make_pair("day", time("Day", "Days", 86400.0))); units.insert(std::make_pair("h", time("Hour", "Hours", 3600.0))); units.insert(std::make_pair("hour", time("Hour", "Hours", 3600.0))); units.insert(std::make_pair("ms", time("Millisecond", "Milliseconds", 0.001))); units.insert(std::make_pair("msec", time("Millisecond", "Milliseconds", 0.001))); units.insert(std::make_pair("min", time("Minute", "Minutes", 60.0))); units.insert(std::make_pair("minute", time("Minute", "Minutes", 60.0))); units.insert(std::make_pair("second", time("Second", "Seconds", 1.0))); units.insert(std::make_pair("yr", time("Year", "Years", 31556925.9747))); units.insert(std::make_pair("year", time("Year", "Years", 31556925.9747))); } return units; } const volume_units_t& volume_units() { static volume_units_t units; if(units.empty()) { units.insert(std::make_pair("m^3", volume("Cubic Meter", "Cubic Meters", 1.0))); units.insert(std::make_pair("bbl", volume("Barrel (Oil)", "Barrels (Oil)", 0.158987294928))); units.insert(std::make_pair("bu", volume("Bushel", "Bushels", 0.03523907))); units.insert(std::make_pair("cu", volume("US Cup", "US Cups", 2.365882365e-4))); units.insert(std::make_pair("fbm", volume("Board Foot", "Board Feet", 0.002359737216))); units.insert(std::make_pair("gal", volume("US Gallon", "US Gallons", 0.003785411784))); units.insert(std::make_pair("galUS", volume("US Gallon", "US Gallons", 0.003785411784))); units.insert(std::make_pair("galC", volume("Canadian Gallon", "Canadian Gallons", 0.00454609))); units.insert(std::make_pair("galUK", volume("UK Gallon", "UK Gallons", 0.004546092))); units.insert(std::make_pair("l", volume("Liter", "Liters", 0.001))); units.insert(std::make_pair("ozfl", volume("US Fluid Ounce", "US Fluid Ounce", 2.95735295625e-5))); units.insert(std::make_pair("ozUK", volume("UK Fluid Ounce", "UK Fluid Ounce", 0.000028413075))); units.insert(std::make_pair("pk", volume("Peck", "Pecks", 0.0088097675))); units.insert(std::make_pair("pt", volume("Pint", "Pints", 0.000473176473))); units.insert(std::make_pair("pint", volume("Pint", "Pints", 0.000473176473))); units.insert(std::make_pair("qt", volume("Quart", "Quarts", 0.000946352946))); units.insert(std::make_pair("quart", volume("Quart", "Quarts", 0.000946352946))); units.insert(std::make_pair("st", volume("Stere", "Steres", 1.0))); units.insert(std::make_pair("stere", volume("Stere", "Steres", 1.0))); units.insert(std::make_pair("tbsp", volume("Tablespoon", "Tablespoons", 1.47867647813e-5))); units.insert(std::make_pair("tsp", volume("Teaspoon", "Teaspoons", 4.92892159375e-6))); } return units; } const angle& angle_units(const std::string& Symbol) { angle_units_t::const_iterator unit = angle_units().find(Symbol); if(unit == angle_units().end()) throw std::domain_error("unknown unit of measure"); return unit->second; } const area& area_units(const std::string& Symbol) { area_units_t::const_iterator unit = area_units().find(Symbol); if(unit == area_units().end()) throw std::domain_error("unknown unit of measure"); return unit->second; } const distance& distance_units(const std::string& Symbol) { distance_units_t::const_iterator unit = distance_units().find(Symbol); if(unit == distance_units().end()) throw std::domain_error("unknown unit of measure"); return unit->second; } const force& force_units(const std::string& Symbol) { force_units_t::const_iterator unit = force_units().find(Symbol); if(unit == force_units().end()) throw std::domain_error("unknown unit of measure"); return unit->second; } const mass& mass_units(const std::string& Symbol) { mass_units_t::const_iterator unit = mass_units().find(Symbol); if(unit == mass_units().end()) throw std::domain_error("unknown unit of measure"); return unit->second; } const pressure& pressure_units(const std::string& Symbol) { pressure_units_t::const_iterator unit = pressure_units().find(Symbol); if(unit == pressure_units().end()) throw std::domain_error("unknown unit of measure"); return unit->second; } const time& time_units(const std::string& Symbol) { time_units_t::const_iterator unit = time_units().find(Symbol); if(unit == time_units().end()) throw std::domain_error("unknown unit of measure"); return unit->second; } const volume& volume_units(const std::string& Symbol) { volume_units_t::const_iterator unit = volume_units().find(Symbol); if(unit == volume_units().end()) throw std::domain_error("unknown unit of measure"); return unit->second; } } // namespace measurement } // namespace k3d ================================================ FILE: k3dsdk/measurement.h ================================================ #ifndef K3DSDK_MEASUREMENT_H #define K3DSDK_MEASUREMENT_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Provides a type-safe framework for doing real-world unit-of-measure conversion and I/O \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { namespace measurement { namespace conversion { /// Conversion policy for real world units that can be converted solely through multiplication class multiplicative { public: double to_si(const double RHS) const { return RHS * m_constant; } double from_si(const double RHS) const { return RHS / m_constant; } protected: explicit multiplicative(const double Constant) : m_constant(Constant) { assert(m_constant); } private: double m_constant; }; } // namespace conversion /// Defines a real-world unit of measure, including singular written name, plural written name, and functions to_si() and from_si() for converting quantities to-and-from their corresponding SI standard units template class unit : public conversion_policy { public: typedef unit this_t; const std::string name() const { return m_name; } const std::string plural_name() const { return m_plural_name; } friend bool operator==(const this_t& LHS, const this_t& RHS) { return LHS.m_name == RHS.m_name; } friend bool operator<(const this_t& LHS, const this_t& RHS) { return LHS.m_name < RHS.m_name; } protected: /* explicit unit(const std::string Name, const std::string PluralName) : conversion_policy(), m_name(Name), m_plural_name(Name) { assert(m_name.size()); assert(m_plural_name.size()); } */ explicit unit(const std::string Name, const std::string PluralName, const double MultiplicativeConstant) : conversion_policy(MultiplicativeConstant), m_name(Name), m_plural_name(PluralName) { assert(m_name.size()); assert(m_plural_name.size()); } private: std::string m_name; std::string m_plural_name; }; /// Defines a proxy object so we can do conversion-by-assignment template class conversion_proxy { public: explicit conversion_proxy(const quantity_t Quantity) : m_quantity(Quantity) { } double to_si() const { return m_quantity.to_si(); } private: const quantity_t m_quantity; }; /// Convenience function for creating conversion_proxy objects template conversion_proxy convert(const quantity_t Quantity) { return conversion_proxy(Quantity); } /// Convenience function for converting a quantity to another unit-of-measure template const quantity_t convert(const quantity_t Quantity, const typename quantity_t::unit_type Units) { return quantity_t(Units.from_si(Quantity.to_si()), Units); } /// Defines a real-world quantity (a combination of value and unit) template class quantity { public: typedef unit_t unit_type; typedef quantity this_t; explicit quantity(const unit_t Units) : m_units(Units) { } explicit quantity(const double Value, const unit_t Units) : m_value(Value), m_units(Units) { } operator double() const { return m_value; } double value() const { return m_value; } const unit_t& units() const { return m_units; } double to_si() const { return m_units.to_si(m_value); } this_t& operator=(const conversion_proxy& RHS) { m_value = m_units.from_si(RHS.to_si()); return *this; } friend std::ostream& operator<<(std::ostream& Stream, const this_t& RHS) { Stream << RHS.m_value << " "; Stream << (1 == RHS.m_value ? RHS.m_units.name() : RHS.m_units.plural_name()); return Stream; } private: double m_value; unit_t m_units; }; /// Defines a "scalar" quantity (no unit-of-measure) typedef void scalar; /// Defines an angular unit-of-measure class angle : public unit { public: explicit angle(const std::string Name, const std::string PluralName, const double Constant) : unit(Name, PluralName, Constant) { } }; /// Defines a unit-of-measure for area class area : public unit { public: explicit area(const std::string Name, const std::string PluralName, const double Constant) : unit(Name, PluralName, Constant) { } }; /// Defines a unit-of-measure for distance class distance : public unit { public: explicit distance(const std::string Name, const std::string PluralName, const double Constant) : unit(Name, PluralName, Constant) { } }; /// Defines a unit-of-measure for force class force : public unit { public: explicit force(const std::string Name, const std::string PluralName, const double Constant) : unit(Name, PluralName, Constant) { } }; /// Defines a unit-of-measure for mass class mass : public unit { public: explicit mass(const std::string Name, const std::string PluralName, const double Constant) : unit(Name, PluralName, Constant) { } }; /// Defines a unit-of-measure for pressure class pressure : public unit { public: explicit pressure(const std::string Name, const std::string PluralName, const double Constant) : unit(Name, PluralName, Constant) { } }; /// Defines a unit-of-measure for time class time : public unit { public: explicit time(const std::string Name, const std::string PluralName, const double Constant) : unit(Name, PluralName, Constant) { } }; /// Defines a unit-of-measure for volume class volume : public unit { public: explicit volume(const std::string Name, const std::string PluralName, const double Constant) : unit(Name, PluralName, Constant) { } }; /** \brief Parses a mathematical expression with optional real-world units-of-measure \param Stream Input stream containing the expression to be parsed \param Value Iff the input expression is completely parsed, contains the expression value; otherwise unchanged \param Units Iff the input expression is completely parsed, contains the (optional) unit-of-measure symbol; otherwise unchanged \return true, iff the input expression is completely parsed, false otherwise */ bool parse(std::istream& Stream, double&Value, std::string& Units); /** \brief Parses a mathematical expression with optional real-world units-of-measure \param Buffer Input buffer containing the expression to be parsed \param Value Iff the input expression is completely parsed, contains the expression value; otherwise unchanged \param Units Iff the input expression is completely parsed, contains the (optional) unit-of-measure symbol; otherwise unchanged \return true, iff the input expression is completely parsed, false otherwise */ bool parse(const std::string& Buffer, double&Value, std::string& Units); /** \brief Parses a mathematical expression with optional real-world units-of-measure, automatically converting it to the appropriate SI units \param Buffer Input buffer containing the expression to be parsed \param Value Iff the input expression is completely parsed, contains the expression value in SI units \param Units Defines the type of measurement (e.g. angle, distance, time, volume, etc) to be formatted \return true, iff the input expression is completely parsed, false otherwise */ bool parse(const std::string& Buffer, double&Value, const std::type_info* const Units); /// Defines a collection of units of angular measure, keyed by string (typically name or symbol) typedef std::map angle_units_t; /// Defines a collection of units of area, keyed by string (typically name or symbol) typedef std::map area_units_t; /// Defines a collection of units of distance, keyed by string (typically name or symbol) typedef std::map distance_units_t; /// Defines a collection of units of force, keyed by string (typically name or symbol) typedef std::map force_units_t; /// Defines a collection of units of mass, keyed by string (typically name or symbol) typedef std::map mass_units_t; /// Defines a collection of units of pressure, keyed by string (typically name or symbol) typedef std::map pressure_units_t; /// Defines a collection of units of time, keyed by string (typically name or symbol) typedef std::map time_units_t; /// Defines a collection of units of volume, keyed by string (typically name or symbol) typedef std::map volume_units_t; /// Returns a singleton collection of common units of angular measure, keyed by symbol const angle_units_t& angle_units(); /// Returns a singleton collection of common units of area, keyed by symbol const area_units_t& area_units(); /// Returns a singleton collection of common units of distance, keyed by symbol const distance_units_t& distance_units(); /// Returns a singleton collection of common units of force, keyed by symbol const force_units_t& force_units(); /// Returns a singleton collection of common units of mass, keyed by symbol const mass_units_t& mass_units(); /// Returns a singleton collection of common units of pressure, keyed by symbol const pressure_units_t& pressure_units(); /// Returns a singleton collection of common units of time, keyed by symbol const time_units_t& time_units(); /// Returns a singleton collection of common units of volume, keyed by symbol const volume_units_t& volume_units(); /// Returns a reference to a common unit of angular measure keyed by symbol. Throws std::exception if the symbol is unknown. const angle& angle_units(const std::string& Symbol); /// Returns a reference to a common unit of area keyed by symbol. Throws std::exception if the symbol is unknown. const area& area_units(const std::string& Symbol); /// Returns a reference to a common unit of distance keyed by symbol. Throws std::exception if the symbol is unknown. const distance& distance_units(const std::string& Symbol); /// Returns a reference to a common unit of force keyed by symbol. Throws std::exception if the symbol is unknown. const force& force_units(const std::string& Symbol); /// Returns a reference to a common unit of mass keyed by symbol. Throws std::exception if the symbol is unknown. const mass& mass_units(const std::string& Symbol); /// Returns a reference to a common unit of pressure keyed by symbol. Throws std::exception if the symbol is unknown. const pressure& pressure_units(const std::string& Symbol); /// Returns a reference to a common unit of time keyed by symbol. Throws std::exception if the symbol is unknown. const time& time_units(const std::string& Symbol); /// Returns a reference to a common unit of volume keyed by symbol. Throws std::exception if the symbol is unknown. const volume& volume_units(const std::string& Symbol); } // namespace measurement } // namespace k3d #endif // !K3DSDK_MEASUREMENT_H ================================================ FILE: k3dsdk/mesh.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include #include #include namespace k3d { //////////////////////////////////////////////////////////////////////////////////////////// // difference::test /// Return the difference between two shared arrays (handles "fuzzy" floating-point comparisons). namespace difference { template void test(const pipeline_data >& A, const pipeline_data >& B, accumulator& Result) { if(A && B) A->difference(*B, Result); else if(!A && !B) Result.exact(true); else Result.exact(false); } /// Return the difference between two shared arrays (handles "fuzzy" floating-point comparisons). void test(const pipeline_data& A, const pipeline_data& B, accumulator& Result) { if(A && B) A->difference(*B, Result); else if(!A && !B) Result.exact(true); else Result.exact(false); } /// Return the difference between two shared objects (handles "fuzzy" floating-point comparisons). template void test(const pipeline_data& A, const pipeline_data& B, accumulator& Result) { if(A && B) k3d::difference::test(*A, *B, Result); else if(!A && !B) Result.exact(true); else Result.exact(false); } /// Return the difference between two sets of primitives. void test(const mesh::primitives_t& A, const mesh::primitives_t& B, accumulator& Result) { // If they have differing numbers of primitives, they definitely aren't equal Result.exact(A.size() == B.size()); for(mesh::primitives_t::const_iterator a = A.begin(), b = B.begin(); a != A.end() && b != B.end(); ++a, ++b) { if(a->get() && b->get()) (**a).difference((**b), Result); else if(!a->get() && !b->get()) Result.exact(true); else Result.exact(false); } } } // namespace difference //////////////////////////////////////////////////////////////////////////////////// // mesh mesh::mesh() { } void mesh::difference(const mesh& Other, difference::accumulator& Result) const { k3d::difference::test(points, Other.points, Result); k3d::difference::test(point_selection, Other.point_selection, Result); k3d::difference::test(point_attributes, Other.point_attributes, Result); k3d::difference::test(primitives, Other.primitives, Result); } namespace detail { /// Helper function used by lookup_unused_points() void mark_used_points(const mesh::indices_t& PrimitivePoints, mesh::bools_t& UnusedPoints) { const uint_t begin = 0; const uint_t end = PrimitivePoints.size(); for(uint_t i = begin; i != end; ++i) UnusedPoints[PrimitivePoints[i]] = false; } /// Helper object used by lookup_unused_points() struct mark_used_primitive_points { mark_used_primitive_points(mesh::bools_t& UnusedPoints) : unused_points(UnusedPoints) { } void operator()(const string_t&, const table&, const string_t&, const pipeline_data& Array) { if(Array->get_metadata_value(metadata::key::domain()) != metadata::value::point_indices_domain()) return; if(const mesh::indices_t* const array = dynamic_cast(Array.get())) mark_used_points(*array, unused_points); } mesh::bools_t& unused_points; }; } // namespace detail const bounding_box3 mesh::bounds(const mesh& Mesh) { return Mesh.points ? bounds(*Mesh.points) : bounding_box3(); } const bounding_box3 mesh::bounds(const points_t& Points) { bounding_box3 results; const uint_t point_begin = 0; const uint_t point_end = point_begin + Points.size(); for(uint_t point = point_begin; point != point_end; ++point) results.insert(Points[point]); return results; } void mesh::deep_copy(const mesh& From, mesh& To) { To = From; assert_not_implemented(); // Need to ensure that all storage is unique } void mesh::lookup_unused_points(const mesh& Mesh, mesh::bools_t& UnusedPoints) { UnusedPoints.assign(Mesh.points ? Mesh.points->size() : 0, true); visit_arrays(Mesh, detail::mark_used_primitive_points(UnusedPoints)); } void mesh::create_index_removal_map(const mesh::bools_t& KeepIndices, mesh::indices_t& IndexMap) { IndexMap.resize(KeepIndices.size()); const uint_t begin = 0; const uint_t end = KeepIndices.size(); for(uint_t current_index = begin, new_index = begin; current_index != end; ++current_index) { IndexMap[current_index] = new_index; if(!KeepIndices[current_index]) ++new_index; } } void mesh::create_index_list(const mesh::bools_t& SelectedIndices, mesh::indices_t& IndexSet) { IndexSet.resize(0); const uint_t begin = 0; const uint_t end = SelectedIndices.size(); for(uint_t index = begin; index != end; ++index) { if(SelectedIndices[index]) IndexSet.push_back(index); } } namespace detail { /// Helper function used by delete_points() void remap_points(mesh::indices_t& PrimitivePoints, const mesh::indices_t& PointMap) { const uint_t begin = 0; const uint_t end = PrimitivePoints.size(); for(uint_t i = begin; i != end; ++i) PrimitivePoints[i] = PointMap[PrimitivePoints[i]]; } /// Helper object used by delete_points() struct remap_primitive_points { remap_primitive_points(const mesh::indices_t& PointMap) : point_map(PointMap) { } void operator()(const string_t&, const table&, const string_t&, pipeline_data& Array) { if(Array->get_metadata_value(metadata::key::domain()) != metadata::value::point_indices_domain()) return; if(mesh::indices_t* const array = dynamic_cast(&Array.writable())) remap_points(*array, point_map); } const mesh::indices_t& point_map; }; } // namespace detail void mesh::remap_points(mesh& Mesh, const mesh::indices_t& PointMap) { visit_arrays(Mesh, detail::remap_primitive_points(PointMap)); } void mesh::delete_points(mesh& Mesh, const mesh::bools_t& Points) { mesh::indices_t point_map; delete_points(Mesh, Points, point_map); } void mesh::delete_points(mesh& Mesh, const mesh::bools_t& Points, mesh::indices_t& PointMap) { // Enforce preconditions ... return_if_fail(Mesh.points); return_if_fail(Mesh.point_selection); return_if_fail(Mesh.points->size() == Mesh.point_selection->size()); return_if_fail(Mesh.points->size() == Mesh.point_attributes.row_count() || 0 == Mesh.point_attributes.column_count()); // Count how many points will be left when we're done ... const uint_t points_remaining = std::count(Points.begin(), Points.end(), false); // Create a mapping from current point indices to indices after we've removed points ... create_index_removal_map(Points, PointMap); // Move leftover points, point selections, and attributes into their final positions ... mesh::points_t& points = Mesh.points.writable(); mesh::selection_t& point_selection = Mesh.point_selection.writable(); table_copier point_attributes(Mesh.point_attributes); const uint_t point_begin = 0; const uint_t point_end = point_begin + Points.size(); for(uint_t point = point_begin; point != point_end; ++point) { if(Points[point]) continue; points[PointMap[point]] = points[point]; point_selection[PointMap[point]] = point_selection[point]; point_attributes.copy(point, PointMap[point]); } // Update generic mesh primitives so they use the correct indices ... visit_arrays(Mesh, detail::remap_primitive_points(PointMap)); // Free leftover memory ... points.resize(points_remaining); point_selection.resize(points_remaining); Mesh.point_attributes.set_row_count(points_remaining); } namespace detail { class offset_point_indices { public: offset_point_indices(const uint_t Offset) : offset(Offset) { } void operator()(const string_t&, const table&, const string_t& ArrayName, pipeline_data& Array) { if(Array->get_metadata_value(metadata::key::domain()) != metadata::value::point_indices_domain()) return; uint_t_array* const array = dynamic_cast(&Array.writable()); if(!array) { log() << error << "array [" << ArrayName << "] must be a k3d::uint_t_array." << std::endl; return; } std::transform(array->begin(), array->end(), array->begin(), std::bind2nd(std::plus(), offset)); } private: const uint_t offset; }; } // namespace detail void mesh::append(const mesh& Source, mesh& Target, uint_t* const PointBegin, uint_t* const PointEnd, uint_t* const PrimitiveBegin, uint_t* const PrimitiveEnd) { const uint_t point_begin = Target.points ? Target.points->size() : 0; if(PointBegin) *PointBegin = point_begin; if(PrimitiveBegin) *PrimitiveBegin = Target.primitives.size(); // Append source points to the target ... if(Source.points) { mesh::points_t& target_points = Target.points ? Target.points.writable() : Target.points.create(); target_points.insert(target_points.end(), Source.points->begin(), Source.points->end()); } if(Source.point_selection) { mesh::selection_t& target_point_selection = Target.point_selection ? Target.point_selection.writable() : Target.point_selection.create(); target_point_selection.insert(target_point_selection.end(), Source.point_selection->begin(), Source.point_selection->end()); } // Append source primitives to the target ... for(mesh::primitives_t::const_iterator primitive = Source.primitives.begin(); primitive != Source.primitives.end(); ++primitive) { Target.primitives.push_back(*primitive); mesh::primitive& new_primitive = Target.primitives.back().writable(); if(point_begin) mesh::visit_arrays(new_primitive, detail::offset_point_indices(point_begin)); } if(PointEnd) *PointEnd = Target.points ? Target.points->size() : 0; if(PrimitiveEnd) *PrimitiveEnd = Target.primitives.size(); } //////////////////////////////////////////////////////////////////////////////////// // mesh::primitive mesh::primitive::primitive() { } mesh::primitive::primitive(const string_t& Type) : type(Type) { } void mesh::primitive::difference(const primitive& Other, difference::accumulator& Result) const { k3d::difference::test(type, Other.type, Result); k3d::difference::test(structure, Other.structure, Result); k3d::difference::test(attributes, Other.attributes, Result); } //////////////////////////////////////////////////////////////////////////////////// // mesh::primitives_t mesh::primitive& mesh::primitives_t::create(const string_t& Type) { push_back(pipeline_data()); return back().create(new mesh::primitive(Type)); } //////////////////////////////////////////////////////////////////////////////////// // operator<< std::ostream& operator<<(std::ostream& Stream, const mesh& RHS) { if(RHS.points) { Stream << standard_indent << "points (" << RHS.points->size() << "):\n"; Stream << push_indent << start_block() << *RHS.points << finish_block << pop_indent << "\n"; } if(RHS.point_selection) { Stream << standard_indent << "point_selection (" << RHS.point_selection->size() << "):\n"; Stream << push_indent << start_block() << *RHS.point_selection << finish_block << pop_indent << "\n"; } Stream << standard_indent << "point_attributes (" << RHS.point_attributes.row_count() << "):\n"; Stream << push_indent << RHS.point_attributes << pop_indent; Stream << standard_indent << "primitives (" << RHS.primitives.size() << "):\n" << push_indent; for(mesh::primitives_t::const_iterator primitive = RHS.primitives.begin(); primitive != RHS.primitives.end(); ++primitive) Stream << **primitive; Stream << pop_indent; return Stream; } //////////////////////////////////////////////////////////////////////////////////// // operator<< std::ostream& operator<<(std::ostream& Stream, const mesh::primitive& RHS) { Stream << standard_indent << "primitive \"" << RHS.type << "\"\n" << push_indent; Stream << standard_indent << "structure (" << RHS.structure.size() << "):\n"; Stream << push_indent << RHS.structure << pop_indent; Stream << standard_indent << "attributes (" << RHS.attributes.size() << "):\n"; Stream << push_indent << RHS.attributes << pop_indent; Stream << pop_indent; return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/mesh.h ================================================ #ifndef K3DSDK_MESH_H #define K3DSDK_MESH_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include namespace k3d { class imaterial; class mesh_selection; //////////////////////////////////////////////////////////////////////////////// // mesh /// Encapsulates a hetereogenous collection of geometric primitives. class mesh { public: mesh(); /// Defines storage for a collection of indices. typedef uint_t_array indices_t; /// Defines storage for a collection of counts. typedef uint_t_array counts_t; /// Defines storage for a collection of orders. typedef uint_t_array orders_t; /// Defines storage for a collection of weights. typedef typed_array weights_t; /// Defines storage for a collection of knot vectors. typedef typed_array knots_t; /// Defines storage for gprim selection state. typedef typed_array selection_t; /// Defines storage for gprim materials. typedef typed_array materials_t; /// Defines storage for a generic collection of boolean values. typedef typed_array bools_t; /// Defines storage for a generic collection of colors. typedef typed_array colors_t; /// Defines storage for a generic collection of floating-point values. typedef typed_array doubles_t; /// Defines storage for a generic collection of 4x4 matrices. typedef typed_array matrices_t; /// Defines storage for a generic collection of 3D normals. typedef typed_array normals_t; /// Defines storage for a generic collection of 2D points. typedef typed_array points_2d_t; /// Defines storage for a generic collection of 3D points. typedef typed_array points_t; /// Defines storage for a generic collection of strings. typedef typed_array strings_t; /// Defines storage for a generic collection of 3D texture coordinates. typedef typed_array texture_coordinates_t; /// Defines storage for a generic collection of 3D vectors. typedef typed_array vectors_t; /// Defines a heterogeneous collection of named, shared arrays with varying lengths. typedef k3d::named_arrays named_arrays_t; /// Defines a heterogeneous collection of named, shared arrays with identical length. typedef k3d::table table_t; /// Defines a named collection of attribute arrays. typedef k3d::named_tables named_tables_t; /// Defines storage for a generic mesh primitive. class primitive { public: primitive(); primitive(const string_t& Type); /// Stores the primitive type ("point_groups", "polyhedra", "teapot", etc). string_t type; /// Stores array data that defines the primitive's structure (topology and geometry). named_tables_t structure; /// Stores array data that defines the primitive's attributes. named_tables_t attributes; /// Returns the difference between two primitives using the fuzzy semantics of difference::test(). void difference(const primitive& Other, difference::accumulator& Result) const; }; /// Defines storage for a collection of primitives. class primitives_t : public std::vector > { public: /// Create a new primitive, appending it to the collection. primitive& create(const string_t& Type); }; /// Stores the set of mesh points. pipeline_data points; /// Stores per-point selection state. pipeline_data point_selection; /// Stores user-defined per-point data (maps to RenderMan vertex data). table_t point_attributes; /// Stores mesh primitives. primitives_t primitives; /// Returns the difference between two meshes using the fuzzy semantics of difference::test(). void difference(const mesh& Other, difference::accumulator& Result) const; /// Returns a bounding-box containing every point in the given mesh. static const bounding_box3 bounds(const mesh& Mesh); /// Returns a bounding-box containing every point in the given array. static const bounding_box3 bounds(const points_t& Points); /// Converts a bitmap marking indices to be removed from a contiguous set into a map. static void create_index_removal_map(const mesh::bools_t& KeepIndices, mesh::indices_t& IndexMap); /// Converts a bitmap marking indices in a range to a set of selected indices. static void create_index_list(const mesh::bools_t& SelectedIndices, mesh::indices_t& IndexSet); /// Initialize an array to mark unused mesh points (points not used by any primitive). static void lookup_unused_points(const mesh& Mesh, mesh::bools_t& UnusedPoints); /// Remaps point indices in every primitive in a mesh. static void remap_points(mesh& Mesh, const mesh::indices_t& PointMap); /// Remove points from a mesh, adjusting point indices in all remaining primitives. static void delete_points(mesh& Mesh, const mesh::bools_t& Points); /// Remove points from a mesh, adjusting point indices in all remaining primitives, returning an array that maps original point indices to new point indices. static void delete_points(mesh& Mesh, const mesh::bools_t& Points, mesh::indices_t& PointMap); /// Performs a deep-copy from one mesh to another (the new mesh doesn't share any memory with the old). static void deep_copy(const mesh& From, mesh& To); /// Iterates over every array in a generic mesh primitive, passing the array name and array to a functor. template static void visit_arrays(const mesh::primitive& Primitive, FunctorT Functor) { for(mesh::named_tables_t::const_iterator structure = Primitive.structure.begin(); structure != Primitive.structure.end(); ++structure) { for(mesh::table_t::const_iterator array = structure->second.begin(); array != structure->second.end(); ++array) Functor(structure->first, structure->second, array->first, array->second); } for(mesh::named_tables_t::const_iterator attributes = Primitive.attributes.begin(); attributes != Primitive.attributes.end(); ++attributes) { for(mesh::table_t::const_iterator array = attributes->second.begin(); array != attributes->second.end(); ++array) Functor(attributes->first, attributes->second, array->first, array->second); } } /// Iterates over every array in a generic mesh primitive, passing the array name and array to a functor. template static void visit_arrays(mesh::primitive& Primitive, FunctorT Functor) { for(mesh::named_tables_t::iterator structure = Primitive.structure.begin(); structure != Primitive.structure.end(); ++structure) { for(mesh::named_arrays_t::iterator array = structure->second.begin(); array != structure->second.end(); ++array) Functor(structure->first, structure->second, array->first, array->second); } for(mesh::named_tables_t::iterator attributes = Primitive.attributes.begin(); attributes != Primitive.attributes.end(); ++attributes) { for(mesh::table_t::iterator array = attributes->second.begin(); array != attributes->second.end(); ++array) Functor(attributes->first, attributes->second, array->first, array->second); } } /// Iterates over every array in every generic primitive in the given mesh, passing the array name and array to a functor. template static void visit_arrays(const mesh& Mesh, FunctorT Functor) { for(mesh::primitives_t::const_iterator p = Mesh.primitives.begin(); p != Mesh.primitives.end(); ++p) visit_arrays(**p, Functor); } /// Iterates over every array in every generic primitive in the given mesh, passing the array name and array to a functor. template static void visit_arrays(mesh& Mesh, FunctorT Functor) { for(mesh::primitives_t::iterator p = Mesh.primitives.begin(); p != Mesh.primitives.end(); ++p) visit_arrays(p->writable(), Functor); } /// Combines two meshes by appending every point / primitive from one to the other. Primitive point indices are automatically /// offset to reflect the new position(s) of points in the combined mesh. Returns the range of point and primitive indices that were appended. static void append(const mesh& Source, mesh& Target, uint_t* const PointBegin = 0, uint_t* const PointEnd = 0, uint_t* const PrimitiveBegin = 0, uint_t* const PrimitiveEnd = 0); }; /// Stream serialization std::ostream& operator<<(std::ostream& Stream, const mesh& RHS); std::ostream& operator<<(std::ostream& Stream, const mesh::primitive& RHS); /// Specialization of difference::test for k3d::mesh namespace difference { inline void test(const k3d::mesh& A, const k3d::mesh& B, accumulator& Result) { A.difference(B, Result); } /// Specialization of difference::test for k3d::mesh::primitive inline void test(const k3d::mesh::primitive& A, const k3d::mesh::primitive& B, accumulator& Result) { A.difference(B, Result); } } // namespace difference } // namespace k3d #endif // !K3DSDK_MESH_H ================================================ FILE: k3dsdk/mesh_deformation_modifier.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { mesh_deformation_modifier::mesh_deformation_modifier(iplugin_factory& Factory, idocument& Document) : base(Factory, Document) { } void mesh_deformation_modifier::on_create_mesh(const mesh& Input, mesh& Output) { Output = Input; } void mesh_deformation_modifier::on_update_mesh(const mesh& Input, mesh& Output) { if(!Input.points) return; if(!Output.points) return; return_if_fail(Input.points->size() == Output.points->size()); geometry::selection::merge(m_mesh_selection.pipeline_value(), Output); return_if_fail(Output.point_selection); return_if_fail(Output.point_selection->size() == Output.points->size()); const mesh::points_t& input_points = *Input.points; const mesh::selection_t& selection = *Output.point_selection; mesh::points_t& output_points = Output.points.writable(); on_deform_mesh(Input, input_points, selection, output_points); } } // namespace k3d ================================================ FILE: k3dsdk/mesh_deformation_modifier.h ================================================ #ifndef K3DSDK_MESH_DEFORMATION_MODIFIER_H #define K3DSDK_MESH_DEFORMATION_MODIFIER_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Mesh modifier implementation for use in plugins that deform a mesh (modify its points) without altering topology. To create a plugin, derive from mesh_deformation_modifier and implement the on_deform_mesh() method. class mesh_deformation_modifier : public mesh_selection_sink > { typedef mesh_selection_sink > base; public: mesh_deformation_modifier(iplugin_factory& Factory, idocument& Document); private: void on_create_mesh(const mesh& Input, mesh& Output); void on_update_mesh(const mesh& Input, mesh& Output); /// Implement this method in derived classes and deform the output points as-desired. virtual void on_deform_mesh(const mesh& Input, const mesh::points_t& InputPoints, const mesh::selection_t& PointSelection, mesh::points_t& OutputPoints) = 0; }; } // namespace k3d #endif // !K3DSDK_MESH_DEFORMATION_MODIFIER_H ================================================ FILE: k3dsdk/mesh_modifier.h ================================================ #ifndef K3DSDK_MESH_MODIFIER_H #define K3DSDK_MESH_MODIFIER_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include namespace k3d { template class mesh_modifier : public base_t, public imesh_sink, public imesh_source { public: mesh_modifier(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_input_mesh(init_owner(*this) + init_name("input_mesh") + init_label(_("Input Mesh")) + init_description(_("Input mesh")) + init_value(0)), m_output_mesh(init_owner(*this) + init_name("output_mesh") + init_label(_("Output Mesh")) + init_description(_("Output mesh"))) { m_input_mesh.changed_signal().connect(make_reset_mesh_slot()); m_output_mesh.set_initialize_slot(sigc::mem_fun(*this, &mesh_modifier::initialize_mesh)); m_output_mesh.set_update_slot(sigc::mem_fun(*this, &mesh_modifier::update_mesh)); } iproperty& mesh_source_output() { return m_output_mesh; } iproperty& mesh_sink_input() { return m_input_mesh; } sigc::slot make_reset_mesh_slot() { return m_output_mesh.make_reset_slot(); } sigc::slot make_update_mesh_slot() { return m_output_mesh.make_update_slot(); } protected: k3d_data(mesh*, data::immutable_name, data::change_signal, data::no_undo, data::local_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_input_mesh; k3d_data(mesh*, data::immutable_name, data::change_signal, data::no_undo, data::pointer_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_output_mesh; private: void initialize_mesh(mesh& Output) { if(const mesh* const input = m_input_mesh.pipeline_value()) { base_t::document().pipeline_profiler().start_execution(*this, "Create Mesh"); on_create_mesh(*input, Output); base_t::document().pipeline_profiler().finish_execution(*this, "Create Mesh"); base_t::document().pipeline_profiler().start_execution(*this, "Update Mesh"); on_update_mesh(*input, Output); base_t::document().pipeline_profiler().finish_execution(*this, "Update Mesh"); } } void update_mesh(mesh& Output) { if(const mesh* const input = m_input_mesh.pipeline_value()) { base_t::document().pipeline_profiler().start_execution(*this, "Update Mesh"); on_update_mesh(*input, Output); base_t::document().pipeline_profiler().finish_execution(*this, "Update Mesh"); } } virtual void on_create_mesh(const mesh& Input, mesh& Output) = 0; virtual void on_update_mesh(const mesh& Input, mesh& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_MESH_MODIFIER_H ================================================ FILE: k3dsdk/mesh_painter_gl.h ================================================ #ifndef K3DSDK_MESH_PAINTER_GL_H #define K3DSDK_MESH_PAINTER_GL_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { namespace gl { /// Provides a boilerplate implementation of k3d::gl::imesh_painter class mesh_painter : public node, public imesh_painter { typedef node base; public: mesh_painter(iplugin_factory& Factory, idocument& Document) : base(Factory, Document), m_enabled(init_owner(*this) + init_name("enabled") + init_label(_("Enabled")) + init_description(_("Enable / disable drawing for this painter.")) + init_value(true)) { m_enabled.changed_signal().connect(make_async_redraw_slot()); } void paint_mesh(const mesh& Mesh, const painter_render_state& RenderState, iproperty::changed_signal_t& ChangedSignal) { if(m_enabled.pipeline_value()) on_paint_mesh(Mesh, RenderState, ChangedSignal); } void select_mesh(const mesh& Mesh, const painter_render_state& RenderState, const painter_selection_state& SelectionState, iproperty::changed_signal_t& ChangedSignal) { if(m_enabled.pipeline_value()) on_select_mesh(Mesh, RenderState, SelectionState, ChangedSignal); } protected: /// Returns a slot that will schedule an asynchronous screen update when called sigc::slot make_async_redraw_slot() { return sigc::mem_fun(*this, &mesh_painter::async_redraw); } /// Schedules an asynchronous screen update void async_redraw(ihint*) { redraw_all(document(), irender_viewport::ASYNCHRONOUS); } /// Implement this in derived classes to draw mesh components virtual void on_paint_mesh(const mesh& Mesh, const painter_render_state& RenderState, iproperty::changed_signal_t& ChangedSignal) { } /// Implement this in derived classes to draw mesh components for selection virtual void on_select_mesh(const mesh& Mesh, const painter_render_state& RenderState, const painter_selection_state& SelectionState, iproperty::changed_signal_t& ChangedSignal) { } /// Used to enable/disable the painter k3d_data(bool, data::immutable_name, data::change_signal, data::with_undo, data::local_storage, data::no_constraint, data::writable_property, data::with_serialization) m_enabled; }; } // namespace gl } // namespace k3d #endif // !K3DSDK_MESH_PAINTER_GL_H ================================================ FILE: k3dsdk/mesh_reader.h ================================================ #ifndef K3DSDK_MESH_READER_H #define K3DSDK_MESH_READER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // mesh_reader template class mesh_reader : public base_t, public imesh_source, public imesh_storage { public: iproperty& mesh_source_output() { return m_output_mesh; } void reset_mesh(mesh* const Mesh) { m_output_mesh.reset(Mesh); } /// Returns a slot that should be connected to input properties to signal that the output mesh has changed sigc::slot make_reload_mesh_slot() { return m_output_mesh.make_slot(); } protected: mesh_reader(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_file(init_owner(*this) + init_name("file") + init_label(_("File")) + init_description(_("Input file path.")) + init_value(filesystem::path()) + init_path_mode(ipath_property::READ) + init_path_type("")), m_center(init_owner(*this) + init_name("center") + init_label(_("Center on Origin")) + init_description(_("Center the output mesh around the origin.")) + init_value(true)), m_scale_to_size(init_owner(*this) + init_name("scale_to_size") + init_label(_("Scale to Size")) + init_description(_("Scale the output mesh to fit within a fixed-size bounding-box.")) + init_value(true)), m_size(init_owner(*this) + init_name("size") + init_label(_("Size")) + init_description(_("Output mesh size when \"Scale to Size\" is enabled.")) + init_value(10.0) + init_step_increment(0.1) + init_units(typeid(measurement::distance))), m_output_mesh(init_owner(*this) + init_name("output_mesh") + init_label(_("Output Mesh")) + init_description("Output mesh")) { m_file.changed_signal().connect(hint::converter< hint::convert >(make_reload_mesh_slot())); m_center.changed_signal().connect(hint::converter< hint::convert >(make_reload_mesh_slot())); m_scale_to_size.changed_signal().connect(hint::converter< hint::convert >(make_reload_mesh_slot())); m_size.changed_signal().connect(hint::converter< hint::convert >(make_reload_mesh_slot())); m_output_mesh.set_update_slot(sigc::mem_fun(*this, &mesh_reader::execute)); } /// Stores the input file path. k3d_data(filesystem::path, immutable_name, change_signal, with_undo, local_storage, no_constraint, watched_path_property, watched_path_serialization) m_file; /// Center the output mesh on the origin. k3d_data(bool_t, immutable_name, change_signal, with_undo, local_storage, no_constraint, writable_property, with_serialization) m_center; /// Scale the output mesh to fit within a fixed-size bounding-box. k3d_data(bool_t, immutable_name, change_signal, with_undo, local_storage, no_constraint, writable_property, with_serialization) m_scale_to_size; /// Stores the size of the bounding-box used with m_scale_to_size. k3d_data(double_t, immutable_name, change_signal, with_undo, local_storage, no_constraint, measurement_property, with_serialization) m_size; /// Stores the output mesh, which is created / updated on-demand. k3d_data(mesh*, immutable_name, change_signal, no_undo, pointer_demand_storage, no_constraint, read_only_property, no_serialization) m_output_mesh; private: /// Called whenever the output mesh has been modified and needs to be updated. /// Note that execution is unaffected by the types of hints we've received. void execute(const std::vector& Hints, mesh& Mesh) { // Start with an empty mesh ... Mesh = mesh(); const filesystem::path path = m_file.pipeline_value(); if(path.empty()) return; log() << info << "Loading " << path.native_console_string() << " using " << base_t::factory().name() << std::endl; if(!filesystem::exists(path)) { log() << error << "filesystem path " << path.native_console_string() << " doesn't exist" << std::endl; return; } base_t::document().pipeline_profiler().start_execution(*this, "Load Mesh"); on_load_mesh(path, Mesh); base_t::document().pipeline_profiler().finish_execution(*this, "Load Mesh"); base_t::document().pipeline_profiler().start_execution(*this, "Transform Mesh"); if(Mesh.points) { const bool_t center = m_center.pipeline_value(); const bool_t scale_to_size = m_scale_to_size.pipeline_value(); bounding_box3 bounding_box; matrix4 transformation = identity3(); mesh::points_t& output_points = Mesh.points.writable(); if(center || scale_to_size) bounding_box = mesh::bounds(output_points); if(center) { transformation = transformation * translate3(vector3( -0.5 * (bounding_box.px + bounding_box.nx), -0.5 * (bounding_box.py + bounding_box.ny), -0.5 * (bounding_box.pz + bounding_box.nz))); } if(scale_to_size) { const double_t current_size = std::max(bounding_box.width(), std::max(bounding_box.height(), bounding_box.depth())); if(current_size) transformation = scale3(m_size.pipeline_value() / current_size) * transformation; } const uint_t point_begin = 0; const uint_t point_end = output_points.size(); for(uint_t point = point_begin; point != point_end; ++point) output_points[point] = transformation * output_points[point]; } base_t::document().pipeline_profiler().finish_execution(*this, "Transform Mesh"); } /// Implement this in derived classes to read the input file and produce an output mesh. Note that the /// output mesh will be empty every time this method is called. virtual void on_load_mesh(const filesystem::path& Path, mesh& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_MESH_READER_H ================================================ FILE: k3dsdk/mesh_selection_modifier.h ================================================ #ifndef K3DSDK_MESH_SELECTION_MODIFIER_H #define K3DSDK_MESH_SELECTION_MODIFIER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { /// Mesh modifier implementation for use in plugins that alter the selection state of a mesh without altering its topology or geometry. To create a plugin, derive from mesh_selection_modifier and implement the on_select_mesh() method. template class mesh_selection_modifier : public base_t, public imesh_sink, public imesh_source { public: iproperty& mesh_source_output() { return m_output_mesh; } iproperty& mesh_sink_input() { return m_input_mesh; } /// Returns a slot that should be connected to input properties to signal that the output mesh has changed sigc::slot make_update_mesh_slot() { return m_output_mesh.make_slot(); } protected: mesh_selection_modifier(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_input_mesh(init_owner(*this) + init_name("input_mesh") + init_label(_("Input Mesh")) + init_description(_("Input mesh")) + init_value(0)), m_output_mesh(init_owner(*this) + init_name("output_mesh") + init_label(_("Output Mesh")) + init_description(_("Output mesh"))) { m_input_mesh.changed_signal().connect(hint::converter< hint::convert >(make_update_mesh_slot())); m_output_mesh.set_update_slot(sigc::mem_fun(*this, &mesh_selection_modifier::execute)); } /// Called whenever the output mesh has been modified and needs to be updated. void execute(const std::vector& Hints, mesh& Mesh) { // In our case, we don't have to worry about any hints, we just execute. if(const mesh* const input = m_input_mesh.pipeline_value()) { Mesh = *input; base_t::document().pipeline_profiler().start_execution(*this, "Update Selection"); on_update_selection(*input, Mesh); base_t::document().pipeline_profiler().finish_execution(*this, "Update Selection"); } } k3d_data(mesh*, immutable_name, change_signal, no_undo, local_storage, no_constraint, read_only_property, no_serialization) m_input_mesh; k3d_data(mesh*, immutable_name, change_signal, no_undo, pointer_demand_storage, no_constraint, read_only_property, no_serialization) m_output_mesh; private: /// Implement this method in derived classes and alter the output selection(s) as-desired. virtual void on_update_selection(const mesh& Input, mesh& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_MESH_SELECTION_MODIFIER_H ================================================ FILE: k3dsdk/mesh_selection_sink.h ================================================ #ifndef K3DSDK_MESH_SELECTION_SINK_H #define K3DSDK_MESH_SELECTION_SINK_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { template class mesh_selection_sink : public base_t, public imesh_selection_sink { public: mesh_selection_sink(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_mesh_selection(init_owner(*this) + init_name("mesh_selection") + init_label(_("Mesh Selection")) + init_description(_("Input Mesh Selection")) + init_value(selection::set())) { } iproperty& mesh_selection_sink_input() { return m_mesh_selection; } protected: k3d_data(selection::set, immutable_name, change_signal, with_undo, local_storage, no_constraint, writable_property, selection_set_serialization) m_mesh_selection; }; } // namespace k3d #endif // !K3DSDK_MESH_SELECTION_SINK_H ================================================ FILE: k3dsdk/mesh_simple_deformation_modifier.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { mesh_simple_deformation_modifier::mesh_simple_deformation_modifier(iplugin_factory& Factory, idocument& Document) : base(Factory, Document) { m_mesh_selection.changed_signal().connect(make_reset_mesh_slot()); } void mesh_simple_deformation_modifier::on_create_mesh(const mesh& Input, mesh& Output) { Output = Input; geometry::selection::merge(m_mesh_selection.pipeline_value(), Output); } void mesh_simple_deformation_modifier::on_update_mesh(const mesh& Input, mesh& Output) { if(!Input.points) return; if(!Output.points) return; return_if_fail(Input.points->size() == Output.points->size()); return_if_fail(Output.point_selection); return_if_fail(Output.point_selection->size() == Output.points->size()); const mesh::points_t& input_points = *Input.points; const mesh::selection_t& selection = *Output.point_selection; document().pipeline_profiler().start_execution(*this, "Copy points"); mesh::points_t& output_points = Output.points.writable(); document().pipeline_profiler().finish_execution(*this, "Copy points"); on_deform_mesh(input_points, selection, output_points); } } // namespace k3d ================================================ FILE: k3dsdk/mesh_simple_deformation_modifier.h ================================================ #ifndef K3DSDK_MESH_SIMPLE_DEFORMATION_MODIFIER_H #define K3DSDK_MESH_SIMPLE_DEFORMATION_MODIFIER_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { /// Mesh modifier implementation for use in plugins that deform a mesh (modify its points) without altering topology, and based solely on the input point positions and selection. To create a plugin, derive from mesh_simple_deformation_modifier and implement the on_deform_mesh() method. If you are only modifying points but need more information about the input mesh, consider using mesh_deformation_modifier instead. class mesh_simple_deformation_modifier : public mesh_selection_sink > { typedef mesh_selection_sink > base; public: mesh_simple_deformation_modifier(iplugin_factory& Factory, idocument& Document); private: void on_create_mesh(const mesh& Input, mesh& Output); void on_update_mesh(const mesh& Input, mesh& Output); /// Implement this method in derived classes and deform the output mesh using its input points and selection. virtual void on_deform_mesh(const mesh::points_t& InputPoints, const mesh::selection_t& PointSelection, mesh::points_t& OutputPoints) = 0; }; } // namespace k3d #endif // !K3DSDK_MESH_SIMPLE_DEFORMATION_MODIFIER_H ================================================ FILE: k3dsdk/mesh_sink.h ================================================ #ifndef K3DSDK_MESH_SINK_H #define K3DSDK_MESH_SINK_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { template class mesh_sink : public base_t, public imesh_sink { public: mesh_sink(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_input_mesh(init_owner(*this) + init_name("input_mesh") + init_label(_("Input Mesh")) + init_description(_("Input mesh")) + init_value(0)) { } iproperty& mesh_sink_input() { return m_input_mesh; } protected: k3d_data(mesh*, data::immutable_name, data::change_signal, data::no_undo, data::local_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_input_mesh; }; } // namespace k3d #endif // !K3DSDK_MESH_SINK_H ================================================ FILE: k3dsdk/mesh_source.h ================================================ #ifndef K3DSDK_MESH_SOURCE_H #define K3DSDK_MESH_SOURCE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { template class mesh_source : public base_t, public imesh_source { public: iproperty& mesh_source_output() { return m_output_mesh; } /// Returns a slot that should be connected to input properties to signal that the output has changed sigc::slot make_update_mesh_slot() { return m_output_mesh.make_slot(); } protected: mesh_source(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_output_mesh(init_owner(*this) + init_name("output_mesh") + init_label(_("Output Mesh")) + init_description("Output mesh")) { m_output_mesh.set_update_slot(sigc::mem_fun(*this, &mesh_source::execute)); } /// Stores the output mesh, which is created / updated on-demand. k3d_data(mesh*, immutable_name, change_signal, no_undo, pointer_demand_storage, no_constraint, read_only_property, no_serialization) m_output_mesh; private: /// Called whenever the output has been modified and needs to be updated. void execute(const std::vector& Hints, mesh& Mesh) { bool_t update_topology = false; bool_t update_geometry = false; for(uint_t i = 0; i != Hints.size(); ++i) { // Update our geometry ... if(dynamic_cast(Hints[i])) { update_geometry = true; } // In all other cases (mesh_topology_changed, unknown hint, or no hint), // we must assume the worst and recreate everything from scratch ... else { update_topology = true; update_geometry = true; break; } } if(update_topology) { base_t::document().pipeline_profiler().start_execution(*this, "Update Topology"); on_update_mesh_topology(Mesh); base_t::document().pipeline_profiler().finish_execution(*this, "Update Topology"); } if(update_geometry) { base_t::document().pipeline_profiler().start_execution(*this, "Update Geometry"); on_update_mesh_geometry(Mesh); base_t::document().pipeline_profiler().finish_execution(*this, "Update Geometry"); } } /// Implement this in derived classes to setup the topology of the output mesh. Note that the /// output mesh is empty the first time this method is called, but will retain its state thereafter, /// so implementations must be written to ensure that they don't simply append to the existing state. virtual void on_update_mesh_topology(mesh& Output) = 0; /// Implement this in derived classes to setup the geometry of the output mesh. virtual void on_update_mesh_geometry(mesh& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_MESH_SOURCE_H ================================================ FILE: k3dsdk/mesh_triangulate_detail.h ================================================ #ifndef K3DSDK_MESH_TRIANGULATE_DETAIL_H #define K3DSDK_MESH_TRIANGULATE_DETAIL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace detail { template class glu_triangulator_t { public: glu_triangulator_t(OutputFaceIterator OutputFaces, OutputPointIterator OutputPoints) : tessellator(sgiNewTess()), output_faces(OutputFaces), output_points(OutputPoints), current_face(0) { sgiTessCallback(tessellator, GLU_TESS_BEGIN_DATA, reinterpret_cast(&raw_begin)); sgiTessCallback(tessellator, GLU_TESS_VERTEX_DATA, reinterpret_cast(&raw_vertex)); sgiTessCallback(tessellator, GLU_TESS_COMBINE_DATA, reinterpret_cast(&raw_combine)); sgiTessCallback(tessellator, GLU_TESS_END_DATA, reinterpret_cast(&raw_end)); sgiTessCallback(tessellator, GLU_TESS_ERROR_DATA, reinterpret_cast(&raw_error)); } ~glu_triangulator_t() { sgiDeleteTess(tessellator); } void operator()(face& Face) { current_face = &Face; sgiTessBeginPolygon(tessellator, this); // Handle the main contour for the face ... sgiTessBeginContour(tessellator); for(split_edge* edge = Face.first_edge; edge && edge->face_clockwise; edge = edge->face_clockwise) { sgiTessVertex(tessellator, edge->vertex->position.n, edge->vertex); if(edge->face_clockwise == Face.first_edge) break; } sgiTessEndContour(tessellator); // Handle holes ... for(face::holes_t::const_iterator hole = Face.holes.begin(); hole != Face.holes.end(); ++hole) { sgiTessBeginContour(tessellator); for(split_edge* edge = *hole; edge && edge->face_clockwise; edge = edge->face_clockwise) { sgiTessVertex(tessellator, edge->vertex->position.n, edge->vertex); if(edge->face_clockwise == *hole) break; } sgiTessEndContour(tessellator); } sgiTessEndPolygon(tessellator); } private: void begin(GLenum Mode) { mode = Mode; v0 = v1 = v2 = 0; flip_strip = false; } void vertex(void* VertexData) { if(!v0) { v0 = v1; v1 = v2; } v2 = reinterpret_cast(VertexData); if(!v0) return; std::vector new_edges; switch(mode) { case GL_TRIANGLE_FAN: new_edges.push_back(new split_edge(v0)); new_edges.push_back(new split_edge(v1)); new_edges.push_back(new split_edge(v2)); break; case GL_TRIANGLE_STRIP: new_edges.push_back(new split_edge(v0)); new_edges.push_back(new split_edge(v1)); new_edges.push_back(new split_edge(v2)); if(flip_strip) std::reverse(new_edges.begin(), new_edges.end()); break; case GL_TRIANGLES: new_edges.push_back(new split_edge(v0)); new_edges.push_back(new split_edge(v1)); new_edges.push_back(new split_edge(v2)); break; } loop_edges(new_edges.begin(), new_edges.end()); face* const new_face = new face(*current_face); new_face->holes.clear(); new_face->first_edge = new_edges.front(); *output_faces++ = new_face; switch(mode) { case GL_TRIANGLE_FAN: v1 = v2; break; case GL_TRIANGLE_STRIP: v0 = v1; v1 = v2; flip_strip = !flip_strip; break; case GL_TRIANGLES: v0 = v1 = v2 = 0; break; } } void combine(GLdouble Coords[3], void* [4], GLfloat [4], void** OutputData) { point* const new_point = new point(point3(Coords[0], Coords[1], Coords[2])); *OutputData = new_point; *output_points++ = new_point; } void end() { } void error(GLenum ErrorNumber) { log() << k3d::error << k3d_file_reference << " " << gluErrorString(ErrorNumber) << std::endl; } static glu_triangulator_t* instance(void* UserData) { return reinterpret_cast(UserData); } static void raw_begin(GLenum Mode, void* UserData) { instance(UserData)->begin(Mode); } static void raw_vertex(void* VertexData, void* UserData) { instance(UserData)->vertex(VertexData); } static void raw_combine(GLdouble Coords[3], void* VertexData[4], GLfloat Weight[4], void** OutputData, void* UserData) { instance(UserData)->combine(Coords, VertexData, Weight, OutputData); } static void raw_end(void* UserData) { instance(UserData)->end(); } static void raw_error(GLenum ErrorNumber, void* UserData) { instance(UserData)->error(ErrorNumber); } SGItesselator* const tessellator; OutputFaceIterator output_faces; OutputPointIterator output_points; GLenum mode; point* v0; point* v1; point* v2; bool flip_strip; /// Stores a reference to the "current" face so data can be copied to child triangles face* current_face; }; } // namespace detail #endif // !K3DSDK_MESH_TRIANGULATE_DETAIL_H ================================================ FILE: k3dsdk/mesh_writer.h ================================================ #ifndef K3DSDK_MESH_WRITER_H #define K3DSDK_MESH_WRITER_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k3d.com) */ #include #include #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // mesh_writer template class mesh_writer : public base_t, public imesh_sink { public: iproperty& mesh_sink_input() { return m_input_mesh; } protected: mesh_writer(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_input_mesh(init_owner(*this) + init_name("input_mesh") + init_label(_("Input Mesh")) + init_description(_("Input mesh")) + init_value(0)), m_file(init_owner(*this) + init_name("file") + init_label(_("File")) + init_description(_("Output file path.")) + init_value(filesystem::path()) + init_path_mode(ipath_property::WRITE) + init_path_type("")) { m_input_mesh.changed_signal().connect(hint::converter< hint::convert >(make_write_file_slot())); m_file.changed_signal().connect(hint::converter< hint::convert >(make_write_file_slot())); } /// Slot to call when the file needs to be written sigc::slot make_write_file_slot() { return sigc::mem_fun(*this, &mesh_writer::write_file); } /// Stores the input mesh. k3d_data(mesh*, data::immutable_name, data::change_signal, data::no_undo, data::local_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_input_mesh; /// Stores the output file path. k3d_data(filesystem::path, immutable_name, change_signal, with_undo, local_storage, no_constraint, path_property, path_serialization) m_file; private: /// Called whenever our inputs have changed and it's time to write to disk. /// Note that execution is unaffected by the types of hints we've received. void write_file(ihint*) { const k3d::filesystem::path path = m_file.pipeline_value(); const k3d::mesh* const mesh = m_input_mesh.pipeline_value(); if(!mesh || path.empty()) return; log() << info << "Writing " << path.native_console_string() << " using " << base_t::factory().name() << std::endl; k3d::filesystem::ofstream stream(path); if(!stream) { k3d::log() << error << k3d_file_reference << ": error opening [" << path.native_console_string() << "] for writing." << std::endl; return; } base_t::document().pipeline_profiler().start_execution(*this, "Write Mesh"); on_write_mesh(*mesh, path, stream); base_t::document().pipeline_profiler().finish_execution(*this, "Write Mesh"); } /// Implement this in derived classes to write the given mesh to an output stream. Note that the output /// path is provided for reference only, all data must be written to the provided stream. virtual void on_write_mesh(const mesh& Input, const filesystem::path& OutputPath, std::ostream& Output) = 0; }; } // namespace k3d #endif // !K3DSDK_MESH_WRITER_H ================================================ FILE: k3dsdk/metadata.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace metadata { //////////////////////////////////////////////////////////////////////////////////////////// // storage void storage::set_metadata_value(const string_t& Name, const string_t& Value) { m_storage[Name] = Value; m_changed_signal.emit(); } void storage::set_metadata(const metadata_t& Values) { // Note ... we don't use insert() here because we want to overwrite any existing values for(metadata_t::const_iterator pair = Values.begin(); pair != Values.end(); ++pair) m_storage[pair->first] = pair->second; m_changed_signal.emit(); } storage::metadata_t storage::get_metadata() { return m_storage; } const string_t storage::get_metadata_value(const string_t& Name) { metadata_t::const_iterator pair = m_storage.find(Name); return pair != m_storage.end() ? pair->second : string_t(); } void storage::erase_metadata_value(const string_t& Name) { m_storage.erase(Name); m_changed_signal.emit(); } sigc::connection storage::connect_metadata_changed_signal(const sigc::slot& Slot) { return m_changed_signal.connect(Slot); } } // namespace metadata } // namespace k3d ================================================ FILE: k3dsdk/metadata.h ================================================ #ifndef K3DSDK_METADATA_H #define K3DSDK_METADATA_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace metadata { /// Provides a boilerplate implementation of imetadata class storage : public imetadata { public: void set_metadata_value(const string_t& Name, const string_t& Value); void set_metadata(const metadata_t& Values); metadata_t get_metadata(); const string_t get_metadata_value(const string_t& Name); void erase_metadata_value(const string_t& Name); sigc::connection connect_metadata_changed_signal(const sigc::slot& Slot); private: metadata_t m_storage; sigc::signal m_changed_signal; }; ////////////////////////////////////////////////////////////////////////////////////////// // property /// Wraps a k3d_data object to add metadata template class property : public property_t, public storage { public: template property(const init_t& Init) : property_t(Init) { } }; } // namespace metadata } // namespace k3d #endif // !K3DSDK_METADATA_H ================================================ FILE: k3dsdk/metadata_keys.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace metadata { namespace key { const string_t authors() { return "k3d:authors"; } const string_t copyright() { return "k3d:copyright"; } const string_t domain() { return "k3d:domain"; } const string_t role() { return "k3d:role"; } const string_t version() { return "k3d:version"; } } // namespace key namespace value { const string_t point_indices_domain() { return "k3d:point-indices"; } const string_t multi_line_text_role() { return "k3d:multi-line-text"; } const string_t selection_role() { return "k3d:selection"; } const string_t nurbs_knot_vector_role() { return "k3d:nurbs-knot-vector"; } } // namespace value } // namespace metadata } // namespace k3d ================================================ FILE: k3dsdk/metadata_keys.h ================================================ #ifndef K3DSDK_METADATA_KEYS_H #define K3DSDK_METADATA_KEYS_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace metadata { namespace key { /// Storage for a collection of authors const string_t authors(); /// Storage for a copyright notice const string_t copyright(); /// Metadata key "k3d:domain" is used to define the domain over which a value / collection of values is defined. /// It is commonly used with geometric primitives to specify that one array contains indices into another. const string_t domain(); /// Metadata key "k3d:role" is used to identify the purpose of an object beyond what can be inferred from its type. /// A common key value will be k3d::metadata::value::selection(), to identify arrays that hold selection state. const string_t role(); /// Metadata key "k3d:version" is used to store an arbitrary version string. It is typically associated with /// serialized K-3D documents in native XML format. const string_t version(); } // namespace key namespace value { /// Metadata value for use with "k3d:domain" that specifies the mesh point array. const string_t point_indices_domain(); /// Metadata value for use with "k3d:role" that specifies that a string can contain multiple lines of text. const string_t multi_line_text_role(); /// Metadata value for use with "k3d:role" that specifies that an array of floating-point values is a selection state. const string_t selection_role(); /// Metadata value for use with "k3d:role" that specifies that an array of floating-point values is a NURBS knot vector. const string_t nurbs_knot_vector_role(); } // namespace value } // namespace metadata } // namespace k3d #endif // !K3DSDK_METADATA_KEYS_H ================================================ FILE: k3dsdk/mime_types.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { namespace mime { ////////////////////////////////////////////////////////////////////////// // handler_iterator class handler_iterator { public: static handler_iterator begin() { static bool_t initialized = false; if(!initialized) { initialized = true; // Get the set of MIME-type handler factories ... factories = plugin::factory::lookup(); // Remove any factories that are missing load-order information ... for(plugin::factory::collection_t::iterator factory = factories.begin(); factory != factories.end(); ++factory) { if(!(**factory).metadata().count("k3d:load-order")) { k3d::log() << error << "MIME Type Handler [" << (**factory).name() << "] without k3d:load-order metadata will not be used" << std::endl; *factory = 0; continue; } } factories.erase(std::remove(factories.begin(), factories.end(), static_cast(0)), factories.end()); handlers.assign(factories.size(), static_cast(0)); // Sort factories by load-order ... std::sort(factories.begin(), factories.end(), load_order); } // Return a new iterator ... handler_iterator result; result.index = get_index(0); return result; } static handler_iterator end() { handler_iterator result; return result; } bool_t operator!=(const handler_iterator& other) const { return index != other.index; } handler_iterator& operator++() { if(!index) return *this; index = get_index(*index + 1); return *this; } imime_type_handler* operator->() const { return handlers[*index]; } private: boost::optional index; static bool_t load_order(iplugin_factory* a, iplugin_factory* b) { return from_string(a->metadata()["k3d:load-order"], 255) < from_string(b->metadata()["k3d:load-order"], 255); } static boost::optional get_index(const uint_t Index) { while(factories.size() > Index) { if(!handlers[Index]) handlers[Index] = plugin::create(*factories[Index]); if(handlers[Index]) return boost::optional(Index); factories.erase(factories.begin() + Index); handlers.erase(handlers.begin() + Index); } return boost::optional(); } static std::vector factories; static std::vector handlers; }; std::vector handler_iterator::factories; std::vector handler_iterator::handlers; //////////////////////////////////////////////////////////////////////////////////////////////////// // type type::type() { } const type type::lookup(const filesystem::path& File) { type return_type; handler_iterator end = handler_iterator::end(); for(handler_iterator handler = handler_iterator::begin(); handler != end; ++handler) { if(handler->identify_mime_type(File, return_type.value)) break; } return return_type; } const type type::lookup(const string_t& Data) { type return_type; handler_iterator end = handler_iterator::end(); for(handler_iterator handler = handler_iterator::begin(); handler != end; ++handler) { if(handler->identify_mime_type(Data, return_type.value)) break; } return return_type; } bool_t type::operator==(const string_t& RHS) const { return value == RHS; } bool_t type::operator==(const type& RHS) const { return value == RHS.value; } bool_t type::operator!=(const type& RHS) const { return value != RHS.value; } const string_t type::str() const { return value; } bool_t type::empty() const { return value.empty(); } type::operator bool_t() const { return value.empty(); } bool_t operator==(const string_t& LHS, const type& RHS) { return RHS == LHS; } } // namespace mime } // namespace k3d ================================================ FILE: k3dsdk/mime_types.h ================================================ #ifndef K3DSDK_MIME_TYPES_H #define K3DSDK_MIME_TYPES_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace filesystem { class path; } namespace mime { /// Defines storage for a MIME type (RFC 2046) class type { public: type(); /// Returns the MIME type of a file (could return an empty value if the file cannot be identified) static const type lookup(const filesystem::path& File); /// Returns the MIME type of a data stream (could return an empty value if the data cannot be identified) static const type lookup(const string_t& Data); bool_t operator==(const string_t&) const; bool_t operator==(const type&) const; bool_t operator!=(const type&) const; const string_t str() const; bool_t empty() const; operator bool_t() const; private: string_t value; }; bool_t operator==(const string_t&, const type&); } // namespace mime } // namespace k3d #endif // !K3DSDK_MIME_TYPES_H ================================================ FILE: k3dsdk/module.h ================================================ #ifndef K3DSDK_MODULE_H #define K3DSDK_MODULE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include ///////////////////////////////////////////////////////////////////////////// // K3D_MODULE_EXPORT #if defined K3D_ENABLE_SYMBOL_VISIBILITY #if defined K3D_COMPILER_GCC #define K3D_MODULE_EXPORT __attribute__ ((visibility("default"))) #elif defined K3D_COMPILER_MSVC #define K3D_MODULE_EXPORT __declspec(dllexport) #else #define K3D_MODULE_EXPORT #endif #else #define K3D_MODULE_EXPORT #endif ///////////////////////////////////////////////////////////////////////////// // K3D_MODULE_START /// Provides boilerplate for the required entry-point into all K-3D plugin modules #define K3D_MODULE_START(Registry) \ extern "C" { K3D_MODULE_EXPORT void register_k3d_plugins(k3d::iplugin_registry& Registry) { ///////////////////////////////////////////////////////////////////////////// // K3D_MODULE_END /// Provides boilerplate for the required entry-point into all K-3D plugin modules #define K3D_MODULE_END } } namespace k3d { /// Defines the signature for the register_k3d_plugins function that must be exported by all plugin modules typedef void (*register_plugins_entry_point)(iplugin_registry&); } // namespace k3d #endif // !K3DSDK_MODULE_H ================================================ FILE: k3dsdk/named_array_types.h ================================================ #ifndef K3DSDK_NAMED_ARRAY_TYPES_H #define K3DSDK_NAMED_ARRAY_TYPES_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { /// Enumerates all of the data types that can be stored using k3d::named_arrays. /// If you create a named array that stores a type not in this list, some operations will fail with runtime errors. typedef boost::mpl::vector22< bool_t, color, double_t, imaterial*, inode*, int16_t, int32_t, int64_t, int8_t, matrix4, normal3, point2, point3, point4, string_t, texture3, uint16_t, uint32_t, uint64_t, uint8_t, vector2, vector3 > named_array_types; } // namespace k3d #endif // !K3DSDK_NAMED_ARRAY_TYPES_H ================================================ FILE: k3dsdk/named_arrays.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { /////////////////////////////////////////////////////////////////////////// // named_arrays const array* named_arrays::lookup(const string_t& Name) const { const_iterator result = find(Name); return result == end() ? static_cast(0) : result->second.get(); } array* named_arrays::writable(const string_t& Name) { iterator result = find(Name); return result == end() ? static_cast(0) : &result->second.writable(); } named_arrays named_arrays::clone_types() const { named_arrays result; for(const_iterator array = begin(); array != end(); ++array) result.insert(std::make_pair(array->first, array->second->clone_type())); return result; } named_arrays named_arrays::clone() const { named_arrays result; for(const_iterator array = begin(); array != end(); ++array) result.insert(std::make_pair(array->first, array->second->clone())); return result; } void named_arrays::difference(const named_arrays& Other, difference::accumulator& Result) const { // If we have differing numbers of arrays, we definitely aren't equal Result.exact(size() == Other.size()); for(named_arrays::const_iterator a = begin(), b = Other.begin(); a != end() && b != Other.end(); ++a, ++b) { // Each pair of arrays must have equal names Result.exact(a->first == b->first); // Perform element-wise comparisons of the arrays a->second->difference(*b->second, Result); } } ////////////////////////////////////////////////////////////////////////////////////////////////////// // operator<< std::ostream& operator<<(std::ostream& Stream, const named_arrays& RHS) { for(named_arrays::const_iterator array_iterator = RHS.begin(); array_iterator != RHS.end(); ++array_iterator) { Stream << standard_indent << "\"" << array_iterator->first << "\" [" << array_iterator->second->type_string() << "] (" << array_iterator->second->size() << "):\n"; if(array_iterator->second->size()) Stream << push_indent << start_block() << *array_iterator->second << finish_block << pop_indent << "\n"; } return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/named_arrays.h ================================================ #ifndef K3DSDK_NAMED_ARRAYS_H #define K3DSDK_NAMED_ARRAYS_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { class array; /// Defines a heterogeneous collection of named, shared arrays. Arrays in the collection are not length-constrained. /// For a collection of arrays that all have the same length, see table. For a concrete list of the /// datatypes that can be stored using named_arrays, see k3d::named_array_types. class named_arrays : public std::map > { public: /// Creates a new array with given name and type, inserting it into the collection and returning a reference to the result. /** \note: An existing array with the same name will be replaced by the new array. */ template ArrayT& create(const string_t& Name) { ArrayT* const array = new ArrayT(); (*this)[Name].create(array); return *array; } /// Inserts a new array into the collection with the given name, returning a reference to the result. /** \note: An existing array with the same name will be replaced by the new array. */ template ArrayT& create(const string_t& Name, ArrayT* Array) { (*this)[Name].create(Array); return *Array; } /// Returns an existing array with the given name, or NULL if no matching array exists. const array* lookup(const string_t& Name) const; /// Returns an existing array with the given name and type, or NULL if no matching array exists. template const ArrayT* lookup(const string_t& Name) const { return dynamic_cast(lookup(Name)); } /// Returns an existing array with the given name, or NULL if no matching array exists. array* writable(const string_t& Name); /// Returns an existing array with the given name and type, or NULL if no matching array exists. template ArrayT* writable(const string_t& Name) { return dynamic_cast(writable(Name)); } /// Returns an object containing empty arrays with the same name and type as the originals. named_arrays clone_types() const; /// Returns an object containing deep copies of all the original arrays. named_arrays clone() const; /// Compares two collections using the imprecise semantics of difference::test(). void difference(const named_arrays& Other, difference::accumulator& Result) const; }; /// Serialization std::ostream& operator<<(std::ostream& Stream, const named_arrays& RHS); /// Specialization of difference::test for named_arrays namespace difference { inline void test(const named_arrays& A, const named_arrays& B, accumulator& Result) { A.difference(B, Result); } } // namespace difference } // namespace k3d #endif // !K3DSDK_NAMED_ARRAYS_H ================================================ FILE: k3dsdk/named_tables.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include namespace k3d { /////////////////////////////////////////////////////////////////////////// // named_tables const table* named_tables::lookup(const string_t& Name) const { const_iterator result = find(Name); return result == end() ? static_cast(0) : &result->second; } table* named_tables::writable(const string_t& Name) { iterator result = find(Name); return result == end() ? static_cast(0) : &result->second; } void named_tables::difference(const named_tables& Other, difference::accumulator& Result) const { // If we have differing numbers of tables, we definitely aren't equal Result.exact(size() == Other.size()); for(named_tables::const_iterator a = begin(), b = Other.begin(); a != end() && b != Other.end(); ++a, ++b) { // Each pair of tables must have equal names Result.exact(a->first == b->first); // Perform element-wise comparisons of the tables a->second.difference(b->second, Result); } } ///////////////////////////////////////////////////////////////////////////////// // operator<< std::ostream& operator<<(std::ostream& Stream, const named_tables& RHS) { for(named_tables::const_iterator attributes = RHS.begin(); attributes != RHS.end(); ++attributes) Stream << standard_indent << "table \"" << attributes->first << "\"\n" << push_indent << attributes->second << pop_indent << "\n"; return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/named_tables.h ================================================ #ifndef K3DSDK_NAMED_TABLES_H #define K3DSDK_NAMED_TABLES_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { /// Defines a collection of named table objects. The length of the individual /// table objects may vary. class named_tables : public std::map { public: /// Return an attribute_array by name, or NULL const table* lookup(const string_t& Name) const; /// Return an attribute_array by name, or NULL table* writable(const string_t& Name); /// Returns the difference between two collections, using the imprecise semantics of difference::test(). void difference(const named_tables& Other, difference::accumulator& Result) const; }; /// Serialization std::ostream& operator<<(std::ostream& Stream, const named_tables& RHS); /// Specialization of difference::test for k3d::named_tables namespace difference { inline void test(const named_tables& A, const named_tables& B, accumulator& Result) { A.difference(B, Result); } } // namespace difference } // namespace k3d #endif // !K3DSDK_NAMED_TABLES_H ================================================ FILE: k3dsdk/namespace_documentation.h ================================================ #ifndef K3DSDK_NAMESPACE_DOCUMENTATION_H #define K3DSDK_NAMESPACE_DOCUMENTATION_H /** \file \brief This do-nothing file is used to provide a central point for documenting the K-3D library namespaces for use with Doxygen \author Timothy M. Shead */ /// Namespace reserved for the boost library, see http://www.boost.org namespace boost { /// Namespace reserved for the boost filesystem library, see http://www.boost.org/libs/filesystem namespace filesystem {} /// Namespace reserved for the spirit parser framework, see http://spirit.sourceforge.net namespace spirit {} } /// Namespace reserved for the gdkmm C++ wrappers for GTK, see http://gtkmm.sourceforge.net namespace Gdk {} /// Namespace reserved for the glibmm C++ wrappers for glib, see http://gtkmm.sourceforge.net namespace Glib {} /// Namespace reserved for the gtkmm C++ wrappers for GTK, see http://gtkmm.sourceforge.net namespace Gtk {} /// Namespace reserved for K-3D plugin modules namespace module {} /// Namespace reserved for all public symbols in the K-3D SDK namespace k3d { /// Contains commonly-used plugin object class identifiers, so specific plugin objects can be instantiated namespace classes {} /// Contains constraint objects used with k3d::data and related objects namespace constraint {} /// Contains private implementation details for the k3d API namespace detail {} /// Contains a boost::spirit grammar and related objects for parsing numeric expressions namespace expression {} /// Contains functions and objects to simplify working with the OpenGL API, sese http://www.opengl.org namespace gl { /// Contains private implementation details of the k3d::gl API namespace detail {} } /// Contains private implementation details for the k3d API (deprecated, use k3d::detail for new code instead) namespace implementation_private {} /// Contains objects for use with libsigc++ signals namespace signal {} /// Contains objects for storing and converting real-world units-of-measure namespace measurement { /// Contains policy objects for converting between real-world units-of-measure namespace conversion {} } // namespace measurement /// Contains functions and classes used to make object serialization & persistence easier namespace persistence {} /// Contains functions and classes used to export easily-modifiable "properties" from objects namespace property {} /// Contains functions and classes used to generate RenderMan compatible descriptions of a document namespace ri { /// Contains private implementation details of the k3d::ri API namespace detail {} } /// Contains functions and classes for working with RenderMan Shading Language data namespace sl {} /// Contains functions and classes used to abstract away differences in operating systems / platforms namespace system {} /// Contains functions and classes for working with XML data namespace xml { /// Contains private implementation details of the k3d::xml API namespace detail {} } } // namespace k3d /// Namespace reserved for the libsigc++ signal library, see http://libsigc.sourceforge.net namespace sigc {} /// Namespace reserved for the libsigc++ signal library (compatibility layer), see http://libsigc.sourceforge.net namespace SigC {} /// Namespace reserved for the C++ Standard Library namespace std {} /// Namespace reserved for the ImageMagick C++ binding, see http://studio.imagemagick.org/Magick++ namespace Magick {} #endif // !K3DSDK_NAMESPACE_DOCUMENTATION_H ================================================ FILE: k3dsdk/network_render_farm.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include using namespace k3d::xml; #include #include #include //#include namespace k3d { namespace detail { /// Stores a reference to the global render farm instance inetwork_render_farm* g_render_farm = 0; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // network_render_frame class network_render_frame : public inetwork_render_frame { public: network_render_frame(const filesystem::path& JobPath, const string_t& Name) : m_Path(JobPath / filesystem::native_path(ustring::from_utf8(Name))) { if(!filesystem::create_directory(m_Path)) log() << error << "Error creating frame directory [" << m_Path.native_console_string() << "]" << std::endl; } ~network_render_frame() { for(commands_t::const_iterator command = m_commands.begin(); command != m_commands.end(); ++command) delete *command; } const filesystem::path add_file(const string_t& Name) { // Sanity checks ... assert_warning(Name.size()); // Make sure the filepath is unique ... unsigned long index = 0; string_t name = Name; while(std::count(m_files.begin(), m_files.end(), name)) name = Name + '-' + string_cast(++index); m_files.push_back(name); return m_Path / filesystem::generic_path(name); } void add_exec_command(const string_t& Binary, const environment& Environment, const arguments& Arguments) { // Sanity checks ... assert_warning(!Binary.empty()); m_commands.push_back(new exec_command(Binary, Environment, Arguments)); } void add_copy_command(const filesystem::path& Source, const filesystem::path& Target) { // Sanity checks ... assert_warning(!Source.empty()); assert_warning(!Target.empty()); m_commands.push_back(new copy_command(Source, Target)); } void add_view_command(const filesystem::path& File) { m_commands.push_back(new view_command(File)); } void write_control_file() { // Create the empty control file ... filesystem::ofstream file(m_Path / filesystem::generic_path("control.k3d")); // Create the XML document ... element xml_document("k3dml"); element& xml_frame = xml_document.append(element("frame")); for(commands_t::const_iterator command = m_commands.begin(); command != m_commands.end(); ++command) { if(exec_command* const exec = dynamic_cast(*command)) { element& xml_command = xml_frame.append(element("command")); element& xml_exec = xml_command.append(element("exec", attribute("binary", exec->m_binary))); element& xml_environment = xml_exec.append(element("environment")); for(environment::const_iterator variable = exec->m_environment.begin(); variable != exec->m_environment.end(); ++variable) { xml_environment.append(element("variable", attribute("name", variable->name), attribute("value", variable->value))); } element& xml_arguments = xml_exec.append(element("arguments")); for(arguments::const_iterator argument = exec->m_arguments.begin(); argument != exec->m_arguments.end(); ++argument) { xml_arguments.append(element("argument", attribute("value", argument->value))); } } else if(copy_command* const copy = dynamic_cast(*command)) { xml_frame.append(element("command", element("copy", attribute("source", copy->m_source.native_utf8_string().raw()), attribute("target", copy->m_target.native_utf8_string().raw())))); } else if(view_command* const view = dynamic_cast(*command)) { xml_frame.append(element("command", element("view", attribute("file", view->m_file.native_utf8_string().raw())))); } else { assert_not_reached(); } } // Write the document ... file << xml_document << std::endl; } void mark_ready() { // Create the empty "ready" status file ... filesystem::ofstream file(m_Path / filesystem::generic_path("ready")); // Boost::filesystem does not rename empty files file << "K-3D renderfarm status file"; } private: /// Stores the filesystem path for this job const filesystem::path m_Path; /// Stores the set of input files used during rendering typedef std::vector files_t; files_t m_files; /// Defines a command to be executed class command { public: virtual ~command() {} protected: command() {} command(const command&) {} command& operator=(const command&) { return *this; } }; class exec_command : public command { public: exec_command(const string_t& Binary, const environment& Environment, const arguments& Arguments) : m_binary(Binary), m_environment(Environment), m_arguments(Arguments) { } const string_t m_binary; const environment m_environment; const arguments m_arguments; }; class copy_command : public command { public: copy_command(const filesystem::path& Source, const filesystem::path& Target) : m_source(Source), m_target(Target) { } const filesystem::path m_source; const filesystem::path m_target; }; class view_command : public command { public: view_command(const filesystem::path& File) : m_file(File) { } const filesystem::path m_file; }; typedef std::vector commands_t; commands_t m_commands; }; ///////////////////////////////////////////////////////////////////////////// // network_render_job class network_render_job : public inetwork_render_job { public: network_render_job(const filesystem::path Path, const string_t JobName) : m_Path(Path / filesystem::generic_path(JobName)) { try { create_directory(m_Path); } catch(const std::exception& ex) { log() << error << k3d_file_reference << ": Error creating job directory [" << m_Path.native_console_string() << "]" << std::endl; } } inetwork_render_frame& create_frame(const string_t& FrameName) { m_frames.push_back(network_render_frame(m_Path, FrameName)); return m_frames.back(); } bool write_control_files() { // Create a control file for each frame ... std::for_each(m_frames.begin(), m_frames.end(), std::mem_fun_ref(&network_render_frame::write_control_file)); // Create the control file ... filesystem::ofstream file(m_Path / filesystem::generic_path("control.k3d")); // Create the XML document ... element document("k3dml"); // Write the document ... file << xml::declaration() << document << std::endl; return true; } bool mark_ready() { // Mark each frame as "ready" ... std::for_each(m_frames.begin(), m_frames.end(), std::mem_fun_ref(&network_render_frame::mark_ready)); // Create the "ready" status file ... filesystem::ofstream file(m_Path / filesystem::generic_path("ready")); // Boost::filesystem does not rename empty files file << "Status file." << std::ends; return true; } const string_t path() { return m_Path.native_utf8_string().raw(); } private: const filesystem::path m_Path; typedef std::list frames_t; frames_t m_frames; }; ///////////////////////////////////////////////////////////////////////////// // network_render_farm::implementation class network_render_farm::implementation { public: implementation(const filesystem::path& OptionsPath) : m_options_path(OptionsPath) { } inetwork_render_job& create_job(const string_t& JobName) { // Sanity checks ... assert_warning(JobName.size()); // Render farm path ... const filesystem::path job_path = options::get_path(options::path::render_farm()); // Ensure that the job gets a unique name ... unsigned long index = 0; string_t job_name(JobName); while(filesystem::exists(job_path / filesystem::generic_path(job_name))) job_name = JobName + '-' + string_cast(index++); m_jobs.push_back(network_render_job(job_path, job_name)); return m_jobs.back(); } void start_job(inetwork_render_job& Job) { // Make sure it's one of ours ... network_render_job* const job = dynamic_cast(&Job); return_if_fail(job); // Update control files for the job and all its frames ... if(!job->write_control_files()) { log() << error << "Error writing render job control files" << std::endl; return; } // Mark the job ready-to-run ... if(!job->mark_ready()) { log() << error << "Error marking render job ready" << std::endl; return; } // Start the local rendering process ... string_t commandline = "k3d-renderjob \""; commandline += job->path(); commandline += "\""; if(!system::spawn_async(commandline)) { log() << error << "Error starting render job " << commandline << std::endl; return; } } private: const filesystem::path m_options_path; typedef std::list jobs_t; jobs_t m_jobs; }; ///////////////////////////////////////////////////////////////////////////// // network_render_farm network_render_farm::network_render_farm(const filesystem::path& OptionsPath) : m_implementation(new implementation(OptionsPath)) { } network_render_farm::~network_render_farm() { delete m_implementation; } inetwork_render_job& network_render_farm::create_job(const string_t& JobName) { return m_implementation->create_job(JobName); } void network_render_farm::start_job(inetwork_render_job& Job) { m_implementation->start_job(Job); } ///////////////////////////////////////////////////////////////////////////// // set_network_render_farm void set_network_render_farm(inetwork_render_farm& RenderFarm) { return_if_fail(!detail::g_render_farm); detail::g_render_farm = &RenderFarm; } ///////////////////////////////////////////////////////////////////////////// // render_farm inetwork_render_farm& get_network_render_farm() { assert_critical(detail::g_render_farm); return *detail::g_render_farm; } } // namespace k3d ================================================ FILE: k3dsdk/network_render_farm.h ================================================ #ifndef K3DSDK_NETWORK_RENDER_FARM_H #define K3DSDK_NETWORK_RENDER_FARM_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { class inetwork_render_farm; /// Returns a reference to the global singleton render farm object inetwork_render_farm& get_network_render_farm(); } // namespace k3d #endif // !K3DSDK_NETWORK_RENDER_FARM_H ================================================ FILE: k3dsdk/network_render_farm_detail.h ================================================ #ifndef K3DSDK_NETWORK_RENDER_FARM_DETAIL_H #define K3DSDK_NETWORK_RENDER_FARM_DETAIL_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // network_render_farm class network_render_farm : public inetwork_render_farm { public: network_render_farm(const filesystem::path& OptionsPath); ~network_render_farm(); inetwork_render_job& create_job(const string_t& JobName); void start_job(inetwork_render_job& Job); private: class implementation; implementation* const m_implementation; }; /// Call this once at startup to register the global singleton render farm implementation - note: does not take control of the given object's lifetime. void set_network_render_farm(inetwork_render_farm& RenderFarm); } // namespace k3d #endif // !K3DSDK_NETWORK_RENDER_FARM_DETAIL_H ================================================ FILE: k3dsdk/ngui/CMakeLists.txt ================================================ PROJECT(k3dsdk-ngui) FILE(GLOB HEADERS *.h) FILE(GLOB SOURCES *.cpp) LIST(SORT HEADERS) LIST(SORT SOURCES) INCLUDE_DIRECTORIES(${k3d_SOURCE_DIR}) INCLUDE_DIRECTORIES(${k3dsdk_BINARY_DIR}) INCLUDE_DIRECTORIES(${k3dsdk_BINARY_DIR}) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_GLIBMM_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_GTKGLEXT_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_GTKMM_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_SIGC_INCLUDE_DIRS}) LINK_DIRECTORIES(${K3D_GTKGLEXT_LIB_DIRS}) LINK_DIRECTORIES(${K3D_GTKMM_LIB_DIRS}) LINK_DIRECTORIES(${K3D_SIGC_LIB_DIRS}) K3D_ADD_LIBRARY(k3dsdk-ngui SHARED ${HEADERS} ${SOURCES}) K3D_GENERATE_DEF_FILE(k3dsdk-ngui) TARGET_LINK_LIBRARIES(k3dsdk-ngui k3dsdk) TARGET_LINK_LIBRARIES(k3dsdk-ngui k3dsdk-opengl) TARGET_LINK_LIBRARIES(k3dsdk-ngui ${K3D_GLIBMM_LIBS}) TARGET_LINK_LIBRARIES(k3dsdk-ngui ${K3D_GTKGLEXT_LIBS}) TARGET_LINK_LIBRARIES(k3dsdk-ngui ${K3D_GTKMM_LIBS}) IF(K3D_ENABLE_NLS) INCLUDE_DIRECTORIES(${K3D_INTL_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(k3dsdk-ngui ${K3D_INTL_LIBS}) ENDIF(K3D_ENABLE_NLS) INSTALL(TARGETS k3dsdk-ngui RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) ================================================ FILE: k3dsdk/ngui/angle_axis.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace angle_axis { namespace detail { /// Adapts a k3d::iproperty object for use with angle_axis::control class data_proxy : public idata_proxy { public: data_proxy(k3d::iproperty& Property, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_property(Property) { assert(Property.property_type() == typeid(k3d::angle_axis)); } const k3d::angle_axis value() { return boost::any_cast(m_property.property_internal_value()); } void set_value(const k3d::angle_axis& Value) { k3d::iwritable_property* const writable_property = dynamic_cast(&m_property); return_if_fail(writable_property); writable_property->property_set_value(boost::any(Value)); } changed_signal_t& changed_signal() { return m_property.property_changed_signal(); } private: k3d::iproperty& m_property; }; } // namespace detail /// Adapts a spin button to control a single angle_axis coordinate (indentified by index) class spin_button_model : public spin_button::imodel { public: spin_button_model(angle_axis::idata_proxy& Data, const unsigned int Index) : m_data(Data), m_index(Index) { assert_warning(m_index < 3); } const Glib::ustring label() { return ""; } k3d::bool_t writable() { return true; } k3d::double_t value() { k3d::quaternion quat(m_data.value()); return k3d::euler_angles(quat, k3d::euler_angles::XYZstatic)[m_index]; } void set_value(const double Value) { k3d::quaternion quaternion(m_data.value()); k3d::euler_angles eulerangles(quaternion, k3d::euler_angles::XYZstatic); eulerangles[m_index] = Value; m_data.set_value(k3d::angle_axis(k3d::quaternion(eulerangles))); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_data.changed_signal().connect(sigc::hide(Slot)); } k3d::double_t step_increment() { return k3d::radians(1.0); } const std::type_info& units() { return typeid(k3d::measurement::angle); } private: angle_axis::idata_proxy& m_data; const unsigned int m_index; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : base(3, 3, false), m_data(std::move(Data)), m_reset_button(new Gtk::Button(_("Reset"))) { spin_button::control* const x = new spin_button::control(new spin_button_model(*m_data, 0), m_data->state_recorder); spin_button::control* const y = new spin_button::control(new spin_button_model(*m_data, 1), m_data->state_recorder); spin_button::control* const z = new spin_button::control(new spin_button_model(*m_data, 2), m_data->state_recorder); attach(*Gtk::manage(new Gtk::Label(_("X"))), 0, 1, 0, 1); attach(*Gtk::manage(x), 1, 2, 0, 1); attach(*Gtk::manage(new Gtk::Label(_("Y"))), 0, 1, 1, 2); attach(*Gtk::manage(y), 1, 2, 1, 2); attach(*Gtk::manage(new Gtk::Label(_("Z"))), 0, 1, 2, 3); attach(*Gtk::manage(z), 1, 2, 2, 3); attach(*Gtk::manage(m_reset_button << connect_button(sigc::mem_fun(*this, &control::on_reset))), 2, 3, 1, 2); } void control::on_reset() { return_if_fail(m_data.get()); // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_data->set_value(k3d::angle_axis(0, k3d::point3(1, 0, 0))); // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), m_data->change_message + " reset", K3D_CHANGE_SET_CONTEXT); } ///////////////////////////////////////////////////////////////////////////// // proxy std::unique_ptr proxy(k3d::iproperty& Property, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new detail::data_proxy(Property, StateRecorder, ChangeMessage)); } } // namespace angle_axis } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/angle_axis.h ================================================ #ifndef K3DSDK_NGUI_ANGLE_AXIS_H #define K3DSDK_NGUI_ANGLE_AXIS_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace Gtk { class Button; } namespace k3d { class ihint; } namespace k3d { class iproperty; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace angle_axis { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a orientation control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Called to return the underlying data value virtual const k3d::angle_axis value() = 0; /// Called to set a new data value virtual void set_value(const k3d::angle_axis& Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for modifying the orientation of an object class control : public Gtk::Table { typedef Gtk::Table base; public: control(std::unique_ptr Data); private: /// Called to reset the object orientation to the origin void on_reset(); /// Stores a reference to the underlying data object std::unique_ptr m_data; /// Stores the reset button Gtk::Button* const m_reset_button; }; ///////////////////////////////////////////////////////////////////////////// // proxy /// Convenience factory function for creating k3d::spin_button::idata_proxy objects, specialized for k3d::iproperty std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()); } // namespace angle_axis } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_ANGLE_AXIS_H ================================================ FILE: k3dsdk/ngui/application_state.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include using namespace k3d::ngui; namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // application_state::implementation class application_state::implementation : public sigc::trackable { public: implementation() : m_custom_layouts(true), m_assign_hotkeys(false) { } /// Used to keep documents sorted in the "safe to close" dialog struct sort_by_title { bool operator()(const safe_close_dialog::entry& LHS, const safe_close_dialog::entry& RHS) { return LHS.document->unsaved_document_title() < RHS.document->unsaved_document_title(); } }; typedef sigc::signal safe_close_signal_t; /// Signal that will be emitted prior to safe shutdown to "gather" unsaved documents safe_close_signal_t m_safe_close_signal; /// Stores the user-customizable UI layouts state bool m_custom_layouts; /// Stores the current global assign hotkeys state bool m_assign_hotkeys; }; //////////////////////////////////////////////////////////////////////////// // application_state application_state& application_state::instance() { static application_state* g_instance = 0; if(!g_instance) g_instance = new application_state(); return *g_instance; } application_state::application_state() : m_implementation(new implementation()) { } application_state::~application_state() { delete m_implementation; } sigc::connection application_state::connect_safe_close_signal(const sigc::slot& Slot) { return m_implementation->m_safe_close_signal.connect(Slot); } bool application_state::safe_close(Gtk::Window& Parent) { if(k3d::batch_mode()) return k3d::application().exit(); safe_close_dialog::entries_t entries; implementation::safe_close_signal_t::slot_list_type slots = m_implementation->m_safe_close_signal.slots(); for(implementation::safe_close_signal_t::slot_list_type::iterator slot = slots.begin(); slot != slots.end(); ++slot) { unsaved_document* doc = (*slot)(); if(doc && doc->unsaved_changes()) entries.push_back(safe_close_dialog::entry(doc)); } if(!entries.empty()) { std::sort(entries.begin(), entries.end(), implementation::sort_by_title()); switch(safe_close_dialog::run(Parent, entries)) { case Gtk::RESPONSE_NONE: case Gtk::RESPONSE_CANCEL: case Gtk::RESPONSE_DELETE_EVENT: return false; case Gtk::RESPONSE_CLOSE: return k3d::application().exit(); case Gtk::RESPONSE_OK: for(safe_close_dialog::entries_t::const_iterator entry = entries.begin(); entry != entries.end(); ++entry) { if(entry->save) { if(!entry->document->save_unsaved_changes()) return false; } } return k3d::application().exit(); } } return k3d::application().exit(); } void application_state::enable_custom_layouts(const bool Enabled) { m_implementation->m_custom_layouts = Enabled; } const bool application_state::custom_layouts() { return m_implementation->m_custom_layouts; } void application_state::enable_hotkey_assignment(const bool Enabled) { m_implementation->m_assign_hotkeys = Enabled; } const bool application_state::assign_hotkeys() { return m_implementation->m_assign_hotkeys; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/application_state.h ================================================ #ifndef K3DSDK_NGUI_APPLICATION_STATE_H #define K3DSDK_NGUI_APPLICATION_STATE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace Gtk { class Window; } namespace k3d { namespace ngui { class unsaved_document; } } namespace k3d { namespace ngui { /// This ugly little fellow stores global (application-wide) user interface state in one place to minimize coupling between UI components class application_state { public: /// Singleton access to the global application_state object static application_state& instance(); /// Connects a slot to a signal that will be called prior to safe shutdown. sigc::connection connect_safe_close_signal(const sigc::slot& Slot); /// Attempts to safely close the application, saving unsaved documents and giving the user a chance to cancel. Returns true iff the application will close. bool safe_close(Gtk::Window& Parent); /// Enables / disables use of user-customized UI layouts void enable_custom_layouts(const bool Enabled = true); /// Returns true if user-customized UI layouts are enabled const bool custom_layouts(); /// Enables / disables interactive hotkey assignment void enable_hotkey_assignment(const bool Enabled = true); /// Returns true if dynamic hotkey assignment is enabled const bool assign_hotkeys(); private: application_state(); application_state(const application_state&); application_state& operator=(const application_state&); ~application_state(); class implementation; implementation* const m_implementation; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_APPLICATION_STATE_H ================================================ FILE: k3dsdk/ngui/application_window.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // application_window application_window::application_window() : base(Gtk::WINDOW_TOPLEVEL) { k3d::application().connect_close_signal(sigc::mem_fun(*this, &application_window::close)); } bool application_window::on_key_press_event(GdkEventKey* event) { if(event->keyval == GDK_Escape) { close(); return true; } return base::on_key_press_event(event); } bool application_window::on_delete_event(GdkEventAny* event) { close(); return true; } void application_window::close() { on_close(); delete this; } void application_window::on_close() { } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/application_window.h ================================================ #ifndef K3DSDK_NGUI_APPLICATION_WINDOW_H #define K3DSDK_NGUI_APPLICATION_WINDOW_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // application_window /// Provides a standard top-level window that will be closed automatically if the application is closed class application_window : public Gtk::Window { typedef Gtk::Window base; public: application_window(); virtual ~application_window() {} bool on_key_press_event(GdkEventKey* event); bool on_delete_event(GdkEventAny* event); /// Closes the window void close(); private: /// Override in derived classes to handle cleanup when the window is closed virtual void on_close(); }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_APPLICATION_WINDOW_H ================================================ FILE: k3dsdk/ngui/asynchronous_update.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // asynchronous_update asynchronous_update::asynchronous_update() : m_block_updates(false) { } asynchronous_update::~asynchronous_update() { } void asynchronous_update::schedule_update() { if(!m_idle_connection.connected()) m_idle_connection = Glib::signal_idle().connect(sigc::mem_fun(*this, &asynchronous_update::on_idle)); } void asynchronous_update::block_updates() { m_block_updates = true; } void asynchronous_update::unblock_updates() { m_block_updates = false; } bool asynchronous_update::on_idle() { if(!m_block_updates) on_update(); m_idle_connection.disconnect(); return false; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/asynchronous_update.h ================================================ #ifndef K3DSDK_NGUI_ASYNCHRONOUS_UPDATE_H #define K3DSDK_NGUI_ASYNCHRONOUS_UPDATE_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // asynchronous_update /// Mixin class that can be used to schedule updates that will only occur when the UI is idle class asynchronous_update : public virtual sigc::trackable { public: asynchronous_update(); virtual ~asynchronous_update(); /// Call this to schedule an update that will occur when the UI is idle ... multiple calls will result in only one update. void schedule_update(); /// Call this to block any pending updates so that on_update() won't be called void block_updates(); /// Call this to unblock updates so that on_update() will be called normally once again. note: any updates that were pending when block_updates() was called are lost void unblock_updates(); /// Implement this in your derived class to handle updates when the UI is idle. virtual void on_update() = 0; private: /// Called by the signal system when the UI is idle bool on_idle(); /// Used to track pending idle events sigc::connection m_idle_connection; /// If true, calls to on_update() are disabled bool m_block_updates; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_ASYNCHRONOUS_UPDATE_H ================================================ FILE: k3dsdk/ngui/auto_property_page.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // Not strictly required to compile, but this #include ensures that we have a std::typeinfo for k3d::mesh that matches the SDK (i.e. we don't break the ODR) #include #include #include #include #include namespace k3d { namespace ngui { namespace auto_property_page { /////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation(document_state& DocumentState) : m_document_state(DocumentState) { } void set_properties(const objects_t& Objects) { iproperty_group_collection::groups_t final_groups; if(Objects.size() == 1) // As a special case when displaying a single object ... { // Get the node properties, grouped together ... if(iproperty_collection* const property_collection = dynamic_cast(Objects[0])) { iproperty_group_collection::group builtin_properties(_("Builtin Properties")); iproperty_group_collection::group user_properties(_("User Properties")); const iproperty_collection::properties_t properties = property_collection->properties(); for(iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { if(dynamic_cast(*property)) user_properties.properties.push_back(*property); else builtin_properties.properties.push_back(*property); } if(iproperty_group_collection* const property_group_collection = dynamic_cast(Objects[0])) { const iproperty_group_collection::groups_t groups = property_group_collection->property_groups(); for(iproperty_group_collection::groups_t::const_iterator group = groups.begin(); group != groups.end(); ++group) { for(iproperty_collection::properties_t::const_iterator property = group->properties.begin(); property != group->properties.end(); ++property) { builtin_properties.properties.erase( std::remove(builtin_properties.properties.begin(), builtin_properties.properties.end(), *property), builtin_properties.properties.end()); } if(!group->properties.empty()) final_groups.push_back(*group); } } if(!builtin_properties.properties.empty()) final_groups.insert(final_groups.begin(), builtin_properties); if(!user_properties.properties.empty()) final_groups.push_back(user_properties); } } else // Display multiple objects ... { // For each object ... for(objects_t::const_iterator object = Objects.begin(); object != Objects.end(); ++object) { // Create a property group ... iproperty_group_collection::group group(_("Unknown object type")); // Assign the group a name based on the node name or the factory name ... if(inode* const node = dynamic_cast(*object)) { group.name = node->name(); if(group.name.empty()) group.name = node->factory().name(); } if(iproperty_collection* const property_collection = dynamic_cast(*object)) group.properties = property_collection->properties(); final_groups.push_back(group); } } set_properties(final_groups); } void set_properties(const iproperty_group_collection::groups_t& PropertyGroups) { // Delete existing controls ... Glib::ListHandle children = m_vbox.get_children(); std::for_each(children.begin(), children.end(), delete_object()); istate_recorder* const state_recorder = &m_document_state.document().state_recorder(); for(iproperty_group_collection::groups_t::const_iterator group = PropertyGroups.begin(); group != PropertyGroups.end(); ++group) { collapsible_frame::control* const frame = new collapsible_frame::control(group->name, m_collapsible_frame_group); frame->get_accessible()->set_name(group->name); m_vbox.pack_start(*manage(frame), Gtk::PACK_SHRINK); Gtk::Table* const table = new Gtk::Table(group->properties.size(), 5, false); frame->add(*manage(table)); // Store entries for focus chain within table std::list entry_list; const unsigned long prop_delete_begin = 0; const unsigned long prop_delete_end = 1; const unsigned long prop_button_begin = 1; const unsigned long prop_button_end = 2; const unsigned long prop_label_begin = 2; const unsigned long prop_label_end = 3; const unsigned long prop_control_begin = 3; const unsigned long prop_control_end = 4; // For each property within the group ... unsigned int row = 0; for(unsigned int i = 0; i != group->properties.size(); ++i, ++row) { iproperty& property = *group->properties[i]; const string_t property_name = property.property_name(); const std::type_info& property_type = property.property_type(); // Provide a property button for the property ... table->attach(*Gtk::manage( new property_button::control(property_widget::proxy(m_document_state,property))), prop_button_begin, prop_button_end, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); // Provide a label for the property ... table->attach(*Gtk::manage( new property_label::control(property_widget::proxy(m_document_state, property))), prop_label_begin, prop_label_end, row, row + 1, Gtk::FILL | Gtk::SHRINK, Gtk::FILL | Gtk::SHRINK); // Keep track of the control that's created (if any) ... Gtk::Widget* control = 0; // Look for custom property controls that match our property role ... if(!control) { // Look for an explicit property role ... if(imetadata* const property_metadata = dynamic_cast(&property)) { const string_t property_control_role = property_metadata->get_metadata()[k3d::metadata::key::role()]; if(property_control_role.size()) { // Now see if we can find a custom property control that matches the role ... static plugin::factory::collection_t control_factories = plugin::factory::lookup("ngui:component-type", "property-control"); for(plugin::factory::collection_t::const_iterator factory = control_factories.begin(); factory != control_factories.end(); ++factory) { if((**factory).metadata()["ngui:property-role"] != property_control_role) continue; if(custom_property::control* const custom_control = plugin::create(**factory)) { if(control = dynamic_cast(custom_control)) { custom_control->initialize(m_document_state, property); } else { k3d::log() << error << "custom property control must derive from Gtk::Widget" << std::endl; } } else { k3d::log() << error << "error creating custom property control" << std::endl; } break; } } } } // Look for custom property controls that match our property type ... if(!control) { // Get the C++ property type ... const string_t property_control_type = k3d::type_string(property_type); if(property_control_type.size()) { // Now see if we can find a custom property control that matches the type ... static plugin::factory::collection_t control_factories = plugin::factory::lookup("ngui:component-type", "property-control"); for(plugin::factory::collection_t::const_iterator factory = control_factories.begin(); factory != control_factories.end(); ++factory) { if((**factory).metadata()["ngui:property-type"] != property_control_type) continue; if(custom_property::control* const custom_control = plugin::create(**factory)) { if(control = dynamic_cast(custom_control)) { custom_control->initialize(m_document_state, property); } else { k3d::log() << error << "custom property control must derive from Gtk::Widget" << std::endl; } } else { k3d::log() << error << "error creating custom property control" << std::endl; } break; } } } // Otherwise, provide our own hard-wired controls based on property type ... if(!control) { // Boolean properties ... if(property_type == typeid(bool_t)) { control = new check_button::control(check_button::proxy(property, state_recorder, property_name)); } // Scalar properties ... else if(property_type == typeid(int32_t) || property_type == typeid(uint32_t) || property_type == typeid(float_t) || property_type == typeid(double_t)) { control = new spin_button::control(spin_button::model(property), state_recorder); } // Color properties ... else if(property_type == typeid(color)) { control = new color_chooser::control(color_chooser::proxy(property, state_recorder, property_name)); } // String properties ... else if(property_type == typeid(string_t)) { if(dynamic_cast(&property)) { control = new enumeration_chooser::control(enumeration_chooser::model(property), state_recorder); } else if(dynamic_cast(&property)) { control = new script_button::control(script_button::model(property), state_recorder, property_name); } else if(ilist_property* const list_property = dynamic_cast*>(&property)) { combo_box::control* const combo_box = new combo_box::control(combo_box::proxy(property, state_recorder, property_name)); combo_box->set_values(list_property->property_values()); control = combo_box; } else { if(imetadata* const metadata = dynamic_cast(&property)) { imetadata::metadata_t property_metadata = metadata->get_metadata(); if(property_metadata["k3d:property-type"] == "k3d:multi-line-text") { control = new text::control(text::model(property), state_recorder); } } if(!control) { control = new entry::control(entry::model(property), state_recorder); } } } // inode* properties ... else if(property_type == typeid(inode*)) { control = new node_chooser::control(node_chooser::proxy(m_document_state, property, state_recorder, property_name), node_chooser::filter(property)); } else if(property_type == typeid(inode_collection_property::nodes_t)) { control = new node_collection_chooser::control(node_collection_chooser::model(property), state_recorder); } // Bitmap properties ... else if(property_type == type_id_k3d_bitmap_ptr()) { control = new bitmap_preview::control(bitmap_preview::proxy(property)); } // Filesystem-path properties ... else if(property_type == typeid(filesystem::path)) { control = new path_chooser::control(path_chooser::proxy(property, state_recorder, property_name)); } // bounding_box3 properties ... else if(property_type == typeid(bounding_box3)) { control = new bounding_box::control(bounding_box::proxy(property)); } // point3 properties ... else if(property_type == typeid(point3) || property_type == typeid(vector3) || property_type == typeid(normal3)) { control = new point::control(point::proxy(property)); } // angle_axis properties ... else if(property_type == typeid(k3d::angle_axis)) { control = new k3d::ngui::angle_axis::control(k3d::ngui::angle_axis::proxy(property, state_recorder, property_name)); } // Transformation properties ... else if(property_type == typeid(matrix4)) { } // Mesh properties ... else if(property_type == typeid(mesh*)) { } // HPoint properties ... else if(property_type == typeid(point4)) { } // Pipeline-profiler records ... else if(property_type == typeid(std::map >)) { } else { log() << warning << k3d_file_reference << "unknown property type: " << property_type.name() << " name: " << property_name << std::endl; } } // Pack the new control into the rest of the UI if(control) { control->get_accessible()->set_name(property_name + "_control"); table->attach(*manage(control), prop_control_begin, prop_control_end, row, row + 1, Gtk::FILL | Gtk::SHRINK, Gtk::FILL | Gtk::SHRINK); entry_list.push_back(control); } // Provide a "delete" button for user properties ... if(dynamic_cast(&property)) { iproperty_collection* const property_collection = dynamic_cast(property.property_node()); Gtk::Button* const control = button::create(*Gtk::manage(new Gtk::Image(Gtk::Stock::DELETE, Gtk::ICON_SIZE_BUTTON))) << connect_button(sigc::bind(sigc::bind(sigc::mem_fun(*this, &implementation::on_delete_user_property), &property), property_collection)) << set_tooltip(_("Delete user property (no undo)")); table->attach(*manage(control), prop_delete_begin, prop_delete_end, row, row + 1, Gtk::SHRINK, Gtk::SHRINK); } } // Set focus chain ... table->set_focus_chain(entry_list); } // Display everything ... m_vbox.show_all(); } void on_delete_user_property(iproperty_collection* Collection, iproperty* Property) { return_if_fail(Collection); return_if_fail(Property); return_if_fail(dynamic_cast(Property)); record_state_change_set change_set(m_document_state.document(), "Delete user property", K3D_CHANGE_SET_CONTEXT); if(m_document_state.document().state_recorder().current_change_set()) m_document_state.document().state_recorder().current_change_set()->record_old_state(new user::property_container(*Collection)); Collection->unregister_property(*Property); if(ipersistent* const persistent = dynamic_cast(Property)) { if(ipersistent_collection* const persistent_collection = dynamic_cast(Collection)) persistent_collection->disable_serialization(*persistent); } undoable_delete(Property, m_document_state.document()); if(m_document_state.document().state_recorder().current_change_set()) m_document_state.document().state_recorder().current_change_set()->record_new_state(new user::property_container(*Collection)); } document_state& m_document_state; /// Stores the collection of property controls Gtk::VBox m_vbox; /// Groups collapsible frames together collapsible_frame::group m_collapsible_frame_group; }; /////////////////////////////////////////////////////////////////////////// // control control::control(document_state& DocumentState) : m_implementation(new implementation(DocumentState)) { } control::~control() { delete m_implementation; } void control::set_properties(iunknown* Object) { m_implementation->set_properties(objects_t(1, Object)); } void control::set_properties(const objects_t& Objects) { m_implementation->set_properties(Objects); } void control::set_properties(const iproperty_group_collection::groups_t& PropertyGroups) { m_implementation->set_properties(PropertyGroups); } Gtk::Widget& control::get_widget() { return m_implementation->m_vbox; } } // namespace auto_property_page } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/auto_property_page.h ================================================ #ifndef K3DSDK_NGUI_AUTO_PROPERTY_PAGE_H #define K3DSDK_NGUI_AUTO_PROPERTY_PAGE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace Gtk { class Widget; } namespace k3d { class iproperty; class iunknown; namespace ngui { class document_state; namespace auto_property_page { /// Provides a widget that auto-generates controls for a collection of properties class control { public: control(document_state& DocumentState); ~control(); /// Auto-generate controls for a single object of arbitrary type. void set_properties(iunknown* Object); /// Auto-generate controls for a collection of objects of arbitrary type. template void set_properties(const iterator_t& Begin, const iterator_t& End) { set_properties(objects_t(Begin, End)); } /// Auto-generate controls for a collection of properties organized into arbitrary groups. void set_properties(const iproperty_group_collection::groups_t& PropertyGroups); /// Called to get the toolbar widget for display Gtk::Widget& get_widget(); private: typedef std::vector objects_t; void set_properties(const objects_t& Objects); class implementation; implementation* const m_implementation; }; } // namespace auto_property_page } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_AUTO_PROPERTY_PAGE_H ================================================ FILE: k3dsdk/ngui/auto_property_toolbar.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // for typeinfo crash on Win32 #include #include #include namespace k3d { namespace ngui { namespace auto_property_toolbar { /// toggle_button model that turns a property-bypass into a togglable action class bypass_property_proxy : public toggle_button::imodel { public: bypass_property_proxy(document_state& DocumentState, iproperty& InputProperty, iproperty& OutputProperty) : m_document_state(DocumentState), m_input_property(InputProperty), m_output_property(OutputProperty) { } const Glib::ustring label() { return _("Bypass modifier"); } const bool_t value() { // true == bypassed, false == normal return m_document_state.document().pipeline().dependency(m_output_property) == &m_input_property; } void set_value(const bool_t Value) { // true == bypassed, false == normal ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&m_output_property, Value ? &m_input_property : static_cast(0))); m_document_state.document().pipeline().set_dependencies(dependencies); m_changed_signal.emit(); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_changed_signal.connect(Slot); } private: bypass_property_proxy(const bypass_property_proxy&); bypass_property_proxy& operator=(const bypass_property_proxy&); document_state& m_document_state; iproperty& m_input_property; iproperty& m_output_property; sigc::signal m_changed_signal; }; /////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation(document_state& DocumentState) : m_document_state(DocumentState), m_toolbar() { } void set_object(iunknown* Object) { // Delete existing icons ... Glib::ListHandle children = m_toolbar.get_children(); std::for_each(children.begin(), children.end(), delete_object()); // Add a help button ... if(inode* const node = dynamic_cast(Object)) { const string_t uri = "http://www.k-3d.org/wiki/" + node->factory().name(); Gtk::Button* const control = new Gtk::Button(Gtk::Stock::HELP) << connect_button(sigc::bind(sigc::ptr_fun(&k3d::ngui::uri::open), uri)) << set_tooltip(_("Display online help.")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } // Add controls for managing user properties ... if(inode* const node = dynamic_cast(Object)) { Gtk::Button* const control = button::create(*Gtk::manage(new Gtk::Image(Gtk::Stock::ADD, Gtk::ICON_SIZE_BUTTON))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_add_user_property), node)) << set_tooltip(_("Add a user property.")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } // Add controls for cameras if(icamera* const camera = dynamic_cast(Object)) { Gtk::Button* const camera_preview = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_preview", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_camera_camera_preview), camera)) << set_tooltip(_("Render Preview")); Gtk::Button* const camera_frame = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_frame", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_camera_camera_frame), camera)) << set_tooltip(_("Render Frame")); Gtk::Button* const camera_animation = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_animation", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_camera_camera_animation), camera)) << set_tooltip(_("Render Animation")); m_toolbar.row(0).pack_start(*Gtk::manage(camera_preview), Gtk::PACK_SHRINK); m_toolbar.row(0).pack_start(*Gtk::manage(camera_frame), Gtk::PACK_SHRINK); m_toolbar.row(0).pack_start(*Gtk::manage(camera_animation), Gtk::PACK_SHRINK); } // Add controls for camera render engines ... if(irender_camera_preview* const render_camera_preview = dynamic_cast(Object)) { Gtk::Button* const control = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_preview", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_camera_preview), render_camera_preview)) << set_tooltip(_("Render Preview")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } if(irender_camera_frame* const render_camera_frame = dynamic_cast(Object)) { Gtk::Button* const control = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_frame", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_camera_frame), render_camera_frame)) << set_tooltip(_("Render Frame")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } if(irender_camera_animation* const render_camera_animation = dynamic_cast(Object)) { Gtk::Button* const control = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_animation", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_camera_animation), render_camera_animation)) << set_tooltip(_("Render Animation")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } // Add controls for render engines if(irender_preview* const render_preview = dynamic_cast(Object)) { Gtk::Button* const control = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_preview", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_preview), render_preview)) << set_tooltip(_("Render Preview")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } if(irender_frame* const render_frame = dynamic_cast(Object)) { Gtk::Button* const control = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_frame", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_frame), render_frame)) << set_tooltip(_("Render Frame")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } if(irender_animation* const render_animation = dynamic_cast(Object)) { Gtk::Button* const control = button::create(*Gtk::manage(new Gtk::Image(load_icon("render_animation", Gtk::ICON_SIZE_BUTTON)))) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_render_animation), render_animation)) << set_tooltip(_("Render Animation")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } // Add a "reset" button for nodes that implement imesh_storage (FrozenMesh, external file readers, etc) ... if(imesh_storage* const mesh_storage = dynamic_cast(Object)) { Gtk::Button* const control = new Gtk::Button(_("Reset Mesh")) << connect_button(sigc::bind(sigc::mem_fun(*this, &implementation::on_reset_mesh), mesh_storage)) << set_tooltip(_("Reset / Reload Mesh")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } // Add a "disable" button for mesh modifiers ... if(imesh_source* const mesh_source = dynamic_cast(Object)) { // Modifiers that take a single mesh input ... if(imesh_sink* const mesh_sink = dynamic_cast(Object)) { iproperty& bypass_input = mesh_sink->mesh_sink_input(); iproperty& bypass_output = mesh_source->mesh_source_output(); toggle_button::control* const control = new toggle_button::control( new bypass_property_proxy(m_document_state, bypass_input, bypass_output), &m_document_state.document().state_recorder(), _("Disable")) << set_tooltip(_("Disable / bypass mesh modifier")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } // Modifiers that take multiple mesh inputs ... else if(imulti_mesh_sink* const mesh_sink = dynamic_cast(Object)) { iproperty* bypass_input = 0; if(iproperty_collection* const property_collection = dynamic_cast(Object)) { const iproperty_collection::properties_t properties = property_collection->properties(); for(iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { if(!dynamic_cast(*property)) continue; if((**property).property_type() != typeid(mesh*)) continue; bypass_input = *property; break; } } iproperty& bypass_output = mesh_source->mesh_source_output(); if(bypass_input) { toggle_button::control* const control = new toggle_button::control( new bypass_property_proxy(m_document_state, *bypass_input, bypass_output), &m_document_state.document().state_recorder(), _("Disable")) << set_tooltip(_("Disable / bypass mesh modifier")); m_toolbar.row(0).pack_start(*Gtk::manage(control), Gtk::PACK_SHRINK); } } } m_toolbar.show_all(); } void on_add_user_property(inode* Node) { k3d::ngui::property::create(*Node); } void on_render_camera_camera_preview(icamera* Camera) { irender_camera_preview* const render_camera_preview = pick_camera_preview_render_engine(m_document_state); if(!render_camera_preview) return; render(*Camera, *render_camera_preview); } void on_render_camera_camera_frame(icamera* Camera) { irender_camera_frame* const render_camera_frame = pick_camera_still_render_engine(m_document_state); if(!render_camera_frame) return; render(*Camera, *render_camera_frame); } void on_render_camera_camera_animation(icamera* Camera) { irender_camera_animation* const render_camera_animation = pick_camera_animation_render_engine(m_document_state); if(!render_camera_animation) return; render(m_document_state, *Camera, *render_camera_animation); } void on_render_camera_preview(irender_camera_preview* RenderCameraPreview) { icamera* const camera = pick_camera(m_document_state); if(!camera) return; render(*camera, *RenderCameraPreview); } void on_render_camera_frame(irender_camera_frame* RenderCameraFrame) { icamera* const camera = pick_camera(m_document_state); if(!camera) return; render(*camera, *RenderCameraFrame); } void on_render_camera_animation(irender_camera_animation* RenderCameraAnimation) { icamera* const camera = pick_camera(m_document_state); if(!camera) return; render(m_document_state, *camera, *RenderCameraAnimation); } void on_render_preview(irender_preview* RenderPreview) { render(*RenderPreview); } void on_render_frame(irender_frame* RenderFrame) { render(*RenderFrame); } void on_render_animation(irender_animation* RenderAnimation) { render(m_document_state, *RenderAnimation); } void on_reset_mesh(imesh_storage* MeshStorage) { MeshStorage->reset_mesh(0); } document_state& m_document_state; toolbar::control m_toolbar; }; /////////////////////////////////////////////////////////////////////////// // control control::control(document_state& DocumentState) : m_implementation(new implementation(DocumentState)) { } control::~control() { delete m_implementation; } void control::set_object(iunknown* Object) { m_implementation->set_object(Object); } Gtk::Widget& control::get_widget() { return m_implementation->m_toolbar; } } // namespace auto_property_toolbar } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/auto_property_toolbar.h ================================================ #ifndef K3DSDK_NGUI_AUTO_PROPERTY_TOOLBAR_H #define K3DSDK_NGUI_AUTO_PROPERTY_TOOLBAR_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace Gtk { class Widget; } namespace k3d { class iunknown; namespace ngui { class document_state; namespace auto_property_toolbar { /// Provides a toolbar with an auto-generated collection of icons based on an object's capabilities / type. class control { public: control(document_state& DocumentState); ~control(); /// Called to set the toolbar contents based on the given object void set_object(iunknown* Object); /// Called to get the toolbar widget for display Gtk::Widget& get_widget(); private: class implementation; implementation* const m_implementation; }; } // namespace auto_property_toolbar } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_AUTO_PROPERTY_TOOLBAR_H ================================================ FILE: k3dsdk/ngui/basic_input_model.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // basic_input_model::implementation struct basic_input_model::implementation { implementation() : double_click(false), triple_click(false), dragging(0) { } const bool button(const unsigned long Button) const { button_state_t::const_iterator button = button_state.find(Button); if(button == button_state.end()) return false; return button->second; } typedef std::map button_state_t; button_state_t button_state; bool double_click; bool triple_click; unsigned long dragging; k3d::point2 start_mouse; sigc::signal mouse_move; sigc::signal lbutton_down; sigc::signal lbutton_up; sigc::signal lbutton_click; sigc::signal lbutton_double_click; sigc::signal lbutton_triple_click; sigc::signal lbutton_start_drag; sigc::signal lbutton_drag; sigc::signal lbutton_end_drag; sigc::signal mbutton_down; sigc::signal mbutton_up; sigc::signal mbutton_click; sigc::signal mbutton_double_click; sigc::signal mbutton_triple_click; sigc::signal mbutton_start_drag; sigc::signal mbutton_drag; sigc::signal mbutton_end_drag; sigc::signal rbutton_down; sigc::signal rbutton_up; sigc::signal rbutton_click; sigc::signal rbutton_double_click; sigc::signal rbutton_triple_click; sigc::signal rbutton_start_drag; sigc::signal rbutton_drag; sigc::signal rbutton_end_drag; sigc::signal scroll; sigc::signal key_press; sigc::signal key_release; }; ///////////////////////////////////////////////////////////////////////////// // basic_input_model basic_input_model::basic_input_model() : m_implementation(new implementation()) { } basic_input_model::~basic_input_model() { delete m_implementation; } void basic_input_model::button_press_event(GdkEventButton* Event) { // Maintain button state ... m_implementation->button_state[Event->button] = true; // Keep track of where the mouse pointer was, so we can detect drag operations ... m_implementation->start_mouse = k3d::point2(Event->x, Event->y); // Triple-click ... if(Event->type == GDK_3BUTTON_PRESS) { m_implementation->triple_click = true; switch(Event->button) { case 1: m_implementation->lbutton_triple_click.emit(*Event); break; case 2: m_implementation->mbutton_triple_click.emit(*Event); break; case 3: m_implementation->rbutton_triple_click.emit(*Event); break; default: break; } return; } // Double-click ... if(Event->type == GDK_2BUTTON_PRESS) { m_implementation->double_click = true; switch(Event->button) { case 1: m_implementation->lbutton_double_click.emit(*Event); break; case 2: m_implementation->mbutton_double_click.emit(*Event); break; case 3: m_implementation->rbutton_double_click.emit(*Event); break; default: break; } return; } // Send the low-level button-down event ... switch(Event->button) { case 1: m_implementation->lbutton_down.emit(*Event); break; case 2: m_implementation->mbutton_down.emit(*Event); break; case 3: m_implementation->rbutton_down.emit(*Event); break; default: break; } } void basic_input_model::button_release_event(GdkEventButton* Event) { // Maintain button state ... m_implementation->button_state[Event->button] = false; // Send the low-level button-up event ... switch(Event->button) { case 1: m_implementation->lbutton_up.emit(*Event); break; case 2: m_implementation->mbutton_up.emit(*Event); break; case 3: m_implementation->rbutton_up.emit(*Event); break; default: break; } // If we were dragging, handle the drag-end event ... if(m_implementation->dragging == Event->button) { switch(m_implementation->dragging) { case 1: m_implementation->lbutton_end_drag.emit(*Event); break; case 2: m_implementation->mbutton_end_drag.emit(*Event); break; case 3: m_implementation->rbutton_end_drag.emit(*Event); break; default: break; } m_implementation->dragging = 0; return; } // Send the click event only if this isn't a double-click or a triple-click ... if(!m_implementation->double_click && !m_implementation->triple_click) { switch(Event->button) { case 1: m_implementation->lbutton_click.emit(*Event); break; case 2: m_implementation->mbutton_click.emit(*Event); break; case 3: m_implementation->rbutton_click.emit(*Event); break; default: break; } } m_implementation->double_click = false; m_implementation->triple_click = false; } void basic_input_model::motion_notify_event(GdkEventMotion* Event) { // Always send mouse movement events ... m_implementation->mouse_move.emit(*Event); // If we're already dragging, send drag events ... if(m_implementation->dragging) { switch(m_implementation->dragging) { case 1: m_implementation->lbutton_drag.emit(*Event); break; case 2: m_implementation->mbutton_drag.emit(*Event); break; case 3: m_implementation->rbutton_drag.emit(*Event); break; default: break; } return; } // If the mouse pointer hasn't moved much lately, we're done ... const k3d::point2 mouse = k3d::point2(Event->x, Event->y); const k3d::vector2 delta = mouse - m_implementation->start_mouse; if(delta.length2() < 9) return; // Adjust the event structure so it reflects the original start point Event->x -= delta[0]; Event->y -= delta[1]; Event->x_root -= delta[0]; Event->y_root -= delta[1]; // Start dragging ... if(m_implementation->button(1)) { m_implementation->dragging = 1; m_implementation->lbutton_start_drag.emit(*Event); } else if(m_implementation->button(2)) { m_implementation->dragging = 2; m_implementation->mbutton_start_drag.emit(*Event); } else if(m_implementation->button(3)) { m_implementation->dragging = 3; m_implementation->rbutton_start_drag.emit(*Event); } } void basic_input_model::scroll_event(GdkEventScroll* Event) { m_implementation->scroll.emit(*Event); } void basic_input_model::key_press_event(GdkEventKey* Event) { m_implementation->key_press.emit(*Event); } void basic_input_model::key_release_event(GdkEventKey* Event) { m_implementation->key_release.emit(*Event); } sigc::connection basic_input_model::connect_mouse_move(const sigc::slot& Slot) { return m_implementation->mouse_move.connect(Slot); } sigc::connection basic_input_model::connect_lbutton_down(const sigc::slot& Slot) { return m_implementation->lbutton_down.connect(Slot); } sigc::connection basic_input_model::connect_lbutton_up(const sigc::slot& Slot) { return m_implementation->lbutton_up.connect(Slot); } sigc::connection basic_input_model::connect_lbutton_click(const sigc::slot& Slot) { return m_implementation->lbutton_click.connect(Slot); } sigc::connection basic_input_model::connect_lbutton_double_click(const sigc::slot& Slot) { return m_implementation->lbutton_double_click.connect(Slot); } sigc::connection basic_input_model::connect_lbutton_triple_click(const sigc::slot& Slot) { return m_implementation->lbutton_triple_click.connect(Slot); } sigc::connection basic_input_model::connect_lbutton_start_drag(const sigc::slot& Slot) { return m_implementation->lbutton_start_drag.connect(Slot); } sigc::connection basic_input_model::connect_lbutton_drag(const sigc::slot& Slot) { return m_implementation->lbutton_drag.connect(Slot); } sigc::connection basic_input_model::connect_lbutton_end_drag(const sigc::slot& Slot) { return m_implementation->lbutton_end_drag.connect(Slot); } sigc::connection basic_input_model::connect_mbutton_down(const sigc::slot& Slot) { return m_implementation->mbutton_down.connect(Slot); } sigc::connection basic_input_model::connect_mbutton_up(const sigc::slot& Slot) { return m_implementation->mbutton_up.connect(Slot); } sigc::connection basic_input_model::connect_mbutton_click(const sigc::slot& Slot) { return m_implementation->mbutton_click.connect(Slot); } sigc::connection basic_input_model::connect_mbutton_double_click(const sigc::slot& Slot) { return m_implementation->mbutton_double_click.connect(Slot); } sigc::connection basic_input_model::connect_mbutton_triple_click(const sigc::slot& Slot) { return m_implementation->mbutton_triple_click.connect(Slot); } sigc::connection basic_input_model::connect_mbutton_start_drag(const sigc::slot& Slot) { return m_implementation->mbutton_start_drag.connect(Slot); } sigc::connection basic_input_model::connect_mbutton_drag(const sigc::slot& Slot) { return m_implementation->mbutton_drag.connect(Slot); } sigc::connection basic_input_model::connect_mbutton_end_drag(const sigc::slot& Slot) { return m_implementation->mbutton_end_drag.connect(Slot); } sigc::connection basic_input_model::connect_rbutton_down(const sigc::slot& Slot) { return m_implementation->rbutton_down.connect(Slot); } sigc::connection basic_input_model::connect_rbutton_up(const sigc::slot& Slot) { return m_implementation->rbutton_up.connect(Slot); } sigc::connection basic_input_model::connect_rbutton_click(const sigc::slot& Slot) { return m_implementation->rbutton_click.connect(Slot); } sigc::connection basic_input_model::connect_rbutton_double_click(const sigc::slot& Slot) { return m_implementation->rbutton_double_click.connect(Slot); } sigc::connection basic_input_model::connect_rbutton_triple_click(const sigc::slot& Slot) { return m_implementation->rbutton_triple_click.connect(Slot); } sigc::connection basic_input_model::connect_rbutton_start_drag(const sigc::slot& Slot) { return m_implementation->rbutton_start_drag.connect(Slot); } sigc::connection basic_input_model::connect_rbutton_drag(const sigc::slot& Slot) { return m_implementation->rbutton_drag.connect(Slot); } sigc::connection basic_input_model::connect_rbutton_end_drag(const sigc::slot& Slot) { return m_implementation->rbutton_end_drag.connect(Slot); } sigc::connection basic_input_model::connect_scroll(const sigc::slot& Slot) { return m_implementation->scroll.connect(Slot); } sigc::connection basic_input_model::connect_key_press(const sigc::slot& Slot) { return m_implementation->key_press.connect(Slot); } sigc::connection basic_input_model::connect_key_release(const sigc::slot& Slot) { return m_implementation->key_release.connect(Slot); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/basic_input_model.h ================================================ #ifndef K3DSDK_NGUI_BASIC_INPUT_MODEL_H #define K3DSDK_NGUI_BASIC_INPUT_MODEL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // basic_input_model /// Implementation of input_model that synthesizes a more useful collection of input events class basic_input_model : public input_model { public: basic_input_model(); virtual ~basic_input_model(); virtual void button_press_event(GdkEventButton* Event); virtual void button_release_event(GdkEventButton* Event); virtual void motion_notify_event(GdkEventMotion* Event); virtual void scroll_event(GdkEventScroll* Event); virtual void key_press_event(GdkEventKey* Event); virtual void key_release_event(GdkEventKey* Event); sigc::connection connect_mouse_move(const sigc::slot& Slot); sigc::connection connect_lbutton_down(const sigc::slot& Slot); sigc::connection connect_lbutton_up(const sigc::slot& Slot); sigc::connection connect_lbutton_click(const sigc::slot& Slot); sigc::connection connect_lbutton_double_click(const sigc::slot& Slot); sigc::connection connect_lbutton_triple_click(const sigc::slot& Slot); sigc::connection connect_lbutton_start_drag(const sigc::slot& Slot); sigc::connection connect_lbutton_drag(const sigc::slot& Slot); sigc::connection connect_lbutton_end_drag(const sigc::slot& Slot); sigc::connection connect_mbutton_down(const sigc::slot& Slot); sigc::connection connect_mbutton_up(const sigc::slot& Slot); sigc::connection connect_mbutton_click(const sigc::slot& Slot); sigc::connection connect_mbutton_double_click(const sigc::slot& Slot); sigc::connection connect_mbutton_triple_click(const sigc::slot& Slot); sigc::connection connect_mbutton_start_drag(const sigc::slot& Slot); sigc::connection connect_mbutton_drag(const sigc::slot& Slot); sigc::connection connect_mbutton_end_drag(const sigc::slot& Slot); sigc::connection connect_rbutton_down(const sigc::slot& Slot); sigc::connection connect_rbutton_up(const sigc::slot& Slot); sigc::connection connect_rbutton_click(const sigc::slot& Slot); sigc::connection connect_rbutton_double_click(const sigc::slot& Slot); sigc::connection connect_rbutton_triple_click(const sigc::slot& Slot); sigc::connection connect_rbutton_start_drag(const sigc::slot& Slot); sigc::connection connect_rbutton_drag(const sigc::slot& Slot); sigc::connection connect_rbutton_end_drag(const sigc::slot& Slot); sigc::connection connect_scroll(const sigc::slot& Slot); sigc::connection connect_key_press(const sigc::slot& Slot); sigc::connection connect_key_release(const sigc::slot& Slot); private: struct implementation; implementation* const m_implementation; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_BASIC_INPUT_MODEL_H ================================================ FILE: k3dsdk/ngui/basic_viewport_input_model.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // basic_viewport_input_model::implementation struct basic_viewport_input_model::implementation { implementation() : double_click(false), triple_click(false), dragging(0) { } const bool button(const unsigned long Button) const { button_state_t::const_iterator button = button_state.find(Button); if(button == button_state.end()) return false; return button->second; } typedef std::map button_state_t; button_state_t button_state; bool double_click; bool triple_click; unsigned long dragging; k3d::point2 start_mouse; sigc::signal mouse_move; sigc::signal lbutton_down; sigc::signal lbutton_up; sigc::signal lbutton_click; sigc::signal lbutton_double_click; sigc::signal lbutton_triple_click; sigc::signal lbutton_start_drag; sigc::signal lbutton_drag; sigc::signal lbutton_end_drag; sigc::signal mbutton_down; sigc::signal mbutton_up; sigc::signal mbutton_click; sigc::signal mbutton_double_click; sigc::signal mbutton_triple_click; sigc::signal mbutton_start_drag; sigc::signal mbutton_drag; sigc::signal mbutton_end_drag; sigc::signal rbutton_down; sigc::signal rbutton_up; sigc::signal rbutton_click; sigc::signal rbutton_double_click; sigc::signal rbutton_triple_click; sigc::signal rbutton_start_drag; sigc::signal rbutton_drag; sigc::signal rbutton_end_drag; sigc::signal scroll; sigc::signal key_press; sigc::signal key_release; }; ///////////////////////////////////////////////////////////////////////////// // basic_viewport_input_model basic_viewport_input_model::basic_viewport_input_model() : m_implementation(new implementation()) { } basic_viewport_input_model::~basic_viewport_input_model() { delete m_implementation; } void basic_viewport_input_model::button_press_event(viewport::control& Viewport, GdkEventButton* Event) { // Maintain button state ... m_implementation->button_state[Event->button] = true; // Keep track of where the mouse pointer was, so we can detect drag operations ... m_implementation->start_mouse = k3d::point2(Event->x, Event->y); // Triple-click ... if(Event->type == GDK_3BUTTON_PRESS) { m_implementation->triple_click = true; switch(Event->button) { case 1: m_implementation->lbutton_triple_click.emit(Viewport, *Event); break; case 2: m_implementation->mbutton_triple_click.emit(Viewport, *Event); break; case 3: m_implementation->rbutton_triple_click.emit(Viewport, *Event); break; default: break; } return; } // Double-click ... if(Event->type == GDK_2BUTTON_PRESS) { m_implementation->double_click = true; switch(Event->button) { case 1: m_implementation->lbutton_double_click.emit(Viewport, *Event); break; case 2: m_implementation->mbutton_double_click.emit(Viewport, *Event); break; case 3: m_implementation->rbutton_double_click.emit(Viewport, *Event); break; default: break; } return; } // Send the low-level button-down event ... switch(Event->button) { case 1: m_implementation->lbutton_down.emit(Viewport, *Event); break; case 2: m_implementation->mbutton_down.emit(Viewport, *Event); break; case 3: m_implementation->rbutton_down.emit(Viewport, *Event); break; default: break; } } void basic_viewport_input_model::button_release_event(viewport::control& Viewport, GdkEventButton* Event) { // Maintain button state ... m_implementation->button_state[Event->button] = false; // Send the low-level button-up event ... switch(Event->button) { case 1: m_implementation->lbutton_up.emit(Viewport, *Event); break; case 2: m_implementation->mbutton_up.emit(Viewport, *Event); break; case 3: m_implementation->rbutton_up.emit(Viewport, *Event); break; default: break; } // If we were dragging, handle the drag-end event ... if(m_implementation->dragging == Event->button) { switch(m_implementation->dragging) { case 1: m_implementation->lbutton_end_drag.emit(Viewport, *Event); break; case 2: m_implementation->mbutton_end_drag.emit(Viewport, *Event); break; case 3: m_implementation->rbutton_end_drag.emit(Viewport, *Event); break; default: break; } m_implementation->dragging = 0; return; } // Send the click event only if this isn't a double-click or a triple-click ... if(!m_implementation->double_click && !m_implementation->triple_click) { switch(Event->button) { case 1: m_implementation->lbutton_click.emit(Viewport, *Event); break; case 2: m_implementation->mbutton_click.emit(Viewport, *Event); break; case 3: m_implementation->rbutton_click.emit(Viewport, *Event); break; default: break; } } m_implementation->double_click = false; m_implementation->triple_click = false; } void basic_viewport_input_model::motion_notify_event(viewport::control& Viewport, GdkEventMotion* Event) { // Always send mouse movement events ... m_implementation->mouse_move.emit(Viewport, *Event); // If we're already dragging, send drag events ... if(m_implementation->dragging) { switch(m_implementation->dragging) { case 1: m_implementation->lbutton_drag.emit(Viewport, *Event); break; case 2: m_implementation->mbutton_drag.emit(Viewport, *Event); break; case 3: m_implementation->rbutton_drag.emit(Viewport, *Event); break; default: break; } return; } // If the mouse pointer hasn't moved much lately, we're done ... const k3d::point2 mouse = k3d::point2(Event->x, Event->y); const k3d::vector2 delta = mouse - m_implementation->start_mouse; if(delta.length2() < 9) return; // Adjust the event structure so it reflects the original start point Event->x -= delta[0]; Event->y -= delta[1]; Event->x_root -= delta[0]; Event->y_root -= delta[1]; // Start dragging ... if(m_implementation->button(1)) { m_implementation->dragging = 1; m_implementation->lbutton_start_drag.emit(Viewport, *Event); } else if(m_implementation->button(2)) { m_implementation->dragging = 2; m_implementation->mbutton_start_drag.emit(Viewport, *Event); } else if(m_implementation->button(3)) { m_implementation->dragging = 3; m_implementation->rbutton_start_drag.emit(Viewport, *Event); } } void basic_viewport_input_model::scroll_event(viewport::control& Viewport, GdkEventScroll* Event) { m_implementation->scroll.emit(Viewport, *Event); } void basic_viewport_input_model::key_press_event(viewport::control& Viewport, GdkEventKey* Event) { m_implementation->key_press.emit(Viewport, *Event); } void basic_viewport_input_model::key_release_event(viewport::control& Viewport, GdkEventKey* Event) { m_implementation->key_release.emit(Viewport, *Event); } sigc::connection basic_viewport_input_model::connect_mouse_move(const sigc::slot& Slot) { return m_implementation->mouse_move.connect(Slot); } sigc::connection basic_viewport_input_model::connect_lbutton_down(const sigc::slot& Slot) { return m_implementation->lbutton_down.connect(Slot); } sigc::connection basic_viewport_input_model::connect_lbutton_up(const sigc::slot& Slot) { return m_implementation->lbutton_up.connect(Slot); } sigc::connection basic_viewport_input_model::connect_lbutton_click(const sigc::slot& Slot) { return m_implementation->lbutton_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_lbutton_double_click(const sigc::slot& Slot) { return m_implementation->lbutton_double_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_lbutton_triple_click(const sigc::slot& Slot) { return m_implementation->lbutton_triple_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_lbutton_start_drag(const sigc::slot& Slot) { return m_implementation->lbutton_start_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_lbutton_drag(const sigc::slot& Slot) { return m_implementation->lbutton_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_lbutton_end_drag(const sigc::slot& Slot) { return m_implementation->lbutton_end_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_mbutton_down(const sigc::slot& Slot) { return m_implementation->mbutton_down.connect(Slot); } sigc::connection basic_viewport_input_model::connect_mbutton_up(const sigc::slot& Slot) { return m_implementation->mbutton_up.connect(Slot); } sigc::connection basic_viewport_input_model::connect_mbutton_click(const sigc::slot& Slot) { return m_implementation->mbutton_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_mbutton_double_click(const sigc::slot& Slot) { return m_implementation->mbutton_double_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_mbutton_triple_click(const sigc::slot& Slot) { return m_implementation->mbutton_triple_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_mbutton_start_drag(const sigc::slot& Slot) { return m_implementation->mbutton_start_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_mbutton_drag(const sigc::slot& Slot) { return m_implementation->mbutton_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_mbutton_end_drag(const sigc::slot& Slot) { return m_implementation->mbutton_end_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_rbutton_down(const sigc::slot& Slot) { return m_implementation->rbutton_down.connect(Slot); } sigc::connection basic_viewport_input_model::connect_rbutton_up(const sigc::slot& Slot) { return m_implementation->rbutton_up.connect(Slot); } sigc::connection basic_viewport_input_model::connect_rbutton_click(const sigc::slot& Slot) { return m_implementation->rbutton_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_rbutton_double_click(const sigc::slot& Slot) { return m_implementation->rbutton_double_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_rbutton_triple_click(const sigc::slot& Slot) { return m_implementation->rbutton_triple_click.connect(Slot); } sigc::connection basic_viewport_input_model::connect_rbutton_start_drag(const sigc::slot& Slot) { return m_implementation->rbutton_start_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_rbutton_drag(const sigc::slot& Slot) { return m_implementation->rbutton_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_rbutton_end_drag(const sigc::slot& Slot) { return m_implementation->rbutton_end_drag.connect(Slot); } sigc::connection basic_viewport_input_model::connect_scroll(const sigc::slot& Slot) { return m_implementation->scroll.connect(Slot); } sigc::connection basic_viewport_input_model::connect_key_press(const sigc::slot& Slot) { return m_implementation->key_press.connect(Slot); } sigc::connection basic_viewport_input_model::connect_key_release(const sigc::slot& Slot) { return m_implementation->key_release.connect(Slot); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/basic_viewport_input_model.h ================================================ #ifndef K3DSDK_NGUI_BASIC_VIEWPORT_INPUT_MODEL_H #define K3DSDK_NGUI_BASIC_VIEWPORT_INPUT_MODEL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // basic_viewport_input_model /// Implementation of viewport_input_model that synthesizes a more useful collection of input events class basic_viewport_input_model : public viewport_input_model { public: basic_viewport_input_model(); virtual ~basic_viewport_input_model(); virtual void button_press_event(viewport::control& Viewport, GdkEventButton* Event); virtual void button_release_event(viewport::control& Viewport, GdkEventButton* Event); virtual void motion_notify_event(viewport::control& Viewport, GdkEventMotion* Event); virtual void scroll_event(viewport::control& Viewport, GdkEventScroll* Event); virtual void key_press_event(viewport::control& Viewport, GdkEventKey* Event); virtual void key_release_event(viewport::control& Viewport, GdkEventKey* Event); sigc::connection connect_mouse_move(const sigc::slot& Slot); sigc::connection connect_lbutton_down(const sigc::slot& Slot); sigc::connection connect_lbutton_up(const sigc::slot& Slot); sigc::connection connect_lbutton_click(const sigc::slot& Slot); sigc::connection connect_lbutton_double_click(const sigc::slot& Slot); sigc::connection connect_lbutton_triple_click(const sigc::slot& Slot); sigc::connection connect_lbutton_start_drag(const sigc::slot& Slot); sigc::connection connect_lbutton_drag(const sigc::slot& Slot); sigc::connection connect_lbutton_end_drag(const sigc::slot& Slot); sigc::connection connect_mbutton_down(const sigc::slot& Slot); sigc::connection connect_mbutton_up(const sigc::slot& Slot); sigc::connection connect_mbutton_click(const sigc::slot& Slot); sigc::connection connect_mbutton_double_click(const sigc::slot& Slot); sigc::connection connect_mbutton_triple_click(const sigc::slot& Slot); sigc::connection connect_mbutton_start_drag(const sigc::slot& Slot); sigc::connection connect_mbutton_drag(const sigc::slot& Slot); sigc::connection connect_mbutton_end_drag(const sigc::slot& Slot); sigc::connection connect_rbutton_down(const sigc::slot& Slot); sigc::connection connect_rbutton_up(const sigc::slot& Slot); sigc::connection connect_rbutton_click(const sigc::slot& Slot); sigc::connection connect_rbutton_double_click(const sigc::slot& Slot); sigc::connection connect_rbutton_triple_click(const sigc::slot& Slot); sigc::connection connect_rbutton_start_drag(const sigc::slot& Slot); sigc::connection connect_rbutton_drag(const sigc::slot& Slot); sigc::connection connect_rbutton_end_drag(const sigc::slot& Slot); sigc::connection connect_scroll(const sigc::slot& Slot); sigc::connection connect_key_press(const sigc::slot& Slot); sigc::connection connect_key_release(const sigc::slot& Slot); private: struct implementation; implementation* const m_implementation; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_BASIC_VIEWPORT_INPUT_MODEL_H ================================================ FILE: k3dsdk/ngui/bitmap_preview.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { namespace ngui { namespace bitmap_preview { /// Specialization of bitmap_preview::data_proxy for use with iproperty objects class property_proxy : public idata_proxy { public: property_proxy(k3d::iproperty& Data) : m_readable_data(Data) { } k3d::bitmap* value() { // As a special-case, if the internal property value is NULL, return the connected property (if any) k3d::bitmap* result = boost::any_cast(m_readable_data.property_internal_value()); if(!result) result = k3d::property::pipeline_value(m_readable_data); return result; } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } private: property_proxy(const property_proxy& RHS); property_proxy& operator=(const property_proxy& RHS); k3d::iproperty& m_readable_data; }; std::unique_ptr proxy(k3d::iproperty& Data) { return std::unique_ptr(new property_proxy(Data)); } ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : base(Gtk::BUTTONBOX_START, 2), m_image_buffer(64, 64), m_alpha_buffer(64, 64), m_image(new Gtk::Image()), m_alpha(new Gtk::Image()), m_data(std::move(Data)) { pack_start(*manage(m_image), Gtk::PACK_SHRINK); pack_start(*manage(m_alpha), Gtk::PACK_SHRINK); data_changed(0); if(m_data.get()) m_data->changed_signal().connect(sigc::mem_fun(*this, &control::data_changed)); } struct extract_rgb { template void operator()(const P1& src, P2& dst) const { get_color(dst, boost::gil::red_t()) = boost::gil::channel_convert(get_color(src, boost::gil::red_t())); get_color(dst, boost::gil::green_t()) = boost::gil::channel_convert(get_color(src, boost::gil::green_t())); get_color(dst, boost::gil::blue_t()) = boost::gil::channel_convert(get_color(src, boost::gil::blue_t())); } }; struct extract_alpha { template void operator()(const P1& src, P2& dst) const { get_color(dst, boost::gil::red_t()) = boost::gil::channel_convert(get_color(src, boost::gil::alpha_t())); get_color(dst, boost::gil::green_t()) = boost::gil::channel_convert(get_color(src, boost::gil::alpha_t())); get_color(dst, boost::gil::blue_t()) = boost::gil::channel_convert(get_color(src, boost::gil::alpha_t())); } }; void control::data_changed(k3d::ihint*) { return_if_fail(m_data.get()); const boost::gil::rgb8_image_t::view_t& image = boost::gil::view(m_image_buffer); const boost::gil::rgb8_image_t::view_t& alpha = boost::gil::view(m_alpha_buffer); k3d::bitmap* const data = m_data->value(); if(data && data->width() && data->height()) { #ifdef K3D_API_DARWIN assert_not_implemented(); #else boost::gil::resize_view( boost::gil::color_converted_view(boost::gil::const_view(*data), extract_rgb()), image, boost::gil::bilinear_sampler()); boost::gil::resize_view( boost::gil::color_converted_view(boost::gil::const_view(*data), extract_alpha()), alpha, boost::gil::bilinear_sampler()); #endif } else { k3d::checkerboard_fill( image, 8, 8, boost::gil::rgb8_pixel_t(32, 32, 32), boost::gil::rgb8_pixel_t(210, 210, 210)); std::fill(alpha.begin(), alpha.end(), boost::gil::rgb8_pixel_t(255, 255, 255)); } m_image->set(Gdk::Pixbuf::create_from_data(reinterpret_cast(&image[0]), Gdk::COLORSPACE_RGB, false, 8, image.width(), image.height(), image.width() * 3)); m_alpha->set(Gdk::Pixbuf::create_from_data(reinterpret_cast(&alpha[0]), Gdk::COLORSPACE_RGB, false, 8, alpha.width(), alpha.height(), alpha.width() * 3)); } } // namespace bitmap_preview } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/bitmap_preview.h ================================================ #ifndef K3DSDK_NGUI_BITMAP_PREVIEW_H #define K3DSDK_NGUI_BITMAP_PREVIEW_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace Gtk { class Image; } namespace k3d { class ihint; } namespace k3d { class iproperty; } namespace k3d { namespace ngui { namespace bitmap_preview { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a bitmap_preview control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Called to return the underlying data value virtual k3d::bitmap* value() = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; protected: idata_proxy() {} idata_proxy(const idata_proxy& RHS) {} idata_proxy& operator=(const idata_proxy& RHS) { return *this; } }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for previewing bitmap images (i.e. the view and the controller from model-view-controller) class control : public Gtk::HButtonBox { typedef Gtk::HButtonBox base; public: control(std::unique_ptr Data); private: /// Called whenever the underlying data changes void data_changed(k3d::ihint*); boost::gil::rgb8_image_t m_image_buffer; boost::gil::rgb8_image_t m_alpha_buffer; /// Displays the image Gtk::Image* const m_image; /// Displays the alpha channel Gtk::Image* const m_alpha; /// Storeas a reference to the underlying data object std::unique_ptr m_data; }; /// Provides an implementation of bitmap_preview::idata_proxy that supports any data source that supports the value(), set_value(), and changed_signal() concepts template class data_proxy : public idata_proxy { public: data_proxy(data_t& Data) : m_data(Data) { } k3d::bitmap* value() { return m_data.value(); } changed_signal_t& changed_signal() { return m_data.changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_data; }; /// Convenience factory function for creating bitmap_preview::idata_proxy objects template std::unique_ptr proxy(data_t& Data) { return std::unique_ptr(new data_proxy(Data)); } /// Specialization of proxy() for use with properties std::unique_ptr proxy(k3d::iproperty& Data); } // namespace bitmap_preview } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_BITMAP_PREVIEW_H ================================================ FILE: k3dsdk/ngui/bounding_box.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace bounding_box { namespace detail { /// Adapts a k3d::iproperty object for use with bounding_box::control class data_proxy : public idata_proxy { public: data_proxy(k3d::iproperty& Property, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_property(Property) { assert(Property.property_type() == typeid(k3d::bounding_box3)); } const k3d::bounding_box3 value() { return boost::any_cast(m_property.property_internal_value()); } void set_value(const k3d::bounding_box3& Value) { k3d::iwritable_property* const writable_property = dynamic_cast(&m_property); return_if_fail(writable_property); writable_property->property_set_value(boost::any(Value)); } changed_signal_t& changed_signal() { return m_property.property_changed_signal(); } private: k3d::iproperty& m_property; }; } // namespace detail /// Adapts a spin button to control a single bounding_box coordinate class spin_button_model : public spin_button::imodel { public: spin_button_model(bounding_box::idata_proxy& Data, double k3d::bounding_box3::* Value) : m_data(Data), m_value(Value) { } const Glib::ustring label() { return ""; } k3d::bool_t writable() { return true; } k3d::double_t value() { return m_data.value().*m_value; } void set_value(const double Value) { k3d::bounding_box3 box = m_data.value(); box.*m_value = Value; m_data.set_value(box); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_data.changed_signal().connect(sigc::hide(Slot)); } k3d::double_t step_increment() { return 0.1; } const std::type_info& units() { return typeid(k3d::measurement::distance); } private: bounding_box::idata_proxy& m_data; double k3d::bounding_box3::* m_value; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : base(3, 3, false), m_data(std::move(Data)) { spin_button::control* const nx = new spin_button::control(new spin_button_model(*m_data, &k3d::bounding_box3::nx), m_data->state_recorder); spin_button::control* const px = new spin_button::control(new spin_button_model(*m_data, &k3d::bounding_box3::px), m_data->state_recorder); spin_button::control* const ny = new spin_button::control(new spin_button_model(*m_data, &k3d::bounding_box3::ny), m_data->state_recorder); spin_button::control* const py = new spin_button::control(new spin_button_model(*m_data, &k3d::bounding_box3::py), m_data->state_recorder); spin_button::control* const nz = new spin_button::control(new spin_button_model(*m_data, &k3d::bounding_box3::nz), m_data->state_recorder); spin_button::control* const pz = new spin_button::control(new spin_button_model(*m_data, &k3d::bounding_box3::pz), m_data->state_recorder); attach(*Gtk::manage(new Gtk::Label(_("X"))), 0, 1, 0, 1); attach(*Gtk::manage(nx), 0, 1, 1, 2); attach(*Gtk::manage(px), 0, 1, 2, 3); attach(*Gtk::manage(new Gtk::Label(_("Y"))), 1, 2, 0, 1); attach(*Gtk::manage(ny), 1, 2, 1, 2); attach(*Gtk::manage(py), 1, 2, 2, 3); attach(*Gtk::manage(new Gtk::Label(_("Z"))), 2, 3, 0, 1); attach(*Gtk::manage(nz), 2, 3, 1, 2); attach(*Gtk::manage(pz), 2, 3, 2, 3); } ///////////////////////////////////////////////////////////////////////////// // proxy std::unique_ptr proxy(k3d::iproperty& Property, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new detail::data_proxy(Property, StateRecorder, ChangeMessage)); } } // namespace bounding_box } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/bounding_box.h ================================================ #ifndef K3DSDK_NGUI_BOUNDING_BOX_H #define K3DSDK_NGUI_BOUNDING_BOX_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include // Forward declarations namespace Gtk { class Button; } namespace k3d { class ihint; } namespace k3d { class iproperty; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace bounding_box { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a bounding_box control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Called to return the underlying data value virtual const k3d::bounding_box3 value() = 0; /// Called to set a new data value virtual void set_value(const k3d::bounding_box3& Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for modifying the bounding_box of an object class control : public Gtk::Table { typedef Gtk::Table base; public: control(std::unique_ptr Data); private: /// Stores a reference to the underlying data object std::unique_ptr m_data; }; ///////////////////////////////////////////////////////////////////////////// // proxy /// Convenience factory function for creating k3d::spin_button::idata_proxy objects, specialized for k3d::iproperty std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()); } // namespace bounding_box } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_BOUNDING_BOX_H ================================================ FILE: k3dsdk/ngui/button.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace button { ///////////////////////////////////////////////////////////////////////////// // create Gtk::Button* create(const Glib::ustring& label_text, const Gtk::StockID& stock_id) { Gtk::Label* const label = new Gtk::Label(label_text, true); Gtk::Image* const image = new Gtk::Image(); Gtk::Stock::lookup(stock_id, Gtk::ICON_SIZE_BUTTON, *image); Gtk::HBox* const hbox = new Gtk::HBox(false, 2); hbox->pack_start(*manage(image), false, false, 0); hbox->pack_start(*manage(label), false, false, 0); Gtk::Alignment* const alignment = new Gtk::Alignment(0.5, 0.5, 0.0, 0.0); alignment->add(*manage(hbox)); Gtk::Button* const button = new Gtk::Button(); button->add(*manage(alignment)); alignment->show_all(); return button; } Gtk::Button* create(Gtk::Widget& widget) { Gtk::Button* const button = new Gtk::Button(); button->add(widget); return button; } } // namespace button } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/button.h ================================================ #ifndef K3DSDK_NGUI_BUTTON_H #define K3DSDK_NGUI_BUTTON_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { namespace button { ///////////////////////////////////////////////////////////////////////////// // create /// Factory function for creating a button with a stock icon but a custom label. Gtk::Button* create(const Glib::ustring& label, const Gtk::StockID& stock_id); /// Factory function for creating a button containing some other widget, typically used with Gtk::Image. Gtk::Button* create(Gtk::Widget& widget); } // namespace button } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_BUTTON_H ================================================ FILE: k3dsdk/ngui/check_button.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { namespace ngui { namespace check_button { /// Specialization of k3d::check_button::data_proxy for use with k3d::iproperty objects template<> class data_proxy : public idata_proxy { public: typedef k3d::iproperty data_t; data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } const bool writable() { return m_writable_data ? true : false; } bool value() { return boost::any_cast(m_readable_data.property_internal_value()); } void set_value(const bool Value) { return_if_fail(m_writable_data); m_writable_data->property_set_value(Value); } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_readable_data; k3d::iwritable_property* const m_writable_data; }; std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : m_data(std::move(Data)) { set_name("k3d-check-button"); attach(); set_sensitive(m_data.get() && m_data->writable()); } control::control(std::unique_ptr Data, const Glib::ustring& label, bool mnemonic) : base(label, mnemonic), m_data(std::move(Data)) { set_name("k3d-check-button"); attach(); set_sensitive(m_data.get() && m_data->writable()); } void control::update(k3d::ihint*) { if(!m_data.get()) return; const bool new_value = m_data->value(); if(new_value != get_active()) set_active(new_value); } void control::attach() { // Update the display ... update(0); // We want to be notified if the data source changes ... if(m_data.get()) m_data->changed_signal().connect(sigc::mem_fun(*this, &control::update)); } void control::on_toggled() { if(m_data.get()) { // If the value hasn't changed, we're done ... const bool new_value = get_active(); if(new_value != m_data->value()) { // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); // Update everything with the new value ... m_data->set_value(new_value); // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), new_value ? m_data->change_message + " \"On\"" : m_data->change_message + " \"Off\"", K3D_CHANGE_SET_CONTEXT); } } base::on_toggled(); } } // namespace check_button } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/check_button.h ================================================ #ifndef K3DSDK_NGUI_CHECK_BUTTON_H #define K3DSDK_NGUI_CHECK_BUTTON_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include // Forward declarations namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace check_button { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a check button control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Returns true iff the underlying data is writable virtual const bool writable() = 0; /// Called to return the underlying data value virtual bool value() = 0; /// Called to set a new data value virtual void set_value(const bool Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating boolean quantities (i.e. the view and the controller from model-view-controller) class control : public Gtk::CheckButton { typedef Gtk::CheckButton base; public: control(std::unique_ptr Data); control(std::unique_ptr Data, const Glib::ustring& label, bool mnemonic = false); void on_toggled(); private: /// Common construction code void attach(); /// Called to update the state of the widget when the underlying data source changes void update(k3d::ihint*); /// Storeas a reference to the underlying data object const std::unique_ptr m_data; }; /// Provides an implementation of k3d::check_button::idata_proxy that supports any data source that supports the value(), set_value(), and changed_signal() concepts template class data_proxy : public idata_proxy { public: data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_data(Data) { } const bool writable() { return true; } bool value() { return m_data.internal_value(); } void set_value(const bool Value) { m_data.set_value(Value); } changed_signal_t& changed_signal() { return m_data.changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_data; }; /// Convenience factory function for creating check_button::idata_proxy objects template std::unique_ptr proxy(data_t& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } /// Convenience factory function for creating check_button::idata_proxy objects specialized for use with k3d::iproperty std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()); /// Convenience factory function for creating empty check_button::idata_proxy objects inline std::unique_ptr proxy() { return std::unique_ptr(nullptr); } } // namespace check_button } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_CHECK_BUTTON_H ================================================ FILE: k3dsdk/ngui/check_menu_item.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { namespace ngui { namespace check_menu_item { /// Specialization of k3d::check_menu_item::data_proxy for use with k3d::iproperty objects template<> class data_proxy : public idata_proxy { public: typedef k3d::iproperty data_t; data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } bool value() { return boost::any_cast(m_readable_data.property_internal_value()); } void set_value(const bool Value) { return_if_fail(m_writable_data); m_writable_data->property_set_value(Value); } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_readable_data; k3d::iwritable_property* const m_writable_data; }; std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : m_data(std::move(Data)) { set_name("k3d-check-menu-item"); attach(); } control::control(std::unique_ptr Data, const Glib::ustring& label, bool mnemonic) : base(label, mnemonic), m_data(std::move(Data)) { set_name("k3d-check-menu-item"); attach(); } void control::attach() { // Update the display ... update(0); // We want to be notified if the data source changes ... if(m_data.get()) m_data->changed_signal().connect(sigc::mem_fun(*this, &control::update)); } void control::update(k3d::ihint*) { if(!m_data.get()) return; const bool new_value = m_data->value(); if(new_value != get_active()) set_active(new_value); } void control::on_toggled() { if(m_data.get()) { // Get the control value ... const bool new_value = get_active(); // If the value hasn't changed, we're done ... if(new_value != m_data->value()) { // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); // Update everything with the new value ... m_data->set_value(new_value); // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), new_value ? m_data->change_message + " \"On\"" : m_data->change_message + " \"Off\"", K3D_CHANGE_SET_CONTEXT); } } base::on_toggled(); } } // namespace check_menu_item } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/check_menu_item.h ================================================ #ifndef K3DSDK_NGUI_CHECK_MENU_ITEM_H #define K3DSDK_NGUI_CHECK_MENU_ITEM_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class ihint; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace check_menu_item { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a toggle button control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Called to return the underlying data value virtual bool value() = 0; /// Called to set a new data value virtual void set_value(const bool Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating boolean quantities (i.e. the view and the controller from model-view-controller) class control : public Gtk::CheckMenuItem { typedef Gtk::CheckMenuItem base; public: control(std::unique_ptr Data); control(std::unique_ptr Data, const Glib::ustring& label, bool mnemonic = false); void on_toggled(); private: /// Common construction code void attach(); /// Called to update the widget state whenever the underlying data changes void update(k3d::ihint*); /// Stores a reference to the underlying data object const std::unique_ptr m_data; }; /// Provides an implementation of k3d::check_menu_item::idata_proxy that supports any data source that supports the value(), set_value(), and changed_signal() concepts template class data_proxy : public idata_proxy { public: data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_data(Data) { } bool value() { return m_data.internal_value(); } void set_value(const bool Value) { m_data.set_value(Value); } changed_signal_t& changed_signal() { return m_data.changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_data; }; /// Convenience factory function for creating check_menu_item::idata_proxy objects template std::unique_ptr proxy(data_t& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } /// Convenience factory function for creating check_menu_item::idata_proxy objects specialized for use with k3d::iproperty objects std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()); /// Convenience factory function for creating empty check_menu_item::idata_proxy objects inline std::unique_ptr proxy() { return std::unique_ptr(); } } // namespace check_menu_item } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_CHECK_MENU_ITEM_H ================================================ FILE: k3dsdk/ngui/collapsible_frame.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace collapsible_frame { ///////////////////////////////////////////////////////////////////////////// // group::implementation class group::implementation { public: sigc::signal expand_all_signal; sigc::signal collapse_all_signal; }; ///////////////////////////////////////////////////////////////////////////// // group group::group() : m_implementation(new implementation()) { } group::~group() { delete m_implementation; } void group::expand_all() { m_implementation->expand_all_signal.emit(); } void group::collapse_all() { m_implementation->collapse_all_signal.emit(); } ///////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation : public sigc::trackable { public: implementation(const Glib::ustring& Name, Gtk::Frame& Frame) : frame(Frame), arrow(Gtk::ARROW_DOWN, Gtk::SHADOW_NONE) { Gtk::HBox* const hbox = new Gtk::HBox(false); hbox->pack_start(arrow, Gtk::PACK_SHRINK); hbox->pack_start(*Gtk::manage(new Gtk::Label(Name)), Gtk::PACK_EXPAND_WIDGET); button.add(*Gtk::manage(hbox)); button.set_relief(Gtk::RELIEF_NONE); button.signal_clicked().connect(sigc::mem_fun(*this, &implementation::on_toggle)); button.signal_button_press_event().connect(sigc::mem_fun(*this, &implementation::on_button_press_event)); button.set_tooltip_text(_("LMB-Click to expand/collapse. RMB-Click for other options.")); frame.set_label_widget(button); frame.set_shadow_type(Gtk::SHADOW_NONE); context_menu.items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Expand")) << connect_menu_item(sigc::mem_fun(*this, &implementation::expand)))); context_menu.items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Collapse")) << connect_menu_item(sigc::mem_fun(*this, &implementation::collapse)))); context_menu.items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Expand All")) << connect_menu_item(expand_all_signal.make_slot()))); context_menu.items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Collapse All")) << connect_menu_item(collapse_all_signal.make_slot()))); } void expand() { arrow.property_arrow_type().set_value(Gtk::ARROW_DOWN); if(frame.get_child()) frame.get_child()->show(); } void collapse() { arrow.property_arrow_type().set_value(Gtk::ARROW_RIGHT); if(frame.get_child()) frame.get_child()->hide(); } bool is_collapsed() { return arrow.property_arrow_type().get_value() != Gtk::ARROW_DOWN; } void on_toggle() { if(is_collapsed()) expand(); else collapse(); } bool on_button_press_event(GdkEventButton* Event) { if(Event->button != 3) return false; context_menu.show_all(); context_menu.popup(3, gtk_get_current_event_time()); return true; } Gtk::Frame& frame; Gtk::Arrow arrow; event_button button; Gtk::Menu context_menu; sigc::signal expand_all_signal; sigc::signal collapse_all_signal; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(const Glib::ustring& Name) : m_implementation(new implementation(Name, *this)) { } control::control(const Glib::ustring& Name, group& Group) : m_implementation(new implementation(Name, *this)) { Group.m_implementation->expand_all_signal.connect(sigc::mem_fun(*this, &control::expand)); Group.m_implementation->collapse_all_signal.connect(sigc::mem_fun(*this, &control::collapse)); m_implementation->expand_all_signal.connect(Group.m_implementation->expand_all_signal.make_slot()); m_implementation->collapse_all_signal.connect(Group.m_implementation->collapse_all_signal.make_slot()); } control::~control() { delete m_implementation; } void control::expand() { m_implementation->expand(); } void control::collapse() { m_implementation->collapse(); } bool control::is_collapsed() { return m_implementation->is_collapsed(); } Gtk::Button& control::toggle_button() { return m_implementation->button; } } // namespace collapsible_frame } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/collapsible_frame.h ================================================ #ifndef K3DSDK_NGUI_COLLAPSIBLE_FRAME_H #define K3DSDK_NGUI_COLLAPSIBLE_FRAME_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include // Forward declarations namespace Gtk { class Button; } namespace k3d { namespace ngui { namespace collapsible_frame { /// Groups a collection of control objects together so they can be expanded / collapsed as a set class group { public: group(); ~group(); /// Expands every control in the group void expand_all(); /// Collapses every control in the group void collapse_all(); private: class implementation; implementation* const m_implementation; friend class control; }; /// Provides a container that can be manually collapsed / expanded by users to reduce clutter class control : public Gtk::Frame { public: control(const Glib::ustring& Name); control(const Glib::ustring& Name, group& Group); ~control(); /// Programmatically expands the control void expand(); /// Programmatically collapses the control void collapse(); /// Returns true iff the control is currently collapsed bool is_collapsed(); /// Low-level access to the button that toggles the collapsed / expanded state Gtk::Button& toggle_button(); private: class implementation; implementation* const m_implementation; }; } // namespace collapsible_frame } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_COLLAPSIBLE_FRAME_H ================================================ FILE: k3dsdk/ngui/color_chooser.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace color_chooser { namespace detail { /// Tutorial-enabled implementation of a standard color selection dialog class color_selection_dialog: public application_window { typedef application_window base; public: color_selection_dialog(std::unique_ptr Data) : m_data(std::move(Data)) { Gtk::VBox* const vbox = new Gtk::VBox(false); add(*manage(vbox)); m_color_selection.set_has_opacity_control(false); m_color_selection.set_has_palette(true); m_color_changed_connection = m_color_selection.signal_color_changed().connect(sigc::mem_fun(*this, &color_selection_dialog::on_color_changed)); vbox->pack_start(m_color_selection, Gtk::PACK_EXPAND_WIDGET); Gtk::HButtonBox* const bbox = new Gtk::HButtonBox(Gtk::BUTTONBOX_END); vbox->pack_start(*Gtk::manage(bbox)); bbox->pack_start(*Gtk::manage( new Gtk::Button(Gtk::Stock::CLOSE) << connect_button(sigc::mem_fun(*this, &color_selection_dialog::close)))); on_data_changed(0); if(m_data.get()) m_data->changed_signal().connect(sigc::mem_fun(*this, &color_selection_dialog::on_data_changed)); show_all(); } private: void on_color_changed() { return_if_fail(m_data.get()); const k3d::color color = convert(m_color_selection.get_current_color()); if(color == m_data->value()) return; if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_data->set_value(color); if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), m_data->change_message + " " + k3d::string_cast(color), K3D_CHANGE_SET_CONTEXT); } void on_data_changed(k3d::ihint*) { return_if_fail(m_data.get()); const Gdk::Color color(convert(m_data->value())); if(color != m_color_selection.get_current_color()) { m_color_changed_connection.block(); m_color_selection.set_current_color(color); m_color_changed_connection.unblock(); } } Gtk::ColorSelection m_color_selection; sigc::connection m_color_changed_connection; std::unique_ptr m_data; }; } // namespace detail /// Specialization of k3d::color_chooser::data_proxy for use with k3d::iproperty objects template<> class data_proxy : public idata_proxy { public: typedef k3d::iproperty data_t; data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } k3d::color value() { const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::color)) return boost::any_cast(m_readable_data.property_internal_value()); else if(type == typeid(k3d::ri::color)) return boost::any_cast(m_readable_data.property_internal_value()); else k3d::log() << error << "unknown property type: " << type.name() << std::endl; return k3d::color(0, 0, 0); } void set_value(const k3d::color Value) { return_if_fail(m_writable_data); const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::color)) m_writable_data->property_set_value(Value); else if(type == typeid(k3d::ri::color)) m_writable_data->property_set_value(k3d::ri::color(Value)); else k3d::log() << error << "unknown property type: " << type.name() << std::endl; } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } std::unique_ptr clone() { return std::unique_ptr(new data_proxy(m_readable_data, state_recorder, change_message)); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_readable_data; k3d::iwritable_property* const m_writable_data; }; std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : m_area(new Gtk::DrawingArea()), m_data(std::move(Data)) { m_area->signal_expose_event().connect(sigc::hide(sigc::mem_fun(*this, &control::on_redraw))); add(*manage(m_area)); data_changed(0); if(m_data.get()) m_data->changed_signal().connect(sigc::mem_fun(*this, &control::data_changed)); } control::~control() { m_deleted_signal.emit(); } bool control::on_redraw() { return_val_if_fail(m_data.get(), false); Glib::RefPtr gc = Gdk::GC::create(m_area->get_window()); Gdk::Color color = convert(m_data->value()); m_area->get_default_colormap()->alloc_color(color); gc->set_foreground(color); m_area->get_window()->draw_rectangle(gc, true, 0, 0, m_area->get_width(), m_area->get_height()); return true; } void control::on_clicked() { return_if_fail(m_data.get()); detail::color_selection_dialog* const color_selection = new detail::color_selection_dialog(m_data->clone()); m_deleted_signal.connect(sigc::mem_fun(*color_selection, &detail::color_selection_dialog::close)); color_selection->show(); base::on_clicked(); } void control::data_changed(k3d::ihint*) { m_area->queue_draw(); } } // namespace color_chooser } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/color_chooser.h ================================================ #ifndef K3DSDK_NGUI_COLOR_CHOOSER_H #define K3DSDK_NGUI_COLOR_CHOOSER_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace Gtk { class DrawingArea; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace color_chooser { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a color chooser control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Called to return the underlying data value virtual k3d::color value() = 0; /// Called to set a new data value virtual void set_value(const k3d::color Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; /// Virtual copy constructor idiom virtual std::unique_ptr clone() = 0; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy&); idata_proxy& operator=(const idata_proxy&); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating colors (i.e. the view and the controller from model-view-controller) class control : public Gtk::Button { typedef Gtk::Button base; public: control(std::unique_ptr Data); ~control(); private: /// Called to refresh the drawing area that displays the current color bool on_redraw(); /// Called when the user clicks on the control void on_clicked(); /// Called whenever the underlying data changes void data_changed(k3d::ihint*); /// Displays the currently color Gtk::DrawingArea* const m_area; /// Stores a reference to the underlying data object std::unique_ptr m_data; /// Stores a signal that will be emitted when the control is destroyed sigc::signal m_deleted_signal; }; /// Provides an implementation of k3d::color_chooser::idata_proxy that supports any data source that supports the value(), set_value(), and changed_signal() concepts template class data_proxy : public idata_proxy { public: data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_data(Data) { } k3d::color value() { return m_data.value(); } void set_value(const k3d::color Value) { m_data.set_value(Value); } changed_signal_t& changed_signal() { return m_data.changed_signal(); } std::unique_ptr clone() { return std::unique_ptr(new data_proxy(m_data, state_recorder, change_message)); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_data; }; /// Convenience factory function for creating color_chooser::idata_proxy objects template std::unique_ptr proxy(data_t& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = "") { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } /// Convenience factory function for creating color_chooser::idata_proxy objects, specialized for k3d::iproperty std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = ""); } // namespace color_chooser } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_COLOR_CHOOSER_H ================================================ FILE: k3dsdk/ngui/combo_box.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements the k3d::combo_box classes, which provide a model-view-controller UI for enumerated (fixed set of choices) types \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { namespace ngui { namespace combo_box { /// Specialization of k3d::combo_box::data_proxy for use with k3d::iproperty objects template<> class data_proxy : public idata_proxy { public: typedef k3d::iproperty data_t; data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } const std::string value() { return boost::any_cast(m_readable_data.property_internal_value()); } void set_value(const std::string& Value) { return_if_fail(m_writable_data); return_if_fail(m_writable_data->property_set_value(Value)); } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_readable_data; k3d::iwritable_property* const m_writable_data; }; std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : m_data(std::move(Data)) { if(m_data.get()) m_data->changed_signal().connect(sigc::mem_fun(*this, &control::data_changed)); m_model = Gtk::ListStore::create(m_columns); set_model(m_model); set_text_column(m_columns.value); Gtk::Entry* const entry = dynamic_cast(get_child()); signal_changed().connect(sigc::mem_fun(*this, &control::on_list_changed)); entry->signal_focus_in_event().connect(sigc::mem_fun(*this, &control::on_entry_focus_in_event)); entry->signal_focus_out_event().connect(sigc::mem_fun(*this, &control::on_entry_focus_out_event)); entry->signal_activate().connect(sigc::mem_fun(*this, &control::on_entry_activate)); } void control::set_values(const values_t& Values) { m_model->clear(); for(values_t::const_iterator value = Values.begin(); value != Values.end(); ++value) { Gtk::TreeRow row = *m_model->append(); row[m_columns.value] = *value; } data_changed(0); } void control::data_changed(k3d::ihint*) { return_if_fail(m_data.get()); const std::string value = m_data->value(); add_impromptu_value(value); Gtk::Entry* const entry = dynamic_cast(get_child()); entry->set_text(value); } void control::on_list_changed() { set_new_value(); } bool control::on_entry_focus_in_event(GdkEventFocus* Event) { // Disable accelerators for this window Gtk::Window* const window = dynamic_cast(get_toplevel()); if(window) { m_disabled_accel_group = window->get_accel_group(); window->remove_accel_group(window->get_accel_group()); } return false; } bool control::on_entry_focus_out_event(GdkEventFocus* Event) { // Enable accelerators for this window Gtk::Window* const window = dynamic_cast(get_toplevel()); if(window) { window->add_accel_group(m_disabled_accel_group); m_disabled_accel_group.clear(); } set_new_value(); return false; } void control::on_entry_activate() { child_focus(Gtk::DIR_TAB_FORWARD); } void control::add_impromptu_value(const std::string& Value) { // Never add empty string to the list ... if(Value.empty()) return; // Never add duplicates to the list ... const Gtk::TreeNodeChildren children = m_model->children(); for(Gtk::TreeNodeChildren::const_iterator child = children.begin(); child != children.end(); ++child) { if(Value == (*child)[m_columns.value]) return; } Gtk::TreeRow row = *m_model->append(); row[m_columns.value] = Value; } void control::set_new_value() { Gtk::Entry* const entry = dynamic_cast(get_child()); const std::string value = entry->get_text(); return_if_fail(m_data.get()); add_impromptu_value(value); if(value == m_data->value()) return; k3d::istate_recorder* const state_recorder = m_data->state_recorder; const Glib::ustring change_message = m_data->change_message; if(state_recorder) state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_data->set_value(value); if(state_recorder) state_recorder->commit_change_set(state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), change_message + " " + value, K3D_CHANGE_SET_CONTEXT); } } // namespace combo_box } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/combo_box.h ================================================ #ifndef K3DSDK_NGUI_COMBO_BOX_H #define K3DSDK_NGUI_COMBO_BOX_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares k3d::combo_box classes, which provide a model-view-controller UI for text data that includes a finite set of default values \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include // Forward declarations namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace combo_box { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a combo_box control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Called to return the underlying data value virtual const std::string value() = 0; /// Called to set a new data value virtual void set_value(const std::string& Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating enumerated quantities (i.e. the view and the controller from model-view-controller) class control : public Gtk::ComboBoxEntry { typedef Gtk::ComboBoxEntry base; public: control(std::unique_ptr Data); /// Defines a predefined (but not exclusive) list of values that should be available to the user typedef std::vector values_t; /// Specifies a predefined (but not exclusive) list of values that should be available to the user void set_values(const values_t& Values); private: /// Called whenever the underlying data changes void data_changed(k3d::ihint*); /// Called when the user picks an existing value using the dropdown list void on_list_changed(); /// Called when the edit control receives the focus bool on_entry_focus_in_event(GdkEventFocus* Event); /// Called when the user tabs off the edit control bool on_entry_focus_out_event(GdkEventFocus* Event); /// Called when the user activates the edit control void on_entry_activate(); /// Called to add new values to the list that aren't already part of the default set void add_impromptu_value(const std::string& Value); /// Called to update the underlying data when the control is modified by the user void set_new_value(); /// Stores a proxy for the underlying data source std::unique_ptr m_data; /// Defines a data model for the underlying combo box widget class columns : public Gtk::TreeModelColumnRecord { public: columns() { add(value); } Gtk::TreeModelColumn value; }; /// Defines a data model for the underlying combo box widget columns m_columns; /// Stores data for the underlying combo box widget Glib::RefPtr m_model; /// Stores the global accel group while the control has the keyboard focus Glib::RefPtr m_disabled_accel_group; }; /// Provides an implementation of k3d::combo_box::idata_proxy that supports any data source that supports the value(), set_value(), and changed_signal() concepts template class data_proxy : public idata_proxy { public: data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_data(Data) { } const std::string value() { return m_data.value(); } void set_value(const std::string& Value) { m_data.set_value(Value); } changed_signal_t& changed_signal() { return m_data.changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_data; }; /// Convenience factory function for creating combo_box::idata_proxy objects template std::unique_ptr proxy(data_t& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } /// Convenience factory function for creating combo_box::idata_proxy objects for use with k3d::iproperty std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()); } // namespace combo_box } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_COMBO_BOX_H ================================================ FILE: k3dsdk/ngui/console.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { namespace ngui { namespace console { ///////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation() : command_index(0), completion_key(GDK_VoidSymbol) { buffer = Gtk::TextBuffer::create(); read_only = Gtk::TextTag::create("read-only"); read_only->property_editable() = false; buffer->get_tag_table()->add(read_only); begin_input = Gtk::TextMark::create("begin-input"); buffer->add_mark(begin_input, buffer->end()); view.set_buffer(buffer); view.set_editable(false); view.set_cursor_visible(false); view.set_wrap_mode(Gtk::WRAP_WORD); view.signal_key_press_event().connect(sigc::mem_fun(*this, &implementation::on_key_press_event), false); scrolled_window.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); scrolled_window.add(view); } bool on_key_press_event(GdkEventKey* event) { if(event->keyval == GDK_Return) { const k3d::string_t input = buffer->get_text(buffer->get_iter_at_mark(begin_input), buffer->end()).raw(); buffer->insert(buffer->end(), "\n"); buffer->apply_tag(read_only, buffer->get_iter_at_mark(begin_input), buffer->end()); buffer->move_mark(begin_input, buffer->end()); if(!input.empty() && (command_history.empty() || input != command_history.back())) command_history.push_back(input); command_index = command_history.size(); command_signal.emit(input); view.scroll_to(buffer->get_insert()); return true; } else if(event->keyval == completion_key) { const k3d::string_t input = buffer->get_text(buffer->get_iter_at_mark(begin_input), buffer->end()).raw(); complete_key_pressed_signal.emit(input); return true; } else if(event->keyval == GDK_Left) { return buffer->get_iter_at_mark(buffer->get_insert()) <= buffer->get_iter_at_mark(begin_input); } else if(event->keyval == GDK_Up) { if(command_index) { if(command_index == command_history.size()) command_buffer = buffer->get_text(buffer->get_iter_at_mark(begin_input), buffer->end()).raw(); command_index -= 1; buffer->erase(buffer->get_iter_at_mark(begin_input), buffer->end()); buffer->insert(buffer->end(), command_history[command_index]); } buffer->place_cursor(buffer->end()); return true; } else if(event->keyval == GDK_Down) { if(command_index < command_history.size()) { command_index += 1; buffer->erase(buffer->get_iter_at_mark(begin_input), buffer->end()); buffer->insert(buffer->end(), command_index < command_history.size() ? command_history[command_index] : command_buffer); } buffer->place_cursor(buffer->end()); return true; } else if(event->keyval == GDK_Home) { buffer->place_cursor(buffer->get_iter_at_mark(begin_input)); return true; } else if(event->keyval == GDK_v && (event->state & GDK_CONTROL_MASK)) { const k3d::string_t input = Gtk::Clipboard::get()->wait_for_text(); std::vector lines; boost::split(lines, input, boost::is_any_of("\n")); for(k3d::uint_t i = 0; i != lines.size(); ++i) { buffer->insert(buffer->end(), lines[i]); if(i+1 < lines.size()) { buffer->insert(buffer->end(), "\n"); buffer->apply_tag(read_only, buffer->get_iter_at_mark(begin_input), buffer->end()); buffer->move_mark(begin_input, buffer->end()); if(!lines[i].empty() && (command_history.empty() || lines[i] != command_history.back())) command_history.push_back(lines[i]); command_index = command_history.size(); command_signal.emit(lines[i]); } } return true; } else if(event->keyval != GDK_Control_L && event->keyval != GDK_Control_R) { return false; } return false; } void print_string(const string_t& String, const bool_t Editable) { if(current_format) { if(!buffer->get_tag_table()->lookup(current_format->property_name().get_value())) buffer->get_tag_table()->add(current_format); buffer->insert_with_tag(buffer->end(), String, current_format); } else { buffer->insert(buffer->end(), String); } if(!Editable) buffer->apply_tag(read_only, buffer->begin(), buffer->end()); view.scroll_to(buffer->get_insert()); } std::vector command_history; std::vector::size_type command_index; string_t command_buffer; sigc::signal command_signal; sigc::signal complete_key_pressed_signal; Glib::RefPtr buffer; Glib::RefPtr current_format; Glib::RefPtr read_only; Glib::RefPtr begin_input; Gtk::TextView view; Gtk::ScrolledWindow scrolled_window; guint completion_key; }; ///////////////////////////////////////////////////////////////////////////// // control control::control() : base(), m_implementation(new implementation()) { set_name("k3d-console"); set_shadow_type(Gtk::SHADOW_NONE); add(m_implementation->scrolled_window); } control::~control() { delete m_implementation; } void control::clear() { m_implementation->buffer->erase(m_implementation->buffer->begin(), m_implementation->buffer->end()); } void control::set_current_format(Glib::RefPtr& Tag) { m_implementation->current_format = Tag; } void control::print_string(const string_t& String, const bool_t Editable) { m_implementation->print_string(String, Editable); if(!Editable) { m_implementation->view.set_editable(false); m_implementation->view.set_cursor_visible(false); } } void control::prompt_string(const string_t& String) { m_implementation->print_string(String, false); m_implementation->buffer->move_mark(m_implementation->begin_input, m_implementation->buffer->end()); m_implementation->buffer->place_cursor(m_implementation->buffer->end()); m_implementation->view.set_editable(true); m_implementation->view.set_cursor_visible(true); } void control::set_completion_key(const uint_t KeySym) { m_implementation->completion_key = KeySym; } sigc::connection control::connect_command_signal(const sigc::slot& Slot) { return m_implementation->command_signal.connect(Slot); } sigc::connection control::connect_complete_key_pressed_signal(const sigc::slot& Slot) { return m_implementation->complete_key_pressed_signal.connect(Slot); } } // namespace console } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/console.h ================================================ #ifndef K3DSDK_NGUI_CONSOLE_H #define K3DSDK_NGUI_CONSOLE_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace Gtk { class TextTag; } namespace k3d { namespace ngui { namespace console { ///////////////////////////////////////////////////////////////////////////// // control /// Provides a "console" control that can be used for line-oriented output class control : public Gtk::Frame { typedef Gtk::Frame base; public: control(); ~control(); /// Clears the contents of the console. void clear(); /// Sets the text formatting tag that will be applied to text passed to print_string() and prompt_string(). void set_current_format(Glib::RefPtr& Tag); /// Writes the supplied text to the console. If Editable is true, the text can be edited on the commad line void print_string(const string_t& String, const bool_t Editable=false); /// Writes the supplied user prompt text to the console. void prompt_string(const string_t& String); /// Set the completion key /** * Note: By default, comletion is disabled (KeySym == GDK_VoidSymbol), so * you need to call this with i.e. GDK_Tab to enable it */ void set_completion_key(const uint_t KeySym); /// Connects a slot to a signal that will be emitted whenever the user enters a command. sigc::connection connect_command_signal(const sigc::slot& Slot); /// Connects a slot to a signal that will be emitted when the "completion request" key (see set_completion_key) is pressed sigc::connection connect_complete_key_pressed_signal(const sigc::slot& Slot); private: class implementation; implementation* const m_implementation; }; } // namespace console } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_CONSOLE_H ================================================ FILE: k3dsdk/ngui/context_menu.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { /// Provides a standardized context menu for nodes class node_context_menu : public Gtk::Menu { public: node_context_menu(document_state& DocumentState) : m_document_state(DocumentState) { // Create viewport-specific functionality ... m_viewport1 = new Gtk::MenuItem(*Gtk::manage( new Gtk::Label() << alignment(0, 0.5) << set_markup(_("Viewport:")))); append(*Gtk::manage(m_viewport1)); // Render-related functionality ... Gtk::Menu* const render_submenu = new Gtk::Menu(); render_submenu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("render_preview", Gtk::ICON_SIZE_MENU))), _("Render Preview")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_render_preview)))); render_submenu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("render_frame", Gtk::ICON_SIZE_MENU))), _("Render Image")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_render_frame)))); render_submenu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("render_animation", Gtk::ICON_SIZE_MENU))), _("Render Animation")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_render_animation)))); items().push_back(Gtk::Menu_Helpers::MenuElem(_("Render"), *Gtk::manage(render_submenu))); items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set Camera ...")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_set_viewport_camera)))); // Set render engines Gtk::Menu* const engines_submenu = new Gtk::Menu(); engines_submenu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set Preview Engine ...")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_set_viewport_preview_engine)))); engines_submenu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set Still Engine ...")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_set_viewport_still_engine)))); engines_submenu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set Animation Engine ...")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_set_viewport_animation_engine)))); engines_submenu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set OpenGL Engine ...")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_set_viewport_gl_engine)))); items().push_back(Gtk::Menu_Helpers::MenuElem(_("Render Engine"), *Gtk::manage(engines_submenu))); // Viewport section end items().push_back(Gtk::Menu_Helpers::SeparatorElem()); // Functionality common to all nodes ... m_delete_nodes = new Gtk::MenuItem(_("Delete")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_delete)); items().push_back(*Gtk::manage(m_delete_nodes)); // Persistence-related functionality ... /* if(dynamic_cast(&Object)) { items().push_back(Gtk::Menu_Helpers::SeparatorElem()); items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::SAVE, Gtk::ICON_SIZE_MENU)), _("Save Object")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_save_node)))); items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::OPEN, Gtk::ICON_SIZE_MENU)), _("Load Object")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_load_node)))); } */ // Mesh-specific functionality ... m_instantiate_meshes = new Gtk::MenuItem(_("Instantiate")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_instantiate)); items().push_back(*Gtk::manage(m_instantiate_meshes)); m_duplicate_meshes = new Gtk::MenuItem(_("Duplicate")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_duplicate)); items().push_back(*Gtk::manage(m_duplicate_meshes)); m_animate_transformation = new Gtk::MenuItem(_("Animate Transformation")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_animate_transformation)); items().push_back(*Gtk::manage(m_animate_transformation)); // Mesh modifiers menu const factories_t& mesh_modifier_factories = mesh_modifiers(); if(!mesh_modifier_factories.empty()) { m_mesh_modifiers = new Gtk::Menu(); for(factories_t::const_iterator modifier = mesh_modifier_factories.begin(); modifier != mesh_modifier_factories.end(); ++modifier) { k3d::iplugin_factory& factory = **modifier; m_mesh_modifiers->items().push_back(*Gtk::manage( create_menu_item(factory) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &node_context_menu::on_modify_meshes), &factory)))); } items().push_back(Gtk::Menu_Helpers::MenuElem(_("Mesh Modifier"), *manage(m_mesh_modifiers))); } // Transform-specific functionality ... const factories_t& transform_modifier_factories = transform_modifiers(); if(!transform_modifier_factories.empty()) { m_transform_modifiers = new Gtk::Menu(); for(factories_t::const_iterator modifier = transform_modifier_factories.begin(); modifier != transform_modifier_factories.end(); ++modifier) { k3d::iplugin_factory& factory = **modifier; m_transform_modifiers->items().push_back(*Gtk::manage( create_menu_item(factory) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &node_context_menu::on_modifier_transform), &factory)))); } items().push_back(Gtk::Menu_Helpers::MenuElem(_("Transform Modifier"), *manage(m_transform_modifiers))); } // Mesh sinks menu const factories_t& mesh_sink_factories = mesh_sinks(); if(!mesh_sink_factories.empty()) { m_mesh_sinks = new Gtk::Menu(); for(factories_t::const_iterator sink = mesh_sink_factories.begin(); sink != mesh_sink_factories.end(); ++sink) { k3d::iplugin_factory& factory = **sink; m_mesh_sinks->items().push_back(*Gtk::manage( create_menu_item(factory) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &node_context_menu::on_modify_meshes), &factory)))); // the modify mesh code also applies to sinks, after only very minor modification } items().push_back(Gtk::Menu_Helpers::MenuElem(_("Mesh Sink"), *manage(m_mesh_sinks))); } // Viewport visibility ... items().push_back(Gtk::Menu_Helpers::SeparatorElem()); items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Hide Selection")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_hide_selection)))); items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Show Selection")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_show_selection)))); items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Hide Unselected")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_hide_unselected)))); items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Show All")) << connect_menu_item(sigc::mem_fun(*this, &node_context_menu::on_show_all)))); show_all(); } void update_menu() { // Display viewport-specific functionality ... m_viewport = m_document_state.get_focus_viewport(); const bool display_viewport = (m_viewport && m_viewport->gl_engine()); m_viewport1->set_sensitive(display_viewport); // Mesh specific functionality unsigned long selected_node_counter = 0; unsigned long selected_mesh_counter = 0; unsigned long selected_transform_counter = 0; const k3d::nodes_t selected_nodes = selection::state(m_document_state.document()).selected_nodes(); for(k3d::nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) { ++selected_node_counter; if(dynamic_cast(*node)) ++selected_mesh_counter; if(dynamic_cast(*node)) ++selected_transform_counter; } const bool non_empty_selection = (selected_node_counter > 0); m_delete_nodes->set_sensitive(non_empty_selection); m_instantiate_meshes->set_sensitive(non_empty_selection); m_duplicate_meshes->set_sensitive(non_empty_selection); const bool display_mesh_modifiers = (selected_mesh_counter > 0); m_mesh_modifiers->set_sensitive(display_mesh_modifiers); m_mesh_sinks->set_sensitive(display_mesh_modifiers); const bool display_transform_modifiers = (selected_transform_counter > 0); m_transform_modifiers->set_sensitive(display_transform_modifiers); } void on_show() { update_menu(); Gtk::Widget::on_show(); } private: void on_set_viewport_camera() { return_if_fail(m_viewport); k3d::icamera* const camera = pick_camera(m_document_state, m_viewport->camera()); if(!camera) return; m_viewport->set_camera(camera); } void on_set_viewport_preview_engine() { return_if_fail(m_viewport); k3d::irender_camera_preview* const engine = pick_camera_preview_render_engine(m_document_state); if(!engine) return; m_viewport->set_camera_preview_engine(engine); } void on_set_viewport_still_engine() { return_if_fail(m_viewport); k3d::irender_camera_frame* const engine = pick_camera_still_render_engine(m_document_state); if(!engine) return; m_viewport->set_camera_still_engine(engine); } void on_set_viewport_animation_engine() { return_if_fail(m_viewport); k3d::irender_camera_animation* const engine = pick_camera_animation_render_engine(m_document_state); if(!engine) return; m_viewport->set_camera_animation_engine(engine); } void on_set_viewport_gl_engine() { return_if_fail(m_viewport); k3d::gl::irender_viewport* const engine = pick_gl_render_engine(m_document_state); if(!engine) return; m_viewport->set_gl_engine(engine); } void on_render_preview() { return_if_fail(m_viewport); k3d::icamera* camera = m_viewport->camera(); if(!camera) camera = pick_camera(m_document_state); if(!camera) return; k3d::irender_camera_preview* render_engine = m_viewport->camera_preview_engine(); if(!render_engine) render_engine = pick_camera_preview_render_engine(m_document_state); if(!render_engine) return; m_viewport->set_camera(camera); m_viewport->set_camera_preview_engine(render_engine); render(*camera, *render_engine); } void on_render_frame() { k3d::icamera* camera = m_viewport ? m_viewport->camera() : 0; if(!camera) camera = pick_camera(m_document_state); if(!camera) return; k3d::irender_camera_frame* render_engine = m_viewport ? m_viewport->camera_still_engine() : 0; if(!render_engine) render_engine = pick_camera_still_render_engine(m_document_state); if(!render_engine) return; if(m_viewport) { m_viewport->set_camera(camera); m_viewport->set_camera_still_engine(render_engine); } render(*camera, *render_engine); } void on_render_animation() { k3d::icamera* camera = m_viewport ? m_viewport->camera() : 0; if(!camera) camera = pick_camera(m_document_state); if(!camera) return; k3d::irender_camera_animation* render_engine = m_viewport ? m_viewport->camera_animation_engine() : 0; if(!render_engine) render_engine = pick_camera_animation_render_engine(m_document_state); if(!render_engine) return; if(m_viewport) { m_viewport->set_camera(camera); m_viewport->set_camera_animation_engine(render_engine); } render(m_document_state, *camera, *render_engine); } /* void on_save_node() { k3d::ipersistent* const persistent = dynamic_cast(&m_node); return_if_fail(persistent); k3d::filesystem::path path; if(!get_file_path(k3d::ipath_property::WRITE, m_node.factory().name(), _("Save Object Properties:"), k3d::filesystem::path(), path)) return; k3d::log() << info << "Writing .k3d file: " << path.native_string() << std::endl; k3d::filesystem::ofstream file(path); if(!file) { k3d::log() << error << k3d_file_reference << ": error opening [" << path.native_string() << "]" << std::endl; return; } const k3d::filesystem::path root_path = path.branch_path(); k3d::dependencies dependencies; k3d::persistent_lookup lookup; k3d::ipersistent::save_context context(root_path, dependencies, lookup); k3d::xml::element xml("k3dml"); k3d::save_node(*persistent, xml, context); file << k3d::xml::declaration() << xml; } void on_load_node() { k3d::ipersistent* const persistent = dynamic_cast(&m_node); return_if_fail(persistent); k3d::filesystem::path path; if(!get_file_path(k3d::ipath_property::READ, m_node.factory().name(), _("Load Object Properties:"), k3d::filesystem::path(), path)) return; k3d::log() << info << "Reading .k3d file: " << path.native_string() << std::endl; k3d::filesystem::ifstream file(path); if(!file) { k3d::log() << error << k3d_file_reference << ": error opening [" << path.native_string() << "]" << std::endl; return; } k3d::xml::element xml("k3dml"); try { k3d::xml::hide_progress progress; k3d::xml::parse(xml, file, path.native_string(), progress); } catch(std::exception& e) { k3d::log() << error << e.what() << std::endl; return; } return_if_fail(xml.name == "k3dml"); k3d::xml::element* const xml_node = k3d::xml::find_element(xml, "node"); return_if_fail(xml_node); const k3d::uuid class_id = k3d::xml::attribute_value(*xml_node, "class", k3d::uuid::null()); if(class_id != m_node.factory().class_id()) { error_message(_("Wrong node type"), _("Load Object Properties:")); return; } k3d::record_state_change_set changeset(m_document_state.document(), k3d::string_cast(boost::format(_("Load %1%")) % path.native_string())); const k3d::filesystem::path root_path = path.branch_path(); k3d::persistent_lookup lookup; k3d::ipersistent::load_context context(root_path, lookup); persistent->load(*xml_node, context); } */ void on_delete() { k3d::record_state_change_set changeset(m_document_state.document(), _("Delete nodes"), K3D_CHANGE_SET_CONTEXT); k3d::nodes_t nodes = selection::state(m_document_state.document()).selected_nodes(); k3d::delete_nodes(m_document_state.document(), nodes); k3d::gl::redraw_all(m_document_state.document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } /// Instantiates selected meshes void on_instantiate() { pipeline::instantiate_selected_nodes(m_document_state.document()); } /// Duplicates selected meshes void on_duplicate() { pipeline::duplicate_selected_nodes(m_document_state.document()); } /// Easy animation of transformation matrix void on_animate_transformation() { const k3d::nodes_t selected_nodes = selection::state(m_document_state.document()).selected_nodes(); for(k3d::nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) { k3d::inode* upstream_node = 0; // Check if the selected node can be transformed k3d::imatrix_sink* const downstream_sink = dynamic_cast(*node); if (!downstream_sink) continue; k3d::iproperty& downstream_input = downstream_sink->matrix_sink_input(); k3d::iproperty* upstream_output = (*node)->document().pipeline().dependency(downstream_input); // Check upstream object if(upstream_output) upstream_node = upstream_output->property_node(); // Skip nodes that are animated already if (dynamic_cast(upstream_node)) continue; // Create the new track if (k3d::inode* const track = k3d::plugin::create("AnimationTrackDoubleMatrix4", m_document_state.document(), (*node)->name() + " Track")) { // Create a default interpolator, if it didn't exist already k3d::inode* interpolator = 0; const std::vector nodes = k3d::node::lookup(m_document_state.document(), "Linear Transformation Interpolator"); if(1 == nodes.size()) { interpolator = nodes[0]; } else { interpolator = k3d::plugin::create("InterpolatorDoubleMatrix4Linear", m_document_state.document(), "Linear Transformation Interpolator"); } // Set the interpolator k3d::property::set_internal_value(*track, "interpolator", interpolator); k3d::ipipeline::dependencies_t dependencies; k3d::iproperty* from = k3d::property::get(**node, "input_matrix"); k3d::iproperty* to = k3d::property::get(*track, "output_value"); if (from && to) // Connect the transformation matrix of the selected node to the output of the track dependencies.insert(std::make_pair(from, to)); k3d::iproperty* track_time = k3d::property::get(*track, "time_input"); k3d::iproperty* time = k3d::get_time(m_document_state.document()); if (track_time && time) // Connect the time property dependencies.insert(std::make_pair(track_time, time)); // We must save the dependencies before the nextstep m_document_state.document().pipeline().set_dependencies(dependencies); // Create a keyframe at the first and last frame k3d::iproperty* start_time = k3d::get_start_time(m_document_state.document()); k3d::iproperty* end_time = k3d::get_end_time(m_document_state.document()); if (time && start_time && end_time) { k3d::ikeyframer* keyframer = dynamic_cast(track); boost::any original_time = k3d::property::pipeline_value(*time); k3d::property::set_internal_value(*time, k3d::property::pipeline_value(*start_time)); keyframer->keyframe(); k3d::property::set_internal_value(*time, k3d::property::pipeline_value(*end_time)); keyframer->keyframe(); k3d::property::set_internal_value(*time, original_time); } } } } /// Modify selected meshes void on_modify_meshes(k3d::iplugin_factory* Modifier) { if(cancel_plugin(*Modifier)) return; modify_selected_meshes(m_document_state, Modifier); k3d::gl::redraw_all(m_document_state.document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } /// Modify selected transforms void on_modifier_transform(k3d::iplugin_factory* Modifier) { if(cancel_plugin(*Modifier)) return; k3d::nodes_t selected_nodes = selection::state(m_document_state.document()).selected_nodes(); k3d::inode* new_modifier; for(k3d::nodes_t::iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) { new_modifier = modify_transformation(m_document_state.document(), **node, Modifier); assert_warning(new_modifier); } // Show the new modifier properties if only one was processed if(selected_nodes.size() == 1) panel::mediator(m_document_state.document()).set_focus(*new_modifier); k3d::gl::redraw_all(m_document_state.document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_hide_selection() { record_state_change_set change_set(m_document_state.document(), _("Hide selection"), K3D_CHANGE_SET_CONTEXT); const nodes_t selected_nodes = selection::state(m_document_state.document()).selected_nodes(); for(nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) node::hide(**node); } void on_show_selection() { k3d::record_state_change_set change_set(m_document_state.document(), _("Show selection"), K3D_CHANGE_SET_CONTEXT); const nodes_t selected_nodes = selection::state(m_document_state.document()).selected_nodes(); for(nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) node::show(**node); } void on_hide_unselected() { k3d::record_state_change_set change_set(m_document_state.document(), _("Hide unselected"), K3D_CHANGE_SET_CONTEXT); const nodes_t& nodes = m_document_state.document().nodes().collection(); for(nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { if(!selection::state(m_document_state.document()).is_selected(**node)) node::hide(**node); } } void on_show_all() { k3d::record_state_change_set change_set(m_document_state.document(), _("Show all"), K3D_CHANGE_SET_CONTEXT); const nodes_t& nodes = m_document_state.document().nodes().collection(); for(nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) node::show(**node); } // Viewport items Gtk::MenuItem* m_viewport1; // Mesh functionality Gtk::MenuItem* m_delete_nodes; Gtk::MenuItem* m_instantiate_meshes; Gtk::MenuItem* m_duplicate_meshes; Gtk::MenuItem* m_animate_transformation; Gtk::Menu* m_mesh_modifiers; Gtk::Menu* m_transform_modifiers; Gtk::Menu* m_mesh_sinks; document_state& m_document_state; viewport::control* m_viewport; }; } // namespace detail Gtk::Menu* create_context_menu(document_state& DocumentState) { return new detail::node_context_menu(DocumentState); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/context_menu.h ================================================ #ifndef K3DSDK_NGUI_CONTEXT_MENU_H #define K3DSDK_NGUI_CONTEXT_MENU_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead (tshead@k-3d.com) */ namespace Gtk { class Menu; } namespace k3d { namespace ngui { class document_state; /// Returns a menu suitable for use as a context-sensitive menu for the given object Gtk::Menu* create_context_menu(document_state& DocumentState); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_CONTEXT_MENU_H ================================================ FILE: k3dsdk/ngui/custom_property_control.h ================================================ #ifndef K3DSDK_NGUI_CUSTOM_PROPERTY_CONTROL_H #define K3DSDK_NGUI_CUSTOM_PROPERTY_CONTROL_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace Gtk { class Widget; } namespace k3d { class iproperty; namespace ngui { class document_state; namespace custom_property { /// Abstract interface for a "custom property control", a UI component that can be displayed in-place-of the normal "auto-generated" control for a specific property. /// Note: implementations must publicly derived from Gtk::Widget. class control { public: virtual ~control() {} /// Called once at startup to initialize the control (this is necessary because plugins can't take constructor arguments). virtual void initialize(document_state& DocumentState, iproperty& Property) = 0; protected: control() {} control(const control&) {} control& operator=(const control&) { return *this; } }; } // namespace custom_property } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_CUSTOM_PROPERTY_CONTROL_H ================================================ FILE: k3dsdk/ngui/custom_property_page.h ================================================ #ifndef K3DSDK_NGUI_CUSTOM_PROPERTY_PAGE_H #define K3DSDK_NGUI_CUSTOM_PROPERTY_PAGE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace Gtk { class Widget; } namespace k3d { class inode; namespace ngui { class document_state; namespace custom_property_page { /// Abstract interface for a custom "property page", a UI component that can be displayed in-place-of the normal "auto-generated" property page for a specific plugin. class control { public: virtual ~control() {} virtual Gtk::Widget& get_widget(document_state& DocumentState, inode& Node) = 0; protected: control() {} control(const control&) {} control& operator=(const control&) { return *this; } }; } // namespace custom_property_page } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_CUSTOM_PROPERTY_PAGE_H ================================================ FILE: k3dsdk/ngui/document.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { ///////////////////////////////////////////////////////////////////////////// // next_document_number /// Returns unique document numbers for the duration of the current session unsigned long next_document_number() { static unsigned long document_number = 0; return ++document_number; } ///////////////////////////////////////////////////////////////////////////// // setup_camera_document void setup_camera_document(k3d::idocument& Document) { return_if_fail(k3d::plugin::factory::lookup("Camera")); k3d::inode* const camera = k3d::plugin::create("Camera", Document, "Camera"); return_if_fail(camera); const k3d::point3 origin = k3d::point3(0, 0, 0); const k3d::vector3 world_up = k3d::vector3(0, 0, 1); const k3d::point3 position = k3d::point3(-15, 20, 10); const k3d::vector3 look_vector = origin - position; const k3d::vector3 right_vector = look_vector ^ world_up; const k3d::vector3 up_vector = right_vector ^ look_vector; k3d::inode* const camera_transformation = k3d::set_matrix(*camera, k3d::view_matrix(look_vector, up_vector, position)); return_if_fail(camera_transformation); camera_transformation->set_name("Camera Transformation"); k3d::property::set_internal_value(*camera, "world_target", k3d::point3(0, 0, 0)); } ///////////////////////////////////////////////////////////////////////////// // setup_renderman_document void setup_renderman_document(k3d::idocument& Document) { return_if_fail(k3d::plugin::factory::lookup("MultiMaterial")); return_if_fail(k3d::plugin::factory::lookup("RenderManBicubicPatchPainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManBilinearPatchPainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManBlobbyPainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManCubicCurvePainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManEngine")); return_if_fail(k3d::plugin::factory::lookup("RenderManLight")); return_if_fail(k3d::plugin::factory::lookup("RenderManLightShader")); return_if_fail(k3d::plugin::factory::lookup("RenderManLinearCurvePainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManMaterial")); return_if_fail(k3d::plugin::factory::lookup("RenderManMultiPainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManNURBSPatchPainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManParticlePainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManPolyhedronPainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManSubdivisionSurfacePainter")); return_if_fail(k3d::plugin::factory::lookup("RenderManSurfaceShader")); // Setup RenderMan painters ... k3d::inode* const multi_painter = k3d::plugin::create("RenderManMultiPainter", Document, "RenderMan Default Painter"); return_if_fail(multi_painter); k3d::property::create(*multi_painter, "particles", "Particles", "", k3d::plugin::create("RenderManParticlePainter", Document, "RenderMan Particle Painter")); k3d::property::create(*multi_painter, "polyhedra", "Polyhedra", "", k3d::plugin::create("RenderManPolyhedronPainter", Document, "RenderMan Polyhedron Painter")); k3d::property::create(*multi_painter, "subdivision_surfaces", "Subdivision Surfaces", "", k3d::plugin::create("RenderManSubdivisionSurfacePainter", Document, "RenderMan Subdivision Surface Painter")); k3d::property::create(*multi_painter, "linear_curves", "Linear Curves", "", k3d::plugin::create("RenderManLinearCurvePainter", Document, "RenderMan Linear Curve Painter")); k3d::property::create(*multi_painter, "cubic_curves", "Cubic Curves", "", k3d::plugin::create("RenderManCubicCurvePainter", Document, "RenderMan Cubic Curve Painter")); k3d::property::create(*multi_painter, "bilinear_patches", "Bilinear Patches", "", k3d::plugin::create("RenderManBilinearPatchPainter", Document, "RenderMan Bilinear Patch Painter")); k3d::property::create(*multi_painter, "bicubic_patches", "Bicubic Patches", "", k3d::plugin::create("RenderManBicubicPatchPainter", Document, "RenderMan Bicubic Patch Painter")); k3d::property::create(*multi_painter, "nurbs_patches", "NURBS Patches", "", k3d::plugin::create("RenderManNURBSPatchPainter", Document, "RenderMan NURBS Patch Painter")); k3d::property::create(*multi_painter, "blobbies", "Blobbies", "", k3d::plugin::create("RenderManBlobbyPainter", Document, "RenderMan Blobby Painter")); k3d::property::create(*multi_painter, "cones", "Cones", "", k3d::plugin::create("RenderManConePainter", Document, "RenderMan Cone Painter")); k3d::property::create(*multi_painter, "cylinders", "Cylinders", "", k3d::plugin::create("RenderManCylinderPainter", Document, "RenderMan Cylinder Painter")); k3d::property::create(*multi_painter, "disks", "Disks", "", k3d::plugin::create("RenderManDiskPainter", Document, "RenderMan Disk Painter")); k3d::property::create(*multi_painter, "hyperboloids", "Hyperboloids", "", k3d::plugin::create("RenderManHyperboloidPainter", Document, "RenderMan Hyperboloid Painter")); k3d::property::create(*multi_painter, "paraboloids", "Paraboloids", "", k3d::plugin::create("RenderManParaboloidPainter", Document, "RenderMan Paraboloid Painter")); k3d::property::create(*multi_painter, "spheres", "Spheres", "", k3d::plugin::create("RenderManSpherePainter", Document, "RenderMan Sphere Painter")); k3d::property::create(*multi_painter, "teapots", "Teapots", "", k3d::plugin::create("RenderManTeapotPainter", Document, "RenderMan Teapot Painter")); k3d::property::create(*multi_painter, "tori", "Tori", "", k3d::plugin::create("RenderManTorusPainter", Document, "RenderMan Torus Painter")); // Setup a default RenderMan shading model ... k3d::inode* const surface_shader = k3d::plugin::create("RenderManSurfaceShader", Document, "Surface Shader"); return_if_fail(surface_shader); k3d::property::set_internal_value(*surface_shader, "shader_path", k3d::share_path() / k3d::filesystem::generic_path("shaders/surface/k3d_plastic.sl")); k3d::imaterial* const renderman_material = k3d::plugin::create("RenderManMaterial", Document, "RenderManMaterial"); return_if_fail(renderman_material); k3d::property::set_internal_value(*renderman_material, "surface_shader", surface_shader); k3d::inode* const light_shader = k3d::plugin::create("RenderManLightShader", Document, "Light Shader"); return_if_fail(light_shader); k3d::property::set_internal_value(*light_shader, "shader_path", k3d::share_path() / k3d::filesystem::generic_path("shaders/light/k3d_pointlight.sl")); k3d::inode* const light = k3d::plugin::create("RenderManLight", Document, "Light"); return_if_fail(light); k3d::property::set_internal_value(*light, "shader", light_shader); k3d::inode* light_transformation = k3d::set_matrix(*light, k3d::translate3(-20, 20, 30)); return_if_fail(light_transformation); light_transformation->set_name("Light Transformation"); k3d::inode* const default_material = k3d::plugin::create(k3d::classes::MultiMaterial(), Document, "Material"); return_if_fail(default_material); k3d::property::create(*default_material, "renderman_material", "RenderMan Material", "", renderman_material); // Setup a default choice of external render engine ... k3d::ri::irender_engine* const bundled_aqsis = k3d::plugin::factory::lookup("BundledAqsisRenderManEngine") ? k3d::plugin::create("BundledAqsisRenderManEngine", Document, "BundledAqsis") : 0; k3d::ri::irender_engine* const aqsis = k3d::plugin::create("AqsisRenderManEngine", Document, "Aqsis"); k3d::ri::irender_engine* const pixie = k3d::plugin::create("PixieRenderManEngine", Document, "Pixie"); k3d::ri::irender_engine* default_render_engine = 0; if(!default_render_engine && bundled_aqsis && bundled_aqsis->installed()) default_render_engine = bundled_aqsis; if(!default_render_engine && aqsis && aqsis->installed()) default_render_engine = aqsis; if(!default_render_engine && pixie && pixie->installed()) default_render_engine = pixie; // Setup a render engine ... k3d::iunknown* const render_engine = k3d::plugin::create("RenderManEngine", Document, "RenderMan Engine"); k3d::property::set_internal_value(*render_engine, "enabled_lights", k3d::inode_collection_property::nodes_t(1, light)); k3d::property::set_internal_value(*render_engine, "render_engine", dynamic_cast(default_render_engine)); } ///////////////////////////////////////////////////////////////////////////// // setup_selection_document /// Adds a node to store the document node selection k3d::iunknown* setup_selection_document(k3d::idocument& Document) { k3d::imetadata* const node_selection = k3d::plugin::create("NodeSelection", Document, "Node Selection"); return_val_if_fail(node_selection, 0); node_selection->set_metadata_value("ngui:unique_node", "node_selection"); // metadata to ensure this node is found by the UI layer return node_selection; } ///////////////////////////////////////////////////////////////////////////// // setup_document /// Adds nodes to a newly-created document to give the user a better out-of-box experience void setup_document(k3d::idocument& Document) { k3d::plugin::create(k3d::classes::Axes(), Document, "Axes"); k3d::iunknown* gl_engine = k3d::plugin::create(k3d::classes::OpenGLEngine(), Document, "GL Engine"); k3d::plugin::create(k3d::classes::TimeSource(), Document, "TimeSource"); setup_camera_document(Document); setup_renderman_document(Document); k3d::property::set_internal_value(*gl_engine, "node_selection", dynamic_cast(setup_selection_document(Document))); } /// Add document nodes that need an opengl context for extension checking void setup_opengl_document(k3d::idocument& Document) { return_if_fail(k3d::plugin::factory::lookup("OpenGLBicubicPatchPainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLBilinearPatchPainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLBlobbyPointPainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLCubicCurvePainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLFaceNormalPainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLFaceOrientationPainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLLinearCurvePainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLMultiPainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLNURBSCurvePainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLNURBSPatchPainter")); return_if_fail(k3d::plugin::factory::lookup("OpenGLBezierTrianglePatchPainter")); return_if_fail(k3d::plugin::factory::lookup("VirtualOpenGLEdgePainter")); return_if_fail(k3d::plugin::factory::lookup("VirtualOpenGLFacePainter")); return_if_fail(k3d::plugin::factory::lookup("VirtualOpenGLPointPainter")); return_if_fail(k3d::plugin::factory::lookup("VirtualOpenGLSDSEdgePainter")); return_if_fail(k3d::plugin::factory::lookup("VirtualOpenGLSDSFacePainter")); return_if_fail(k3d::plugin::factory::lookup("VirtualOpenGLSDSPointPainter")); k3d::inode* const multi_painter = k3d::plugin::create("OpenGLMultiPainter", Document, "GL Default Painter"); return_if_fail(multi_painter); k3d::property::create(*multi_painter, "points", "Points", "", k3d::plugin::create("VirtualOpenGLPointPainter", Document, "GL Point Painter")); k3d::property::create(*multi_painter, "edges", "Edges", "", k3d::plugin::create("VirtualOpenGLEdgePainter", Document, "GL Edge Painter")); k3d::property::create(*multi_painter, "faces", "Faces", "", k3d::plugin::create("VirtualOpenGLFacePainter", Document, "GL Face Painter")); k3d::property::create(*multi_painter, "sds_points", "SDS Points", "", k3d::plugin::create("VirtualOpenGLSDSPointPainter", Document, "SDS Point Painter")); k3d::property::create(*multi_painter, "sds_edges", "SDS Edges", "", k3d::plugin::create("VirtualOpenGLSDSEdgePainter", Document, "SDS Edge Painter")); k3d::property::create(*multi_painter, "sds_faces", "SDS Faces", "", k3d::plugin::create("VirtualOpenGLSDSFacePainter", Document, "SDS Face Painter")); k3d::property::create(*multi_painter, "linear_curves", "Linear Curves", "", k3d::plugin::create("OpenGLLinearCurvePainter", Document, "GL Linear Curve Painter")); k3d::property::create(*multi_painter, "cubic_curves", "Cubic Curves", "", k3d::plugin::create("OpenGLCubicCurvePainter", Document, "GL Cubic Curve Painter")); k3d::property::create(*multi_painter, "nurbs_curves", "NURBS Curves", "", k3d::plugin::create("OpenGLNURBSCurvePainter", Document, "GL NURBS Curve Painter")); k3d::property::create(*multi_painter, "bilinear_patches", "Bilinear Patches", "", k3d::plugin::create("OpenGLBilinearPatchPainter", Document, "GL Bilinear Patch Painter")); k3d::property::create(*multi_painter, "bicubic_patches", "Bicubic Patches", "", k3d::plugin::create("OpenGLBicubicPatchPainter", Document, "GL Bicubic Patch Painter")); k3d::property::create(*multi_painter, "nurbs_patches", "NURBS Patches", "", k3d::plugin::create("OpenGLNURBSPatchPainter", Document, "GL NURBS Patch Painter")); k3d::property::create(*multi_painter, "bezier_triangle_patches", "Bezier Triangle Patches", "", k3d::plugin::create("OpenGLBezierTrianglePatchPainter", Document, "GL Bezier Triangle Patch Painter")); k3d::property::create(*multi_painter, "blobbies", "Blobbies", "", k3d::plugin::create("OpenGLBlobbyPointPainter", Document, "GL Blobby Point Painter")); k3d::property::create(*multi_painter, "face_normals", "Face Normals", "", k3d::plugin::create("OpenGLFaceNormalPainter", Document, "GL Face Normal Painter")); k3d::property::create(*multi_painter, "face_orientation", "Face Orientation", "", k3d::plugin::create("OpenGLFaceOrientationPainter", Document, "GL Face Orientation Painter")); k3d::property::create(*multi_painter, "cones", "Cones", "", k3d::plugin::create("OpenGLConePainter", Document, "GL Cone Painter")); k3d::property::create(*multi_painter, "cylinders", "Cylinders", "", k3d::plugin::create("OpenGLCylinderPainter", Document, "GL Cylinder Painter")); k3d::property::create(*multi_painter, "disks", "Disks", "", k3d::plugin::create("OpenGLDiskPainter", Document, "GL Disk Painter")); k3d::property::create(*multi_painter, "hyperboloids", "Hyperboloids", "", k3d::plugin::create("OpenGLHyperboloidPainter", Document, "GL Hyperboloid Painter")); k3d::property::create(*multi_painter, "paraboloids", "Paraboloids", "", k3d::plugin::create("OpenGLParaboloidPainter", Document, "GL Paraboloid Painter")); k3d::property::create(*multi_painter, "spheres", "Spheres", "", k3d::plugin::create("OpenGLSpherePainter", Document, "GL Sphere Painter")); k3d::property::create(*multi_painter, "teapots", "Teapots", "", k3d::plugin::create("OpenGLTeapotPainter", Document, "GL Teapot Painter")); k3d::property::create(*multi_painter, "tori", "Tori", "", k3d::plugin::create("OpenGLTorusPainter", Document, "GL Torus Painter")); } } // namespace detail void create_document() { k3d::idocument* const document = k3d::application().create_document(); return_if_fail(document); const k3d::ustring new_title = k3d::ustring::from_utf8(k3d::string_cast(boost::format(_("Untitled Document %1%")) % detail::next_document_number())); k3d::property::set_internal_value(document->title(), new_title); detail::setup_document(*document); document_state* const state = new document_state(*document); create_main_document_window(*state); k3d::ngui::viewport::control* const focus_viewport = state->get_focus_viewport(); if(focus_viewport) { focus_viewport->gl_context().begin(); detail::setup_opengl_document(*document); focus_viewport->gl_context().end(); } else { k3d::log() << debug << "Failed to initialize OpenGL plugins: no active viewport found" << std::endl; } } void open_document(const k3d::filesystem::path& Path) { boost::scoped_ptr importer(k3d::plugin::create(k3d::classes::DocumentImporter())); if(!importer) { error_message(_("Document importer plugin not installed.")); return; } k3d::idocument* const document = k3d::application().create_document(); return_if_fail(document); // Nag users about the file version ... k3d::imetadata::metadata_t file_metadata = importer->get_file_metadata(Path); std::stringstream version(file_metadata[k3d::metadata::key::version()]); k3d::uint32_t major_version = 0; k3d::uint32_t minor_version = 0; k3d::uint32_t revision = 0; k3d::uint32_t build = 0; char point; version >> major_version >> point >> minor_version >> point >> revision >> point >> build; if(major_version == 0 && minor_version < 8) { warning_message( _("Documents prior to K-3D 0.8 are unsupported."), _("Due to significant changes to K-3D internals, documents from versions prior to 0.8 are unsupported and may not function correctly.")); } if(!importer->read_file(Path, *document)) { error_message(k3d::string_cast(boost::format(_("Error reading document %1%")) % Path.native_filesystem_string())); return; } document_state* const state = new document_state(*document); create_main_document_window(*state); k3d::property::set_internal_value(document->path(), Path); k3d::property::set_internal_value(document->title(), Path.leaf()); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/document.h ================================================ #ifndef K3DSDK_NGUI_DOCUMENT_H #define K3DSDK_NGUI_DOCUMENT_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { namespace filesystem { class path; } } namespace k3d { class idocument; } namespace k3d { namespace ngui { class document_state; /// Creates a new document void create_document(); /// Opens an existing document void open_document(const k3d::filesystem::path& Path); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_DOCUMENT_H ================================================ FILE: k3dsdk/ngui/document_state.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { /// Provides human-readable labels for the selection::mode enumeration const k3d::ienumeration_property::enumeration_values_t& selection_mode_values() { static k3d::ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(k3d::ienumeration_property::enumeration_value_t(_("Nodes"), "nodes", _("Select Nodes"))); values.push_back(k3d::ienumeration_property::enumeration_value_t(_("Points"), "points", _("Select Points"))); values.push_back(k3d::ienumeration_property::enumeration_value_t(_("Lines"), "lines", _("Select Lines"))); values.push_back(k3d::ienumeration_property::enumeration_value_t(_("Faces"), "faces", _("Select Faces"))); } return values; } } // namespace detail ///////////////////////////////////////////////////////////////////////////// // document_state::implementation class document_state::implementation : public sigc::trackable/*, public k3d::ipersistent*/ { public: implementation(k3d::idocument& Document) : m_document(Document), m_gdkgl_share_list(0), m_last_selection_mode(selection::NODE), m_active_tool(0), m_selection_tool(0), m_move_tool(0), m_rotate_tool(0), m_scale_tool(0), m_context_menu(0), m_node_selection(0) { // Process remove_nodes_signal m_document.nodes().remove_nodes_signal().connect(sigc::mem_fun(*this, &implementation::on_nodes_removed)); } ~implementation() { while(!m_tools.empty()) { delete m_tools.begin()->second; m_tools.erase(m_tools.begin()); } delete m_context_menu; delete m_scale_tool; delete m_rotate_tool; delete m_move_tool; delete m_selection_tool; m_node_selection_metadata_connection.disconnect(); m_node_selection_deleted_connection.disconnect(); } /// Returns the document k3d::idocument& document() { return m_document; } #if defined K3D_API_DARWIN || defined K3D_API_WIN32 /// Returns a "global" (to the document) gdkgl context that can be used to share display lists GdkGLContext* gdkgl_share_list() { if(!m_gdkgl_share_list) { GdkGLConfig* const config = gdk_gl_config_new_by_mode( static_cast(GDK_GL_MODE_RGBA | GDK_GL_MODE_DOUBLE | GDK_GL_MODE_DEPTH)); return_val_if_fail(config, 0); Gtk::Window* const window = new Gtk::Window(); gtk_widget_set_gl_capability(GTK_WIDGET(window->gobj()), config, 0, true, GDK_GL_RGBA_TYPE); window->show(); window->hide(); GdkGLContext* const context = gtk_widget_get_gl_context(GTK_WIDGET(window->gobj())); return_val_if_fail(context, 0); m_gdkgl_share_list = context; } return m_gdkgl_share_list; } #else // K3D_API_WIN32 /// Returns a "global" (to the document) gdkgl context that can be used to share display lists GdkGLContext* gdkgl_share_list() { if(!m_gdkgl_share_list) { GdkGLConfig* const config = gdk_gl_config_new_by_mode( static_cast(GDK_GL_MODE_RGBA | GDK_GL_MODE_DOUBLE | GDK_GL_MODE_DEPTH)); return_val_if_fail(config, 0); GdkPixmap* const pixmap = gdk_pixmap_new(0, 8, 8, gdk_gl_config_get_depth(config)); return_val_if_fail(pixmap, 0); GdkGLPixmap* const glpixmap = gdk_pixmap_set_gl_capability(pixmap, config, 0); return_val_if_fail(glpixmap, 0); GdkGLContext* const context = gdk_gl_context_new( gdk_pixmap_get_gl_drawable(pixmap), 0, true, GDK_GL_RGBA_TYPE); return_val_if_fail(context, 0); m_gdkgl_share_list = context; } return m_gdkgl_share_list; } #endif /// Returns a signal that can be emitted to acknowledge of a document selection change document_selection_change_signal_t& document_selection_change_signal() { return m_document_selection_change_signal; } /// Returns the active tool for the document tool& active_tool() { return *m_active_tool; } /// Sets the active tool for the document void set_active_tool(tool& ActiveTool) { m_active_tool->deactivate(); m_active_tool = &ActiveTool; m_active_tool->activate(); m_active_tool_changed_signal.emit(); } /// Called by the signal system anytime nodes are removed from the document void on_nodes_removed(const k3d::inode_collection::nodes_t& Nodes) { assert_not_implemented(); /* selection_changed(); */ } /* typedef std::set meshes_t; typedef std::set node_selection_t; void on_node_selection_node_changed() { m_node_selection_metadata_connection.disconnect(); m_node_selection_deleted_connection.disconnect(); m_node_selection = 0; } k3d::inode_selection* node_selection() { if(!m_node_selection) { k3d::inode_collection::nodes_t nodes = k3d::find_nodes(m_document.nodes(), "ngui:unique_node", "node_selection"); if(nodes.size() != 1) return 0; m_node_selection = dynamic_cast(nodes.back()); // Make sure the node gets updated whenever the metadata is changed or the node is deleted k3d::imetadata* metadata = dynamic_cast(m_node_selection); m_node_selection_metadata_connection = metadata->connect_metadata_changed_signal(sigc::mem_fun(*this, &implementation::on_node_selection_node_changed)); m_node_selection_deleted_connection = nodes.back()->deleted_signal().connect(sigc::mem_fun(*this, &implementation::on_node_selection_node_changed)); } return m_node_selection; } */ document_state::set_cursor_signal_t& set_cursor_signal() { return m_set_cursor_signal; } document_state::clear_cursor_signal_t& clear_cursor_signal() { return m_clear_cursor_signal; } void popup_context_menu(const bool UserAction) { if(UserAction) m_context_menu->popup(1, gtk_get_current_event_time()); else m_context_menu->popup(0, GDK_CURRENT_TIME); } /// Stores a reference to the owning document k3d::idocument& m_document; sigc::signal m_safe_to_close_signal; /// Stores an unused off-screen pixmap so we can create a global gdkgl context for sharing display lists Glib::RefPtr m_gdkgl_share_pixmap; /// Stores a gdkgl context that can be used to share display lists for the entire document GdkGLContext* m_gdkgl_share_list; /// A signal that can be emitted to acknowledge of a document selection change document_selection_change_signal_t m_document_selection_change_signal; /// A signal that will be emitted whenever the active tool changes sigc::signal m_active_tool_changed_signal; /// Stores the last document-wide selection mode selection::mode m_last_selection_mode; document_state::set_cursor_signal_t m_set_cursor_signal; document_state::clear_cursor_signal_t m_clear_cursor_signal; /// Store a reference to the current active tool tool* m_active_tool; /// Store builtin tools (deprecated) k3d::ngui::selection_tool* m_selection_tool; tool* m_move_tool; tool* m_rotate_tool; tool* m_scale_tool; /// Store plugin tools std::map m_tools; /// Document wide context menu Gtk::Menu* m_context_menu; /// Used to keep documents sorted in the "safe to close" dialog struct sort_by_title { bool operator()(const safe_close_dialog::entry& LHS, const safe_close_dialog::entry& RHS) { return LHS.document->unsaved_document_title() < RHS.document->unsaved_document_title(); } }; typedef sigc::signal safe_close_signal_t; /// Signal that will be emitted prior to safe shutdown to "gather" unsaved documents safe_close_signal_t m_safe_close_signal; /// Stores auto-start plugins typedef std::vector auto_start_plugins_t; /// Stores auto-start plugins auto_start_plugins_t m_auto_start_plugins; /// Cached pointer to the document node selection node k3d::inode_selection* m_node_selection; sigc::connection m_node_selection_metadata_connection; sigc::connection m_node_selection_deleted_connection; }; ///////////////////////////////////////////////////////////////////////////// // document_state document_state::document_state(k3d::idocument& Document) : m_implementation(new implementation(Document)), m_focus_viewport(0) { // Create auto-start plugins for this document ... const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); for(k3d::plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { k3d::iplugin_factory::metadata_t metadata = (**factory).metadata(); if(!metadata.count("ngui:document-start")) continue; k3d::log() << info << "Creating plugin [" << (**factory).name() << "] via ngui:document-start" << std::endl; k3d::iunknown* const plugin = k3d::plugin::create(**factory); if(!plugin) { k3d::log() << error << "Error creating plugin [" << (**factory).name() << "] via ngui:document-start" << std::endl; continue; } m_implementation->m_auto_start_plugins.push_back(plugin); if(k3d::iscripted_action* const scripted_action = dynamic_cast(plugin)) { k3d::iscript_engine::context context; context["command"] = k3d::string_t("startup"); context["document"] = &Document; scripted_action->execute(context); } } Document.close_signal().connect(sigc::mem_fun(*this, &document_state::on_document_close)); m_implementation->m_selection_tool = new k3d::ngui::selection_tool(*this, "selection_tool"); m_implementation->m_move_tool = new k3d::ngui::move_tool(*this, "move_tool"); m_implementation->m_rotate_tool = new k3d::ngui::rotate_tool(*this, "rotate_tool"); m_implementation->m_scale_tool = new k3d::ngui::scale_tool(*this, "scale_tool"); m_implementation->m_active_tool = m_implementation->m_selection_tool; m_implementation->m_active_tool->activate(); m_implementation->m_context_menu = create_context_menu(*this); } document_state::~document_state() { // Shut-down any auto-start plugins associated with this document ... for(implementation::auto_start_plugins_t::iterator plugin = m_implementation->m_auto_start_plugins.begin(); plugin != m_implementation->m_auto_start_plugins.end(); ++plugin) { if(k3d::iscripted_action* const scripted_action = dynamic_cast(*plugin)) { k3d::iscript_engine::context context; context["command"] = k3d::string_t("shutdown"); context["document"] = &document(); scripted_action->execute(context); } } delete m_implementation; } void document_state::on_document_close() { delete this; } k3d::idocument& document_state::document() { return m_implementation->document(); } sigc::connection document_state::connect_safe_close_signal(const sigc::slot& Slot) { return m_implementation->m_safe_close_signal.connect(Slot); } bool document_state::safe_close(Gtk::Window& Parent) { if(k3d::batch_mode()) { k3d::application().close_document(document()); return true; } safe_close_dialog::entries_t entries; implementation::safe_close_signal_t::slot_list_type slots = m_implementation->m_safe_close_signal.slots(); for(implementation::safe_close_signal_t::slot_list_type::iterator slot = slots.begin(); slot != slots.end(); ++slot) { unsaved_document* doc = (*slot)(); if(doc && doc->unsaved_changes()) entries.push_back(safe_close_dialog::entry(doc)); } if(!entries.empty()) { switch(safe_close_dialog::run(Parent, entries)) { case Gtk::RESPONSE_NONE: case Gtk::RESPONSE_CANCEL: case Gtk::RESPONSE_DELETE_EVENT: return false; case Gtk::RESPONSE_CLOSE: k3d::application().close_document(document()); return true; case Gtk::RESPONSE_OK: for(safe_close_dialog::entries_t::const_iterator entry = entries.begin(); entry != entries.end(); ++entry) { if(entry->save) { if(!entry->document->save_unsaved_changes()) return false; } } k3d::application().close_document(document()); return true; } } k3d::application().close_document(document()); return true; } GdkGLContext* document_state::gdkgl_share_list() { return m_implementation->gdkgl_share_list(); } document_state::document_selection_change_signal_t& document_state::document_selection_change_signal() { return m_implementation->document_selection_change_signal(); } tool& document_state::active_tool() { return m_implementation->active_tool(); } void document_state::set_active_tool(tool& ActiveTool) { m_implementation->set_active_tool(ActiveTool); } sigc::connection document_state::connect_active_tool_changed_signal(const sigc::slot& Slot) { return m_implementation->m_active_tool_changed_signal.connect(Slot); } tool* document_state::get_tool(const k3d::string_t& Name) { if(!m_implementation->m_tools.count(Name)) { tool* const new_tool = k3d::plugin::create(Name); return_val_if_fail(new_tool, new_tool); new_tool->initialize(*this); m_implementation->m_tools.insert(std::make_pair(Name, new_tool)); return new_tool; } return m_implementation->m_tools[Name]; } tool& document_state::selection_tool() { return *m_implementation->m_selection_tool; } tool& document_state::move_tool() { return *m_implementation->m_move_tool; } tool& document_state::rotate_tool() { return *m_implementation->m_rotate_tool; } tool& document_state::scale_tool() { return *m_implementation->m_scale_tool; } bool document_state::pick_backfacing() { return m_implementation->m_selection_tool->pick_backfacing(); } bool document_state::paint_backfacing() { return m_implementation->m_selection_tool->paint_backfacing(); } bool document_state::rubber_band_backfacing() { return m_implementation->m_selection_tool->rubber_band_backfacing(); } document_state::set_cursor_signal_t& document_state::set_cursor_signal() { return m_implementation->set_cursor_signal(); } document_state::clear_cursor_signal_t& document_state::clear_cursor_signal() { return m_implementation->clear_cursor_signal(); } void document_state::popup_context_menu(const bool UserAction) { m_implementation->popup_context_menu(UserAction); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/document_state.h ================================================ #ifndef K3DSDK_NGUI_DOCUMENT_STATE_H #define K3DSDK_NGUI_DOCUMENT_STATE_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace Gdk { class Pixbuf; } namespace Gtk { class Window; } namespace k3d { class ianimation_render_engine; } namespace k3d { class idocument; } namespace k3d { class inode; } namespace k3d { class ipreview_render_engine; } namespace k3d { class istill_render_engine; } namespace k3d { namespace ngui { class unsaved_document; } } namespace k3d { namespace ngui { class tool; namespace viewport { class control; } /// This ugly little fellow stores document-wide user interface state in one place to minimize coupling between the various per-document UI components class document_state : public sigc::trackable { public: document_state(k3d::idocument& Document); ~document_state(); /// Stores a reference to the owning document k3d::idocument& document(); /// Connects a slot to a signal that will be called prior to safe shutdown. sigc::connection connect_safe_close_signal(const sigc::slot& Slot); /// Attempts to safely close the application, saving unsaved documents and giving the user a chance to cancel. Returns true iff the application will close. bool safe_close(Gtk::Window& Parent); /// Returns a gdkgl context node that can be used to share display lists between viewports GdkGLContext* gdkgl_share_list(); /// Defines a signal that can be emitted to acknowledge of a document selection change typedef sigc::signal document_selection_change_signal_t; /// Returns a signal that can be emitted to acknowledge of a document selection change document_selection_change_signal_t& document_selection_change_signal(); /// Returns the active tool for the document tool& active_tool(); /// Sets the active tool for the document void set_active_tool(tool& ActiveTool); /// Connects a slot to a signal that will be emitted when the active tool changes sigc::connection connect_active_tool_changed_signal(const sigc::slot& Slot); /// Returns an instance of a tool plugin by name (could return NULL). tool* get_tool(const k3d::string_t& Name); /// Returns a reference to the builtin Selection Tool that can be passed to set_active_tool() tool& selection_tool(); /// Returns a reference to the builtin Move Tool that can be passed to set_active_tool() tool& move_tool(); /// Returns a reference to the builtin Rotate Tool that can be passed to set_active_tool() tool& rotate_tool(); /// Returns a reference to the builtin Scale Tool that can be passed to set_active_tool() tool& scale_tool(); /// True if backfacing components are to be picked bool pick_backfacing(); /// True if backfacing components are to be paint-selected bool paint_backfacing(); /// True if backfacing components are to be rubber-band selected bool rubber_band_backfacing(); /// Defines a signal to set the document-wide cursor typedef sigc::signal > set_cursor_signal_t; /// Returns a signal for setting the document-wide cursor set_cursor_signal_t& set_cursor_signal(); /// Defines a signal to reset the document-wide cursor typedef sigc::signal clear_cursor_signal_t; /// Returns a signal for setting the document-wide cursor clear_cursor_signal_t& clear_cursor_signal(); /// Returns focused viewport viewport::control* get_focus_viewport() { return m_focus_viewport; } /// Sets focused viewport void set_focus_viewport(viewport::control* Viewport) { m_focus_viewport = Viewport; } /// Shows context menu, pass false in interactive mode void popup_context_menu(const bool UserAction = true); private: class implementation; implementation* const m_implementation; void on_document_close(); /// Stores focused viewport viewport::control* m_focus_viewport; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_DOCUMENT_STATE_H ================================================ FILE: k3dsdk/ngui/document_window.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // document_window document_window::document_window(document_state& Document) : base(Gtk::WINDOW_TOPLEVEL), m_document(Document) { Document.document().close_signal().connect(sigc::mem_fun(*this, &document_window::close)); } k3d::idocument& document_window::document() { return m_document.document(); } bool document_window::on_key_press_event(GdkEventKey* event) { if(event->keyval == GDK_Escape) { close(); return true; } return base::on_key_press_event(event); } bool document_window::on_delete_event(GdkEventAny* event) { close(); return true; } void document_window::close() { on_close(); delete this; } void document_window::on_close() { } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/document_window.h ================================================ #ifndef K3DSDK_NGUI_DOCUMENT_WINDOW_H #define K3DSDK_NGUI_DOCUMENT_WINDOW_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class idocument; } namespace k3d { namespace ngui { class document_state; /////////////////////////////////////////////////////////////////////////////// // document_window /// Provides a standard document-level window class document_window : public Gtk::Window { typedef Gtk::Window base; public: document_window(document_state& Document); ~document_window() {} k3d::idocument& document(); bool on_key_press_event(GdkEventKey* event); bool on_delete_event(GdkEventAny* event); /// Closes the window void close(); private: /// Override in derived classes to handle cleanup when the window is closed virtual void on_close(); /// Stores the owning document document_state& m_document; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_DOCUMENT_WINDOW_H ================================================ FILE: k3dsdk/ngui/entry.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace entry { ///////////////////////////////////////////////////////////////////////////// // property_model /// Implementation of entry::imodel for use with k3d::iproperty objects class property_model : public imodel { public: property_model(k3d::iproperty& Data) : m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } const Glib::ustring label() { Glib::ustring result = m_readable_data.property_label(); if(m_readable_data.property_node()) result = m_readable_data.property_node()->name() + " " + result; return result; } const k3d::string_t value() { const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::string_t)) return boost::any_cast(m_readable_data.property_internal_value()); k3d::log() << error << k3d_file_reference << ": unknown property type: " << type.name() << std::endl; return k3d::string_t(); } void set_value(const k3d::string_t& Value) { return_if_fail(m_writable_data); const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::string_t)) m_writable_data->property_set_value(Value); else k3d::log() << error << k3d_file_reference << ": unknown property type: " << type.name() << std::endl; } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_readable_data.property_changed_signal().connect(sigc::hide(Slot)); } private: property_model(const property_model& RHS); property_model& operator=(const property_model& RHS); k3d::iproperty& m_readable_data; k3d::iwritable_property* const m_writable_data; }; ///////////////////////////////////////////////////////////////////////////// // model imodel* const model(k3d::iproperty& Property) { return new property_model(Property); } ///////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_model(Model), m_state_recorder(StateRecorder) { assert(m_model.get()); } /// Stores a reference to the underlying data object const boost::scoped_ptr m_model; /// Stores a reference to the (optional) object for recording undo/redo data k3d::istate_recorder* const m_state_recorder; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_implementation(new implementation(Model, StateRecorder)) { set_name("k3d-entry"); // Synchronize the view with the data source ... on_data_changed(); // We want to be notified if the data source changes ... m_implementation->m_model->connect_changed_signal(sigc::mem_fun(*this, &control::on_data_changed)); } control::~control() { delete m_implementation; } bool control::on_focus_out_event(GdkEventFocus* Event) { on_set_value(); return base::on_focus_out_event(Event); } void control::on_activate() { on_set_value(); base::on_activate(); } void control::on_set_value() { // If the value didn't change, we're done ... const k3d::string_t new_value = get_text(); if(new_value == m_implementation->m_model->value()) return; // Turn this into an undo/redo -able event ... if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); // Update everything with the new value ... m_implementation->m_model->set_value(new_value); // Turn this into an undo/redo -able event ... if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->commit_change_set(m_implementation->m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), change_message(m_implementation->m_model->value()), K3D_CHANGE_SET_CONTEXT); } void control::on_data_changed() { set_text(m_implementation->m_model->value()); } const k3d::string_t control::change_message(const k3d::string_t& Value) { return k3d::string_cast(boost::format(_("Change %1% to %2%")) % m_implementation->m_model->label().raw() % Value); } } // namespace entry } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/entry.h ================================================ #ifndef K3DSDK_NGUI_ENTRY_H #define K3DSDK_NGUI_ENTRY_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class iproperty; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace entry { ///////////////////////////////////////////////////////////////////////////// // imodel /// Abstract data model for an entry::control class imodel { public: virtual ~imodel() {} /// Returns a human-readable label for the underlying data virtual const Glib::ustring label() = 0; /// Called to return the underlying data value virtual const k3d::string_t value() = 0; /// Called to set a new data value virtual void set_value(const k3d::string_t& Value) = 0; /// Connects a slot to a signal that will be emitted if the underlying data changes virtual sigc::connection connect_changed_signal(const sigc::slot& Slot) = 0; protected: imodel() {} private: imodel(const imodel&); imodel& operator=(const imodel&); }; /// Factory method for creating an imodel object given a suitably-typed property imodel* const model(k3d::iproperty& Property); /// Provides an implementation of entry::imodel that can "wrap" any data source that supports the internal_value(), set_value(), and changed_signal() concepts template class generic_model_t : public imodel { public: generic_model_t(data_t& Data, const Glib::ustring& Label) : m_data(Data), m_label(Label) { } const Glib::ustring label() { return m_label; } const k3d::string_t value() { return m_data.internal_value(); } void set_value(const k3d::string_t& Value) { m_data.set_value(Value); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_data.changed_signal().connect(sigc::hide(Slot)); } private: data_t& m_data; const Glib::ustring m_label; }; /// Convenience factory function for creating generic_model_t objects template imodel* model(data_t& Data, const Glib::ustring& Label = "") { return new generic_model_t(Data, Label); } ///////////////////////////////////////////////////////////////////////////// // control /// Provides a standard UI control for manipulating text fields (i.e. the view and the controller from model-view-controller) class control : public hotkey_entry { typedef hotkey_entry base; public: control(imodel* const Model, k3d::istate_recorder* const StateRecorder); ~control(); private: /// Called when the control loses the keyboard focus bool on_focus_out_event(GdkEventFocus* Event); /// Called when the control is activated void on_activate(); /// Called when the user finishes editing data void on_set_value(); /// Called whenever the underlying data changes void on_data_changed(); const k3d::string_t change_message(const k3d::string_t& Value); class implementation; implementation* const m_implementation; }; } // namespace entry } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_ENTRY_H ================================================ FILE: k3dsdk/ngui/enumeration_chooser.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements the k3d::enumeration_chooser classes, which provide a model-view-controller UI for enumerated (fixed set of choices) types \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace enumeration_chooser { ///////////////////////////////////////////////////////////////////////////// // property_model /// Implementation of enumeration_chooser::imodel for use with k3d::iproperty objects class property_model : public imodel { public: property_model(k3d::iproperty& Data) : m_readable_data(Data), m_enumeration_data(dynamic_cast(&Data)), m_writable_data(dynamic_cast(&Data)) { } const Glib::ustring label() { Glib::ustring result = m_readable_data.property_label(); if(m_readable_data.property_node()) result = m_readable_data.property_node()->name() + " " + result; return result; } const k3d::ienumeration_property::enumeration_values_t enumeration_values() { return_val_if_fail(m_enumeration_data, k3d::ienumeration_property::enumeration_values_t()); return m_enumeration_data->enumeration_values(); } const k3d::string_t value() { return boost::any_cast(m_readable_data.property_internal_value()); } void set_value(const k3d::string_t& Value) { return_if_fail(m_writable_data); return_if_fail(m_writable_data->property_set_value(Value)); } sigc::connection connect_changed(const sigc::slot& Slot) { return m_readable_data.property_changed_signal().connect(Slot); } sigc::connection connect_enumeration_values_changed(const sigc::slot& Slot) { return_val_if_fail(m_enumeration_data, sigc::connection()); return m_enumeration_data->connect_enumeration_values_changed(Slot); } private: property_model(const property_model&); property_model& operator=(const property_model&); k3d::iproperty& m_readable_data; k3d::ienumeration_property* const m_enumeration_data; k3d::iwritable_property* const m_writable_data; }; ///////////////////////////////////////////////////////////////////////////// // model imodel* const model(k3d::iproperty& Property) { return new property_model(Property); } ///////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_model(Model), m_state_recorder(StateRecorder) { assert(m_model.get()); m_list_model = Gtk::ListStore::create(m_columns); } /// Stores the underlying data object boost::scoped_ptr m_model; /// Stores a referenence to the (optional) object for recording undo/redo data k3d::istate_recorder* const m_state_recorder; /// Defines a data model for the underlying combo box widget class columns : public Gtk::TreeModelColumnRecord { public: columns() { add(label); add(value); add(description); } Gtk::TreeModelColumn label; Gtk::TreeModelColumn value; Gtk::TreeModelColumn description; }; /// Defines a data model for the underlying combo box widget columns m_columns; /// Stores data for the underlying combo box widget Glib::RefPtr m_list_model; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_implementation(new implementation(Model, StateRecorder)) { if(Model) { Model->connect_changed(sigc::mem_fun(*this, &control::on_data_changed)); Model->connect_enumeration_values_changed(sigc::mem_fun(*this, &control::on_enumeration_values_changed)); } set_model(m_implementation->m_list_model); Gtk::CellRendererText* const cell_renderer = new Gtk::CellRendererText(); pack_start(*manage(cell_renderer), true); add_attribute(cell_renderer->property_text(), m_implementation->m_columns.label); on_enumeration_values_changed(); on_data_changed(0); signal_changed().connect(sigc::mem_fun(*this, &control::on_list_changed)); } control::~control() { delete m_implementation; } void control::on_data_changed(k3d::iunknown*) { return_if_fail(m_implementation->m_model.get()); const k3d::string_t value = m_implementation->m_model->value(); const Gtk::TreeNodeChildren children = m_implementation->m_list_model->children(); for(Gtk::TreeNodeChildren::const_iterator child = children.begin(); child != children.end(); ++child) { const k3d::string_t child_value = (*child)[m_implementation->m_columns.value]; if(value == child_value) { set_active(child); return; } } k3d::log() << error << "Current enumeration value [" << value << "] does not match any allowed values" << std::endl; } void control::on_enumeration_values_changed() { return_if_fail(m_implementation->m_model.get()); m_implementation->m_list_model->clear(); const k3d::ienumeration_property::enumeration_values_t values = m_implementation->m_model->enumeration_values(); for(k3d::ienumeration_property::enumeration_values_t::const_iterator choice = values.begin(); choice != values.end(); ++choice) { Gtk::TreeRow row = *m_implementation->m_list_model->append(); row[m_implementation->m_columns.label] = choice->label; row[m_implementation->m_columns.value] = choice->value; row[m_implementation->m_columns.description] = choice->description; } set_active(0); } void control::on_list_changed() { Gtk::TreeIter active = get_active(); return_if_fail(active != m_implementation->m_list_model->children().end()); Gtk::TreeRow row = *active; const k3d::string_t value = row[m_implementation->m_columns.value]; return_if_fail(m_implementation->m_model.get()); if(value == m_implementation->m_model->value()) return; if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_implementation->m_model->set_value(value); if(m_implementation->m_state_recorder) { const k3d::string_t change_message = k3d::string_cast(boost::format(_("Change %1% to %2%")) % m_implementation->m_model->label().raw() % value); m_implementation->m_state_recorder->commit_change_set(m_implementation->m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), change_message, K3D_CHANGE_SET_CONTEXT); } } } // namespace enumeration_chooser } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/enumeration_chooser.h ================================================ #ifndef K3DSDK_NGUI_ENUMERATION_CHOOSER_H #define K3DSDK_NGUI_ENUMERATION_CHOOSER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { class iproperty; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace enumeration_chooser { ///////////////////////////////////////////////////////////////////////////// // imodel /// Abstract data model for an enumeration_chooser::control class imodel { public: virtual ~imodel() {} /// Returns a human-readible label for the underlying data virtual const Glib::ustring label() = 0; /// Returns the set of allowed values virtual const k3d::ienumeration_property::enumeration_values_t enumeration_values() = 0; /// Called to return the underlying data value virtual const k3d::string_t value() = 0; /// Called to set a new data value virtual void set_value(const k3d::string_t& Value) = 0; /// Makes a connection to a signal that will be emitted if the underlying data changes virtual sigc::connection connect_changed(const sigc::slot& Slot) = 0; /// Makes a connection to a signal that will be emitted if the set of allowed values changes virtual sigc::connection connect_enumeration_values_changed(const sigc::slot& Slot) = 0; protected: imodel() {} private: imodel(const imodel&); imodel& operator=(const imodel&); }; /// Factory method for creating an imodel instance given a suitably-typed property (could return NULL) imodel* const model(k3d::iproperty& Property); ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating enumerated quantities (i.e. the view and the controller from model-view-controller) class control : public Gtk::ComboBox { typedef Gtk::ComboBox base; public: control(imodel* const Model, k3d::istate_recorder* const StateRecorder = 0); ~control(); private: /// Called whenever the underlying data changes void on_data_changed(k3d::iunknown*); /// Called whenever the set of allowable values changes void on_enumeration_values_changed(); /// Called when the user picks an existing value using the dropdown list void on_list_changed(); class implementation; implementation* const m_implementation; }; } // namespace enumeration_chooser } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_ENUMERATION_CHOOSER_H ================================================ FILE: k3dsdk/ngui/event_button.h ================================================ #ifndef K3DSDK_NGUI_EVENT_BUTTON_H #define K3DSDK_NGUI_EVENT_BUTTON_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace ngui { /// Defines a push-button that can handle any button event, not just LMB-click class event_button : public Gtk::Button { typedef Gtk::Button base; public: event_button() { } private: bool on_button_press_event(GdkEventButton* Event) { base::on_button_press_event(Event); return false; } bool on_button_release_event(GdkEventButton* Event) { base::on_button_release_event(Event); return false; } }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_EVENT_BUTTON_H ================================================ FILE: k3dsdk/ngui/file_chooser_dialog.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // file_chooser_dialog file_chooser_dialog::file_chooser_dialog(const Glib::ustring& Title, const std::string& PathType, Gtk::FileChooserAction Action, const k3d::filesystem::path& InitialPath) : base(Title, Action), path_type(PathType), initial_path(InitialPath), compression(false), extra_widget_container(new Gtk::VBox(false, 0)) { base::set_extra_widget(*extra_widget_container); set_select_multiple(false); set_local_only(); } file_chooser_dialog::file_chooser_dialog(const Glib::ustring& Title, const std::string& PathType, k3d::ipath_property::mode_t Action, const k3d::filesystem::path& InitialPath) : base(Title), path_type(PathType), initial_path(InitialPath), compression(false), extra_widget_container(new Gtk::VBox(false, 0)) { base::set_extra_widget(*extra_widget_container); set_select_multiple(false); set_local_only(); switch(Action) { case k3d::ipath_property::READ: set_action(Gtk::FILE_CHOOSER_ACTION_OPEN); break; case k3d::ipath_property::WRITE: set_action(Gtk::FILE_CHOOSER_ACTION_SAVE); break; } } file_chooser_dialog::file_chooser_dialog(Gtk::Window& Parent, const Glib::ustring& Title, const std::string& PathType, Gtk::FileChooserAction Action, const k3d::filesystem::path& InitialPath) : base(Parent, Title, Action), path_type(PathType), initial_path(InitialPath), compression(false), extra_widget_container(new Gtk::VBox(false, 0)) { base::set_extra_widget(*extra_widget_container); set_select_multiple(false); set_local_only(); } file_chooser_dialog::file_chooser_dialog(Gtk::Window& Parent, const Glib::ustring& Title, const std::string& PathType, k3d::ipath_property::mode_t Action, const k3d::filesystem::path& InitialPath) : base(Parent, Title), path_type(PathType), initial_path(InitialPath), compression(false), extra_widget_container(new Gtk::VBox(false, 0)) { base::set_extra_widget(*extra_widget_container); set_select_multiple(false); set_local_only(); switch(Action) { case k3d::ipath_property::READ: set_action(Gtk::FILE_CHOOSER_ACTION_OPEN); break; case k3d::ipath_property::WRITE: set_action(Gtk::FILE_CHOOSER_ACTION_SAVE); break; } } file_chooser_dialog::~file_chooser_dialog() { delete extra_widget_container; } void file_chooser_dialog::add_pattern_filter(const Glib::ustring& Name, const Glib::ustring& Pattern) { Gtk::FileFilter filter; filter.set_name(Name); filter.add_pattern(Pattern); add_filter(filter); } void file_chooser_dialog::add_mime_type_filter(const Glib::ustring& Name, const Glib::ustring& MimeType) { Gtk::FileFilter filter; filter.set_name(Name); filter.add_mime_type(MimeType); add_filter(filter); } void file_chooser_dialog::add_all_files_filter() { Gtk::FileFilter filter; filter.set_name(_("All Files")); filter.add_pattern("*"); add_filter(filter); } void file_chooser_dialog::enable_compression(const bool Compression) { compression = Compression; } void file_chooser_dialog::append_extension(const std::string& Extension) { extension = Extension; } void file_chooser_dialog::add_extra_widget(Gtk::Widget& ExtraWidget) { extra_widget_container->pack_start(ExtraWidget, Gtk::PACK_SHRINK, 0); } bool file_chooser_dialog::get_file_path(k3d::filesystem::path& Result) { bool compressed = false; return get_file_path(Result, compressed); } bool file_chooser_dialog::get_file_path(k3d::filesystem::path& Result, bool& Compressed) { // Create buttons that will be (optionally) added to the dialog. We do this on the stack // so the same buttons don't get added to the widget multiple times if get_file_path() is // called more-than-once. Gtk::CheckButton compression_widget(_("Compress output file")); compression_widget.set_active(Compressed); Gtk::CheckButton append_extension_widget(_("Append filename extension automatically")); append_extension_widget.set_active(true); Gtk::Button cancel_widget(Gtk::Stock::CANCEL); cancel_widget.set_flags(cancel_widget.get_flags() | Gtk::CAN_DEFAULT); cancel_widget.show(); Gtk::Button open_widget(Gtk::Stock::OPEN); open_widget.set_flags(open_widget.get_flags() | Gtk::CAN_DEFAULT); open_widget.show(); Gtk::Button save_widget(Gtk::Stock::SAVE); save_widget.set_flags(save_widget.get_flags() | Gtk::CAN_DEFAULT); save_widget.show(); // Add the K-3D share path as a shortcut ... add_shortcut_folder(k3d::share_path().native_utf8_string().raw()); add_action_widget(cancel_widget, Gtk::RESPONSE_CANCEL); switch(Gtk::FileChooser::get_action()) { case Gtk::FILE_CHOOSER_ACTION_OPEN: case Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER: add_action_widget(open_widget, Gtk::RESPONSE_OK); set_default_response(Gtk::RESPONSE_OK); break; case Gtk::FILE_CHOOSER_ACTION_SAVE: // Setup the (optional) automatic extension control ... if(!extension.empty()) extra_widget_container->pack_end(append_extension_widget, Gtk::PACK_SHRINK, 0); // Setup the (optional) compression control ... if(compression) extra_widget_container->pack_end(compression_widget, Gtk::PACK_SHRINK, 0); add_action_widget(save_widget, Gtk::RESPONSE_OK); set_default_response(Gtk::RESPONSE_OK); break; case Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER: add_action_widget(save_widget, Gtk::RESPONSE_OK); set_default_response(Gtk::RESPONSE_OK); break; } // Setup the initial path to display ... k3d::filesystem::path start_path = initial_path; if(start_path.empty()) start_path = k3d::options::get_path(path_type); if(start_path.empty()) start_path = k3d::system::get_home_directory(); if(k3d::filesystem::exists(start_path) && k3d::filesystem::is_directory(start_path)) set_current_folder(start_path.native_filesystem_string()); else set_filename(start_path.native_filesystem_string()); // Run the dialog ... set_position(Gtk::WIN_POS_CENTER); extra_widget_container->show_all(); if(Gtk::RESPONSE_OK != run()) return false; // Optionally add an extension if the user didn't ... Result = k3d::filesystem::native_path(k3d::ustring::from_utf8(Glib::filename_to_utf8(get_filename()).raw())); if(!extension.empty() && append_extension_widget.get_active() && (k3d::filesystem::extension(Result).lowercase().raw() != extension)) Result = Result + extension; // Prompt the user if they're about to overwrite an existing file ... if(!prompt_file_overwrite(Result)) return false; // Record the path for posterity ... k3d::options::set_path(path_type, Result); switch(Gtk::FileChooser::get_action()) { case Gtk::FILE_CHOOSER_ACTION_OPEN: case Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER: break; case Gtk::FILE_CHOOSER_ACTION_SAVE: if(compression) Compressed = compression_widget.get_active(); break; case Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER: break; } return true; } bool file_chooser_dialog::prompt_file_overwrite(const k3d::filesystem::path& File) { switch(Gtk::FileChooser::get_action()) { case Gtk::FILE_CHOOSER_ACTION_OPEN: case Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER: return true; case Gtk::FILE_CHOOSER_ACTION_SAVE: case Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER: break; } if(!k3d::filesystem::exists(File)) return true; Gtk::MessageDialog dialog(*this, "", false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE); dialog.set_message(k3d::string_cast(boost::format(_("A file named \"%1%\" already exists.")) % File.native_utf8_string().raw())); dialog.set_secondary_text(_("Do you want to replace it with the one you are saving?")); Gtk::Image replace_icon(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_BUTTON); Gtk::Button replace_button(_("Replace")); replace_button.set_image(replace_icon); replace_button.set_flags(replace_button.get_flags() | Gtk::CAN_DEFAULT); replace_button.show(); dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_action_widget(replace_button, Gtk::RESPONSE_OK); dialog.set_default_response(Gtk::RESPONSE_CANCEL); return dialog.run() == Gtk::RESPONSE_OK; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/file_chooser_dialog.h ================================================ #ifndef K3DSDK_NGUI_FILE_CHOOSER_DIALOG_H #define K3DSDK_NGUI_FILE_CHOOSER_DIALOG_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace ngui { /// Wraps the standard file dialog widget, adding K-3D-specific functionality class file_chooser_dialog : public Gtk::FileChooserDialog { typedef Gtk::FileChooserDialog base; public: file_chooser_dialog(const Glib::ustring& Title, const std::string& PathType, Gtk::FileChooserAction Action = Gtk::FILE_CHOOSER_ACTION_OPEN, const k3d::filesystem::path& InitialPath = k3d::filesystem::path()); file_chooser_dialog(const Glib::ustring& Title, const std::string& PathType, k3d::ipath_property::mode_t Action, const k3d::filesystem::path& InitialPath = k3d::filesystem::path()); file_chooser_dialog(Gtk::Window& Parent, const Glib::ustring& Title, const std::string& PathType, Gtk::FileChooserAction Action = Gtk::FILE_CHOOSER_ACTION_OPEN, const k3d::filesystem::path& InitialPath = k3d::filesystem::path()); file_chooser_dialog(Gtk::Window& Parent, const Glib::ustring& Title, const std::string& PathType, k3d::ipath_property::mode_t Action, const k3d::filesystem::path& InitialPath = k3d::filesystem::path()); ~file_chooser_dialog(); /// Adds a GLOB style pattern filter to the list of available files void add_pattern_filter(const Glib::ustring& Name, const Glib::ustring& Pattern); /// Adds a Mime-type filter to the list of available files void add_mime_type_filter(const Glib::ustring& Name, const Glib::ustring& MimeType); /// Adds an "all files" filter to the list of available files void add_all_files_filter(); /// Adds an option to compress output files. void enable_compression(const bool Compression = true); /// Adds an option to force the user's choice of file to end in the given extension. Pass the extension (including dot) to be added. Pass an empty string to disable. Disabled by default. void append_extension(const std::string& Extension); /// Adds an extra widget (for previewing, special options, etc) to the dialog void add_extra_widget(Gtk::Widget& ExtraWidget); /// Displays a modal dialog and prompts the user to choose a file, returning false if the user cancels bool get_file_path(k3d::filesystem::path& Result); /// Displays a modal dialog and prompts the user to choose a file, returning false if the user cancels bool get_file_path(k3d::filesystem::path& Result, bool& Compressed); private: // Force callers to use add_extra_widget() instead void set_extra_widget(Gtk::Widget&); bool prompt_file_overwrite(const k3d::filesystem::path& Path); const std::string path_type; const k3d::filesystem::path initial_path; bool compression; std::string extension; Gtk::VBox* const extra_widget_container; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_FILE_CHOOSER_DIALOG_H ================================================ FILE: k3dsdk/ngui/hotkey_cell_renderer_text.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // hotkey_cell_renderer_text hotkey_cell_renderer_text::hotkey_cell_renderer_text() : m_window(0) { } Gtk::CellEditable* hotkey_cell_renderer_text::start_editing_vfunc(GdkEvent* event, Gtk::Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) { m_window = dynamic_cast(widget.get_toplevel()); if(m_window) { m_disabled_accel_group = m_window->get_accel_group(); m_window->remove_accel_group(m_window->get_accel_group()); } return base::start_editing_vfunc(event, widget, path, background_area, cell_area, flags); } void hotkey_cell_renderer_text::on_editing_canceled() { if(m_window) { m_window->add_accel_group(m_disabled_accel_group); m_disabled_accel_group.clear(); } base::on_editing_canceled(); } void hotkey_cell_renderer_text::on_edited(const Glib::ustring& path, const Glib::ustring& new_text) { if(m_window) { m_window->add_accel_group(m_disabled_accel_group); m_disabled_accel_group.clear(); } base::on_edited(path, new_text); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/hotkey_cell_renderer_text.h ================================================ #ifndef K3DSDK_NGUI_HOTKEY_CELL_RENDERER_TEXT_H #define K3DSDK_NGUI_HOTKEY_CELL_RENDERER_TEXT_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // hotkey_cell_renderer_text /// Gtk::CellRendererText derivative that automatically disables accelerators during editing class hotkey_cell_renderer_text : public Gtk::CellRendererText { typedef Gtk::CellRendererText base; public: hotkey_cell_renderer_text(); Gtk::CellEditable* start_editing_vfunc(GdkEvent* event, Gtk::Widget& widget, const Glib::ustring& path, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags); void on_editing_canceled(); void on_edited (const Glib::ustring& path, const Glib::ustring& new_text); private: /// Stores the parent window while the control has the keyboard focus Gtk::Window* m_window; /// Stores the global accel group while the control has the keyboard focus Glib::RefPtr m_disabled_accel_group; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_HOTKEY_CELL_RENDERER_TEXT_H ================================================ FILE: k3dsdk/ngui/hotkey_entry.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // hotkey_entry bool hotkey_entry::on_focus_in_event(GdkEventFocus* Event) { // Disable accelerators for this window if(Gtk::Window* const window = dynamic_cast(get_toplevel())) { m_disabled_accel_group = window->get_accel_group(); window->remove_accel_group(window->get_accel_group()); } return base::on_focus_in_event(Event); } bool hotkey_entry::on_focus_out_event(GdkEventFocus* Event) { // Enable accelerators for this window if(Gtk::Window* const window = dynamic_cast(get_toplevel())) { window->add_accel_group(m_disabled_accel_group); m_disabled_accel_group.clear(); } return base::on_focus_out_event(Event); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/hotkey_entry.h ================================================ #ifndef K3DSDK_NGUI_HOTKEY_ENTRY_H #define K3DSDK_NGUI_HOTKEY_ENTRY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // hotkey_entry /// Gtk::Entry derivative that automatically disables accelerators while it has the focus class hotkey_entry : public Gtk::Entry { typedef Gtk::Entry base; public: /// Called when the control gets the keyboard focus bool on_focus_in_event(GdkEventFocus* Event); /// Called when the control loses the keyboard focus bool on_focus_out_event(GdkEventFocus* Event); private: /// Stores the global accel group while the control has the keyboard focus Glib::RefPtr m_disabled_accel_group; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_HOTKEY_ENTRY_H ================================================ FILE: k3dsdk/ngui/icons.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { const k3d::filesystem::path scalable_path() { return k3d::share_path() / k3d::filesystem::generic_path("ngui/scalable"); } const k3d::filesystem::path rasterized_path() { return k3d::share_path() / k3d::filesystem::generic_path("ngui/rasterized"); } const k3d::filesystem::path pixmap_path() { return k3d::share_path() / k3d::filesystem::generic_path("ngui/pixmap"); } #include } // namespace detail Glib::RefPtr load_icon(const std::string& Name, const Gtk::IconSize& Size) { static Glib::RefPtr theme; if(!theme) { theme = Gtk::IconTheme::create(); #ifdef K3D_HAVE_SVG_ICONS theme->append_search_path(detail::scalable_path().native_utf8_string().raw()); k3d::log() << info << "Loading icons from " << detail::scalable_path().native_console_string() << std::endl; #endif // K3D_HAVE_SVG_ICONS theme->append_search_path(detail::rasterized_path().native_utf8_string().raw()); k3d::log() << info << "Loading icons from " << detail::rasterized_path().native_console_string() << std::endl; theme->append_search_path(detail::pixmap_path().native_utf8_string().raw()); k3d::log() << info << "Loading icons from " << detail::pixmap_path().native_console_string() << std::endl; } int width = 0; int height = 0; return_val_if_fail(Gtk::IconSize::lookup(Size, width, height), Glib::RefPtr()); try { return theme->load_icon(Name, width, Gtk::ICON_LOOKUP_USE_BUILTIN); } catch(Glib::Exception& e) { k3d::log() << error << e.what() << std::endl; } static Glib::RefPtr unknown_icon; if(!unknown_icon) { try { unknown_icon = Gdk::Pixbuf::create_from_xpm_data(detail::unknown_xpm); } catch(Glib::Exception& e) { k3d::log() << error << e.what() << std::endl; } } return unknown_icon; } Glib::RefPtr quiet_load_icon(const std::string& Name, const Gtk::IconSize& Size) { #ifdef K3D_HAVE_SVG_ICONS if(k3d::filesystem::exists(detail::scalable_path() / k3d::filesystem::native_path(k3d::ustring::from_utf8(Name + ".svg")))) return load_icon(Name, Size); #endif // !K3D_HAVE_SVG_ICONS if(k3d::filesystem::exists(detail::rasterized_path() / k3d::filesystem::native_path(k3d::ustring::from_utf8(Name + ".png")))) return load_icon(Name, Size); if(k3d::filesystem::exists(detail::pixmap_path() / k3d::filesystem::native_path(k3d::ustring::from_utf8(Name + ".xpm")))) return load_icon(Name, Size); static Glib::RefPtr unknown_icon; if(!unknown_icon) { try { unknown_icon = Gdk::Pixbuf::create_from_xpm_data(detail::unknown_xpm); } catch(Glib::Exception& e) { k3d::log() << error << e.what() << std::endl; } } return unknown_icon; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/icons.h ================================================ #ifndef K3DSDK_NGUI_ICONS_H #define K3DSDK_NGUI_ICONS_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead (tshead@k-3d.com) */ #include #include // Forward declarations namespace Gdk { class Pixbuf; } namespace Gtk { class IconSize; } namespace k3d { namespace ngui { // Loads an (optionally themed) application icon Glib::RefPtr load_icon(const std::string& Name, const Gtk::IconSize& Size); // Loads an (optionally themed) application icon, without generating an error messages if the icon cannot be located Glib::RefPtr quiet_load_icon(const std::string& Name, const Gtk::IconSize& Size); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_ICONS_H ================================================ FILE: k3dsdk/ngui/image_toggle_button.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { namespace image_toggle_button { ///////////////////////////////////////////////////////////////////////////// // control control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder, Glib::RefPtr Image) : base(Model, StateRecorder), m_image(new Gtk::Image()), m_active_image(Image), m_inactive_image(Image) { get_accessible()->set_name(Model->label()); add(*manage(m_image)); on_update(); } control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder, Glib::RefPtr ActiveImage, Glib::RefPtr InactiveImage) : base(Model, StateRecorder), m_image(new Gtk::Image()), m_active_image(ActiveImage), m_inactive_image(InactiveImage) { add(*manage(m_image)); on_update(); } void control::on_update() { m_image->set(get_active() ? m_active_image : m_inactive_image); } } // namespace image_toggle_button } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/image_toggle_button.h ================================================ #ifndef K3DSDK_NGUI_IMAGE_TOGGLE_BUTTON_H #define K3DSDK_NGUI_IMAGE_TOGGLE_BUTTON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace Gtk { class Image; } namespace Gdk { class Pixbuf; } namespace k3d { namespace ngui { namespace image_toggle_button { using toggle_button::imodel; using toggle_button::model; ///////////////////////////////////////////////////////////////////////////// // control /// Specialization of toggle_button::control that displays different images dependent on the button state class control : public toggle_button::control { typedef toggle_button::control base; public: control(imodel* const Model, k3d::istate_recorder* const StateRecorder, Glib::RefPtr Image); control(imodel* const Model, k3d::istate_recorder* const StateRecorder, Glib::RefPtr ActiveImage, Glib::RefPtr InactiveImage); private: void on_update(); Gtk::Image* const m_image; Glib::RefPtr m_active_image; Glib::RefPtr m_inactive_image; }; } // namespace image_toggle_button } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_IMAGE_TOGGLE_BUTTON_H ================================================ FILE: k3dsdk/ngui/input_model.h ================================================ #ifndef K3DSDK_NGUI_INPUT_MODEL_H #define K3DSDK_NGUI_INPUT_MODEL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // input_model /// Abstract interface for objects that can process user input class input_model { public: /// Called when a mouse button is pressed virtual void button_press_event(GdkEventButton* Event) = 0; /// Called when a mouse button is released virtual void button_release_event(GdkEventButton* Event) = 0; /// Called during mouse movement virtual void motion_notify_event(GdkEventMotion* Event) = 0; /// Called when the mouse wheel is scrolled virtual void scroll_event(GdkEventScroll* Event) = 0; /// Called when a key is pressed virtual void key_press_event(GdkEventKey* Event) = 0; /// Called when a key is released virtual void key_release_event(GdkEventKey* Event) = 0; protected: input_model() {} input_model(const input_model&) {} input_model& operator=(const input_model&) { return *this; } virtual ~input_model() {} }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_INPUT_MODEL_H ================================================ FILE: k3dsdk/ngui/interactive.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined K3D_API_WIN32 //#include #undef min #undef max #elif defined K3D_API_DARWIN #else // K3D_API_WIN32 #include #endif // !K3D_API_WIN32 namespace k3d { namespace ngui { namespace interactive { namespace detail { void warp_pointer(const k3d::point2& Offset) { #ifdef K3D_API_WIN32 // Make that pointer jump! SetCursorPos(static_cast(Offset[0]), static_cast(Offset[1])); #elif defined K3D_API_DARWIN #else // K3D_API_WIN32 // Get the X display ... Display* xdisplay = GDK_WINDOW_XDISPLAY(Gdk::Display::get_default()->get_default_screen()->get_root_window()->gobj()); return_if_fail(xdisplay); // Get our X window ... Window xwindow = GDK_WINDOW_XWINDOW(Gdk::Display::get_default()->get_default_screen()->get_root_window()->gobj()); return_if_fail(xwindow); // Move that pointer! XWarpPointer(xdisplay, None, xwindow, 0, 0, 0, 0, static_cast(Offset[0]), static_cast(Offset[1])); XFlush(xdisplay); #endif // !K3D_API_WIN32 } void warp_pointer(Glib::RefPtr Window, const k3d::point2& Offset) { return_if_fail(Window); int left = 0; int top = 0; Window->get_origin(left, top); warp_pointer(k3d::point2(left, top) + Offset); } const k3d::point2 screen_coordinates(Gtk::Widget& Widget) { // Sanity check return_val_if_fail(Widget.get_window(), k3d::point2(0, 0)); int left = 0; int top = 0; Widget.get_window()->get_origin(left, top); if(Widget.has_no_window()) { left += Widget.get_allocation().get_x(); top += Widget.get_allocation().get_y(); } return k3d::point2(left, top); } } // namespace detail const k3d::point2 get_pointer() { int x = 0; int y = 0; Gdk::ModifierType modifiers; Gdk::Display::get_default()->get_pointer(x, y, modifiers); return k3d::point2(x, y); } void warp_pointer(const k3d::point2& Coords) { detail::warp_pointer(Coords); } void warp_pointer(Gtk::Widget& Widget, const k3d::point2& Coords) { detail::warp_pointer(detail::screen_coordinates(Widget) + Coords); } void warp_pointer(Gtk::Widget& Widget) { detail::warp_pointer(detail::screen_coordinates(Widget) + k3d::point2(Widget.get_width() / 2, Widget.get_height() / 2)); } } // namespace interactive } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/interactive.h ================================================ #ifndef K3DSDK_NGUI_INTERACTIVE_H #define K3DSDK_NGUI_INTERACTIVE_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace Gtk { class Widget; } namespace k3d { namespace ngui { namespace interactive { /// Returns the current pointer screen coordinates const k3d::point2 get_pointer(); /// Instantaneously warps the pointer from its current location to the given screen coordinates void warp_pointer(const k3d::point2& Coords); /// Instantaneously warps the pointer from its current location to the given widget coordinates void warp_pointer(Gtk::Widget& Widget, const k3d::point2& Coords); /// Instantaneously warps the pointer from its current location to the center of a widget void warp_pointer(Gtk::Widget& Widget); } // namespace interactive } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_INTERACTIVE_H ================================================ FILE: k3dsdk/ngui/keyboard.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { const k3d::key_modifiers convert(const unsigned int Modifiers) { k3d::key_modifiers result; result.set_shift(Modifiers & GDK_SHIFT_MASK ? true : false); result.set_lock(Modifiers & GDK_LOCK_MASK ? true : false); result.set_control(Modifiers & GDK_CONTROL_MASK ? true : false); result.set_mod1(Modifiers & GDK_MOD1_MASK ? true : false); result.set_mod2(Modifiers & GDK_MOD2_MASK ? true : false); result.set_mod3(Modifiers & GDK_MOD3_MASK ? true : false); result.set_mod4(Modifiers & GDK_MOD4_MASK ? true : false); result.set_mod5(Modifiers & GDK_MOD5_MASK ? true : false); result.set_button1(Modifiers & GDK_BUTTON1_MASK ? true : false); result.set_button2(Modifiers & GDK_BUTTON2_MASK ? true : false); result.set_button3(Modifiers & GDK_BUTTON3_MASK ? true : false); result.set_button4(Modifiers & GDK_BUTTON4_MASK ? true : false); result.set_button5(Modifiers & GDK_BUTTON5_MASK ? true : false); result.set_release(Modifiers & GDK_RELEASE_MASK ? true : false); return result; } const unsigned int convert(const k3d::key_modifiers Modifiers) { int result = 0; if(Modifiers.shift()) result |= GDK_SHIFT_MASK; if(Modifiers.lock()) result |= GDK_LOCK_MASK; if(Modifiers.control()) result |= GDK_CONTROL_MASK; if(Modifiers.mod1()) result |= GDK_MOD1_MASK; if(Modifiers.mod2()) result |= GDK_MOD2_MASK; if(Modifiers.mod3()) result |= GDK_MOD3_MASK; if(Modifiers.mod4()) result |= GDK_MOD4_MASK; if(Modifiers.mod5()) result |= GDK_MOD5_MASK; if(Modifiers.button1()) result |= GDK_BUTTON1_MASK; if(Modifiers.button2()) result |= GDK_BUTTON2_MASK; if(Modifiers.button3()) result |= GDK_BUTTON3_MASK; if(Modifiers.button4()) result |= GDK_BUTTON4_MASK; if(Modifiers.button5()) result |= GDK_BUTTON5_MASK; if(Modifiers.release()) result |= GDK_RELEASE_MASK; return result; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/keyboard.h ================================================ #ifndef K3DSDK_NGUI_KEYBOARD_H #define K3DSDK_NGUI_KEYBOARD_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { /// Converts GDK keyboard modifiers to our native keyboard modifier type const k3d::key_modifiers convert(const unsigned int Modifiers); /// Converts our native keyboard modifier type to GDK keyboard modifiers const unsigned int convert(const k3d::key_modifiers Modifiers); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_KEYBOARD_H ================================================ FILE: k3dsdk/ngui/main_document_window.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { ///////////////////////////////////////////////////////////////////////////// // select: selecting nodes using std::for_each struct select { select(idocument& Document) : document(Document) { } void operator()(k3d::inode* Node) { if(Node) selection::state(document).select(*Node); } private: idocument& document; }; ///////////////////////////////////////////////////////////////////////////// // get_panel_frames void get_panel_frames(Gtk::Widget& Parent, panel_frame::controls& Results) { panel_frame::control* const panel = dynamic_cast(&Parent); if(panel) { Results.push_back(panel); return; } Gtk::Container* const container = dynamic_cast(&Parent); if(container) { std::vector children = container->get_children(); for(std::vector::iterator child = children.begin(); child != children.end(); ++child) get_panel_frames(**child, Results); } } panel_frame::controls get_panel_frames(Gtk::Widget& Parent) { panel_frame::controls results; get_panel_frames(Parent, results); return results; } ///////////////////////////////////////////////////////////////////////////// // ui_layout_path const k3d::filesystem::path ui_layout_path() { return k3d::system::get_home_directory() / k3d::filesystem::generic_path(".k3d/ui_layout"); } } // namespace detail ///////////////////////////////////////////////////////////////////////////// // main_document_window class main_document_window : public savable_document_window, public k3d::property_collection, public k3d::ipersistent { typedef savable_document_window base; public: main_document_window(document_state& DocumentState) : k3d::property_collection(), m_maximize_panel(init_name("maximize_panel") + init_label(_("Maximize active panel")) + init_description(_("Maximize active panel (make it the only visible one)")) + init_value(false)), m_hide_unpinned_panels(init_name("hide_unpinned_panels") + init_label(_("Hide unpinned panels")) + init_description(_("Hide/show unpinned panels in main document window")) + init_value(false)), m_fullscreen(init_name("fullscreen") + init_label(_("Fullscreen")) + init_description(_("Fullscreen mode for main document window")) + init_value(false)), m_focus_panel(0), m_focus_viewport_panel(0), m_layout_maximize_panel(0), m_layout_hide_unpinned(0), m_layout_pin_all(0), m_layout_unpin_all(0), m_layout_decorate_panel(0), m_layout_undecorate_panel(0), m_layout_split_horizontal(0), m_layout_split_vertical(0), m_layout_kill_panel(0), m_document_state(DocumentState) { base::initialize(DocumentState); ++m_count; document().title().property_changed_signal().connect(sigc::mem_fun(*this, &main_document_window::on_document_title_changed)); m_fullscreen.changed_signal().connect(sigc::mem_fun(*this, &main_document_window::on_window_fullscreen)); m_panel_focus_signal.connect(sigc::mem_fun(*this, &main_document_window::on_panel_focus_changed)); document().state_recorder().connect_current_node_changed_signal(sigc::mem_fun(*this, &main_document_window::update_undo_redo_controls)); m_document_state.set_cursor_signal().connect(sigc::mem_fun(*this, &main_document_window::on_set_cursor)); m_document_state.clear_cursor_signal().connect(sigc::mem_fun(*this, &main_document_window::on_clear_cursor)); Gtk::MenuBar* const menubar = new Gtk::MenuBar(); menubar->get_accessible()->set_name("main"); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_File"), *manage(create_file_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Edit"), *manage(create_edit_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Select"), *manage(create_select_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Layout"), *manage(create_layout_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_View"), *manage(create_view_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Create"), *manage(create_create_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Modify"), *manage(create_modifier_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Render"), *manage(create_render_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("S_cripting"), *manage(create_scripting_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Advanced"), *manage(create_advanced_menu()))); menubar->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Help"), *manage(create_help_menu()))); menubar->show_all(); m_panel_frame.get_accessible()->set_name("main"); m_panel_frame.show_all(); // Setup main box with menubar, panel frame and status bar Gtk::VBox* const vbox1 = new Gtk::VBox(false); vbox1->get_accessible()->set_name("vbox"); vbox1->pack_start(*Gtk::manage(menubar), Gtk::PACK_SHRINK); vbox1->pack_start(m_panel_frame, Gtk::PACK_EXPAND_WIDGET); // vbox1->pack_start(*Gtk::manage(hbox1), Gtk::PACK_SHRINK); vbox1->show(); add(*manage(vbox1)); // Load layout if(!load_ui_layout()) { set_default_layout(); maximize(); } update_panel_controls(0); // Update variables on_document_title_changed(0); on_window_fullscreen(0); show(); // Give the event-loop a chance to catch-up (otherwise, we get breakage in test cases) handle_pending_events(); } void delete_children(Gtk::Widget& Widget) { if(panel_frame::control* const control = dynamic_cast(&Widget)) { delete control; return; } if(Gtk::Container* const container = dynamic_cast(&Widget)) { std::vector children = container->get_children(); for(size_t i = 0; i != children.size(); ++i) delete_children(*children[i]); delete container; } } ~main_document_window() { if(Gtk::Widget* frame_child = m_panel_frame.get_child()) delete_children(*frame_child); --m_count; } void save(k3d::xml::element& Element, const k3d::ipersistent::save_context& Context) { Gtk::Widget* frame_child = m_panel_frame.get_child(); if(!frame_child) return; save_ui_container(frame_child, Element); } void load(k3d::xml::element& Element, const k3d::ipersistent::load_context& Context) { if(!load_ui_container(Element)) { k3d::log() << warning << "Using default UI layout" << std::endl; set_default_layout(); } } void set_default_layout() { if(Gtk::Widget* frame_child = m_panel_frame.get_child()) { m_panel_frame.remove(); delete frame_child; } // Create first panel frame panel_frame::control* const panel_frame1 = create_panel_frame(); m_panel_frame.set_shadow_type(Gtk::SHADOW_NONE); m_panel_frame.add(*Gtk::manage(panel_frame1)); // First panel is the toolbar panel_frame1->mount_panel("NGUIToolbarPanel"); panel_frame1->decorations.set_value(false); // Node list in the middle panel_frame::control* const panel_frame2 = split_panel(*panel_frame1, *Gtk::manage(new Gtk::VPaned), -1); panel_frame2->mount_panel("NGUINodeListPanel"); // Timeline at the bottom panel_frame::control* const panel_frame3 = split_panel(*panel_frame2, *Gtk::manage(new Gtk::VPaned), -1, Gtk::SHRINK); panel_frame3->mount_panel("NGUITimelinePanel"); panel_frame3->decorations.set_value(false); // Viewport on node list's right panel_frame::control* const panel_frame4 = split_panel(*panel_frame2, *Gtk::manage(new Gtk::HPaned), 200); const std::vector gl_engines = k3d::node::lookup(document()); k3d::gl::irender_viewport* const glengine1 = gl_engines.size() ? gl_engines[0] : 0; const std::vector cameras = k3d::node::lookup(document()); k3d::icamera* const camera1 = cameras.size() ? cameras[0] : 0; if(glengine1 && camera1) { viewport::control* const control = new viewport::control(m_document_state); control->get_accessible()->set_name("viewport"); control->set_camera(camera1); control->set_gl_engine(glengine1); panel_frame4->mount_panel(*Gtk::manage(control), "NGUIViewportPanel"); } // Node history below node list panel_frame::control* const panel_frame5 = split_panel(*panel_frame2, *Gtk::manage(new Gtk::VPaned), -1); panel_frame5->mount_panel("NGUIPipelinePanel"); // Node properties below node history panel_frame::control* const panel_frame6 = split_panel(*panel_frame5, *Gtk::manage(new Gtk::VPaned), -1); panel_frame6->mount_panel("NGUINodePropertiesPanel"); set_focus_viewport_panel(panel_frame4); } private: void on_set_cursor(const Glib::RefPtr Cursor) { if(Cursor) get_window()->set_cursor(Gdk::Cursor(get_display(), Cursor, 0, 0)); else get_window()->set_cursor(); } void on_clear_cursor() { get_window()->set_cursor(); } panel_frame::control* create_panel_frame(/*const std::string& Name*/) { panel_frame::control* const control = new panel_frame::control(m_document_state, m_panel_focus_signal); control->pinned.changed_signal().connect(sigc::mem_fun(*this, &main_document_window::update_panel_controls)); control->automagic.changed_signal().connect(sigc::mem_fun(*this, &main_document_window::update_panel_controls)); control->grab_panel_focus(); return control; } Gtk::Menu* create_file_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::NEW, Gtk::ICON_SIZE_MENU)), _("_New"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_file_new)) << set_accelerator_path("/actions/file/new", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::OPEN, Gtk::ICON_SIZE_MENU)), _("_Open..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_file_open)) << set_accelerator_path("/actions/file/open", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::OPEN, Gtk::ICON_SIZE_MENU)), _("_Merge Nodes..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_file_merge_nodes)) << set_accelerator_path("/actions/file/merge_nodes", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::SAVE, Gtk::ICON_SIZE_MENU)), _("_Save"), true) << connect_menu_item(sigc::hide_return(sigc::mem_fun(*this, &main_document_window::on_file_save))) << set_accelerator_path("/actions/file/save", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::SAVE_AS, Gtk::ICON_SIZE_MENU)), _("Save _As..."), true) << connect_menu_item(sigc::hide_return(sigc::mem_fun(*this, &main_document_window::on_file_save_as))) << set_accelerator_path("/actions/file/save_as", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::REVERT_TO_SAVED, Gtk::ICON_SIZE_MENU)), _("_Revert"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_file_revert)) << set_accelerator_path("/actions/file/revert", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Import ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_file_import)) << set_accelerator_path("/actions/file/import", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Export ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_file_export)) << set_accelerator_path("/actions/file/export", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::CLOSE, Gtk::ICON_SIZE_MENU)), _("_Close"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_file_close)) << set_accelerator_path("/actions/file/close", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::QUIT, Gtk::ICON_SIZE_MENU)), _("_Quit"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_file_quit)) << set_accelerator_path("/actions/file/quit", get_accel_group()))); return menu; } Gtk::Menu* create_tools_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Select"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_selection_tool)) << set_accelerator_path("/actions/edit/tools/select_tool", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Move"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_move_tool)) << set_accelerator_path("/actions/edit/tools/move_tool", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Rotate"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_rotate_tool)) << set_accelerator_path("/actions/edit/tools/rotate_tool", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Scale"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_scale_tool)) << set_accelerator_path("/actions/edit/tools/scale_tool", get_accel_group()))); if(k3d::plugin::factory::lookup("NGUIParentTool")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Parent"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_parent_tool)) << set_accelerator_path("/actions/edit/tools/NGUIParentTool", get_accel_group()))); } menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Unparent"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_unparent)) << set_accelerator_path("/actions/edit/tools/unparent", get_accel_group()))); if(k3d::plugin::factory::lookup("NGUIRenderRegionTool")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem( _("Render R_egion"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_region_tool)) << set_accelerator_path("/actions/edit/tools/NGUIRenderRegionTool", get_accel_group()))); } if(k3d::plugin::factory::lookup("NGUISnapTool")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("S_nap Tool"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_snap_tool)) << set_accelerator_path("/actions/edit/tools/NGUISnapTool", get_accel_group()))); } return menu; } Gtk::Menu* create_edit_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); m_undo_menu_item.reset( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU)), _("_Undo"), true) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_edit_undo), false)) << set_accelerator_path("/actions/edit/undo", get_accel_group())); m_undo_all_menu_item.reset( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::UNDO, Gtk::ICON_SIZE_MENU)), _("Undo All")) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_edit_undo), true)) << set_accelerator_path("/actions/edit/undo_all", get_accel_group())); m_redo_menu_item.reset( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::REDO, Gtk::ICON_SIZE_MENU)), _("_Redo"), true) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_edit_redo), false)) << set_accelerator_path("/actions/edit/redo", get_accel_group())); m_redo_all_menu_item.reset( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::REDO, Gtk::ICON_SIZE_MENU)), _("Redo All")) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_edit_redo), true)) << set_accelerator_path("/actions/edit/redo_all", get_accel_group())); menu->items().push_back(*m_undo_menu_item); menu->items().push_back(*m_undo_all_menu_item); menu->items().push_back(*m_redo_menu_item); menu->items().push_back(*m_redo_all_menu_item); update_undo_redo_controls(); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Tools"), *Gtk::manage(create_tools_menu()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Instantiate"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_instantiate)) << set_accelerator_path("/actions/edit/instantiate", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("D_uplicate"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_duplicate)) << set_accelerator_path("/actions/edit/duplicate", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Delete"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_delete)) << set_accelerator_path("/actions/edit/delete", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); if(k3d::plugin::factory::lookup("NGUIAssignHotkeysDialog")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Assign _Hotkeys"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_assign_hotkeys)) << set_accelerator_path("/actions/view/assign_hotkeys", get_accel_group()))); } return menu; } Gtk::Menu* create_select_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_All"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_all)) << set_accelerator_path("/actions/select/select_all", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_None"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_none)) << set_accelerator_path("/actions/select/select_none", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Invert"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_invert)) << set_accelerator_path("/actions/select/select_invert", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Parent"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_parent)) << set_accelerator_path("/actions/select/select_parent", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Child"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_child)) << set_accelerator_path("/actions/select/select_child", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Sibling"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_sibling)) << set_accelerator_path("/actions/select/select_sibling", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("N_odes"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_nodes)) << set_accelerator_path("/actions/select/select_nodes", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Poin_ts"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_vertices)) << set_accelerator_path("/actions/select/select_points", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Edges"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_split_edges)) << set_accelerator_path("/actions/select/select_split_edges", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Faces"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_faces)) << set_accelerator_path("/actions/select/select_faces", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Curves"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_curves)) << set_accelerator_path("/actions/select/select_curves", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Patches"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_patches)) << set_accelerator_path("/actions/select/select_patches", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Uniform"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_select_uniform)) << set_accelerator_path("/actions/select/select_uniform", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); return menu; } Gtk::Menu* create_layout_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); m_layout_maximize_panel = new check_menu_item::control(check_menu_item::proxy(m_maximize_panel), _("_Maximize Panel"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_maximize_panel)) << set_accelerator_path("/actions/layout/maximize_panel", get_accel_group()); m_layout_hide_unpinned = new check_menu_item::control(check_menu_item::proxy(m_hide_unpinned_panels), _("H_ide Unpinned Panels"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_hide_show_unpinned)) << set_accelerator_path("/actions/layout/hide_unpinned", get_accel_group()); m_layout_pin_all = new Gtk::MenuItem(_("_Pin All Panels"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_pin_all)) << set_accelerator_path("/actions/layout/pin_all_panels", get_accel_group()); m_layout_unpin_all = new Gtk::MenuItem(_("_Unpin All Panels"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_unpin_all)) << set_accelerator_path("/actions/layout/unpin_all", get_accel_group()); m_layout_decorate_panel = new Gtk::MenuItem(_("_Decorate Selected Panel"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_decorate_panel)) << set_accelerator_path("/actions/layout/decorate_panel", get_accel_group()); m_layout_undecorate_panel = new Gtk::MenuItem(_("U_ndecorate Selected Panel"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_undecorate_panel)) << set_accelerator_path("/actions/layout/undecorate_panel", get_accel_group()); m_layout_split_horizontal = new Gtk::MenuItem(_("Split Panel _Horizontally"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_split_horizontal)) << set_accelerator_path("/actions/layout/split_horizontal", get_accel_group()); m_layout_split_vertical = new Gtk::MenuItem(_("Split Panel _Vertically"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_split_vertical)) << set_accelerator_path("/actions/layout/split_vertical", get_accel_group()); m_layout_kill_panel = new Gtk::MenuItem(_("_Kill Panel"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_kill_panel)) << set_accelerator_path("/actions/layout/kill_panel", get_accel_group()); menu->items().push_back(*Gtk::manage(m_layout_maximize_panel)); menu->items().push_back(*Gtk::manage(m_layout_hide_unpinned)); menu->items().push_back(*Gtk::manage(m_layout_pin_all)); menu->items().push_back(*Gtk::manage(m_layout_unpin_all)); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage(m_layout_decorate_panel)); menu->items().push_back(*Gtk::manage(m_layout_undecorate_panel)); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage(m_layout_split_horizontal)); menu->items().push_back(*Gtk::manage(m_layout_split_vertical)); menu->items().push_back(*Gtk::manage(m_layout_kill_panel)); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new check_menu_item::control(check_menu_item::proxy(m_fullscreen), _("_Fullscreen"), true) << set_accelerator_path("/actions/layout/fullscreen", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Save layout"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_save)) << set_accelerator_path("/actions/layout/save_layout", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Reset layout"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_layout_reset)) << set_accelerator_path("/actions/layout/reset_layout", get_accel_group()))); return menu; } Gtk::Menu* create_set_view_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("+_X view"), true) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_view_set_view), k3d::PX)) << set_accelerator_path("/actions/view/set_view/px_view", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("-X view")) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_view_set_view), k3d::NX)) << set_accelerator_path("/actions/view/set_view/nx_view", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("+_Y view"), true) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_view_set_view), k3d::PY)) << set_accelerator_path("/actions/view/set_view/py_view", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("-Y view")) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_view_set_view), k3d::NY)) << set_accelerator_path("/actions/view/set_view/ny_view", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("+_Z view"), true) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_view_set_view), k3d::PZ)) << set_accelerator_path("/actions/view/set_view/pz_view", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("-Z view")) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_view_set_view), k3d::NZ)) << set_accelerator_path("/actions/view/set_view/nz_view", get_accel_group()))); return menu; } Gtk::Menu* create_view_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Hide Selection"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_view_hide_selection)) << set_accelerator_path("/actions/view/hide_selection", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Show Selection"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_view_show_selection)) << set_accelerator_path("/actions/view/show_selection", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Hide _Unselected"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_view_hide_unselected)) << set_accelerator_path("/actions/view/hide_unselected", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Show _All"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_view_show_all)) << set_accelerator_path("/actions/view/show_all", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Aim Selection")) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_view_aim_selection)) << set_accelerator_path("/actions/view/aim_selection", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Frame Selection"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_view_frame_selection)) << set_accelerator_path("/actions/view/frame_selection", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set _Camera ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_view_set_camera)) << set_accelerator_path("/actions/view/set_camera", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Orthographic toggle"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_view_toggle_projection)) << set_accelerator_path("/actions/view/toggle_projection", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Set view"), *Gtk::manage(create_set_view_menu()))); return menu; } Gtk::Menu* create_create_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); // Group plugin types by their categories ... typedef std::set sorted_factories_t; typedef std::map grouped_factories_t; grouped_factories_t grouped_factories; const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); for(k3d::plugin::factory::collection_t::const_iterator f = factories.begin(); f != factories.end(); ++f) { // If it isn't a document plugin factory, skip it ... if(!dynamic_cast(*f)) continue; k3d::iplugin_factory& factory = **f; for(k3d::iplugin_factory::categories_t::const_iterator category = factory.categories().begin(); category != factory.categories().end(); ++category) grouped_factories[*category].insert(&factory); if(factory.categories().empty()) grouped_factories[""].insert(&factory); } for(grouped_factories_t::const_iterator group = grouped_factories.begin(); group != grouped_factories.end(); ++group) { Gtk::Menu* const submenu = new Gtk::Menu(); submenu->set_accel_group(get_accel_group()); menu->items().push_back(Gtk::Menu_Helpers::MenuElem(group->first, *manage(submenu))); const sorted_factories_t& sorted_factories = group->second; for(sorted_factories_t::const_iterator f = sorted_factories.begin(); f != sorted_factories.end(); ++f) { k3d::iplugin_factory& factory = **f; submenu->items().push_back(*Gtk::manage( create_menu_item(factory) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_create_node), &factory)) << set_accelerator_path("/actions/create/" + factory.name(), get_accel_group()))); } } return menu; } Gtk::Menu* create_modifier_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); // Mesh modifiers const factories_t& mesh_modifiers = k3d::ngui::mesh_modifiers(); if(!mesh_modifiers.empty()) { Gtk::Menu* const submenu = new Gtk::Menu(); submenu->set_accel_group(get_accel_group()); menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Mesh"), *manage(submenu))); for(factories_t::const_iterator modifier = mesh_modifiers.begin(); modifier != mesh_modifiers.end(); ++modifier) { k3d::iplugin_factory& factory = **modifier; submenu->items().push_back(*Gtk::manage( create_menu_item(factory) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_modify_meshes), &factory)) << set_accelerator_path("/actions/modifier/" + factory.name(), get_accel_group()))); } } // Transform modifiers const factories_t& transform_modifiers = k3d::ngui::transform_modifiers(); if(!transform_modifiers.empty()) { Gtk::Menu* const submenu = new Gtk::Menu(); submenu->set_accel_group(get_accel_group()); menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Transform"), *manage(submenu))); for(factories_t::const_iterator modifier = transform_modifiers.begin(); modifier != transform_modifiers.end(); ++modifier) { k3d::iplugin_factory& factory = **modifier; submenu->items().push_back(*Gtk::manage( create_menu_item(factory) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_modify_transformations), &factory)) << set_accelerator_path("/actions/modifier/" + factory.name(), get_accel_group()))); } } return menu; } Gtk::Menu* create_render_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); if(k3d::plugin::factory::lookup("NGUIRenderRegionTool")) { menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("NGUIRenderRegionTool", Gtk::ICON_SIZE_MENU))), _("_Region"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_region_tool)) << set_accelerator_path("/actions/render/render_region", get_accel_group()))); } menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("render_preview", Gtk::ICON_SIZE_MENU))), _("_Preview"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_preview)) << set_accelerator_path("/actions/render/render_preview", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("render_frame", Gtk::ICON_SIZE_MENU))), _("_Frame"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_frame)) << set_accelerator_path("/actions/render/render_frame", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("render_animation", Gtk::ICON_SIZE_MENU))), _("_Animation"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_animation)) << set_accelerator_path("/actions/render/render_animation", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("render_frame", Gtk::ICON_SIZE_MENU))), _("_Viewport Frame"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_viewport_frame)) << set_accelerator_path("/actions/render/render_viewport_frame", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(load_icon("render_animation", Gtk::ICON_SIZE_MENU))), _("Viewport A_nimation"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_viewport_animation)) << set_accelerator_path("/actions/render/render_viewport_animation", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set Preview Engine ...")) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_set_viewport_preview_engine)) << set_accelerator_path("/actions/render/set_preview_engine", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set Still Engine ...")) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_set_viewport_still_engine)) << set_accelerator_path("/actions/render/set_still_engine", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Set Animation Engine ...")) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_render_set_viewport_animation_engine)) << set_accelerator_path("/actions/render/set_animation_engine", get_accel_group()))); return menu; } Gtk::Menu* create_scripting_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Play ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_scripting_play)) << set_accelerator_path("/actions/scripting/play_script", get_accel_group()))); if(k3d::plugin::factory::lookup("NGUITextEditorDialog")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Editor ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_scripting_script_editor)) << set_accelerator_path("/actions/scripting/script_editor", get_accel_group()))); } if(k3d::plugin::factory::lookup("NGUIPythonShellDialog")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Python _Shell ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_scripting_python_shell)) << set_accelerator_path("/actions/scripting/python_shell", get_accel_group()))); } menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); // Create menu items for (optional) scripted actions ... Gtk::Menu* actions_menu = 0; const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); for(k3d::plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { k3d::iplugin_factory::metadata_t metadata = (**factory).metadata(); if(!metadata.count("ngui:action")) continue; if(!actions_menu) { actions_menu = new Gtk::Menu(); actions_menu->set_accel_group(get_accel_group()); menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Actions"), *manage(actions_menu))); } actions_menu->items().push_back(*Gtk::manage( create_menu_item(**factory) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_scripting_action), *factory)) << set_accelerator_path("/actions/scripting/action/" + (**factory).name(), get_accel_group()))); } return menu; } Gtk::Menu* create_advanced_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); const k3d::plugin::factory::collection_t dialogs = k3d::plugin::factory::lookup("ngui:component-type", "dialog"); if(!dialogs.empty()) { std::vector sorted_dialogs(dialogs.begin(), dialogs.end()); std::sort(sorted_dialogs.begin(), sorted_dialogs.end(), k3d::sort_by_name()); Gtk::Menu* const dialogs_menu = new Gtk::Menu(); menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Dialogs"), *manage(dialogs_menu))); for(std::vector::iterator dialog = sorted_dialogs.begin(); dialog != sorted_dialogs.end(); ++dialog) { dialogs_menu->items().push_back(*Gtk::manage( create_menu_item(**dialog) << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &main_document_window::on_advanced_create_dialog), *dialog)) << set_accelerator_path("/actions/advanced/create_dialog/" + (**dialog).name(), get_accel_group()))); } } return menu; } Gtk::Menu* create_help_menu() { Gtk::Menu* const menu = new Gtk::Menu(); menu->set_accel_group(get_accel_group()); if(k3d::plugin::factory::lookup("NGUILearningDialog")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Example documents ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_help_learning_menu)) << set_accelerator_path("/actions/help/learning_menu", get_accel_group()))); } menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("File _Bug Report ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_help_file_bug_report)) << set_accelerator_path("/actions/help/file_bug_report", get_accel_group()))); if(k3d::plugin::factory::lookup("NGUILogDialog")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("Open _Log Window ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_help_open_log_window)) << set_accelerator_path("/actions/help/open_log_window", get_accel_group()))); } menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); menu->items().push_back(*Gtk::manage( new Gtk::ImageMenuItem( *Gtk::manage(new Gtk::Image(Gtk::Stock::HELP, Gtk::ICON_SIZE_MENU)), _("_K-3D Guide"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_help_guide)) << set_accelerator_path("/actions/help/guide", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_Release Notes"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_help_release_notes)) << set_accelerator_path("/actions/help/release_notes", get_accel_group()))); menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("K-3D _Online"), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_help_online)) << set_accelerator_path("/actions/help/online", get_accel_group()))); menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); if(k3d::plugin::factory::lookup("NGUIAboutDialog")) { menu->items().push_back(*Gtk::manage( new Gtk::MenuItem(_("_About K-3D ..."), true) << connect_menu_item(sigc::mem_fun(*this, &main_document_window::on_help_about)) << set_accelerator_path("/actions/help/about", get_accel_group()))); } return menu; } bool on_delete_event(GdkEventAny*) { on_file_close(); return true; } void on_assign_hotkeys() { // Note: the plugin will only open one dialog at-a-time, so it isn't an error if we don't get one back ... if(Gtk::Window* const window = k3d::plugin::create("NGUIAssignHotkeysDialog")) window->set_transient_for(*this); } void on_file_new() { create_document(); } void on_file_open() { k3d::filesystem::path document_path; { file_chooser_dialog dialog(_("Open K-3D Document:"), k3d::options::path::documents(), Gtk::FILE_CHOOSER_ACTION_OPEN); dialog.add_pattern_filter(_("K-3D Document (*.k3d)"), "*.k3d"); dialog.add_all_files_filter(); if(!dialog.get_file_path(document_path)) return; } open_document(document_path); } void on_file_merge_nodes() { merge_nodes::merge_nodes(document()); } bool on_file_save() { const k3d::filesystem::path document_path = boost::any_cast(document().path().property_internal_value()); if(document_path.empty()) return on_file_save_as(); boost::scoped_ptr exporter(k3d::plugin::create(k3d::classes::DocumentExporter())); return_val_if_fail(exporter, false); if(!exporter->write_file(document(), document_path)) { error_message(_("File could not be saved")); return false; } return true; } bool on_file_save_as() { k3d::filesystem::path document_path; { file_chooser_dialog dialog(_("Save K-3D Document As:"), k3d::options::path::documents(), Gtk::FILE_CHOOSER_ACTION_SAVE); dialog.add_pattern_filter(_("K-3D Document (*.k3d)"), "*.k3d"); dialog.add_all_files_filter(); dialog.append_extension(".k3d"); if(!dialog.get_file_path(document_path)) return false; } boost::scoped_ptr exporter(k3d::plugin::create(k3d::classes::DocumentExporter())); return_val_if_fail(exporter.get(), false); if(!exporter->write_file(document(), document_path)) { error_message(_("File could not be saved")); return false; } // Record the new path & title ... //k3d::property::set_internal_value(document().path(), document_path); //k3d::property::set_internal_value(document().title(), document_path.leaf()); return true; } class import_export_columns : public Gtk::TreeModelColumnRecord { public: import_export_columns() { add(factory); add(label); add(icon); } Gtk::TreeModelColumn factory; Gtk::TreeModelColumn label; Gtk::TreeModelColumn > icon; }; void file_revert() { boost::scoped_ptr importer(k3d::plugin::create(k3d::classes::DocumentImporter())); if(!importer) { error_message(_("Document reader plugin not installed.")); return; } const k3d::filesystem::path document_path = boost::any_cast(document().path().property_internal_value()); k3d::idocument* const reverted_document = k3d::application().create_document(); return_if_fail(reverted_document); if(!importer->read_file(document_path, *reverted_document)) { error_message(_("Error reading document. The document could not be reverted.")); return; } document_state* const state = new document_state(*reverted_document); create_main_document_window(*state); k3d::property::set_internal_value(reverted_document->path(), document_path); k3d::property::set_internal_value(reverted_document->title(), document_path.leaf()); k3d::application().close_document(document()); } void on_file_revert() { const k3d::ustring document_title = boost::any_cast(document().title().property_internal_value()); std::vector buttons; buttons.push_back(_("Revert")); buttons.push_back(_("Cancel")); std::string message = k3d::string_cast(boost::format(_("Revert %1% to last-saved version? Unsaved changes will be lost (No Undo)")) % document_title.raw()); const int choice = query_message(message, 1, buttons); switch(choice) { case 0: return; case 1: file_revert(); return; case 2: return; } } void on_file_import() { // Make sure we have some file formats to choose from ... const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); if(factories.empty()) { error_message(_("No import file filters available")); return; } import_export_columns columns; Glib::RefPtr model = Gtk::ListStore::create(columns); Gtk::TreeRow row = *model->append(); row[columns.factory] = 0; row[columns.label] = _("Automatic file detection"); for(k3d::plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { Gtk::TreeRow row = *model->append(); row[columns.factory] = *factory; row[columns.icon] = quiet_load_icon((*factory)->name(), Gtk::ICON_SIZE_MENU); row[columns.label] = (*factory)->short_description(); } // Prompt the user for a file to import ... k3d::filesystem::path filepath; boost::scoped_ptr importer; { file_chooser_dialog dialog(_("Import Document:"), k3d::options::path::documents(), Gtk::FILE_CHOOSER_ACTION_OPEN); Gtk::HBox import_box(false, 5); Gtk::Label import_label(_("Choose import plugin:")); Gtk::ComboBox import_combo(Glib::RefPtr::cast_dynamic(model)); import_combo.pack_start(columns.icon, false); import_combo.pack_start(columns.label); import_combo.set_active(0); import_box.pack_start(import_label, Gtk::PACK_SHRINK); import_box.pack_start(import_combo, Gtk::PACK_EXPAND_WIDGET); import_box.show_all(); dialog.add_extra_widget(import_box); if(!dialog.get_file_path(filepath)) return; return_if_fail(import_combo.get_active() != model->children().end()); if(k3d::iplugin_factory* factory = import_combo.get_active()->get_value(columns.factory)) { importer.reset(k3d::plugin::create(*factory)); } else { const k3d::mime::type mime_type = k3d::mime::type::lookup(filepath); if(mime_type.empty()) { error_message( _("Could not detect filetype automatically.\n" "Try choosing a specific filter that matches the file to be imported")); return; } const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(mime_type); if(factories.size() != 1) { error_message(k3d::string_cast(boost::format(_("No plugin installed that can import documents of type %1%.")) % mime_type)); return; } importer.reset(k3d::plugin::create(**factories.begin())); } if(!importer) { error_message(_("Error creating a plugin to load the document.")); } } // Make this an undoable operation ... k3d::record_state_change_set change_set(document(), k3d::string_cast(boost::format(_("Import %1%")) % filepath.native_utf8_string().raw()), K3D_CHANGE_SET_CONTEXT); if(!importer->read_file(filepath, document())) { error_message( "Error importing file. If you chose \"Automatic\" as the filter type,\n" "try choosing a specific filter that matches the filetype you're importing."); return; } k3d::gl::redraw_all(document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_file_export() { // Make sure we have some file formats to choose from ... const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); if(factories.empty()) { error_message(_("No export file filters available")); return; } import_export_columns columns; Glib::RefPtr model = Gtk::ListStore::create(columns); for(k3d::plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { Gtk::TreeRow row = *model->append(); row[columns.factory] = *factory; row[columns.icon] = quiet_load_icon((*factory)->name(), Gtk::ICON_SIZE_MENU); row[columns.label] = (*factory)->short_description(); } // Prompt the user for a file to export ... k3d::filesystem::path filepath; boost::scoped_ptr exporter; { file_chooser_dialog dialog(_("Export Document:"), k3d::options::path::documents(), Gtk::FILE_CHOOSER_ACTION_SAVE); Gtk::HBox export_box(false, 5); Gtk::Label export_label(_("Choose export plugin:")); Gtk::ComboBox export_combo(Glib::RefPtr::cast_dynamic(model)); export_combo.pack_start(columns.icon, false); export_combo.pack_start(columns.label); export_combo.set_active(0); export_box.pack_start(export_label, Gtk::PACK_SHRINK); export_box.pack_start(export_combo, Gtk::PACK_EXPAND_WIDGET); export_box.show_all(); dialog.add_extra_widget(export_box); if(!dialog.get_file_path(filepath)) return; return_if_fail(export_combo.get_active() != model->children().end()); if(k3d::iplugin_factory* factory = export_combo.get_active()->get_value(columns.factory)) { exporter.reset(k3d::plugin::create(*factory)); } return_if_fail(exporter.get()); } if(!exporter->write_file(document(), filepath)) error_message(_("Error exporting document")); } void on_file_close() { if(m_count == 1) { application_state::instance().safe_close(*this); } else { m_document_state.safe_close(*this); } } void on_file_quit() { application_state::instance().safe_close(*this); } void on_edit_undo(const bool All) { const k3d::istate_recorder::node* const current_node = document().state_recorder().current_node(); return_if_fail(current_node); current_node->change_set->undo(); document().state_recorder().set_current_node(current_node->parent); const std::string top_node_name = current_node->label; while(All) { const k3d::istate_recorder::node* const previous_node = document().state_recorder().current_node(); if(!previous_node) break; if(top_node_name != previous_node->label) break; previous_node->change_set->undo(); document().state_recorder().set_current_node(previous_node->parent); } k3d::gl::redraw_all(document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_edit_redo(const bool All) { const k3d::istate_recorder::node* const redo_node = next_redo(document().state_recorder()); return_if_fail(redo_node); redo_node->change_set->redo(); document().state_recorder().set_current_node(redo_node); const std::string initial_node_name = redo_node->label; while(All) { const k3d::istate_recorder::node* const next_node = next_redo(document().state_recorder()); if(!next_node) break; if(initial_node_name != next_node->label) break; next_node->change_set->redo(); document().state_recorder().set_current_node(next_node); } k3d::gl::redraw_all(document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_selection_tool() { m_document_state.set_active_tool(m_document_state.selection_tool()); } void on_move_tool() { m_document_state.set_active_tool(m_document_state.move_tool()); } void on_rotate_tool() { m_document_state.set_active_tool(m_document_state.rotate_tool()); } void on_scale_tool() { m_document_state.set_active_tool(m_document_state.scale_tool()); } void on_parent_tool() { tool* const parent_tool = m_document_state.get_tool("NGUIParentTool"); return_if_fail(parent_tool); m_document_state.set_active_tool(*parent_tool); } void on_snap_tool() { tool* const snap_tool = m_document_state.get_tool("NGUISnapTool"); return_if_fail(snap_tool); m_document_state.set_active_tool(*snap_tool); } void on_instantiate() { pipeline::instantiate_selected_nodes(m_document_state.document()); } void on_duplicate() { pipeline::duplicate_selected_nodes(m_document_state.document()); } void on_delete() { k3d::record_state_change_set changeset(m_document_state.document(), _("Delete nodes"), K3D_CHANGE_SET_CONTEXT); k3d::nodes_t nodes = selection::state(m_document_state.document()).selected_nodes(); k3d::delete_nodes(m_document_state.document(), nodes); k3d::gl::redraw_all(m_document_state.document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_render_region_tool() { tool* const render_region_tool = m_document_state.get_tool("NGUIRenderRegionTool"); return_if_fail(render_region_tool); m_document_state.set_active_tool(*render_region_tool); } void on_select_all() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select All"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).select_all(); } void on_select_none() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select None"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect_all(); } void on_select_invert() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select Invert"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).invert_selection(); } void on_select_parent() { // Keep track of the set of parent nodes to be selected std::set parents; const k3d::inode_collection::nodes_t& nodes = m_document_state.document().nodes().collection(); for(k3d::inode_collection::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { // Skip unselected nodes if(!selection::state(m_document_state.document()).is_selected(**node)) continue; // Skip non-parentable nodes if(k3d::iparentable* const parentable = dynamic_cast(*node)) parents.insert(boost::any_cast(parentable->parent().property_internal_value())); } // Don't let NULL creep in ... parents.erase(static_cast(0)); if(parents.empty()) return; k3d::record_state_change_set change_set(m_document_state.document(), _("Select parent"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect_all(); std::for_each(parents.begin(), parents.end(), detail::select(m_document_state.document())); } void on_select_child() { std::set children; const k3d::inode_collection::nodes_t& nodes = m_document_state.document().nodes().collection(); for(k3d::inode_collection::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { // Skip non-parentable nodes k3d::iparentable* const parentable = dynamic_cast(*node); if(!parentable) continue; // Get parent k3d::inode* const parent = boost::any_cast(parentable->parent().property_internal_value()); if(!parent) continue; if(selection::state(m_document_state.document()).is_selected(*parent)) children.insert(*node); } if(children.empty()) return; k3d::record_state_change_set change_set(m_document_state.document(), _("Select child"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect_all(); std::for_each(children.begin(), children.end(), detail::select(m_document_state.document())); } void on_select_sibling() { std::set parents; const k3d::inode_collection::nodes_t& nodes = m_document_state.document().nodes().collection(); for(k3d::inode_collection::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { // Skip unselected nodes if(!selection::state(m_document_state.document()).is_selected(**node)) continue; // Skip non-parentable nodes k3d::iparentable* const parentable = dynamic_cast(*node); if(!parentable) continue; // Get parent k3d::inode* const parent = boost::any_cast(parentable->parent().property_internal_value()); if(!parent) continue; parents.insert(parent); } std::set siblings; for(k3d::inode_collection::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { // Skip selected nodes if(selection::state(m_document_state.document()).is_selected(**node)) continue; // Skip non-parentable nodes k3d::iparentable* const parentable = dynamic_cast(*node); if(!parentable) continue; // Get parent k3d::inode* const parent = boost::any_cast(parentable->parent().property_internal_value()); if(!parent) continue; if(parents.count(parent)) siblings.insert(*node); } if(siblings.empty()) return; k3d::record_state_change_set change_set(m_document_state.document(), _("Select sibling"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect_all(); std::for_each(siblings.begin(), siblings.end(), detail::select(m_document_state.document())); } void on_select_curves() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select Curves"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).set_current_mode(selection::CURVE); } void on_select_patches() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select Patches"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).set_current_mode(selection::PATCH); } void on_select_faces() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select Polygon Faces"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).set_current_mode(selection::FACE); } void on_select_nodes() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select Nodes"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).set_current_mode(selection::NODE); } void on_select_vertices() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select Points"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).set_current_mode(selection::POINT); } void on_select_split_edges() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select Polygon Edges"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).set_current_mode(selection::EDGE); } void on_select_uniform() { k3d::record_state_change_set change_set(m_document_state.document(), _("Select Surface"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).set_current_mode(selection::SURFACE); } void on_layout_maximize_panel() { return_if_fail(m_focus_panel); if(m_maximize_panel.internal_value()) { const panel_frame::controls panel_frames = detail::get_panel_frames(m_panel_frame); for(panel_frame::controls::const_iterator panel_frame = panel_frames.begin(); panel_frame != panel_frames.end(); ++panel_frame) if(*panel_frame != m_focus_panel) (*panel_frame)->hide(); // Hide panes containing hidden panels (or panes) only return_if_fail(m_panel_frame.get_children().size() == 1); Gtk::Widget* frame_child = *m_panel_frame.get_children().begin(); hide_panes(frame_child); // Update menu entry //->set_label("Show All Panels"); } else { show_all_panels(); if(m_hide_unpinned_panels.internal_value()) hide_unpinned_panels(); // Update menu entry //->set_label("Hide Unpinned Panels"); } update_panel_controls(0); } void on_layout_hide_show_unpinned() { if(m_hide_unpinned_panels.internal_value()) { hide_unpinned_panels(); // Update menu entry //->set_label("Show All Panels"); } else { show_all_panels(); // Update menu entry //->set_label("Hide Unpinned Panels"); } update_panel_controls(0); } void hide_unpinned_panels() { const panel_frame::controls panel_frames = detail::get_panel_frames(m_panel_frame); for(panel_frame::controls::const_iterator panel_frame = panel_frames.begin(); panel_frame != panel_frames.end(); ++panel_frame) if(!(*panel_frame)->pinned.internal_value()) (*panel_frame)->hide(); // Hide panes containing hidden panels (or panes) only return_if_fail(m_panel_frame.get_children().size() == 1); Gtk::Widget* frame_child = *m_panel_frame.get_children().begin(); hide_panes(frame_child); } /// Recursively hides panes containing only hidden panels (or panes) bool hide_panes(Gtk::Widget* Widget) { Gtk::Paned* gtk_paned = dynamic_cast(Widget); if(gtk_paned) { if(!hide_panes(gtk_paned->get_child1()) && !hide_panes(gtk_paned->get_child2())) { // Pane contains only hidden children: hide it gtk_paned->hide(); return false; } return true; } panel_frame::control* k3d_panel = dynamic_cast(Widget); if(k3d_panel) return k3d_panel->is_visible(); assert_not_reached(); return false; } void show_all_panels() { return_if_fail(m_panel_frame.get_children().size() == 1); Gtk::Widget* frame_child = *m_panel_frame.get_children().begin(); show_all_panels(frame_child); } /// Recursively shows all panels and panes void show_all_panels(Gtk::Widget* Widget) { return_if_fail(Widget); Gtk::Paned* gtk_paned = dynamic_cast(Widget); if(gtk_paned) { show_all_panels(gtk_paned->get_child1()); show_all_panels(gtk_paned->get_child2()); } Widget->show(); } void on_layout_pin_all() { const panel_frame::controls panel_frames = detail::get_panel_frames(m_panel_frame); for(panel_frame::controls::const_iterator panel_frame = panel_frames.begin(); panel_frame != panel_frames.end(); ++panel_frame) (*panel_frame)->pinned.set_value(true); } void on_layout_unpin_all() { const panel_frame::controls panel_frames = detail::get_panel_frames(m_panel_frame); for(panel_frame::controls::const_iterator panel_frame = panel_frames.begin(); panel_frame != panel_frames.end(); ++panel_frame) (*panel_frame)->pinned.set_value(false); } void on_layout_decorate_panel() { if(!m_focus_panel) return; m_focus_panel->decorations.set_value(true); m_layout_decorate_panel->set_sensitive(false); m_layout_undecorate_panel->set_sensitive(true); } void on_layout_undecorate_panel() { if(!m_focus_panel) return; m_focus_panel->decorations.set_value(false); m_layout_decorate_panel->set_sensitive(true); m_layout_undecorate_panel->set_sensitive(false); } /// Moves Panel inside NewPaned, creates, inserts and returns new panel_frame::control panel_frame::control* split_panel(panel_frame::control& Panel, Gtk::Paned& NewPaned, const int NewPosition, Gtk::AttachOptions AttachOptions = Gtk::EXPAND) { if(Panel.get_parent() == &m_panel_frame) { NewPaned.get_accessible()->set_name(Panel.get_parent()->get_accessible()->get_name()); // Move Panel inside NewPaned Panel.reparent(NewPaned); // Replace Panel with NewPaned m_panel_frame.add(NewPaned); } else { // Make sure parent is a Gtk::Paned widget Gtk::Paned* const parent_paned = dynamic_cast(Panel.get_parent()); return_val_if_fail(parent_paned, 0); const k3d::bool_t horizontal = dynamic_cast(parent_paned) ? true : false; // Move Panel inside NewPaned, and put NewPaned instead if(parent_paned->get_child1() == &Panel) { // Panel is parent_paned's child 1 Panel.reparent(NewPaned); parent_paned->pack1(NewPaned, Gtk::EXPAND); if(horizontal) NewPaned.get_accessible()->set_name("left"); else NewPaned.get_accessible()->set_name("top"); } else { // Panel is parent_paned's child 2 Panel.reparent(NewPaned); parent_paned->pack2(NewPaned, Gtk::EXPAND); if(horizontal) NewPaned.get_accessible()->set_name("right"); else NewPaned.get_accessible()->set_name("bottom"); } } // Create new panel and insert it as child 2 (Panel is child 1) panel_frame::control* const new_panel_frame = create_panel_frame(); NewPaned.pack2(*manage(new_panel_frame), AttachOptions); NewPaned.set_position(NewPosition); NewPaned.show(); update_panel_controls(0); return new_panel_frame; } void on_layout_split_horizontal() { return_if_fail(m_focus_panel && m_focus_panel->mounted_panel()); const std::string panel_type = m_focus_panel->mounted_panel()->panel_type(); panel_frame::control* new_panel = split_panel(*m_focus_panel, *manage(new Gtk::VPaned), m_focus_panel->get_height() / 2); new_panel->mount_panel(panel_type, true); set_focus_viewport_panel(new_panel); } void on_layout_split_vertical() { return_if_fail(m_focus_panel && m_focus_panel->mounted_panel()); const std::string panel_type = m_focus_panel->mounted_panel()->panel_type(); panel_frame::control* new_panel = split_panel(*m_focus_panel, *manage(new Gtk::HPaned), m_focus_panel->get_width() / 2); new_panel->mount_panel(panel_type, true); set_focus_viewport_panel(new_panel); } void on_layout_kill_panel() { return_if_fail(m_focus_panel); if(m_focus_viewport_panel == m_focus_panel) unset_focus_viewport_panel(); Gtk::Paned* const old_paned = dynamic_cast(m_focus_panel->get_parent()); return_if_fail(old_paned); Gtk::Container* const old_paned_parent = dynamic_cast(old_paned->get_parent()); return_if_fail(old_paned_parent); Gtk::Frame temp_storage; old_paned->reparent(temp_storage); if(old_paned->get_child1() == m_focus_panel) { old_paned->get_child2()->reparent(*old_paned_parent); } else { old_paned->get_child1()->reparent(*old_paned_parent); } delete m_focus_panel; delete old_paned; update_panel_controls(0); } void on_layout_save() { save_ui_layout(); message(_("Window layout saved. Your custom layout will be used whenever you open a document.")); } void on_layout_reset() { k3d::filesystem::remove(detail::ui_layout_path()); message(_("Window layout reset. The default layout will be used the next time you open a document.")); } void on_view_hide_selection() { k3d::record_state_change_set change_set(m_document_state.document(), _("Hide selection"), K3D_CHANGE_SET_CONTEXT); const k3d::nodes_t selected_nodes = selection::state(m_document_state.document()).selected_nodes(); for(k3d::nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) node::hide(**node); k3d::gl::redraw_all(document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_view_show_selection() { k3d::record_state_change_set change_set(m_document_state.document(), _("Show selection"), K3D_CHANGE_SET_CONTEXT); const k3d::nodes_t selected_nodes = selection::state(m_document_state.document()).selected_nodes(); for(k3d::nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) node::show(**node); k3d::gl::redraw_all(document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_view_hide_unselected() { k3d::record_state_change_set change_set(m_document_state.document(), _("Hide unselected"), K3D_CHANGE_SET_CONTEXT); const k3d::nodes_t& nodes = m_document_state.document().nodes().collection(); for(k3d::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { if(!selection::state(m_document_state.document()).is_selected(**node)) node::hide(**node); } k3d::gl::redraw_all(document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_view_show_all() { k3d::record_state_change_set change_set(m_document_state.document(), _("Show all"), K3D_CHANGE_SET_CONTEXT); const k3d::nodes_t& nodes = m_document_state.document().nodes().collection(); for(k3d::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) node::show(**node); k3d::gl::redraw_all(document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_view_aim_selection() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::record_state_change_set change_set(m_document_state.document(), _("Aim selection"), K3D_CHANGE_SET_CONTEXT); aim_selection(m_document_state, *viewport_control); } void on_view_frame_selection() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::record_state_change_set change_set(m_document_state.document(), _("Frame selection"), K3D_CHANGE_SET_CONTEXT); frame_selection(m_document_state, *viewport_control); } void on_view_set_camera() { viewport::control* const viewport = m_document_state.get_focus_viewport(); return_if_fail(viewport); k3d::icamera* const camera = pick_camera(m_document_state, viewport->camera()); if(!camera) return; viewport->set_camera(camera); } void on_view_toggle_projection() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::icamera* camera = viewport_control->camera(); assert_warning(k3d::property::set_internal_value(*camera, "orthographic", !boost::any_cast(k3d::property::pipeline_value(*camera, "orthographic")))); } void on_view_set_view(const k3d::signed_axis Axis) { // Get camera/target distance viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::icamera* camera = viewport_control->camera(); const k3d::matrix4 transform_matrix = boost::any_cast(k3d::property::pipeline_value(camera->transformation().matrix_source_output())); const k3d::point3 world_position = transform_matrix * k3d::point3(0, 0, 0); const k3d::point3 world_target = boost::any_cast(camera->world_target().property_internal_value()); const double distance = k3d::distance(world_position, world_target); k3d::point3 position; k3d::vector3 look_vector; k3d::vector3 up_vector; k3d::vector3 right_vector; switch(Axis) { case k3d::PX: position = k3d::point3(distance, 0, 0); look_vector = k3d::vector3(-1, 0, 0); up_vector = k3d::vector3(0, 0, 1); right_vector = k3d::vector3(0, -1, 0); break; case k3d::NX: position = k3d::point3(-distance, 0, 0); look_vector = k3d::vector3(1, 0, 0); up_vector = k3d::vector3(0, 0, 1); right_vector = k3d::vector3(0, 1, 0); break; case k3d::PY: position = k3d::point3(0, distance, 0); look_vector = k3d::vector3(0, -1, 0); up_vector = k3d::vector3(0, 0, 1); right_vector = k3d::vector3(1, 0, 0); break; case k3d::NY: position = k3d::point3(0, -distance, 0); look_vector = k3d::vector3(0, 1, 0); up_vector = k3d::vector3(0, 0, 1); right_vector = k3d::vector3(-1, 0, 0); break; case k3d::PZ: position = k3d::point3(0, 0, distance); look_vector = k3d::vector3(0, 0, -1); up_vector = k3d::vector3(0, -1, 0); right_vector = k3d::vector3(1, 0, 0); break; case k3d::NZ: position = k3d::point3(0, 0, -distance); look_vector = k3d::vector3(0, 0, 1); up_vector = k3d::vector3(0, 1, 0); right_vector = k3d::vector3(1, 0, 0); break; } const k3d::matrix4 view_matrix = k3d::view_matrix(look_vector, up_vector, world_target + position); viewport_control->set_view_matrix(view_matrix); } void on_create_node(k3d::iplugin_factory* const Factory) { if(cancel_plugin(*Factory)) return; pipeline::create_node(m_document_state.document(), *Factory); } void on_modify_meshes(k3d::iplugin_factory* Modifier) { if(cancel_plugin(*Modifier)) return; modify_selected_meshes(m_document_state, Modifier); k3d::gl::redraw_all(m_document_state.document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_modify_transformations(k3d::iplugin_factory* Modifier) { if(cancel_plugin(*Modifier)) return; k3d::nodes_t selected_nodes = selection::state(m_document_state.document()).selected_nodes(); k3d::inode* new_modifier; for(k3d::nodes_t::iterator selected_node = selected_nodes.begin(); selected_node != selected_nodes.end(); ++selected_node) { new_modifier = modify_transformation(m_document_state.document(), **selected_node, Modifier); assert_warning(new_modifier); } // Show the new modifier properties if only one was processed if(selected_nodes.size() == 1) panel::mediator(m_document_state.document()).set_focus(*new_modifier); k3d::gl::redraw_all(m_document_state.document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_scripting_play() { k3d::filesystem::path filepath; // Close file chooser dialog before executing script { file_chooser_dialog dialog(_("Play Script:"), k3d::options::path::scripts(), Gtk::FILE_CHOOSER_ACTION_OPEN); if(!dialog.get_file_path(filepath)) return; } k3d::filesystem::igzstream file(filepath); k3d::iscript_engine::context context; context["document"] = &document(); execute_script(file, filepath.native_utf8_string().raw(), context); } void on_scripting_script_editor() { if(Gtk::Window* const window = k3d::plugin::create("NGUITextEditorDialog")) { if(k3d::idocument_sink* const document_sink = dynamic_cast(window)) document_sink->set_document(&document()); window->set_transient_for(*this); } } void on_scripting_python_shell() { if(Gtk::Window* const window = k3d::plugin::create("NGUIPythonShellDialog")) { if(k3d::idocument_sink* const document_sink = dynamic_cast(window)) document_sink->set_document(&document()); window->set_transient_for(*this); } } void on_scripting_action(k3d::iplugin_factory* Factory) { boost::scoped_ptr plugin(k3d::plugin::create(*Factory)); if(!plugin) { k3d::log() << error << "Error creating plugin [" << (*Factory).name() << "]" << std::endl; return; } if(k3d::iscripted_action* const scripted_action = dynamic_cast(plugin.get())) { k3d::iscript_engine::context context; context["command"] = k3d::string_t("action"); context["document"] = &document(); scripted_action->execute(context); } } void on_window_fullscreen(k3d::iunknown*) { if(m_fullscreen.internal_value()) fullscreen(); else unfullscreen(); } void on_advanced_create_dialog(k3d::iplugin_factory* Factory) { Gtk::Window* const window = k3d::plugin::create(*Factory); return_if_fail(window); window->set_transient_for(*this); } void on_help_learning_menu() { Gtk::Window* const window = k3d::plugin::create("NGUILearningDialog"); return_if_fail(window); window->set_transient_for(*this); } void on_help_file_bug_report() { k3d::ngui::uri::open("http://www.k-3d.org/wiki/Reporting_Bugs"); } void on_help_open_log_window() { Gtk::Window* const window = k3d::plugin::create("NGUILogDialog"); return_if_fail(window); window->set_transient_for(*this); } void on_help_guide() { k3d::ngui::uri::open("file://" + (k3d::share_path() / k3d::filesystem::generic_path("/guide/html/index.html")).native_filesystem_string()); } void on_help_online() { k3d::ngui::uri::open("http://www.k-3d.org"); } void on_help_release_notes() { k3d::ngui::uri::open("http://www.k-3d.org/wiki/K-3D_" K3D_VERSION "_Release_Notes"); } void on_help_about() { Gtk::Window* const window = k3d::plugin::create("NGUIAboutDialog"); return_if_fail(window); window->set_transient_for(*this); } /// Unparents all selected nodes void on_unparent() { const k3d::nodes_t nodes = selection::state(m_document_state.document()).selected_nodes(); if(nodes.empty()) return; k3d::record_state_change_set change_set(m_document_state.document(), _("Unparent selected"), K3D_CHANGE_SET_CONTEXT); for(k3d::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) k3d::ngui::unparent(**node); selection::state(m_document_state.document()).deselect_all(); k3d::gl::redraw_all(m_document_state.document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void on_render_preview() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::icamera* camera = viewport_control->camera(); return_if_fail(camera); k3d::irender_camera_preview* render_engine = viewport_control->camera_preview_engine(); if(!render_engine) render_engine = pick_camera_preview_render_engine(m_document_state); if(!render_engine) return; viewport_control->set_camera(camera); viewport_control->set_camera_preview_engine(render_engine); render(*camera, *render_engine); } void on_render_frame() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::icamera* const camera = viewport_control->camera(); return_if_fail(camera); k3d::irender_camera_frame* render_engine = viewport_control->camera_still_engine(); if(!render_engine) render_engine = pick_camera_still_render_engine(m_document_state); if(!render_engine) return; viewport_control->set_camera(camera); viewport_control->set_camera_still_engine(render_engine); render(*camera, *render_engine); } void on_render_animation() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::icamera* const camera = viewport_control->camera(); return_if_fail(camera); k3d::irender_camera_animation* render_engine = viewport_control->camera_animation_engine(); if(!render_engine) render_engine = pick_camera_animation_render_engine(m_document_state); if(!render_engine) return; viewport_control->set_camera(camera); viewport_control->set_camera_animation_engine(render_engine); render(m_document_state, *camera, *render_engine); } void on_render_viewport_frame() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::irender_camera_frame* render_engine = dynamic_cast(viewport_control); return_if_fail(render_engine); k3d::icamera* camera = viewport_control->camera(); if(!camera) camera = pick_camera(m_document_state); if(!camera) return; viewport_control->set_camera(camera); render(*camera, *render_engine); } void on_render_viewport_animation() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::irender_camera_animation* render_engine = dynamic_cast(viewport_control); return_if_fail(render_engine); k3d::icamera* camera = viewport_control->camera(); if(!camera) camera = pick_camera(m_document_state); if(!camera) return; viewport_control->set_camera(camera); render(m_document_state, *camera, *render_engine); } void on_render_set_viewport_preview_engine() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::irender_camera_preview* const engine = pick_camera_preview_render_engine(m_document_state); if(!engine) return; viewport_control->set_camera_preview_engine(engine); } void on_render_set_viewport_still_engine() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::irender_camera_frame* const engine = pick_camera_still_render_engine(m_document_state); if(!engine) return; viewport_control->set_camera_still_engine(engine); } void on_render_set_viewport_animation_engine() { viewport::control* const viewport_control = m_document_state.get_focus_viewport(); return_if_fail(viewport_control); k3d::irender_camera_animation* const engine = pick_camera_animation_render_engine(m_document_state); if(!engine) return; viewport_control->set_camera_animation_engine(engine); } void on_document_title_changed(k3d::iunknown*) { k3d::ustring doctitle = boost::any_cast(document().title().property_internal_value()); set_title(doctitle.raw() + " - K-3D"); get_accessible()->set_name(doctitle.raw()); } void on_panel_focus_changed(panel_frame::control* Panel) { if(m_focus_panel == Panel) return; m_focus_panel = Panel; if(Panel) { set_focus_viewport_panel(Panel); const bool decorated = Panel->decorations.internal_value(); m_layout_decorate_panel->set_sensitive(!decorated); m_layout_undecorate_panel->set_sensitive(decorated); } update_panel_controls(0); } void update_panel_controls(k3d::iunknown*) { unsigned long panel_count = 0; unsigned long pinned_count = 0; unsigned long visible_count = 0; const panel_frame::controls panel_frames = detail::get_panel_frames(m_panel_frame); for(panel_frame::controls::const_iterator panel_frame = panel_frames.begin(); panel_frame != panel_frames.end(); ++panel_frame) { // Ensure that the focus viewport defaults to any available viewport ... if(!m_focus_viewport_panel) set_focus_viewport_panel(*panel_frame); ++panel_count; if((*panel_frame)->pinned.internal_value()) ++pinned_count; if((*panel_frame)->is_visible()) ++visible_count; } m_layout_pin_all->set_sensitive(panel_count != pinned_count); m_layout_unpin_all->set_sensitive(pinned_count); m_layout_split_horizontal->set_sensitive(m_focus_panel); m_layout_split_vertical->set_sensitive(m_focus_panel); m_layout_kill_panel->set_sensitive((panel_count > 1) && m_focus_panel); } void save_ui_layout() { k3d::xml::element xml_document("ui_layout"); // Save window's parameters xml_document.append(k3d::xml::attribute("fullscreen", m_fullscreen.internal_value())); int width; int height; get_size(width, height); xml_document.append(k3d::xml::attribute("window_width", width)); xml_document.append(k3d::xml::attribute("window_height", height)); int root_x; int root_y; get_position(root_x, root_y); xml_document.append(k3d::xml::attribute("position_x", root_x)); xml_document.append(k3d::xml::attribute("position_y", root_y)); return_if_fail(m_panel_frame.get_children().size() == 1); Gtk::Widget* frame_child = *m_panel_frame.get_children().begin(); // Save panel frame k3d::xml::element& xml_panel_frame = xml_document.append(k3d::xml::element("panel_frame")); save_ui_container(frame_child, xml_panel_frame); k3d::filesystem::ofstream stream(detail::ui_layout_path()); stream << xml_document; } bool load_ui_layout() { if(!application_state::instance().custom_layouts()) return false; const k3d::filesystem::path layout_path = detail::ui_layout_path(); if(!k3d::filesystem::exists(layout_path)) return false; k3d::xml::element xml_layout; try { k3d::log() << info << "Loading UI layout from " << layout_path.native_console_string() << std::endl; // Find layout k3d::filesystem::ifstream layout_stream(layout_path); layout_stream >> xml_layout; assert_warning(xml_layout.name == "ui_layout"); } catch(...) { k3d::log() << error << "Error loading UI layout from " << layout_path.native_console_string() << std::endl; return false; } // Set window's values const bool fullscreen = k3d::xml::attribute_value(xml_layout, "fullscreen", false); m_fullscreen.set_value(fullscreen); const int window_width = k3d::xml::attribute_value(xml_layout, "window_width", 0); const int window_height = k3d::xml::attribute_value(xml_layout, "window_height", 0); if(window_width && window_height) set_default_size(window_width, window_height); const int root_x = k3d::xml::attribute_value(xml_layout, "position_x", 0); const int root_y = k3d::xml::attribute_value(xml_layout, "position_y", 0); move(root_x, root_y); // Load panel frame k3d::xml::element* xml_panel = find_element(xml_layout, "panel_frame"); return_val_if_fail(xml_panel, false); return load_ui_container(*xml_panel); } void save_ui_container(Gtk::Widget* Widget, k3d::xml::element& Document) { Gtk::Paned* gtk_paned = dynamic_cast(Widget); if(gtk_paned) { k3d::xml::element& xml_paned = Document.append(k3d::xml::element("paned")); std::string paned_type = ""; if(dynamic_cast(gtk_paned)) paned_type = "hpaned"; else if(dynamic_cast(gtk_paned)) paned_type = "vpaned"; else assert_not_reached(); xml_paned.append(k3d::xml::attribute("type", paned_type)); xml_paned.append(k3d::xml::attribute("position", gtk_paned->get_position())); save_ui_container(gtk_paned->get_child1(), xml_paned); save_ui_container(gtk_paned->get_child2(), xml_paned); return; } panel_frame::control* k3d_panel = dynamic_cast(Widget); if(k3d_panel) { k3d_panel->save(Document); return; } assert_not_reached(); } // Loads UI, returns false iff main panel could load bool load_ui_container(k3d::xml::element& Element) { k3d::xml::element* xml_panel = find_element(Element, "paned"); if(!xml_panel) xml_panel = find_element(Element, "panel"); return_val_if_fail(xml_panel, false); // Load main panel Gtk::Widget* main_panel = load_panel(*xml_panel); if(main_panel) { if(Gtk::Widget* frame_child = m_panel_frame.get_child()) { m_panel_frame.remove(); delete frame_child; } m_panel_frame.set_shadow_type(Gtk::SHADOW_NONE); m_panel_frame.add(*Gtk::manage(main_panel)); update_panel_controls(0); return true; } return false; } Gtk::Widget* load_panel(k3d::xml::element& Paned) { // Load panel ... if("panel" == Paned.name) { panel_frame::control* const new_panel_frame = create_panel_frame(); new_panel_frame->load(Paned); if(new_panel_frame->is_visible()) new_panel_frame->show(); return new_panel_frame; } // ... else load paned return_val_if_fail("paned" == Paned.name, 0); return_val_if_fail(Paned.children.size(), 0); std::string type = attribute_text(Paned, "type"); Gtk::Paned* new_paned = 0; if("hpaned" == type) new_paned = Gtk::manage(new Gtk::HPaned); else if("vpaned" == type) new_paned = Gtk::manage(new Gtk::VPaned); else { assert_not_reached(); k3d::log() << error << "Unknowned Gtk::Paned type : " << type << std::endl; return 0; } new_paned->set_position(k3d::xml::attribute_value(Paned, "position", 0)); // Load paned children k3d::xml::element& child1 = *Paned.children.begin(); new_paned->pack1(*load_panel(child1), Gtk::EXPAND); if(new_paned->get_child1()->is_visible()) new_paned->show(); if(Paned.children.size() > 1) { k3d::xml::element& child2 = *(Paned.children.begin() + 1); new_paned->pack2(*load_panel(child2), Gtk::EXPAND); if(new_paned->get_child2()->is_visible()) new_paned->show(); } return new_paned; } bool on_key_press_event(GdkEventKey* event) { if(event->keyval == GDK_Escape) { return true; } return base::on_key_press_event(event); } bool on_button_press_event(GdkEventButton* event) { return base::on_button_press_event(event); } void update_undo_redo_controls() { k3d::istate_recorder& state_recorder = document().state_recorder(); const k3d::istate_recorder::node* const current_node = state_recorder.current_node(); const k3d::istate_recorder::node* const redo_node = next_redo(state_recorder); // Setup the undo menu item ... if(current_node) { get_label(*m_undo_menu_item)->set_text(k3d::string_cast(boost::format(_("Undo %1%")) % current_node->label)); m_undo_menu_item->set_sensitive(true); } else { get_label(*m_undo_menu_item)->set_text(_("Can't undo")); m_undo_menu_item->set_sensitive(false); } // Setup the undo-all menu item if(current_node && current_node->parent && (current_node->label == current_node->parent->label)) { get_label(*m_undo_all_menu_item)->set_text(k3d::string_cast(boost::format(_("Undo all %1%")) % current_node->label)); m_undo_all_menu_item->set_sensitive(true); } else { get_label(*m_undo_all_menu_item)->set_text(_("Can't undo all")); m_undo_all_menu_item->set_sensitive(false); } // Setup the redo menu items ... if(redo_node) { get_label(*m_redo_menu_item)->set_text(k3d::string_cast(boost::format(_("Redo %1%")) % redo_node->label)); m_redo_menu_item->set_sensitive(true); get_label(*m_redo_all_menu_item)->set_text(k3d::string_cast(boost::format(_("Redo all %1%")) % redo_node->label)); m_redo_all_menu_item->set_sensitive(true); } else { get_label(*m_redo_menu_item)->set_text(_("Can't redo")); m_redo_menu_item->set_sensitive(false); get_label(*m_redo_all_menu_item)->set_text(_("Can't redo all")); m_redo_all_menu_item->set_sensitive(false); } } const bool unsaved_changes() { return document().state_recorder().last_saved_node() != document().state_recorder().current_node(); } const std::string unsaved_document_title() { return boost::any_cast(document().title().property_internal_value()).raw(); } const bool save_unsaved_changes() { return on_file_save(); } // Saves focus viewport and updates document_state void set_focus_viewport_panel(panel_frame::control* Panel) { viewport::control* const viewport_control = dynamic_cast(Panel->mounted_panel()); if(!viewport_control) return; m_focus_viewport_panel = Panel; m_document_state.set_focus_viewport(viewport_control); // Highlight focused viewport const panel_frame::controls panel_frames = detail::get_panel_frames(m_panel_frame); for(panel_frame::controls::const_iterator panel_frame = panel_frames.begin(); panel_frame != panel_frames.end(); ++panel_frame) { if(!dynamic_cast((*panel_frame)->mounted_panel())) continue; if(*panel_frame == Panel) (*panel_frame)->set_bg_color(Gdk::Color("blue")); else (*panel_frame)->unset_bg_color(); } } void unset_focus_viewport_panel() { m_focus_viewport_panel = 0; m_document_state.set_focus_viewport(0); } /// Keeps track of the count of open document windows static unsigned long m_count; /// Stores the Edit > Undo menu item std::unique_ptr m_undo_menu_item; /// Stores the Edit > Undo All menu item std::unique_ptr m_undo_all_menu_item; /// Stores the Edit > Redo menu item std::unique_ptr m_redo_menu_item; /// Stores the Edit > Redo All menu item std::unique_ptr m_redo_all_menu_item; /// Set to true iff current panel was maximized k3d_data(bool, immutable_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) m_maximize_panel; /// Set to true iff unpinned panels are hidden k3d_data(bool, immutable_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) m_hide_unpinned_panels; /// Set to true iff the window is displayed fullscreen k3d_data(bool, immutable_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) m_fullscreen; /// Stores a signal for notifying observers when the panel focus changes panel_frame::control::panel_focus_signal_t m_panel_focus_signal; /// Keeps track of the currently focused panel panel_frame::control* m_focus_panel; /// Keeps track of the last-focused viewport panel panel_frame::control* m_focus_viewport_panel; /// Stores the root container for panels Gtk::Frame m_panel_frame; check_menu_item::control* m_layout_maximize_panel; check_menu_item::control* m_layout_hide_unpinned; Gtk::MenuItem* m_layout_pin_all; Gtk::MenuItem* m_layout_unpin_all; Gtk::MenuItem* m_layout_decorate_panel; Gtk::MenuItem* m_layout_undecorate_panel; Gtk::MenuItem* m_layout_split_horizontal; Gtk::MenuItem* m_layout_split_vertical; Gtk::MenuItem* m_layout_kill_panel; /// Stores document-wide state to be shared with the rest of the UI document_state& m_document_state; }; unsigned long main_document_window::m_count = 0; ///////////////////////////////////////////////////////////////////////////// // create_main_document_window void create_main_document_window(document_state& DocumentState) { new main_document_window(DocumentState); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/main_document_window.h ================================================ #ifndef K3DSDK_NGUI_MAIN_DOCUMENT_WINDOW_H #define K3DSDK_NGUI_MAIN_DOCUMENT_WINDOW_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { namespace ngui { class document_state; /// Create a new main document window, attaching it to the given document void create_main_document_window(document_state& DocumentState); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_MAIN_DOCUMENT_WINDOW_H ================================================ FILE: k3dsdk/ngui/menus.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { const std::string plugin_factory_markup(k3d::iplugin_factory& Factory) { std::string markup; if(k3d::iplugin_factory::EXPERIMENTAL == Factory.quality()) { markup = k3d::string_cast(boost::format(_("%1% (Experimental)")) % Factory.name()); } else if(k3d::iplugin_factory::DEPRECATED == Factory.quality()) { markup = k3d::string_cast(boost::format(_("%1% (Deprecated)")) % Factory.name()); } else { markup = Factory.name(); } return markup; } } // namespace detail Gtk::ImageMenuItem* create_menu_item(k3d::iplugin_factory& Factory) { Gtk::Image* const image = new Gtk::Image(quiet_load_icon(Factory.name(), Gtk::ICON_SIZE_MENU)); Gtk::ImageMenuItem* const menu_item = new Gtk::ImageMenuItem( *Gtk::manage(image), "", true) << set_tooltip(Factory.short_description()); get_label(*menu_item)->set_markup(detail::plugin_factory_markup(Factory)); return menu_item; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/menus.h ================================================ #ifndef K3DSDK_NGUI_MENUS_H #define K3DSDK_NGUI_MENUS_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iplugin_factory; } namespace Gtk { class ImageMenuItem; } namespace k3d { namespace ngui { /// Creates a menu item based on a plugin type Gtk::ImageMenuItem* create_menu_item(k3d::iplugin_factory& Factory); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_MENUS_H ================================================ FILE: k3dsdk/ngui/merge_nodes.cpp ================================================ // K-3D // Copyright (c) 2005-2006, Romain Behar // // Contact: romainbehar@yahoo.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Romain Behar (romainbehar@yahoo.com) \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace merge_nodes { namespace detail { // Merge nodes UI struct node_check_t { node_check_t(const std::string& Name) : name(Name) { } std::string name; bool check; }; typedef std::vector document_nodes_t; class merge_nodes_dialog : public Gtk::Dialog { typedef Gtk::Dialog base; public: merge_nodes_dialog(document_nodes_t& DocumentNodes, std::string& NodePrefix) : base("Choose Nodes to Merge:", true), m_document_nodes(DocumentNodes), m_node_prefix(NodePrefix), m_property_table(1, 4, false), m_check_all_button(_("Check All")), m_clear_selection_button(_("Clear Selection")), m_prefix_label(_("Node prefix :")) { m_model = Gtk::ListStore::create(m_nodes); for(document_nodes_t::const_iterator node = DocumentNodes.begin(); node != DocumentNodes.end(); ++node) { Gtk::TreeRow row = *(m_model->append()); return_if_fail(row); row[m_nodes.name] = node->name; row[m_nodes.check] = false; } m_treeview.set_model(m_model); m_treeview.append_column_editable(_("Merge?"), m_nodes.check); m_treeview.append_column_editable(_("Node"), m_nodes.name); m_scrolled_window.add(m_treeview); m_scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); // Setup dialog set_default_size(500, 350); set_border_width(5); get_vbox()->pack_start(m_scrolled_window, Gtk::PACK_EXPAND_WIDGET); m_property_table.attach(m_check_all_button, 0, 1, 0, 1, Gtk::EXPAND, Gtk::SHRINK); m_property_table.attach(m_clear_selection_button, 1, 2, 0, 1, Gtk::EXPAND, Gtk::SHRINK); m_property_table.attach(m_prefix_label, 2, 3, 0, 1, Gtk::EXPAND, Gtk::SHRINK); m_property_table.attach(m_prefix_entry, 3, 4, 0, 1, Gtk::EXPAND, Gtk::SHRINK); get_vbox()->pack_start(m_property_table, Gtk::PACK_SHRINK); add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); set_position(Gtk::WIN_POS_CENTER); show_all(); m_check_all_button.signal_clicked().connect(sigc::mem_fun(*this, &merge_nodes_dialog::on_check_all)); m_clear_selection_button.signal_clicked().connect(sigc::mem_fun(*this, &merge_nodes_dialog::on_clear_selection)); m_prefix_entry.signal_key_release_event().connect(sigc::mem_fun(*this, &merge_nodes_dialog::on_update_prefix)); } private: void on_response(int ID) { if(Gtk::RESPONSE_OK == ID) { Gtk::TreeNodeChildren rows = m_model->children(); document_nodes_t::iterator node = m_document_nodes.begin(); for(Gtk::TreeNodeChildren::const_iterator row = rows.begin(); row != rows.end(); ++row) { return_if_fail(node != m_document_nodes.end()); node->check = (*row)[m_nodes.check]; ++node; } } } void on_check_all() { Gtk::TreeNodeChildren rows = m_model->children(); for(Gtk::TreeNodeChildren::const_iterator row = rows.begin(); row != rows.end(); ++row) (*row)[m_nodes.check] = true; } void on_clear_selection() { Gtk::TreeNodeChildren rows = m_model->children(); for(Gtk::TreeNodeChildren::const_iterator row = rows.begin(); row != rows.end(); ++row) (*row)[m_nodes.check] = false; } bool on_update_prefix(GdkEventKey* Event) { m_node_prefix = m_prefix_entry.get_text(); return true; } document_nodes_t& m_document_nodes; std::string& m_node_prefix; Glib::RefPtr m_model; Gtk::TreeView m_treeview; Gtk::ScrolledWindow m_scrolled_window; Gtk::Table m_property_table; Gtk::Button m_check_all_button; Gtk::Button m_clear_selection_button; Gtk::Label m_prefix_label; Gtk::Entry m_prefix_entry; class columns_t : public Gtk::TreeModelColumnRecord { public: columns_t() { add(name); add(check); } Gtk::TreeModelColumn name; Gtk::TreeModelColumn check; }; columns_t m_nodes; }; } // namespace detail void merge_nodes(k3d::idocument& Document) { k3d::filesystem::path document_path; { file_chooser_dialog dialog(_("Merge K-3D Document:"), k3d::options::path::documents(), Gtk::FILE_CHOOSER_ACTION_OPEN); dialog.add_pattern_filter(_("K-3D Document (*.k3d)"), "*.k3d"); dialog.add_all_files_filter(); if(!dialog.get_file_path(document_path)) return; } // Check for a K-3D document k3d::xml::element xml("k3dml"); try { k3d::filesystem::ifstream stream(document_path); k3d::xml::hide_progress progress; parse(xml, stream, document_path.native_utf8_string().raw(), progress); } catch(std::exception& e) { k3d::log() << error << e.what() << std::endl; return; } return_if_fail(xml.name == "k3dml"); // Synchronize older documents k3d::xml::upgrade_document(xml); // Setup context const k3d::filesystem::path root_path = document_path.branch_path(); k3d::persistent_lookup persistent_lookup; k3d::ipersistent::load_context context(root_path, persistent_lookup); // Get document node list k3d::xml::element* const xml_document = k3d::xml::find_element(xml, "document"); return_if_fail(xml_document); k3d::xml::element* xml_nodes = k3d::xml::find_element(*xml_document, "nodes"); if(!xml_nodes) xml_nodes = k3d::xml::find_element(*xml_document, "objects"); return_if_fail(xml_nodes); if(xml_nodes->name != "nodes") k3d::log() << warning << "Loading data from obsolete <" << xml_nodes->name << "> tag ... re-save document to eliminate this warning" << std::endl; detail::document_nodes_t document_nodes; for(k3d::xml::element::elements_t::iterator xml_node = xml_nodes->children.begin(); xml_node != xml_nodes->children.end(); ++xml_node) { if(xml_node->name != "node" && xml_node->name != "object") continue; if(k3d::xml::attribute_value(*xml_node, "do_not_load", false)) continue; const std::string name = k3d::xml::attribute_text(*xml_node, "name"); document_nodes.push_back(detail::node_check_t(name)); } // Run node list UI std::string node_prefix = ""; { detail::merge_nodes_dialog dialog(document_nodes, node_prefix); if(Gtk::RESPONSE_OK != dialog.run()) return; } // Load checked nodes k3d::inode_collection::nodes_t nodes; std::vector persistent_nodes; std::vector node_storage; detail::document_nodes_t::const_iterator user_node = document_nodes.begin(); for(k3d::xml::element::elements_t::iterator xml_node = xml_nodes->children.begin(); xml_node != xml_nodes->children.end(); ++xml_node, ++user_node) { return_if_fail(user_node != document_nodes.end()); if(xml_node->name != "node" && xml_node->name != "object") continue; if(k3d::xml::attribute_value(*xml_node, "do_not_load", false)) continue; if(xml_node->name != "node") k3d::log() << warning << "Loading data from obsolete <" << xml_node->name << "> tag ... re-save document to eliminate this warning" << std::endl; const std::string name = attribute_text(*xml_node, "name"); return_if_fail(name == user_node->name); // Skip unchecked nodes if(!user_node->check) continue; const k3d::uuid factory_id = k3d::xml::attribute_value(*xml_node, "factory", k3d::uuid::null()); if(factory_id == k3d::uuid::null()) { k3d::log() << error << "node [" << name << "] with unspecified factory ID will not be loaded" << std::endl; continue; } const k3d::ipersistent_lookup::id_type node_id = k3d::xml::attribute_value(*xml_node, "id", 0); if(node_id == 0) { k3d::log() << error << "node [" << name << "] with unspecified ID will not be loaded" << std::endl; continue; } k3d::iplugin_factory* const plugin_factory = k3d::plugin::factory::lookup(factory_id); if(!plugin_factory) { k3d::log() << error << "node [" << name << "] with unknown factory ID [" << factory_id << "] will not be loaded" << std::endl; continue; } k3d::idocument_plugin_factory* const document_plugin_factory = dynamic_cast(plugin_factory); if(!document_plugin_factory) { k3d::log() << error << "Non-document plugin [" << name << "] will not be loaded" << std::endl; continue; } k3d::inode* const node = document_plugin_factory->create_plugin(*plugin_factory, Document); if(!node) { k3d::log() << error << "Error creating node [" << name << "] instance" << std::endl; continue; } k3d::ipersistent* const persistent = dynamic_cast(node); if(!persistent) { k3d::log() << error << "node [" << name << "] does not support persistence" << std::endl; delete node; continue; } k3d::undoable_new(node, Document); nodes.push_back(node); persistent_nodes.push_back(persistent); node_storage.push_back(&(*xml_node)); persistent_lookup.insert_lookup(node_id, node); } Document.nodes().add_nodes(nodes); for(unsigned long i = 0; i != persistent_nodes.size(); ++i) { persistent_nodes[i]->load(*node_storage[i], context); if(node_prefix.size()) { k3d::inode* node = dynamic_cast(persistent_nodes[i]); if(node) node->set_name(node_prefix + node->name()); } } k3d::xml::load_pipeline(Document, *xml_document, context); } } // namespace merge_nodes } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/merge_nodes.h ================================================ #ifndef K3DSDK_NGUI_MERGE_NODES_H #define K3DSDK_NGUI_MERGE_NODES_H // K-3D // Copyright (c) 2005, Romain Behar // // Contact: romainbehar@yahoo.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Forward declarations namespace k3d { class idocument; } namespace k3d { namespace ngui { namespace merge_nodes { void merge_nodes(k3d::idocument& Document); } // namespace merge_nodes } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_MERGE_NODES_H ================================================ FILE: k3dsdk/ngui/messages.cpp ================================================ // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { void message(const std::string& Message, const std::string& SecondaryMessage) { if(batch_mode()) return; Gtk::MessageDialog dialog(Message, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); if(!SecondaryMessage.empty()) dialog.set_secondary_text(SecondaryMessage); dialog.run(); } void warning_message(const std::string& Message, const std::string& SecondaryMessage) { if(batch_mode()) return; Gtk::MessageDialog dialog(Message, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true); if(!SecondaryMessage.empty()) dialog.set_secondary_text(SecondaryMessage); dialog.run(); } void error_message(const std::string& Message, const std::string& SecondaryMessage) { if(batch_mode()) return; Gtk::MessageDialog dialog(Message, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); if(!SecondaryMessage.empty()) dialog.set_secondary_text(SecondaryMessage); dialog.run(); } unsigned int query_message(const std::string& Message, const unsigned int DefaultOption, const std::vector& Options) { return_val_if_fail(!batch_mode(), 0); Gtk::MessageDialog dialog(Message, false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true); for(unsigned long i = 0; i != Options.size(); ++i) dialog.add_button(Options[i], i+1); if(DefaultOption) dialog.set_default_response(DefaultOption-1); else dialog.set_default_response(Options.size()); dialog.set_position(Gtk::WIN_POS_CENTER); dialog.show_all(); int result = dialog.run(); if(Gtk::RESPONSE_DELETE_EVENT == result) result = 0; return result; } void nag_message(const std::string& Type, const k3d::ustring& Message, const k3d::ustring& SecondaryMessage) { if(batch_mode()) return; if(!options::nag(Type)) return; Gtk::MessageDialog dialog(Message.raw(), false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); if(!SecondaryMessage.empty()) dialog.set_secondary_text(SecondaryMessage.raw()); Gtk::CheckButton show_message(_("Display this message again in the future")); show_message.set_active(true); show_message.show(); Gtk::Alignment alignment(0.5, 0.5, 0, 0); alignment.add(show_message); alignment.show(); dialog.get_vbox()->pack_start(alignment); dialog.run(); options::enable_nag(Type, show_message.get_active()); } bool_t cancel_plugin(iplugin_factory& Factory) { if(batch_mode()) return false; switch(Factory.quality()) { case iplugin_factory::EXPERIMENTAL: { if(!options::nag("warn_experimental")) return false; Gtk::MessageDialog dialog(_("Use Experimental Plugin?"), false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_OK_CANCEL, true); dialog.set_secondary_text(_("Experimental plugins are still under development and may be modified or removed at any time. If this happens, documents that include them may become unusable.")); Gtk::CheckButton show_message(_("Display this message again in the future")); show_message.set_active(true); show_message.show(); Gtk::Alignment alignment(0.5, 0.5, 0, 0); alignment.add(show_message); alignment.show(); dialog.get_vbox()->pack_start(alignment); dialog.set_default_response(Gtk::RESPONSE_CANCEL); const int response = dialog.run(); options::enable_nag("warn_experimental", show_message.get_active()); return response != Gtk::RESPONSE_OK; } case iplugin_factory::STABLE: { return false; } case iplugin_factory::DEPRECATED: { if(!options::nag("warn_deprecated")) return false; Gtk::MessageDialog dialog(_("Use Deprecated Plugin?"), false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_OK_CANCEL, true); dialog.set_secondary_text(_("Deprecated plugins are scheduled for removal in future versions of K-3D. When this happens, documents that include them may become unusable. We strongly recommend against using deprecated plugins, unless you plan to keep a specific version of K-3D on-hand to maintain them.")); Gtk::CheckButton show_message(_("Display this message again in the future")); show_message.set_active(true); show_message.show(); Gtk::Alignment alignment(0.5, 0.5, 0, 0); alignment.add(show_message); alignment.show(); dialog.get_vbox()->pack_start(alignment); dialog.set_default_response(Gtk::RESPONSE_CANCEL); const int response = dialog.run(); options::enable_nag("warn_deprecated", show_message.get_active()); return response != Gtk::RESPONSE_OK; } } } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/messages.h ================================================ #ifndef K3DSDK_NGUI_MESSAGES_H #define K3DSDK_NGUI_MESSAGES_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class iplugin_factory; namespace ngui { /// Displays an informational message in a modal dialog box void message(const std::string& Message, const std::string& SecondaryMessage = ""); /// Displays a warning message in a modal dialog box void warning_message(const std::string& Message, const std::string& SecondaryMessage = ""); /// Displays an error message in a modal dialog box void error_message(const std::string& Message, const std::string& SecondaryMessage = ""); /** \brief Prompts the user to choose an option from a modal dialog box \param Message text displayed by the message box. \param DefaultOption one-based index of the option that is selected by default. If DefaultOption is 0, then no option is selected by default. \return one-based index of the option selected by the user, or "0" if a choice was not made (e.g. user clicked WM "close" button) */ unsigned int query_message(const std::string& Message, const unsigned int DefaultOption, const std::vector& Options); /// Displays an information "nag" message in a modal dialog box void nag_message(const std::string& Type, const k3d::ustring& Message, const k3d::ustring& SecondaryMessage = k3d::ustring()); /// Warns the user before creating an experimental or deprecated plugin, and gives them a chance to cancel. Returns true iff the user decided to cancel. bool_t cancel_plugin(iplugin_factory& Factory); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_MESSAGES_H ================================================ FILE: k3dsdk/ngui/modifiers.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { const factories_t& mesh_modifiers() { static factories_t modifiers; if(modifiers.empty()) { const plugin::factory::collection_t data_source_modifiers = plugin::factory::lookup(); const plugin::factory::collection_t data_sink_modifiers = plugin::factory::lookup(); const plugin::factory::collection_t multi_sink_modifiers = plugin::factory::lookup(); const plugin::factory::collection_t scripted_modifiers = plugin::factory::lookup("k3d:plugin-type", "MeshModifierScript"); std::set_intersection(data_source_modifiers.begin(), data_source_modifiers.end(), data_sink_modifiers.begin(), data_sink_modifiers.end(), std::inserter(modifiers, modifiers.end())); modifiers.insert(modifiers.end(), multi_sink_modifiers.begin(), multi_sink_modifiers.end()); modifiers.insert(modifiers.end(), scripted_modifiers.begin(), scripted_modifiers.end()); std::sort(modifiers.begin(), modifiers.end(), k3d::sort_by_name()); } return modifiers; } const factories_t& mesh_sinks() { static factories_t sinks; if(sinks.empty()) { const plugin::factory::collection_t data_source_modifiers = plugin::factory::lookup(); const plugin::factory::collection_t data_sink_modifiers = plugin::factory::lookup(); std::set_difference(data_sink_modifiers.begin(), data_sink_modifiers.end(), data_source_modifiers.begin(), data_source_modifiers.end(), std::inserter(sinks, sinks.end())); std::sort(sinks.begin(), sinks.end(), k3d::sort_by_name()); } return sinks; } const factories_t& transform_modifiers() { static factories_t modifiers; if(modifiers.empty()) { const plugin::factory::collection_t data_source_modifiers = plugin::factory::lookup(); const plugin::factory::collection_t data_sink_modifiers = plugin::factory::lookup(); std::set_intersection(data_source_modifiers.begin(), data_source_modifiers.end(), data_sink_modifiers.begin(), data_sink_modifiers.end(), std::inserter(modifiers, modifiers.end())); std::sort(modifiers.begin(), modifiers.end(), k3d::sort_by_name()); } return modifiers; } /// Modify transformation inode* modify_transformation(idocument& Document, inode& Object, iplugin_factory* Modifier) { return_val_if_fail(Modifier, 0); // Get the upstream and downstream properties ... imatrix_sink* const downstream_sink = dynamic_cast(&Object); return_val_if_fail(downstream_sink, 0); iproperty& downstream_input = downstream_sink->matrix_sink_input(); iproperty* const upstream_output = Document.pipeline().dependency(downstream_input); inode* modifier = 0; // This block is recorded for undo purposes ... { record_state_change_set changeset(Document, string_cast(boost::format(_("Add Modifier %1%")) % Modifier->name()), K3D_CHANGE_SET_CONTEXT); // Create our modifier object ... modifier = plugin::create(*Modifier, Document, unique_name(Document.nodes(), Modifier->name())); return_val_if_fail(modifier, 0); // Get its input and output properties ... imatrix_sink* const modifier_sink = dynamic_cast(modifier); return_val_if_fail(modifier_sink, 0); imatrix_source* const modifier_source = dynamic_cast(modifier); return_val_if_fail(modifier_source, 0); // Insert the modifier into the DAG ... ipipeline::dependencies_t dependencies; if(upstream_output) dependencies.insert(std::make_pair(&modifier_sink->matrix_sink_input(), upstream_output)); dependencies.insert(std::make_pair(&downstream_input, &modifier_source->matrix_source_output())); Document.pipeline().set_dependencies(dependencies); } return modifier; } /// Modify mesh inode* modify_mesh(document_state& DocumentState, inode& Node, iplugin_factory* Modifier) { return_val_if_fail(Modifier, 0); idocument& document = DocumentState.document(); // Get the upstream and downstream properties ... imesh_sink* const downstream_sink = dynamic_cast(&Node); return_val_if_fail(downstream_sink, 0); iproperty& downstream_input = downstream_sink->mesh_sink_input(); iproperty* const upstream_output = document.pipeline().dependency(downstream_input); return_val_if_fail(upstream_output, 0); inode* modifier = 0; // This block is recorded for undo purposes ... { record_state_change_set changeset(document, string_cast(boost::format(_("Add Modifier %1%")) % Modifier->name()), K3D_CHANGE_SET_CONTEXT); // Create our modifier object ... modifier = plugin::create(*Modifier, document, unique_name(document.nodes(), Modifier->name())); return_val_if_fail(modifier, 0); // Get its input and output properties ... imesh_sink* const modifier_sink = dynamic_cast(modifier); return_val_if_fail(modifier_sink, 0); imesh_source* const modifier_source = dynamic_cast(modifier); // Insert the modifier into the pipeline ... ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&modifier_sink->mesh_sink_input(), upstream_output)); if(modifier_source) dependencies.insert(std::make_pair(&downstream_input, &modifier_source->mesh_source_output())); document.pipeline().set_dependencies(dependencies); // If the modifier is a mesh selection sink, set its selection state ... imesh_selection_sink* const modifier_mesh_selection_sink = dynamic_cast(modifier); imesh_selection_sink* const downstream_mesh_selection_sink = dynamic_cast(&Node); if(modifier_mesh_selection_sink && downstream_mesh_selection_sink) { if(selection::NODE == selection::state(DocumentState.document()).current_mode()) { property::set_internal_value( modifier_mesh_selection_sink->mesh_selection_sink_input(), geometry::selection::create(1)); } else { property::set_internal_value( modifier_mesh_selection_sink->mesh_selection_sink_input(), downstream_mesh_selection_sink->mesh_selection_sink_input().property_internal_value()); } property::set_internal_value( downstream_mesh_selection_sink->mesh_selection_sink_input(), k3d::selection::set()); } } // Give nodes a chance to initialize their property values based on their inputs, if any ... if(ireset_properties* const reset_properties = dynamic_cast(modifier)) reset_properties->reset_properties(); return modifier; } void modify_selected_meshes(document_state& DocumentState, iplugin_factory* Modifier) { return_if_fail(Modifier); idocument& document = DocumentState.document(); if (Modifier->implements(typeid(imulti_mesh_sink))) { // Mesh modifier taking multiple inputs uint_t count = 0; ipipeline::dependencies_t dependencies; const nodes_t selected_nodes = selection::state(DocumentState.document()).selected_nodes(); // Create the node inode* multi_sink = pipeline::create_node(document, *Modifier); record_state_change_set changeset(document, string_cast(boost::format(_("Add Modifier %1%")) % Modifier->name()), K3D_CHANGE_SET_CONTEXT); nodes_t nodes_to_delete; for(nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) { imesh_sink* const mesh_sink = dynamic_cast(*node); if(!mesh_sink) continue; imatrix_sink* const matrix_sink = dynamic_cast(*node); iproperty* source_mesh = document.pipeline().dependency(mesh_sink->mesh_sink_input()); if (!source_mesh) continue; if (matrix_sink) // Insert a transform node { iproperty* const source_transformation = document.pipeline().dependency(matrix_sink->matrix_sink_input()); if (source_transformation) { inode* transform_points = plugin::create("TransformPoints", document, unique_name(document.nodes(), "TransformPoints")); return_if_fail(transform_points); imatrix_sink* transform_points_matrix_sink = dynamic_cast(transform_points); return_if_fail(transform_points_matrix_sink); imesh_sink* transform_points_mesh_sink = dynamic_cast(transform_points); return_if_fail(transform_points_mesh_sink); dependencies.insert(std::make_pair(&transform_points_matrix_sink->matrix_sink_input(), source_transformation)); dependencies.insert(std::make_pair(&transform_points_mesh_sink->mesh_sink_input(), source_mesh)); imesh_source* transform_points_mesh_source = dynamic_cast(transform_points); return_if_fail(transform_points_mesh_source); source_mesh = &transform_points_mesh_source->mesh_source_output(); imesh_selection_sink* selection_sink = dynamic_cast(transform_points); return_if_fail(selection_sink); property::set_internal_value(selection_sink->mesh_selection_sink_input(), k3d::geometry::selection::create(1.0)); } } ++count; // Create a new user property std::stringstream name, label; name << "input_mesh" << count; label << "Input Mesh " << count; iproperty* sink = property::get(*multi_sink, name.str()); if (!sink) sink = property::create(*multi_sink, name.str(), label.str(), "", static_cast(0)); // Store the connection dependencies.insert(std::make_pair(sink, source_mesh)); // Delete the input node nodes_to_delete.push_back(*node); } document.pipeline().set_dependencies(dependencies); delete_nodes(document, nodes_to_delete); // Give nodes a chance to initialize their property values based on their inputs, if any ... if(ireset_properties* const reset_properties = dynamic_cast(multi_sink)) reset_properties->reset_properties(); panel::mediator(DocumentState.document()).set_focus(*multi_sink); } else { // Normal mesh modifier nodes_t new_modifiers; const nodes_t selected_nodes = selection::state(DocumentState.document()).selected_nodes(); for(nodes_t::const_iterator node = selected_nodes.begin(); node != selected_nodes.end(); ++node) { new_modifiers.push_back(modify_mesh(DocumentState, **node, Modifier)); assert_warning(new_modifiers.back()); } // Show the new modifier properties if only one was processed if(selected_nodes.size() == 1) { panel::mediator(DocumentState.document()).set_focus(*new_modifiers.front()); } else // otherwise connect all parameter properties to the first node and show that one { iproperty_collection* first_property_collection = dynamic_cast(new_modifiers.front()); if (first_property_collection) { // Get the in-and output property names, to exclude them from the connections imesh_sink* const modifier_sink = dynamic_cast(new_modifiers.front()); return_if_fail(modifier_sink); imesh_source* const modifier_source = dynamic_cast(new_modifiers.front()); return_if_fail(modifier_source); const std::string sink_name = modifier_sink->mesh_sink_input().property_name(); const std::string source_name = modifier_source->mesh_source_output().property_name(); ipipeline::dependencies_t dependencies; const iproperty_collection::properties_t& first_properties = first_property_collection->properties(); nodes_t::iterator modifier = new_modifiers.begin(); ++modifier; for (modifier; modifier != new_modifiers.end(); ++modifier) { iproperty_collection* property_collection = dynamic_cast(*modifier); return_if_fail(property_collection); const iproperty_collection::properties_t& properties = property_collection->properties(); iproperty_collection::properties_t::const_iterator property = properties.begin(); for (iproperty_collection::properties_t::const_iterator first_property = first_properties.begin(); first_property != first_properties.end(); ++first_property) { return_if_fail(property != properties.end()); return_if_fail((*property)->property_name() == (*first_property)->property_name()); if ((*property)->property_name() == sink_name || (*property)->property_name() == source_name || (*property)->property_name() == "name") { ++property; continue; } dependencies.insert(std::make_pair(*property, *first_property)); ++property; } } document.pipeline().set_dependencies(dependencies); panel::mediator(DocumentState.document()).set_focus(*new_modifiers.front()); } } } } const transform_modifier create_transform_modifier(idocument& Document, const uuid& ModifierType, const std::string& ModifierName) { inode* const object = plugin::create(ModifierType, Document, ModifierName); return_val_if_fail(object, transform_modifier()); imatrix_sink* const sink = dynamic_cast(object); return_val_if_fail(sink, transform_modifier()); imatrix_source* const source = dynamic_cast(object); return_val_if_fail(source, transform_modifier()); return transform_modifier(*object, *sink, *source); } inode* insert_transform_modifier(inode& Object, const uuid& ModifierType, const std::string& ModifierName) { imatrix_sink* const downstream_sink = dynamic_cast(&Object); return_val_if_fail(downstream_sink, 0); iproperty& downstream_input = downstream_sink->matrix_sink_input(); iproperty* const upstream_output = Object.document().pipeline().dependency(downstream_input); const transform_modifier modifier = create_transform_modifier(Object.document(), ModifierType, ModifierName); return_val_if_fail(!modifier.empty(), 0); ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&modifier.sink->matrix_sink_input(), upstream_output)); dependencies.insert(std::make_pair(&downstream_input, &modifier.source->matrix_source_output())); Object.document().pipeline().set_dependencies(dependencies); return modifier.node; } inode* upstream_transform_modifier(inode& Object) { imatrix_sink* const downstream_sink = dynamic_cast(&Object); return_val_if_fail(downstream_sink, 0); iproperty& downstream_input = downstream_sink->matrix_sink_input(); iproperty* const upstream_output = Object.document().pipeline().dependency(downstream_input); // Check upstream object if(upstream_output) return upstream_output->property_node(); return 0; } const mesh_modifier create_mesh_modifier(idocument& Document, const uuid& ModifierType, const std::string& ModifierName) { inode* const object = plugin::create(ModifierType, Document, ModifierName); return_val_if_fail(object, mesh_modifier()); imesh_sink* const sink = dynamic_cast(object); return_val_if_fail(sink, mesh_modifier()); imesh_source* const source = dynamic_cast(object); return_val_if_fail(source, mesh_modifier()); return mesh_modifier(*object, *sink, *source); } inode* insert_mesh_modifier(inode& Object, const uuid& ModifierType, const std::string& ModifierName) { imesh_sink* const downstream_sink = dynamic_cast(&Object); return_val_if_fail(downstream_sink, 0); iproperty& downstream_input = downstream_sink->mesh_sink_input(); iproperty* const upstream_output = Object.document().pipeline().dependency(downstream_input); const mesh_modifier modifier = create_mesh_modifier(Object.document(), ModifierType, ModifierName); return_val_if_fail(!modifier.empty(), 0); ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&modifier.sink->mesh_sink_input(), upstream_output)); dependencies.insert(std::make_pair(&downstream_input, &modifier.source->mesh_source_output())); Object.document().pipeline().set_dependencies(dependencies, modifier.source->hint()); return modifier.node; } inode* upstream_mesh_modifier(inode& Object) { imesh_sink* const downstream_sink = dynamic_cast(&Object); return_val_if_fail(downstream_sink, 0); iproperty& downstream_input = downstream_sink->mesh_sink_input(); iproperty* const upstream_output = Object.document().pipeline().dependency(downstream_input); // Check upstream object if(upstream_output) return upstream_output->property_node(); return 0; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/modifiers.h ================================================ #ifndef K3DSDK_NGUI_MODIFIERS_H #define K3DSDK_NGUI_MODIFIERS_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class idocument; } namespace k3d { class inode; } namespace k3d { class imesh_sink; } namespace k3d { class imesh_source; } namespace k3d { class iplugin_factory; } namespace k3d { class imatrix_sink; } namespace k3d { class imatrix_source; } namespace k3d { class uuid; } namespace k3d { namespace ngui { class document_state; /// Returns upstream transform modifier (0 if none) k3d::inode* upstream_transform_modifier(k3d::inode& Object); /// Returns upstream mesh modifier (0 if none) k3d::inode* upstream_mesh_modifier(k3d::inode& Object); typedef std::vector factories_t; /// Returns a collection of transform modifier plugin factories, sorted by name const factories_t& transform_modifiers(); /// Returns a collection of mesh modifier plugin factories, sorted by name const factories_t& mesh_modifiers(); /// Returns a collection of mesh sink plugin factories that are NOT mesh sources. Sorted by name const factories_t& mesh_sinks(); /// Modify transformation k3d::inode* modify_transformation(k3d::idocument& Document, k3d::inode& Object, k3d::iplugin_factory* Modifier); /// Modify mesh object k3d::inode* modify_mesh(document_state& DocumentState, k3d::inode& Object, k3d::iplugin_factory* Modifier); /// Modify all selected meshes void modify_selected_meshes(document_state& DocumentState, k3d::iplugin_factory* Modifier); struct transform_modifier; const transform_modifier create_transform_modifier(k3d::idocument& Document, const k3d::uuid& ModifierType, const std::string& ModifierName); k3d::inode* insert_transform_modifier(k3d::inode& Object, const k3d::uuid& ModifierType, const std::string& ModifierName); struct mesh_modifier; const mesh_modifier create_mesh_modifier(k3d::idocument& Document, const k3d::uuid& ModifierType, const std::string& ModifierName); k3d::inode* insert_mesh_modifier(k3d::inode& Object, const k3d::uuid& ModifierType, const std::string& ModifierName); struct transform_modifier { transform_modifier() : node(0), sink(0), source(0) { } transform_modifier(k3d::inode& Object, k3d::imatrix_sink& Sink, k3d::imatrix_source& Source) : node(&Object), sink(&Sink), source(&Source) { } operator bool() const { return node && sink && source; } bool empty() const { return !(node && sink && source); } k3d::inode* node; k3d::imatrix_sink* sink; k3d::imatrix_source* source; }; struct mesh_modifier { mesh_modifier() : node(0), sink(0), source(0) { } mesh_modifier(k3d::inode& Object, k3d::imesh_sink& Sink, k3d::imesh_source& Source) : node(&Object), sink(&Sink), source(&Source) { } operator bool() const { return node && sink && source; } bool empty() const { return !(node && sink && source); } k3d::inode* node; k3d::imesh_sink* sink; k3d::imesh_source* source; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_MODIFIERS_H ================================================ FILE: k3dsdk/ngui/move_tool.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { class move_manipulators : public imanipulators { private: struct constraint : public k3d::selectable { constraint(const std::string& Label, Glib::RefPtr Cursor, const k3d::selection::token& SelectionToken) : m_selection_token(SelectionToken), m_label(Label), m_cursor(Cursor), m_plane(k3d::vector3(0, 0, 1), 0), m_x_sensitivity(0), m_y_sensitivity(0), m_z_sensitivity(0) { assert_warning(!m_label.empty()); } const std::string label() { return m_label; } Glib::RefPtr cursor() { return m_cursor; } void set_plane(const k3d::plane& Plane, const double XSensitivity, const double YSensitivity, const double ZSensitivity) { m_plane = Plane; m_x_sensitivity = XSensitivity; m_y_sensitivity = YSensitivity; m_z_sensitivity = ZSensitivity; } void begin_mouse_move(const k3d::point2& Mouse, const k3d::point3& Origin) { m_last_mouse = Mouse; } k3d::vector3 mouse_move(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { const k3d::point2 current_mouse(Coordinates); // Turn mouse coordinates into lines in world coordinates ... k3d::line3 last_line = mouse_to_world(Viewport, m_last_mouse); k3d::line3 current_line = mouse_to_world(Viewport, current_mouse); m_last_mouse = current_mouse; // Calculate intersections with our plane in world coordinates ... k3d::point3 last_intersection; return_val_if_fail(k3d::intersect(m_plane, last_line, last_intersection), k3d::vector3(0, 0, 0)); k3d::point3 current_intersection; return_val_if_fail(k3d::intersect(m_plane, current_line, current_intersection), k3d::vector3(0, 0, 0)); // Convert the change into world axis coordinates and constrain them (with sensitivity) const k3d::vector3 delta = k3d::inverse(Orientation) * (current_intersection - last_intersection); return k3d::vector3(delta[0] * m_x_sensitivity, delta[1] * m_y_sensitivity, delta[2] * m_z_sensitivity); } const k3d::selection::token m_selection_token; const std::string m_label; const Glib::RefPtr m_cursor; /// Stores the constraint plane in world coordinates k3d::plane m_plane; double m_x_sensitivity; double m_y_sensitivity; double m_z_sensitivity; k3d::point2 m_last_mouse; }; public: move_manipulators() : m_quadric(0), m_current_constraint(&m_screen_xy_constraint), m_screen_xy_constraint(_("Move Screen XY"), load_icon("move_cursor_screen_xy", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 0)), m_x_constraint(_("Move X"), load_icon("move_cursor_x", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 1)), m_y_constraint(_("Move Y"), load_icon("move_cursor_y", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 2)), m_z_constraint(_("Move Z"), load_icon("move_cursor_z", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 3)), m_xy_constraint(_("Move XY"), load_icon("move_cursor_xy", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 4)), m_xz_constraint(_("Move XZ"), load_icon("move_cursor_xz", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 5)), m_yz_constraint(_("Move YZ"), load_icon("move_cursor_yz", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 6)) { } ~move_manipulators() { gluDeleteQuadric(m_quadric); } void activate() { // Load parameters from configuration file try { k3d::filesystem::ifstream layout_stream(k3d::share_path() / k3d::filesystem::generic_path("ngui/tool_layout.k3d")); k3d::xml::element layout_xml; layout_stream >> layout_xml; k3d::xml::element& xml_move = layout_xml.safe_element("application").safe_element("user_interface").safe_element("tools").safe_element("move"); m_manipulators_size = k3d::xml::attribute_value(xml_move, "size", 10); m_current_color = k3d::xml::attribute_value(xml_move, "current_color", k3d::color(1, 1, 0)); m_x_color = k3d::xml::attribute_value(xml_move, "x_color", k3d::color(1, 0, 0)); m_y_color = k3d::xml::attribute_value(xml_move, "y_color", k3d::color(0, 1, 0)); m_z_color = k3d::xml::attribute_value(xml_move, "z_color", k3d::color(0, 0, 1)); m_screen_xy_color = k3d::xml::attribute_value(xml_move, "screen_xy_color", k3d::color(0.9, 0.9, 0.9)); m_plane_offset = k3d::xml::attribute_value(xml_move, "plane_offset", 5); m_plane_size = k3d::xml::attribute_value(xml_move, "plane_size", 4.8); m_screen_xy_radius = k3d::xml::attribute_value(xml_move, "screen_xy_radius", 0.5); m_screen_xy_slices = k3d::xml::attribute_value(xml_move, "screen_xy_slices", 8); m_screen_xy_stacks = k3d::xml::attribute_value(xml_move, "screen_xy_stacks", 8); m_axis_start = k3d::xml::attribute_value(xml_move, "axis_start", 5); m_axis_end = k3d::xml::attribute_value(xml_move, "axis_end", 10); m_axis_line_width = k3d::xml::attribute_value(xml_move, "axis_line_width", 1); m_axis_arrow_radius = k3d::xml::attribute_value(xml_move, "axis_arrow_radius", 0.5); m_axis_arrow_length = k3d::xml::attribute_value(xml_move, "axis_arrow_length", 2.0); m_axis_arrow_slices = k3d::xml::attribute_value(xml_move, "axis_arrow_slices", 8); } catch(std::exception& e) { k3d::log() << error << e.what() << std::endl; } set_constraint("screen_xy"); } void redraw(viewport::control& Viewport, const bool Visible, const k3d::point3& Position, const k3d::matrix4& Orientation, tool_selection::motion_t Motion, const k3d::point3& Scaling) { // Sanity checks return_if_fail(Viewport.gl_engine()); return_if_fail(Viewport.camera()); // Update constraints const k3d::matrix4 screen_matrix = k3d::node_to_world_matrix(*Viewport.camera()); const k3d::vector3 screen_normal = screen_matrix * k3d::vector3(0, 0, 1); // Update the screen xy constraint so it always aligns with the camera direction vector in world coordinates m_screen_xy_constraint.set_plane(k3d::plane(screen_normal, Position), 1, 1, 1); // Update axis constraints so their planes are always as perpendicular to the screen as-possible m_x_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(1, 0, 0)) ^ ((Orientation * k3d::vector3(1, 0, 0)) ^ screen_normal), Position), 1, 0, 0); m_y_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(0, 1, 0)) ^ ((Orientation * k3d::vector3(0, 1, 0)) ^ screen_normal), Position), 0, 1, 0); m_z_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(0, 0, 1)) ^ ((Orientation * k3d::vector3(0, 0, 1)) ^ screen_normal), Position), 0, 0, 1); // Update plane constraints so they have the correct positions in world coordinates m_xy_constraint.set_plane(k3d::plane(Orientation * k3d::vector3(0, 0, 1), Position), 1, 1, 0); m_xz_constraint.set_plane(k3d::plane(Orientation * k3d::vector3(0, 1, 0), Position), 1, 0, 1); m_yz_constraint.set_plane(k3d::plane(Orientation * k3d::vector3(1, 0, 0), Position), 0, 1, 1); // Draw manipulators if(!Visible) return; k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(k3d::to_vector(Position))); k3d::gl::push_matrix(Orientation); glClear(GL_DEPTH_BUFFER_BIT); // Scale manipulators to show them at constant size (except on mouse drag) if(tool_selection::MOTION_NONE == Motion) m_scale = detail::manipulators_scale(Viewport, Position, m_manipulators_size); glScaled(m_scale, m_scale, m_scale); // Draw manipulators k3d::vector3 px; k3d::vector3 py; k3d::vector3 pz; const bool motion = (tool_selection::MOTION_DRAG == Motion) || (tool_selection::MOTION_CLICK_DRAG == Motion); if(!motion || &m_x_constraint == m_current_constraint || &m_xy_constraint == m_current_constraint || &m_xz_constraint == m_current_constraint) { if(is_front_facing(Viewport, k3d::vector3(1, 0, 0), Position, Orientation)) { px = k3d::vector3(1, 0, 0); draw_axis(m_x_color, m_current_constraint == &m_x_constraint ? m_current_color : m_x_color, k3d::rotate3(k3d::radians(90.0), k3d::vector3(0, 1, 0))); } else { px = k3d::vector3(-1, 0, 0); draw_axis(m_x_color, m_current_constraint == &m_x_constraint ? m_current_color : m_x_color, k3d::rotate3(k3d::radians(-90.0), k3d::vector3(0, 1, 0))); } } if(!motion || &m_y_constraint == m_current_constraint || &m_xy_constraint == m_current_constraint || &m_yz_constraint == m_current_constraint) { if(is_front_facing(Viewport, k3d::vector3(0, -1, 0), Position, Orientation)) { py = k3d::vector3(0, -1, 0); draw_axis(m_y_color, m_current_constraint == &m_y_constraint ? m_current_color : m_y_color, k3d::rotate3(k3d::radians(90.0), k3d::vector3(1, 0, 0))); } else { py = k3d::vector3(0, 1, 0); draw_axis(m_y_color, m_current_constraint == &m_y_constraint ? m_current_color : m_y_color, k3d::rotate3(k3d::radians(-90.0), k3d::vector3(1, 0, 0))); } } if(!motion || &m_z_constraint == m_current_constraint || &m_xz_constraint == m_current_constraint || &m_yz_constraint == m_current_constraint) { if(is_front_facing(Viewport, k3d::vector3(0, 0, 1), Position, Orientation)) { pz = k3d::vector3(0, 0, 1); draw_axis(m_z_color, m_current_constraint == &m_z_constraint ? m_current_color : m_z_color, k3d::rotate3(k3d::radians(0.0), k3d::vector3(0, 1, 0))); } else { pz = k3d::vector3(0, 0, -1); draw_axis(m_z_color, m_current_constraint == &m_z_constraint ? m_current_color : m_z_color, k3d::rotate3(k3d::radians(180.0), k3d::vector3(0, 1, 0))); } } if(!motion || &m_yz_constraint == m_current_constraint) draw_plane(m_current_constraint == &m_yz_constraint ? m_current_color : m_x_color, py, py + pz, pz); if(!motion || &m_xz_constraint == m_current_constraint) draw_plane(m_current_constraint == &m_xz_constraint ? m_current_color : m_y_color, px, px + pz, pz); if(!motion || &m_xy_constraint == m_current_constraint) draw_plane(m_current_constraint == &m_xy_constraint ? m_current_color : m_z_color, px, px + py, py); if(!motion || &m_screen_xy_constraint == m_current_constraint) draw_screen_xy(Viewport, m_current_constraint == &m_screen_xy_constraint ? m_current_color : m_screen_xy_color); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } void select(viewport::control& Viewport, const k3d::point3& Position, const k3d::matrix4& Orientation) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(k3d::to_vector(Position))); k3d::gl::push_matrix(Orientation); glDisable(GL_LIGHTING); glClear(GL_DEPTH_BUFFER_BIT); // Scale manipulators glScaled(m_scale, m_scale, m_scale); // Draw manipulators k3d::vector3 px; k3d::vector3 py; k3d::vector3 pz; if(is_front_facing(Viewport, k3d::vector3(1, 0, 0), Position, Orientation)) { px = k3d::vector3(1, 0, 0); select_axis(m_x_constraint, k3d::rotate3(k3d::radians(90.0), k3d::vector3(0, 1, 0))); } else { px = k3d::vector3(-1, 0, 0); select_axis(m_x_constraint, k3d::rotate3(k3d::radians(-90.0), k3d::vector3(0, 1, 0))); } if(is_front_facing(Viewport, k3d::vector3(0, -1, 0), Position, Orientation)) { py = k3d::vector3(0, -1, 0); select_axis(m_y_constraint, k3d::rotate3(k3d::radians(90.0), k3d::vector3(1, 0, 0))); } else { py = k3d::vector3(0, 1, 0); select_axis(m_y_constraint, k3d::rotate3(k3d::radians(-90.0), k3d::vector3(1, 0, 0))); } if(is_front_facing(Viewport, k3d::vector3(0, 0, 1), Position, Orientation)) { pz = k3d::vector3(0, 0, 1); select_axis(m_z_constraint, k3d::rotate3(k3d::radians(0.0), k3d::vector3(0, 1, 0))); } else { pz = k3d::vector3(0, 0, -1); select_axis(m_z_constraint, k3d::rotate3(k3d::radians(180.0), k3d::vector3(0, 1, 0))); } select_plane(m_yz_constraint, py, py + pz, pz); select_plane(m_xz_constraint, px, px + pz, pz); select_plane(m_xy_constraint, px, px + py, py); select_screen_xy(m_screen_xy_constraint); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } std::string get_constraint_name() { return_val_if_fail(m_current_constraint, ""); return m_current_constraint->label(); } // Set manipulator constraint Glib::RefPtr set_constraint(const std::string& Name) { if(Name == "screen_xy") m_current_constraint = &m_screen_xy_constraint; else if(Name == "x_axis") m_current_constraint = &m_x_constraint; else if(Name == "y_axis") m_current_constraint = &m_y_constraint; else if(Name == "z_axis") m_current_constraint = &m_z_constraint; else if(Name == "xy_plane") m_current_constraint = &m_xy_constraint; else if(Name == "xz_plane") m_current_constraint = &m_xz_constraint; else if(Name == "yz_plane") m_current_constraint = &m_yz_constraint; else assert_not_reached(); return m_current_constraint->cursor(); } std::string constraint_name(const k3d::selection::id ID) { if(ID == m_screen_xy_constraint.m_selection_token.id) return "screen_xy"; else if(ID == m_x_constraint.m_selection_token.id) return "x_axis"; else if(ID == m_y_constraint.m_selection_token.id) return "y_axis"; else if(ID == m_z_constraint.m_selection_token.id) return "z_axis"; else if(ID == m_xy_constraint.m_selection_token.id) return "xy_plane"; else if(ID == m_xz_constraint.m_selection_token.id) return "xz_plane"; else if(ID == m_yz_constraint.m_selection_token.id) return "yz_plane"; return ""; } std::string cycle_constraint(constraint* Constraint) { if(Constraint == &m_x_constraint) return "y_axis"; if(Constraint == &m_y_constraint) return "z_axis"; if(Constraint == &m_z_constraint) return "x_axis"; return ""; } void update_constraint(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { // Cycle through X - Screen - Y - Screen - Z - Screen - X - etc if(m_current_constraint == &m_x_constraint || m_current_constraint == &m_y_constraint || m_current_constraint == &m_z_constraint) { // Save current constraint m_previous_constraint = m_current_constraint; // Go back to screeen mode set_constraint("screen_xy"); } else if(m_previous_constraint) { // An axis was previously chosen, cycle to next one set_constraint(cycle_constraint(m_previous_constraint)); } else { // Constrain movement to the "nearest" axis const k3d::point2 mouse(Coordinates); const k3d::point2 coords = Viewport.project(Position); std::map constraints; constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(1, 0, 0))))), "x_axis")); constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(0, 1, 0))))), "y_axis")); constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(0, 0, 1))))), "z_axis")); set_constraint(constraints.begin()->second); } begin_mouse_move(Coordinates, Position); } void begin_mouse_move(const k3d::point2& Coordinates, const k3d::point3& Origin) { m_current_constraint->begin_mouse_move(Coordinates, Origin); } k3d::vector3 mouse_move(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { return m_current_constraint->mouse_move(Viewport, Coordinates, Position, Orientation); } private: // Manipulator drawing/selection functions void draw_screen_xy(viewport::control& Viewport, const k3d::color& Color) { k3d::gl::store_attributes attributes; k3d::gl::color3d(Color); k3d::gl::material(GL_FRONT_AND_BACK, GL_AMBIENT, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_DIFFUSE, Color); k3d::gl::material(GL_FRONT_AND_BACK, GL_SPECULAR, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_EMISSION, k3d::color(0, 0, 0)); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glEnable(GL_LIGHTING); gluQuadricDrawStyle(quadric(), GLU_FILL); gluQuadricNormals(quadric(), GLU_SMOOTH); gluSphere(quadric(), m_screen_xy_radius, m_screen_xy_slices, m_screen_xy_stacks); glPopMatrix(); } void select_screen_xy(constraint& Constraint) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_selection_token(Constraint.m_selection_token); glDisable(GL_LIGHTING); gluQuadricDrawStyle(quadric(), GLU_FILL); gluQuadricNormals(quadric(), GLU_NONE); gluSphere(quadric(), m_screen_xy_radius, m_screen_xy_slices, m_screen_xy_stacks); k3d::gl::pop_selection_token(); glPopMatrix(); } void draw_axis(const k3d::color& ArrowColor, const k3d::color& AxisColor, const k3d::matrix4& Matrix) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(Matrix); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(0, 0, m_axis_end - (0.5 * m_axis_arrow_length))); glEnable(GL_LIGHTING); k3d::gl::material(GL_FRONT_AND_BACK, GL_AMBIENT, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_DIFFUSE, AxisColor); k3d::gl::material(GL_FRONT_AND_BACK, GL_SPECULAR, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_EMISSION, k3d::color(0, 0, 0)); gluQuadricDrawStyle(quadric(), GLU_FILL); gluQuadricNormals(quadric(), GLU_SMOOTH); gluCylinder(quadric(), m_axis_arrow_radius, m_axis_arrow_radius * 0.001, m_axis_arrow_length, m_axis_arrow_slices, 1); glPopMatrix(); glDisable(GL_LIGHTING); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glEnable(GL_LINE_SMOOTH); glLineWidth(m_axis_line_width); k3d::gl::color3d(AxisColor); glBegin(GL_LINES); glVertex3d(0, 0, m_axis_start); glVertex3d(0, 0, m_axis_end); glEnd(); glPopMatrix(); } void select_axis(constraint& Constraint, const k3d::matrix4& Matrix) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(Matrix); k3d::gl::push_selection_token(Constraint.m_selection_token); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(0, 0, m_axis_end - (0.5 * m_axis_arrow_length))); gluQuadricDrawStyle(quadric(), GLU_FILL); gluQuadricNormals(quadric(), GLU_NONE); gluCylinder(quadric(), m_axis_arrow_radius, m_axis_arrow_radius * 0.001, m_axis_arrow_length, m_axis_arrow_slices, 1); glPopMatrix(); glBegin(GL_LINES); glVertex3d(0, 0, m_axis_start); glVertex3d(0, 0, m_axis_end); glEnd(); k3d::gl::pop_selection_token(); glPopMatrix(); } void draw_plane(const k3d::color& Color, const k3d::vector3& P1, const k3d::vector3& P2, const k3d::vector3& P3) { k3d::gl::store_attributes attributes; k3d::gl::color3d(Color); glDisable(GL_LIGHTING); glLineWidth(m_axis_line_width); glBegin(GL_LINE_STRIP); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P1 * m_plane_size)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P2 * m_plane_size)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P3 * m_plane_size)); glEnd(); } void select_plane(constraint& Constraint, const k3d::vector3& P1, const k3d::vector3& P2, const k3d::vector3& P3) { k3d::gl::store_attributes attributes; k3d::gl::push_selection_token(Constraint.m_selection_token); glDisable(GL_LIGHTING); glBegin(GL_QUADS); k3d::gl::vertex3d(k3d::point3(0, 0, 0)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P1 * m_plane_size)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P2 * m_plane_size)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P3 * m_plane_size)); glEnd(); k3d::gl::pop_selection_token(); } /// Stores a GLU quadric object for drawing the manipulators GLUquadricObj* m_quadric; /// Get the quadric object, creating it as needed GLUquadricObj* quadric() { if(!m_quadric) m_quadric = gluNewQuadric(); return m_quadric; } /// Stores the constraint that was in effect when movement began (if any) constraint* m_current_constraint; /// Stores the constraint that was in effect before m_current_constraint constraint* m_previous_constraint; // These are placeholders, used to identify hotspots in the manipulators constraint m_screen_xy_constraint; constraint m_x_constraint; constraint m_y_constraint; constraint m_z_constraint; constraint m_xy_constraint; constraint m_xz_constraint; constraint m_yz_constraint; // Parameters that control the on-screen appearance of the tool double m_manipulators_size; double m_scale; k3d::color m_current_color; k3d::color m_x_color; k3d::color m_y_color; k3d::color m_z_color; k3d::color m_screen_xy_color; double m_plane_offset; double m_plane_size; double m_screen_xy_radius; unsigned long m_screen_xy_slices; unsigned long m_screen_xy_stacks; double m_axis_start; double m_axis_end; double m_axis_line_width; double m_axis_arrow_radius; double m_axis_arrow_length; unsigned long m_axis_arrow_slices; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // move_tool move_tool::move_tool(document_state& DocumentState, const std::string& Name) : transform_tool_base(DocumentState.document(), DocumentState, Name), m_mutex(false), m_move(init_owner(*this) + init_name("move") + init_label(_("Move")) + init_description(_("Move")) + init_value(k3d::point3(0, 0, 0))), m_world_position(init_owner(*this) + init_name("world_position") + init_label(_("World position")) + init_description(_("Manipulators' world position")) + init_value(k3d::point3(0, 0, 0))) { m_world_position.set_update_slot(sigc::mem_fun(*this, &move_tool::get_world_position)); m_move.connect_explicit_change_signal(sigc::mem_fun(*this, &move_tool::on_move)); m_input_model.connect_lbutton_down(sigc::mem_fun(*this, &move_tool::on_lbutton_down)); m_input_model.connect_lbutton_click(sigc::mem_fun(*this, &move_tool::on_lbutton_click)); m_input_model.connect_lbutton_start_drag(sigc::mem_fun(*this, &move_tool::on_lbutton_start_drag)); m_input_model.connect_lbutton_drag(sigc::mem_fun(*this, &move_tool::on_lbutton_drag)); m_input_model.connect_lbutton_end_drag(sigc::mem_fun(*this, &move_tool::on_lbutton_end_drag)); m_input_model.connect_mbutton_click(sigc::mem_fun(*this, &move_tool::on_mbutton_click)); m_input_model.connect_rbutton_click(sigc::mem_fun(*this, &move_tool::on_rbutton_click)); m_input_model.connect_mouse_move(sigc::mem_fun(*this, &move_tool::on_mouse_move)); m_manipulators = new detail::move_manipulators(); } move_tool::~move_tool() { delete m_manipulators; } void move_tool::on_activate() { m_manipulators->activate(); m_visible_manipulators.set_value(true); on_document_selection_changed(); tool_selection::redraw_all(); } void move_tool::on_deactivate() { if(MOTION_NONE != m_current_motion) cancel_mouse_move(); clear_targets(); m_document_state.clear_cursor_signal().emit(); tool_selection::redraw_all(); } void move_tool::on_document_selection_changed() { target_list_changed(); update_targets(); reset(); // Update world position m_world_position.update(); } void move_tool::on_redraw(viewport::control& Viewport) { // Update target list update_targets(); // Redraw manipulators m_manipulators->redraw(Viewport, (m_visible_manipulators.internal_value() && target_number()), world_position(), world_orientation(), m_current_motion, k3d::point3(1.0, 1.0, 1.0)); } void move_tool::on_select(viewport::control& Viewport) { if(m_visible_manipulators.internal_value() && target_number()) m_manipulators->select(Viewport, world_position(), world_orientation()); } k3d::iproperty_collection* move_tool::get_property_collection() { return dynamic_cast(this); } viewport_input_model& move_tool::get_input_model() { return input_model(); } // LMB drag actions k3d::vector3 move_tool::mouse_move_to_3d(viewport::control& Viewport, const k3d::point2& Coordinates) { // Transform mouse move to a world move const k3d::point3 origin = world_position(); const k3d::matrix4 orientation = world_orientation(); const k3d::vector3 delta = m_manipulators->mouse_move(Viewport, Coordinates, origin, orientation); return delta; } k3d::vector3 move_tool::lbutton_drag(viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_DRAG == m_current_motion) { const k3d::vector3 delta = mouse_move_to_3d(Viewport, Coordinates); move_selection(delta); return delta; } if(MOTION_BOX_SELECT == m_current_motion) lmb_drag_box_select(Viewport, Coordinates); return k3d::vector3(0, 0, 0); } k3d::vector3 move_tool::mouse_move_action(viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_CLICK_DRAG == m_current_motion) { const k3d::vector3 delta = mouse_move_to_3d(Viewport, Coordinates); move_selection(delta); return delta; } return k3d::vector3(0, 0, 0); } void move_tool::move_selection(const k3d::vector3& Delta) { if(Delta == k3d::vector3(0, 0, 0)) return; const k3d::point3 new_position = m_move.internal_value() + Delta; m_move.set_value(new_position); } void move_tool::on_move(k3d::iunknown*) { if(m_mutex) return; move_targets(k3d::to_vector(m_move.internal_value())); // Update world position m_world_position.update(); } void move_tool::get_world_position(const std::vector& Hints, k3d::point3& Output) { Output = world_position(); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/move_tool.h ================================================ #ifndef K3DSDK_NGUI_MOVE_TOOL_H #define K3DSDK_NGUI_MOVE_TOOL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // move_tool /// Implementation of tool that implements standard geometry move behavior class move_tool : public transform_tool { typedef transform_tool transform_tool_base; public: move_tool(document_state& DocumentState, const std::string& Name); ~move_tool(); const k3d::string_t tool_type() { return "move_tool"; } private: void on_activate(); void on_deactivate(); void on_document_selection_changed(); void on_redraw(viewport::control& Viewport); void on_select(viewport::control& Viewport); k3d::iproperty_collection* get_property_collection(); viewport_input_model& get_input_model(); void on_lbutton_down(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); const k3d::key_modifiers modifiers = convert(Event.state); lbutton_down(Viewport, coordinates, modifiers); } void on_lbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_click(Viewport, coordinates); } void on_lbutton_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_start_drag(Viewport, coordinates); } void on_lbutton_drag(viewport::control& Viewport, const GdkEventMotion& Event) { k3d::point2 coordinates(Event.x, Event.y); // Off-screen wrap off_screen_warp(Viewport, coordinates); const k3d::vector3 move = lbutton_drag(Viewport, coordinates); } void on_lbutton_end_drag(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_end_drag(Viewport, coordinates); } void on_mbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); const k3d::key_modifiers modifiers = convert(Event.state); mbutton_click(Viewport, coordinates, modifiers); } void on_rbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); rbutton_click(Viewport, coordinates); } void on_mouse_move(viewport::control& Viewport, const GdkEventMotion& Event) { if(MOTION_CLICK_DRAG != m_current_motion) return; k3d::point2 coordinates(Event.x, Event.y); // Off-screen wrap off_screen_warp(Viewport, coordinates); const k3d::vector3 move = mouse_move_action(Viewport, coordinates); } // Manipulator functions virtual std::string manipulator_name(const k3d::selection::id ID) { return m_manipulators->constraint_name(ID); } virtual std::string get_manipulator(const manipulators_t& Manipulators) { if(!Manipulators.size()) return std::string(""); // Give priority to the middle sphere since the invisible planes intersect it if(std::find(Manipulators.begin(), Manipulators.end(), std::string("screen_xy")) != Manipulators.end()) return std::string("screen_xy"); return *Manipulators.begin(); } virtual void set_manipulator(const std::string ManipulatorName) { m_document_state.set_cursor_signal().emit(m_manipulators->set_constraint(ManipulatorName)); } virtual std::string get_constraint_name() { return m_manipulators->get_constraint_name(); } virtual void begin_mouse_move(const k3d::point2& Coordinates) { start_move(); reset(); m_manipulators->begin_mouse_move(Coordinates, world_position()); } virtual void update_constraint(viewport::control& Viewport, const k3d::point2& Coordinates) { m_manipulators->update_constraint(Viewport, Coordinates, world_position(), world_orientation()); begin_mouse_move(Coordinates); } virtual void reset() { m_mutex = true; m_move.set_value(k3d::point3(0, 0, 0)); m_mutex = false; } // LMB drag actions k3d::vector3 mouse_move_to_3d(viewport::control& Viewport, const k3d::point2& Coordinates); k3d::vector3 lbutton_drag(viewport::control& Viewport, const k3d::point2& Coordinates); k3d::vector3 mouse_move_action(viewport::control& Viewport, const k3d::point2& Coordinates); void move_selection(const k3d::vector3& Delta); void on_move(k3d::iunknown*); void get_world_position(const std::vector& Hints, k3d::point3& Output); /// Stores manipulators detail::imanipulators* m_manipulators; // Move value bool m_mutex; k3d_data(k3d::point3, immutable_name, explicit_change_signal, with_undo, local_storage, no_constraint, writable_property, no_serialization) m_move; k3d_data(k3d::point3, immutable_name, change_signal, no_undo, value_demand_storage, no_constraint, read_only_property, no_serialization) m_world_position; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_MOVE_TOOL_H ================================================ FILE: k3dsdk/ngui/navigation_input_model.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { /// Returns the angle of this vector with respect to the positive X axis in radians [-pi, pi] double angle(const k3d::vector2& Vector) { return atan2(Vector[1], Vector[0]); } } // namespace detail ///////////////////////////////////////////////////////////////////////////// // navigation_input_model::implementation struct navigation_input_model::implementation { implementation(document_state& DocumentState) : m_document_state(DocumentState) { } void on_button1_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { return_if_fail(interactive_target(Viewport)); return_if_fail(Viewport.camera()); if(Event.state & GDK_CONTROL_MASK) { motion_state = MOTION_ZOOM; } else if(Event.state & GDK_SHIFT_MASK) { motion_state = MOTION_PAN_TILT; } else { motion_state = MOTION_TRACK; } k3d::start_state_change_set(m_document_state.document(), K3D_CHANGE_SET_CONTEXT); m_last_mouse = screen_pointer_coordinates(Viewport); m_timer.restart(); switch(motion_state) { case MOTION_ZOOM: { break; } case MOTION_PAN_TILT: { break; } case MOTION_TRACK: { m_track_sensitivity = k3d::distance(k3d::position(Viewport.get_view_matrix()), Viewport.get_target()); // Adapt sensitivity to FOV double top = 0; double bottom = 0; double near = 0; if(k3d::iperspective* const perspective = dynamic_cast(&Viewport.camera()->projection())) { top = k3d::property::pipeline_value(perspective->top()); bottom = k3d::property::pipeline_value(perspective->bottom()); near = k3d::property::pipeline_value(perspective->near()); } else if(k3d::iorthographic* const orthographic = dynamic_cast(&Viewport.camera()->projection())) { top = k3d::property::pipeline_value(orthographic->top()); bottom = k3d::property::pipeline_value(orthographic->bottom()); near = k3d::property::pipeline_value(orthographic->near()); } if(near > 0) { const double height = top - bottom; const double tan_fov = height / near; m_track_sensitivity *= tan_fov; } break; } default: assert_not_reached(); } } void on_button2_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { return_if_fail(interactive_target(Viewport)); return_if_fail(Viewport.camera()); if(Event.state & GDK_CONTROL_MASK) { motion_state = MOTION_DOLLY; } else if(Event.state & GDK_SHIFT_MASK) { motion_state = MOTION_ROLL; } else { motion_state = MOTION_ORBIT; } k3d::start_state_change_set(m_document_state.document(), K3D_CHANGE_SET_CONTEXT); m_last_mouse = screen_pointer_coordinates(Viewport); m_timer.restart(); switch(motion_state) { case MOTION_DOLLY: { const double target_distance = k3d::distance(k3d::position(Viewport.get_view_matrix()), Viewport.get_target()); m_dolly_sensitivity = target_distance ? target_distance : 0.001; break; } case MOTION_ROLL: { break; } case MOTION_ORBIT: { break; } default: assert_not_reached(); } } void on_drag(viewport::control& Viewport, const GdkEventMotion& Event) { return_if_fail(Viewport.camera()); switch(motion_state) { case MOTION_TRACK: on_track_motion(Viewport, Event); break; case MOTION_DOLLY: on_dolly_motion(Viewport, Event); break; case MOTION_ZOOM: on_zoom_motion(Viewport, Event); break; case MOTION_PAN_TILT: on_pan_tilt_motion(Viewport, Event); break; case MOTION_ORBIT: on_orbit_motion(Viewport, Event); break; case MOTION_ROLL: on_roll_motion(Viewport, Event); break; } } void on_end_drag(viewport::control& Viewport, const GdkEventButton& Event) { return_if_fail(Viewport.camera()); Viewport.get_window()->set_cursor(); switch(motion_state) { case MOTION_TRACK: k3d::finish_state_change_set(m_document_state.document(), _("Track Viewport"), K3D_CHANGE_SET_CONTEXT); break; case MOTION_DOLLY: k3d::finish_state_change_set(m_document_state.document(), _("Dolly Viewport"), K3D_CHANGE_SET_CONTEXT); break; case MOTION_ZOOM: k3d::finish_state_change_set(m_document_state.document(), _("Zoom Viewport"), K3D_CHANGE_SET_CONTEXT); break; case MOTION_PAN_TILT: k3d::finish_state_change_set(m_document_state.document(), _("Pan & Tilt Viewport"), K3D_CHANGE_SET_CONTEXT); break; case MOTION_ORBIT: k3d::finish_state_change_set(m_document_state.document(), _("Orbit Viewport"), K3D_CHANGE_SET_CONTEXT); break; case MOTION_ROLL: k3d::finish_state_change_set(m_document_state.document(), _("Roll Viewport"), K3D_CHANGE_SET_CONTEXT); break; } } /// Called to track the viewport (move left/right/up/down in screen space) in response to mouse motion void on_track_motion(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look_vector = k3d::look_vector(view_matrix); const k3d::vector3 up_vector = k3d::up_vector(view_matrix); const k3d::vector3 right_vector = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); const k3d::point2 current_mouse = screen_pointer_coordinates(Viewport); const k3d::point2 current_ndc = ndc(Viewport, current_mouse); const k3d::point2 last_ndc = ndc(Viewport, m_last_mouse); const double direction = 1.0; // Change the sign to set the One True Tracking Behavior const double deltax = last_ndc[0] - current_ndc[0]; const double deltay = last_ndc[1] - current_ndc[1]; const k3d::vector3 offset = (m_track_sensitivity * direction * deltax * right_vector) + (m_track_sensitivity * direction * deltay * up_vector); const k3d::point3 new_position = position + offset; const k3d::point3 new_target = Viewport.get_target() + offset; const k3d::matrix4 new_view_matrix = k3d::view_matrix(look_vector, up_vector, new_position); Viewport.set_view_matrix(new_view_matrix); Viewport.set_target(new_target); m_last_mouse = current_mouse; wrap_mouse_pointer(Viewport); } /// Called to dolly the viewport (move forward/backward in screen space) in response to mouse motion void on_dolly_motion(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::point2 current_mouse = screen_pointer_coordinates(Viewport); const double deltay = ndc(Viewport, current_mouse)[1] - ndc(Viewport, m_last_mouse)[1]; const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look_vector = k3d::look_vector(view_matrix); const k3d::vector3 up_vector = k3d::up_vector(view_matrix); const k3d::vector3 right_vector = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); const k3d::point3 new_position = position + (deltay * m_dolly_sensitivity * look_vector); const k3d::matrix4 new_view_matrix = k3d::view_matrix(look_vector, up_vector, new_position); Viewport.set_view_matrix(new_view_matrix); m_last_mouse = current_mouse; wrap_mouse_pointer(Viewport); } /// Called to zoom the viewport (change focal length) in response to mouse motion void on_zoom_motion(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::point2 current_mouse = screen_pointer_coordinates(Viewport); const k3d::point2 current_ndc = ndc(Viewport, current_mouse); const k3d::point2 last_ndc = ndc(Viewport, m_last_mouse); const double sensitivity = 4.0; const double zoom_factor = (current_ndc[1] < last_ndc[1]) ? std::pow(sensitivity, last_ndc[1] - current_ndc[1]) : std::pow(1 / sensitivity, current_ndc[1] - last_ndc[1]); k3d::iprojection* const projection = Viewport.camera() ? &Viewport.camera()->projection() : 0; return_if_fail(projection); if(k3d::iperspective* const perspective = dynamic_cast(projection)) { const double left = boost::any_cast(perspective->left().property_internal_value()) * zoom_factor; const double right = boost::any_cast(perspective->right().property_internal_value()) * zoom_factor; const double top = boost::any_cast(perspective->top().property_internal_value()) * zoom_factor; const double bottom = boost::any_cast(perspective->bottom().property_internal_value()) * zoom_factor; k3d::property::set_internal_value(perspective->left(), left); k3d::property::set_internal_value(perspective->right(), right); k3d::property::set_internal_value(perspective->top(), top); k3d::property::set_internal_value(perspective->bottom(), bottom); m_last_mouse = current_mouse; wrap_mouse_pointer(Viewport); return; } if(k3d::iorthographic* const orthographic = dynamic_cast(projection)) { const double left = boost::any_cast(orthographic->left().property_internal_value()) * zoom_factor; const double right = boost::any_cast(orthographic->right().property_internal_value()) * zoom_factor; const double top = boost::any_cast(orthographic->top().property_internal_value()) * zoom_factor; const double bottom = boost::any_cast(orthographic->bottom().property_internal_value()) * zoom_factor; k3d::property::set_internal_value(orthographic->left(), left); k3d::property::set_internal_value(orthographic->right(), right); k3d::property::set_internal_value(orthographic->top(), top); k3d::property::set_internal_value(orthographic->bottom(), bottom); m_last_mouse = current_mouse; wrap_mouse_pointer(Viewport); return; } k3d::log() << error << "Unknown projection type" << std::endl; } /// Called to orbit the viewport (rotate it around an arbitrary origin) in response to mouse motion void on_orbit_motion(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look_vector = k3d::look_vector(view_matrix); const k3d::vector3 up_vector = k3d::up_vector(view_matrix); const k3d::vector3 right_vector = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); const k3d::point3 target = Viewport.get_target(); const k3d::point2 current_mouse = screen_pointer_coordinates(Viewport); const k3d::point2 current_ndc = ndc(Viewport, current_mouse); const k3d::point2 last_ndc = ndc(Viewport, m_last_mouse); /* This snippet orbits the camera within the view plane. Pros: works intuitively regardless of camera orientation, completely axis-independent. Cons: weak for modeling, the camera quickly becomes "tilted" WRT the ground plane. const k3d::point3 target = Viewport.get_target(); const double target_distance = k3d::length(position - target); const double direction = 1.0; const double sensitivity = k3d::pi() * target_distance; const double deltax = last_ndc[0] - current_ndc[0]; const double deltay = last_ndc[1] - current_ndc[1]; const k3d::vector3 offset = (sensitivity * direction * deltax * right_vector) + (sensitivity * direction * deltay * up_vector); k3d::point3 new_position = position + offset; new_position *= (target_distance / k3d::length(target - new_position)); const k3d::vector3 new_look_vector = k3d::to_vector(target - new_position); Viewport.set_view_matrix(k3d::view_matrix(new_look_vector, up_vector, right_vector, new_position)); */ const double direction = -1.0; const double sensitivity = k3d::pi(); const double ysensitivity = -1.0; const double deltax = last_ndc[0] - current_ndc[0]; const double deltay = last_ndc[1] - current_ndc[1]; const k3d::matrix4 matrix = k3d::rotate3(k3d::angle_axis(sensitivity * direction * deltax, Viewport.get_up_axis())) * k3d::rotate3(k3d::angle_axis(ysensitivity * sensitivity * direction * deltay, right_vector)); const k3d::vector3 new_look_vector = matrix * look_vector; const k3d::vector3 new_up_vector = matrix * up_vector; const k3d::vector3 new_right_vector = matrix * right_vector; const k3d::point3 new_position = target + (matrix * (position - target)); const k3d::matrix4 new_view_matrix = k3d::view_matrix(new_look_vector, new_up_vector, new_position); Viewport.set_view_matrix(new_view_matrix); m_last_mouse = current_mouse; wrap_mouse_pointer(Viewport); } /// Called to aim the viewport (pan and tilt) in response to mouse motion void on_pan_tilt_motion(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look_vector = k3d::look_vector(view_matrix); const k3d::vector3 up_vector = k3d::up_vector(view_matrix); const k3d::vector3 right_vector = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); const double target_distance = k3d::distance(k3d::position(Viewport.get_view_matrix()), Viewport.get_target()); const k3d::point2 current_mouse = screen_pointer_coordinates(Viewport); const k3d::point2 current_ndc = ndc(Viewport, current_mouse); const k3d::point2 last_ndc = ndc(Viewport, m_last_mouse); const double theta = current_ndc[0] - last_ndc[0]; const double phi = -(current_ndc[1] - last_ndc[1]); const k3d::matrix4 matrix = k3d::rotate3(k3d::angle_axis(theta, up_vector)) * k3d::rotate3(k3d::angle_axis(phi, right_vector)); const k3d::vector3 new_look_vector = matrix * look_vector; const k3d::vector3 new_up_vector = matrix * up_vector; const k3d::vector3 new_right_vector = matrix * right_vector; const k3d::matrix4 new_view_matrix = k3d::view_matrix(new_look_vector, new_up_vector, position); const k3d::point3 new_target = position + (target_distance * k3d::normalize(new_look_vector)); Viewport.set_view_matrix(new_view_matrix); Viewport.set_target(new_target); m_last_mouse = current_mouse; wrap_mouse_pointer(Viewport); } /// Called to roll the viewport (dutch tilt) in response to mouse motion void on_roll_motion(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look_vector = k3d::look_vector(view_matrix); const k3d::vector3 up_vector = k3d::up_vector(view_matrix); const k3d::vector3 right_vector = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); const k3d::point2 current_mouse = screen_pointer_coordinates(Viewport); const k3d::point2 current_ndc = ndc(Viewport, current_mouse); const k3d::point2 last_ndc = ndc(Viewport, m_last_mouse); const double theta = detail::angle(k3d::to_vector(current_ndc)) - detail::angle(k3d::to_vector(last_ndc)); const k3d::matrix4 roll_matrix = k3d::rotate3(k3d::angle_axis(-theta, look_vector)); const k3d::vector3 new_up_vector = roll_matrix * up_vector; const k3d::vector3 new_right_vector = roll_matrix * right_vector; const k3d::matrix4 new_view_matrix = k3d::view_matrix(look_vector, new_up_vector, position); Viewport.set_view_matrix(new_view_matrix); m_last_mouse = current_mouse; } /// Called to dolly the viewport (move forward / backward in screen space) in response to mouse-wheel motion void on_scroll(viewport::control& Viewport, const GdkEventScroll& Event) { return_if_fail(Viewport.camera()); const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look = k3d::look_vector(view_matrix); const k3d::vector3 up = k3d::up_vector(view_matrix); const k3d::vector3 right = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); const double target_distance = k3d::distance(position, Viewport.get_target()); if(!target_distance) m_dolly_sensitivity = 0.001; else m_dolly_sensitivity = target_distance * 0.1; double direction = 0; std::string direction_label; std::string change_set_label; switch(Event.direction) { case GDK_SCROLL_UP: direction = 1; direction_label = "forward"; change_set_label = _("Dolly Forward"); break; case GDK_SCROLL_DOWN: direction = -1; direction_label = "backward"; change_set_label = _("Dolly Backward"); break; default: break; } const k3d::matrix4 new_view_matrix = k3d::view_matrix(look, up, position + (m_dolly_sensitivity * direction * look)); k3d::record_state_change_set change_set(m_document_state.document(), change_set_label, K3D_CHANGE_SET_CONTEXT); Viewport.set_view_matrix(new_view_matrix); } void on_button1_click(viewport::control& Viewport, const GdkEventButton& Event) { return_if_fail(Viewport.camera()); const k3d::selection::record selection = Viewport.pick_node(k3d::point2(Event.x, Event.y)); if(!selection.empty()) { // Get the new target position in world coordinates ... k3d::inode* const node = k3d::selection::get_node(selection); const k3d::point3 new_target = node ? k3d::world_position(*node) : k3d::point3(0, 0, 0); const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look_vector = k3d::look_vector(view_matrix); const k3d::vector3 up_vector = k3d::up_vector(view_matrix); const k3d::vector3 right_vector = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); const k3d::vector3 new_look_vector = new_target - position; const k3d::vector3 new_right_vector = new_look_vector ^ Viewport.get_up_axis(); const k3d::vector3 new_up_vector = new_right_vector ^ new_look_vector; const k3d::matrix4 new_view_matrix = k3d::view_matrix(new_look_vector, new_up_vector, position); k3d::record_state_change_set change_set(m_document_state.document(), _("Pick Target"), K3D_CHANGE_SET_CONTEXT); Viewport.set_view_matrix(new_view_matrix); Viewport.set_target(new_target); } else { k3d::record_state_change_set change_set(m_document_state.document(), _("Aim Selection"), K3D_CHANGE_SET_CONTEXT); aim_selection(m_document_state, Viewport); } } void on_context_menu(viewport::control& Viewport, const GdkEventButton& Event) { m_document_state.popup_context_menu(); } void wrap_mouse_pointer(viewport::control& Viewport) { int x, y; Gdk::ModifierType modifiers; Gdk::Display::get_default()->get_pointer(x, y, modifiers); const int border = 5; const int width = Viewport.get_screen()->get_width(); const int height = Viewport.get_screen()->get_height(); if(x < border) { m_last_mouse = k3d::point2(width - (border + 1), y); interactive::warp_pointer(k3d::point2(width - (border + 1), y)); } else if(width - x < border) { m_last_mouse = k3d::point2((border + 1), y); interactive::warp_pointer(k3d::point2((border + 1), y)); } if(y < border) { m_last_mouse = k3d::point2(x, height - (border + 1)); interactive::warp_pointer(k3d::point2(x, height - (border + 1))); } else if(height - y < border) { m_last_mouse = k3d::point2(x, (border + 1)); interactive::warp_pointer(k3d::point2(x, (border + 1))); } } k3d::iunknown* interactive_target(viewport::control& Viewport) { return Viewport.camera() ? &Viewport.camera()->navigation_target() : 0; } k3d::iunknown* interactive_target(k3d::iunknown& Unknown) { viewport::control* const control = dynamic_cast(&Unknown); return_val_if_fail(control, 0); return control->camera() ? &control->camera()->navigation_target() : 0; } /// Converts screen coordinates into normalized device coordinates in the range [-0.5, 0.5] const k3d::point2 ndc(viewport::control& Viewport, const k3d::point2 ScreenCoords) { int x, y; Viewport.get_window()->get_origin(x, y); const double width = Viewport.get_width(); const double height = Viewport.get_height(); return_val_if_fail(width && height, k3d::point2()); return k3d::point2( ((ScreenCoords[0] - x) / width) - 0.5, 0.5 - ((ScreenCoords[1] - y) / height)); } /// Returns the current mouse position in screen coordinates const k3d::point2 screen_pointer_coordinates(viewport::control& Viewport) { int x, y; Gdk::ModifierType modifiers; Viewport.get_display()->get_pointer(x, y, modifiers); return k3d::point2(x, y); } /// Enumerates mouse motion types typedef enum { MOTION_TRACK, MOTION_DOLLY, MOTION_ZOOM, MOTION_PAN_TILT, MOTION_ORBIT, MOTION_ROLL, } motion_state_t; /// Stores a reference to the owning document document_state& m_document_state; /// Stores the current mouse motion type motion_state_t motion_state; /// Stores the most recent mouse pointer coordinates k3d::point2 m_last_mouse; /// Controls the sensitivity of tracking movement while dragging double m_track_sensitivity; /// Controls the sensitivity of dollying movement while dragging double m_dolly_sensitivity; /// Context menu std::unique_ptr m_context_menu; k3d::timer m_timer; }; ///////////////////////////////////////////////////////////////////////////// // navigation_input_model navigation_input_model::navigation_input_model(document_state& DocumentState) : m_implementation(new implementation(DocumentState)) { } navigation_input_model::~navigation_input_model() { delete m_implementation; } void navigation_input_model::on_button1_click(viewport::control& Viewport, const GdkEventButton& Event) { m_implementation->on_button1_click(Viewport, Event); } void navigation_input_model::on_button1_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { m_implementation->on_button1_start_drag(Viewport, Event); } void navigation_input_model::on_button1_drag(viewport::control& Viewport, const GdkEventMotion& Event) { m_implementation->on_drag(Viewport, Event); } void navigation_input_model::on_button1_end_drag(viewport::control& Viewport, const GdkEventButton& Event) { m_implementation->on_end_drag(Viewport, Event); } void navigation_input_model::on_button2_click(viewport::control& Viewport, const GdkEventButton& Event) { m_implementation->on_context_menu(Viewport, Event); } void navigation_input_model::on_button2_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { m_implementation->on_button2_start_drag(Viewport, Event); } void navigation_input_model::on_button2_drag(viewport::control& Viewport, const GdkEventMotion& Event) { m_implementation->on_drag(Viewport, Event); } void navigation_input_model::on_button2_end_drag(viewport::control& Viewport, const GdkEventButton& Event) { m_implementation->on_end_drag(Viewport, Event); } void navigation_input_model::on_scroll(viewport::control& Viewport, const GdkEventScroll& Event) { m_implementation->on_scroll(Viewport, Event); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/navigation_input_model.h ================================================ #ifndef K3DSDK_NGUI_NAVIGATION_INPUT_MODEL_H #define K3DSDK_NGUI_NAVIGATION_INPUT_MODEL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { class document_state; ///////////////////////////////////////////////////////////////////////////// // navigation_input_model /// Input model implementation that handles standard viewport navigation and context menus class navigation_input_model { public: navigation_input_model(document_state& DocumentState); ~navigation_input_model(); void on_button1_click(viewport::control& Viewport, const GdkEventButton& Event); void on_button1_start_drag(viewport::control& Viewport, const GdkEventMotion& Event); void on_button1_drag(viewport::control& Viewport, const GdkEventMotion& Event); void on_button1_end_drag(viewport::control& Viewport, const GdkEventButton& Event); void on_button2_click(viewport::control& Viewport, const GdkEventButton& Event); void on_button2_start_drag(viewport::control& Viewport, const GdkEventMotion& Event); void on_button2_drag(viewport::control& Viewport, const GdkEventMotion& Event); void on_button2_end_drag(viewport::control& Viewport, const GdkEventButton& Event); void on_scroll(viewport::control& Viewport, const GdkEventScroll& Event); private: struct implementation; implementation* const m_implementation; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_NAVIGATION_INPUT_MODEL_H ================================================ FILE: k3dsdk/ngui/node.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace ngui { namespace node { void show(inode& Node) { // Note: in the future, visibility should be handled using painter links, not properties. // See http://www.k-3d.org/wiki/Node_Visibility if(iproperty* const prop = property::get(Node, "viewport_visible")) property::set_internal_value(*prop, true); if(iproperty* const prop = property::get(Node, "render_final")) property::set_internal_value(*prop, true); } void hide(inode& Node) { // Note: in the future, visibility should be handled using painter links, not properties. // See http://www.k-3d.org/wiki/Node_Visibility if(iproperty* const prop = property::get(Node, "viewport_visible")) property::set_internal_value(*prop, false); if(iproperty* const prop = property::get(Node, "render_final")) property::set_internal_value(*prop, false); } } // namespace node } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/node.h ================================================ #ifndef K3DSDK_NGUI_NODE_H #define K3DSDK_NGUI_NODE_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { class inode; namespace ngui { namespace node { /// Make the given node visible. void show(inode& Node); /// Make the given node invisible. void hide(inode& Node); } // namespace node } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_NODE_H ================================================ FILE: k3dsdk/ngui/node_chooser.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements k3d::node_chooser, which provides a user interface for either creating new, or choosing existing, K-3D nodes \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace node_chooser { namespace detail { /// Provides an implementation of k3d::node_chooser::iselection_filter that filters based on a k3d::iproperty node class property_filter : public iselection_filter { public: property_filter(k3d::iproperty& Property) : m_node_property(dynamic_cast(&Property)) { } bool allow_none() { return m_node_property && m_node_property->property_allow_none(); } bool allow(k3d::iplugin_factory& Factory) { return m_node_property && m_node_property->property_allow(Factory); } bool allow(k3d::inode& Object) { return m_node_property && m_node_property->property_allow(Object); } private: k3d::inode_property* const m_node_property; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data, std::unique_ptr Filter) : base(false, 0), m_data(std::move(Data)), m_filter(std::move(Filter)), m_label(new Gtk::Label()), m_menu_button(new Gtk::Button()), m_edit_button(new Gtk::Button()) { m_menu_button->add(*Gtk::manage(m_label)); m_menu_button->signal_clicked().connect(sigc::mem_fun(*this, &control::on_choose)); pack_start(*manage(m_menu_button), Gtk::PACK_EXPAND_WIDGET); m_edit_button->add(*Gtk::manage(new Gtk::Arrow(Gtk::ARROW_RIGHT, Gtk::SHADOW_NONE))); m_edit_button->signal_clicked().connect(sigc::mem_fun(*this, &control::on_edit)); pack_start(*manage(m_edit_button), Gtk::PACK_SHRINK); data_changed(0); if(m_data.get()) { m_data->document().document().nodes().add_nodes_signal().connect(sigc::mem_fun(*this, &control::on_nodes_added)); m_data->document().document().nodes().remove_nodes_signal().connect(sigc::mem_fun(*this, &control::on_nodes_removed)); m_data->changed_signal().connect(sigc::mem_fun(*this, &control::data_changed)); } } void control::on_nodes_added(const k3d::inode_collection::nodes_t&) { reset_menu(); } void control::on_nodes_removed(const k3d::inode_collection::nodes_t&) { reset_menu(); } void control::data_changed(k3d::ihint*) { return_if_fail(m_data.get()); m_label->set_text(m_data->node() ? m_data->node()->name() : _("--None--")); reset_menu(); } void control::reset_menu() { m_menu.reset(); m_menu_item_create.clear(); m_menu_item_select.clear(); } void control::on_choose() { return_if_fail(m_data.get()); return_if_fail(m_filter.get()); // Build the menu on-demand ... if(!m_menu.get()) { m_menu.reset(new Gtk::Menu()); // Insert a "none" choice ... if(m_filter->allow_none()) { Gtk::MenuItem* const menu_item = new Gtk::MenuItem(_("--None--")); m_menu_item_select[std::string()] = menu_item; menu_item->signal_activate().connect(sigc::mem_fun(*this, &control::on_select_none)); m_menu->items().push_back(*manage(menu_item)); } // Insert choices for creating new nodes ... const k3d::plugin::factory::collection_t unsorted_factories = k3d::plugin::factory::lookup(); std::vector sorted_factories(unsorted_factories.begin(), unsorted_factories.end()); std::sort(sorted_factories.begin(), sorted_factories.end(), k3d::sort_by_name()); for(std::vector::const_iterator factory = sorted_factories.begin(); factory != sorted_factories.end(); ++factory) { // Filter choices ... if(!m_filter->allow(**factory)) continue; // Create a "new" menu item for each factory ... const std::string label = k3d::string_cast(boost::format(_("--New %1%")) % (*factory)->name()); Gtk::MenuItem* const menu_item = new Gtk::MenuItem(label); m_menu_item_create[(*factory)->name()] = menu_item; menu_item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &control::on_create_node), *factory)); m_menu->items().push_back(*manage(menu_item)); } // Insert choices for selecting existing nodes ... k3d::inode_collection::nodes_t sorted_nodes = m_data->document().document().nodes().collection(); std::sort(sorted_nodes.begin(), sorted_nodes.end(), k3d::sort_by_name()); for(k3d::inode_collection::nodes_t::const_iterator handle = sorted_nodes.begin(); handle != sorted_nodes.end(); ++handle) { k3d::inode* const node = *handle; // Filter choices ... if(!m_filter->allow(*node)) continue; // Create a menu item for each node ... Gtk::MenuItem* const menu_item = new Gtk::MenuItem(node->name()); m_menu_item_select[node->name()] = menu_item; menu_item->signal_activate().connect(sigc::bind(sigc::mem_fun(*this, &control::on_select_node), node)); m_menu->items().push_back(*manage(menu_item)); } } m_menu->show_all(); m_menu->popup(1, gtk_get_current_event_time()); } void control::on_select_none() { return_if_fail(m_data.get()); if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_data->set_node(0); if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), _("Select None"), K3D_CHANGE_SET_CONTEXT); } void control::on_create_node(k3d::iplugin_factory* const Factory) { return_if_fail(Factory); return_if_fail(m_data.get()); if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); k3d::inode* const node = k3d::plugin::create(*Factory, m_data->document().document(), k3d::unique_name(m_data->document().document().nodes(), Factory->name())); assert_warning(node); m_data->set_node(node); if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), k3d::string_cast(boost::format(_("Create %1%")) % Factory->name()), K3D_CHANGE_SET_CONTEXT); if(node) panel::mediator(m_data->document().document()).set_focus(*node); } void control::on_select_node(k3d::inode* const Object) { return_if_fail(Object); return_if_fail(m_data.get()); if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_data->set_node(Object); if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), k3d::string_cast(boost::format(_("Select %1%")) % Object->name()), K3D_CHANGE_SET_CONTEXT); } void control::on_edit() { return_if_fail(m_data.get()); if(!m_data->node()) return; panel::mediator(m_data->document().document()).set_focus(*m_data->node()); } std::unique_ptr filter(k3d::iproperty& Data) { return std::unique_ptr(new detail::property_filter(Data)); } } // namespace node_chooser } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/node_chooser.h ================================================ #ifndef K3DSDK_NGUI_NODE_CHOOSER_H #define K3DSDK_NGUI_NODE_CHOOSER_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace Gtk { class Button; } namespace Gtk { class Label; } namespace Gtk { class Menu; } namespace Gtk { class MenuItem; } namespace k3d { class idocument; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { class document_state; namespace node_chooser { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an node that proxies a data source for an node_chooser::control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Called to return the underlying data value virtual k3d::inode* node() = 0; /// Called to set a new data value virtual void set_node(k3d::inode* Object) = 0; /// Called to return the owning document virtual document_state& document() = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // iselection_filter /// Abstract interface for an node that will be queried to filter the set of available choices class iselection_filter { public: virtual ~iselection_filter() {} /// Return true iff "None" should be available to the user as a selection virtual bool allow_none() = 0; /// Return true iff the specified plugin type should be available to the user as a "Create XXX" selection virtual bool allow(k3d::iplugin_factory& Factory) = 0; /// Return true iff the specified inode should be available to the user for selection virtual bool allow(k3d::inode& Object) = 0; protected: iselection_filter() {} iselection_filter(const idata_proxy& RHS) {} iselection_filter& operator=(const idata_proxy& RHS) { return *this; } }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for choosing nodes (either existing, or newly-created) (i.e. the view and the controller from model-view-controller) class control : public Gtk::HBox { typedef Gtk::HBox base; public: control(std::unique_ptr Data, std::unique_ptr Filter); private: /// Called when new nodes are added to the document void on_nodes_added(const k3d::inode_collection::nodes_t&); /// Called when nodes are removed from the document void on_nodes_removed(const k3d::inode_collection::nodes_t&); /// Called whenever the underlying data source changes void data_changed(k3d::ihint*); /// Called to display the set of available choices void on_choose(); /// Called when the user decides to select no node void on_select_none(); /// Called when the user wants to create a new node void on_create_node(k3d::iplugin_factory* const Factory); /// Called when the user selects an existing node void on_select_node(k3d::inode* const Object); /// Called when the user wants to edit the current choice void on_edit(); /// Resets the contents of the popup menu so it can be recreated the next time it's needed void reset_menu(); /// Stores a reference to the underlying data node std::unique_ptr m_data; /// Stores a filter node for controlling the set of available choices std::unique_ptr m_filter; Gtk::Label* const m_label; Gtk::Button* const m_menu_button; Gtk::Button* const m_edit_button; std::unique_ptr m_menu; std::map m_menu_item_create; std::map m_menu_item_select; }; /// Provides an implementation of k3d::node_chooser::idata_proxy that supports any data source that supports the node(), set_node(), node_collection(), and changed_signal() concepts template class data_proxy : public idata_proxy { public: data_proxy(document_state& DocumentState, data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_data(Data), m_document_state(DocumentState) { } k3d::inode* node() { return m_data.node(); } void set_node(k3d::inode* Object) { m_data.set_node(Object); } document_state& document() { return m_document_state; } changed_signal_t& changed_signal() { return m_data.changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_data; document_state& m_document_state; }; /// Specialization of k3d::node_chooser::data_proxy for use with k3d::iproperty objects template<> class data_proxy : public idata_proxy { public: typedef k3d::iproperty data_t; data_proxy(document_state& DocumentState, data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_readable_data(Data), m_writable_data(dynamic_cast(&Data)), m_document_state(DocumentState) { } k3d::inode* node() { return boost::any_cast(m_readable_data.property_internal_value()); } void set_node(k3d::inode* Object) { return_if_fail(m_writable_data); m_writable_data->property_set_value(Object); } document_state& document() { return m_document_state; } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_readable_data; k3d::iwritable_property* const m_writable_data; document_state& m_document_state; }; /// Convenience factory function for creating node_chooser::idata_proxy objects template std::unique_ptr proxy(document_state& DocumentState, data_t& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = "") { return std::unique_ptr(new data_proxy(DocumentState, Data, StateRecorder, ChangeMessage)); } /// Provides an implementation of k3d::node_chooser::iselection_filter that filters based on a specific interface type template class selection_filter : public iselection_filter { public: selection_filter(const bool AllowNone) : m_allow_none(AllowNone) { } bool allow_none() { return m_allow_none; } bool allow(k3d::iplugin_factory& Factory) { return Factory.implements(typeid(interface_t)); } bool allow(k3d::inode& Object) { return dynamic_cast(&Object) ? true : false; } private: bool m_allow_none; }; /// Convenience factory function for creating k3d::node_chooser::iselection_filter nodes template std::unique_ptr filter(const bool AllowNone) { return std::unique_ptr(new selection_filter(AllowNone)); } /// Convenience factory function for creating k3d::node_chooser::iselection_filter nodes for use with k3d::iproperty nodes std::unique_ptr filter(k3d::iproperty& Data); } // namespace node_chooser } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_NODE_CHOOSER_H ================================================ FILE: k3dsdk/ngui/node_collection_chooser.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace node_collection_chooser { ///////////////////////////////////////////////////////////////////////////// // list_window class list_window : public application_window, public asynchronous_update { public: list_window(const boost::shared_ptr& Model, k3d::istate_recorder* StateRecorder) : m_model(Model), m_state_recorder(StateRecorder), m_block_update(false), m_block_toggle(false) { set_title(m_model->label()); set_role("node_collection_chooser"); resize(400, 400); set_position(Gtk::WIN_POS_CENTER); m_model->connect_changed_signal(sigc::mem_fun(*this, &list_window::on_model_changed)); Gtk::ScrolledWindow* const scrolled_window = new Gtk::ScrolledWindow(); scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolled_window->add(m_view); m_view_model = Gtk::ListStore::create(m_columns); m_view_model->signal_row_changed().connect(sigc::mem_fun(*this, &list_window::on_selection_toggled)); m_view.set_model(m_view_model); m_view.set_headers_visible(true); m_view.set_reorderable(false); m_view.get_selection()->set_mode(Gtk::SELECTION_EXTENDED); m_view.append_column("", m_columns.icon); m_view.append_column(_("Name"), m_columns.name); m_view.append_column_editable(_("Selected"), m_columns.selected); Gtk::HButtonBox* const hbox = new Gtk::HButtonBox(Gtk::BUTTONBOX_END); hbox->pack_start(*Gtk::manage( new Gtk::Button(_("Select All")) << connect_button(sigc::mem_fun(*this, &list_window::on_select_all)) ), Gtk::PACK_SHRINK); hbox->pack_start(*Gtk::manage( new Gtk::Button(_("Deselect All")) << connect_button(sigc::mem_fun(*this, &list_window::on_deselect_all)) ), Gtk::PACK_SHRINK); hbox->pack_start(*Gtk::manage( new Gtk::Button(_("Toggle Selected")) << connect_button(sigc::mem_fun(*this, &list_window::on_toggle_selected)) ), Gtk::PACK_SHRINK); Gtk::VBox* const vbox = new Gtk::VBox(); vbox->pack_start(*Gtk::manage(hbox), Gtk::PACK_SHRINK); vbox->pack_start(*Gtk::manage(scrolled_window), Gtk::PACK_EXPAND_WIDGET); add(*Gtk::manage(vbox)); schedule_update(); } private: /// Called to refresh the contents of the list view ... void on_update() { const k3d::inode_collection_property::nodes_t available_nodes = m_model->available_nodes(); const k3d::inode_collection_property::nodes_t selected_nodes = m_model->selected_nodes(); m_block_toggle = true; m_view_model->clear(); for(k3d::inode_collection_property::nodes_t::const_iterator node = available_nodes.begin(); node != available_nodes.end(); ++node) { Gtk::TreeRow row = *m_view_model->append(); row[m_columns.node] = (*node); row[m_columns.icon] = quiet_load_icon((**node).factory().name(), Gtk::ICON_SIZE_MENU); row[m_columns.name] = (**node).name(); row[m_columns.selected] = std::count(selected_nodes.begin(), selected_nodes.end(), *node); } m_block_toggle = false; } /// Called whenever a checkbox changes state ... void on_selection_toggled(const Gtk::TreeModel::Path& path, const Gtk::TreeModel::iterator& iterator) { if(m_block_toggle) return; if(m_state_recorder) m_state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_block_update = true; Gtk::TreeRow row = *iterator; k3d::inode* const node = row[m_columns.node]; const k3d::bool_t selected = row[m_columns.selected]; k3d::inode_collection_property::nodes_t selected_nodes = m_model->selected_nodes(); if(selected) { selected_nodes.push_back(node); } else { selected_nodes.erase(std::remove(selected_nodes.begin(), selected_nodes.end(), node), selected_nodes.end()); } m_model->set_selected_nodes(selected_nodes); m_block_update = false; if(m_state_recorder) m_state_recorder->commit_change_set(m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), k3d::string_cast(boost::format(_("Change %1%")) % m_model->label()), K3D_CHANGE_SET_CONTEXT); } /// Called when the user presses the "toggle selected" button void on_toggle_selected() { if(m_state_recorder) m_state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); k3d::inode_collection_property::nodes_t selected_nodes = m_model->selected_nodes(); const std::vector selected_rows = m_view.get_selection()->get_selected_rows(); for(int i = 0; i != selected_rows.size(); ++i) { Gtk::TreeRow row = *m_view_model->get_iter(selected_rows[i]); k3d::inode* const node = row[m_columns.node]; const k3d::bool_t selected = !row[m_columns.selected]; if(selected) { selected_nodes.push_back(node); } else { selected_nodes.erase(std::remove(selected_nodes.begin(), selected_nodes.end(), node), selected_nodes.end()); } } m_model->set_selected_nodes(selected_nodes); if(m_state_recorder) m_state_recorder->commit_change_set(m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), k3d::string_cast(boost::format(_("Toggle Selected %1%")) % m_model->label()), K3D_CHANGE_SET_CONTEXT); } /// Called whenever the underlying data model changes ... void on_model_changed() { if(m_block_update) return; schedule_update(); } void on_select_all() { m_view.get_selection()->select_all(); } void on_deselect_all() { m_view.get_selection()->unselect_all(); } class columns : public Gtk::TreeModelColumnRecord { public: columns() { add(node); add(icon); add(name); add(selected); } Gtk::TreeModelColumn node; Gtk::TreeModelColumn > icon; Gtk::TreeModelColumn name; Gtk::TreeModelColumn selected; }; const boost::shared_ptr m_model; k3d::istate_recorder* const m_state_recorder; columns m_columns; Glib::RefPtr m_view_model; Gtk::TreeView m_view; bool m_block_update; bool m_block_toggle; }; ///////////////////////////////////////////////////////////////////////////// // property_model class property_model : public imodel { public: property_model(k3d::iproperty& Property) : m_property(Property) { if(m_property.property_node()) { m_property.property_node()->document().nodes().add_nodes_signal().connect(sigc::hide(m_changed_signal.make_slot())); m_property.property_node()->document().nodes().remove_nodes_signal().connect(sigc::hide(m_changed_signal.make_slot())); m_property.property_node()->document().nodes().rename_node_signal().connect(sigc::hide(m_changed_signal.make_slot())); } m_property.property_changed_signal().connect(sigc::hide(m_changed_signal.make_slot())); } const Glib::ustring label() { Glib::ustring result = m_property.property_label(); if(m_property.property_node()) result = m_property.property_node()->name() + " " + result; return result; } const k3d::inode_collection_property::nodes_t available_nodes() { if(m_property.property_node()) { const k3d::inode_collection_property::nodes_t all_nodes = m_property.property_node()->document().nodes().collection(); if(k3d::inode_collection_property* const node_collection_property = dynamic_cast(&m_property)) { k3d::inode_collection_property::nodes_t filtered_nodes; for(k3d::inode_collection_property::nodes_t::const_iterator node = all_nodes.begin(); node != all_nodes.end(); ++node) { if(node_collection_property->property_allow(**node)) filtered_nodes.push_back(*node); } return filtered_nodes; } else { return all_nodes; } } return k3d::inode_collection_property::nodes_t(); } const k3d::inode_collection_property::nodes_t selected_nodes() { return k3d::property::internal_value(m_property); } void set_selected_nodes(const k3d::inode_collection_property::nodes_t& Value) { return_if_fail(k3d::property::set_internal_value(m_property, Value)); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_changed_signal.connect(Slot); } private: k3d::iproperty& m_property; sigc::signal m_changed_signal; }; ///////////////////////////////////////////////////////////////////////////// // model imodel* const model(k3d::iproperty& Property) { return new property_model(Property); } ///////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation(imodel* const Model, k3d::istate_recorder* StateRecorder) : m_model(Model), m_state_recorder(StateRecorder) { m_delete_signal.emit(); } const boost::shared_ptr m_model; k3d::istate_recorder* const m_state_recorder; sigc::signal m_delete_signal; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(imodel* const Model, k3d::istate_recorder* StateRecorder) : base(false, 0), m_implementation(new implementation(Model, StateRecorder)) { Gtk::Button* const edit_button = new Gtk::Button(_("Edit")); edit_button->signal_clicked().connect(sigc::mem_fun(*this, &control::on_edit)); pack_start(*manage(edit_button), Gtk::PACK_SHRINK); } control::~control() { delete m_implementation; } void control::on_edit() { return_if_fail(m_implementation->m_model.get()); list_window* const window = new list_window(m_implementation->m_model, m_implementation->m_state_recorder); m_implementation->m_delete_signal.connect(sigc::mem_fun(*window, &list_window::close)); window->show_all(); } } // namespace node_collection_chooser } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/node_collection_chooser.h ================================================ #ifndef K3DSDK_NGUI_NODE_COLLECTION_CHOOSER_H #define K3DSDK_NGUI_NODE_COLLECTION_CHOOSER_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class iproperty; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace node_collection_chooser { ///////////////////////////////////////////////////////////////////////////// // imodel /// Abstract data model for a node_collection_chooser::control class imodel { public: virtual ~imodel() {} /// Returns a human-readable label for the underlying data virtual const Glib::ustring label() = 0; /// Called to return the set of all available nodes virtual const k3d::inode_collection_property::nodes_t available_nodes() = 0; /// Called to return the underlying data value virtual const k3d::inode_collection_property::nodes_t selected_nodes() = 0; /// Called to set a new data value virtual void set_selected_nodes(const k3d::inode_collection_property::nodes_t& Value) = 0; /// Connects a slot to a signal that will be emitted if the underlying data changes virtual sigc::connection connect_changed_signal(const sigc::slot& Slot) = 0; protected: imodel() {} private: imodel(const imodel&); imodel& operator=(const imodel&); }; /// Factory method for creating an imodel object given a node collection property imodel* const model(k3d::iproperty& Property); ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for selecting a set of nodes class control : public Gtk::HBox { typedef Gtk::HBox base; public: control(imodel* const Model, k3d::istate_recorder* StateRecorder); ~control(); private: /// Called to modify the current set of nodes void on_edit(); class implementation; implementation* const m_implementation; }; } // namespace node_collection_chooser } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_NODE_COLLECTION_CHOOSER_H ================================================ FILE: k3dsdk/ngui/node_window.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // node_window::implementation class node_window::implementation { public: implementation(k3d::inode& Node) : m_node(Node) { } /// Stores the owning node k3d::inode& m_node; }; ///////////////////////////////////////////////////////////////////////////// // node_window node_window::node_window(k3d::inode& Node) : base(Gtk::WINDOW_TOPLEVEL), m_implementation(new implementation(Node)) { Node.deleted_signal().connect(sigc::mem_fun(*this, &node_window::close)); } node_window::~node_window() { delete m_implementation; } k3d::inode& node_window::node() { return m_implementation->m_node; } k3d::bool_t node_window::on_key_press_event(GdkEventKey* event) { if(event->keyval == GDK_Escape) { safe_close(); return true; } return base::on_key_press_event(event); } k3d::bool_t node_window::on_delete_event(GdkEventAny* event) { safe_close(); return true; } k3d::bool_t node_window::safe_to_close() { return on_safe_to_close(); } void node_window::safe_close() { if(safe_to_close()) close(); } void node_window::close() { on_close(); /** \note: This prevents any entry widgets from receiving a focus-out event after going out-of-scope (causing a segfault). * See http://sourceforge.net/tracker/index.php?func=detail&aid=1714540&group_id=11113&atid=111113 for details. */ hide_all(); delete this; } k3d::bool_t node_window::on_safe_to_close() { return true; } void node_window::on_close() { } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/node_window.h ================================================ #ifndef K3DSDK_NGUI_NODE_WINDOW_H #define K3DSDK_NGUI_NODE_WINDOW_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class inode; } namespace k3d { namespace ngui { /////////////////////////////////////////////////////////////////////////////// // node_window /// Provides a standard node-level window class node_window : public Gtk::Window { typedef Gtk::Window base; public: node_window(k3d::inode& Node); virtual ~node_window(); k3d::inode& node(); k3d::bool_t on_key_press_event(GdkEventKey* event); k3d::bool_t on_delete_event(GdkEventAny* event); /// Call to determine whether it is safe to close the window k3d::bool_t safe_to_close(); /// Closes the window safely, giving derived classes a chance to cancel void safe_close(); /// Closes the window void close(); private: /// Override in derived classes to determine whether it is safe to close the window virtual k3d::bool_t on_safe_to_close(); /// Override in derived classes to handle cleanup when the window is closed virtual void on_close(); class implementation; implementation* const m_implementation; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_NODE_WINDOW_H ================================================ FILE: k3dsdk/ngui/null_viewport_input_model.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // null_viewport_input_model void null_viewport_input_model::button_press_event(viewport::control& Viewport, GdkEventButton* Event) { } void null_viewport_input_model::button_release_event(viewport::control& Viewport, GdkEventButton* Event) { } void null_viewport_input_model::motion_notify_event(viewport::control& Viewport, GdkEventMotion* Event) { } void null_viewport_input_model::scroll_event(viewport::control& Viewport, GdkEventScroll* Event) { } void null_viewport_input_model::key_press_event(viewport::control& Viewport, GdkEventKey* Event) { } void null_viewport_input_model::key_release_event(viewport::control& Viewport, GdkEventKey* Event) { } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/null_viewport_input_model.h ================================================ #ifndef K3DSDK_NGUI_NULL_VIEWPORT_INPUT_MODEL_H #define K3DSDK_NGUI_NULL_VIEWPORT_INPUT_MODEL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // null_viewport_input_model /// Do-nothing implementation of viewport_input_model class null_viewport_input_model : public viewport_input_model { public: virtual void button_press_event(viewport::control& Viewport, GdkEventButton* Event); virtual void button_release_event(viewport::control& Viewport, GdkEventButton* Event); virtual void motion_notify_event(viewport::control& Viewport, GdkEventMotion* Event); virtual void scroll_event(viewport::control& Viewport, GdkEventScroll* Event); virtual void key_press_event(viewport::control& Viewport, GdkEventKey* Event); virtual void key_release_event(viewport::control& Viewport, GdkEventKey* Event); }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_NULL_VIEWPORT_INPUT_MODEL_H ================================================ FILE: k3dsdk/ngui/options.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares k3d::ioptions, an abstract interface for global user options \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace ngui { namespace options { namespace detail { k3d::xml::element& ngui_element() { return k3d::options::tree().safe_element("ngui"); } k3d::xml::element& nags_element() { return ngui_element().safe_element("nags"); } k3d::xml::element& nag_element(const std::string& Type) { const k3d::xml::element match("nag", k3d::xml::attribute("message", Type)); const k3d::xml::element prototype("nag", k3d::string_cast(true), k3d::xml::attribute("message", Type)); return nags_element().safe_element(match, prototype); } } // namespace detail const bool nag(const std::string& Type) { return k3d::from_string(detail::nag_element(Type).text, true); } void enable_nag(const std::string& Type, const bool Enabled) { detail::nag_element(Type).text = k3d::string_cast(Enabled); } } // namespace options } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/options.h ================================================ #ifndef K3DSDK_NGUI_OPTIONS_H #define K3DSDK_NGUI_OPTIONS_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { namespace options { /// Returns true iff the given nag message is enabled const bool nag(const std::string& Type); /// Enables / disables the given nag message void enable_nag(const std::string& Type, const bool Enabled); } // namespace options } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_OPTIONS_H ================================================ FILE: k3dsdk/ngui/panel.h ================================================ #ifndef K3DSDK_NGUI_PANEL_H #define K3DSDK_NGUI_PANEL_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace ngui { class document_state; namespace panel { /// Abstract interface for a "panel", a UI component that can be "mounted" in a panel_container class control : public virtual iunknown { public: /// Set the document and parent command node for this panel - this is ugly, but application plugins don't take ctor arguments virtual void initialize(document_state& DocumentState) = 0; /// Returns a unique string identifying the panel type - panel frames use this to coordinate layout serialization virtual const k3d::string_t panel_type() = 0; /// Connects a slot to a signel that should be emitted whenever the panel receives the keyboard focus virtual sigc::connection connect_focus_signal(const sigc::slot& Slot) = 0; protected: control() {} control(const control&) {} control& operator=(const control&) { return *this; } virtual ~control() {} }; } // namespace panel } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PANEL_H ================================================ FILE: k3dsdk/ngui/panel_frame.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace panel_frame { namespace detail { ///////////////////////////////////////////////////////////////////////////// // window class floating_window : public document_window { typedef document_window base; public: floating_window(document_state& Document) : base(Document) { } }; } // namespace detail control::control(document_state& DocumentState, panel_focus_signal_t& PanelFocusSignal) : base(), k3d::property_collection(), pinned(init_name("pinned") + init_label(_("Pinned Panel")) + init_description(_("Works with 'Hide Unpinned Panels' action")) + init_value(false)), automagic(init_name("automagic") + init_label(_("Automagic")) + init_description(_("Allows panel to change depending on active tool")) + init_value(false)), decorations(init_name("decorations") + init_label(_("Decorations")) + init_description(_("Hides/shows decorations")) + init_value(true)), m_decorations(false, 0), m_document_state(DocumentState), m_panel_focus_signal(PanelFocusSignal), m_panel_focus(false) { m_panel_focus_changed_connection = m_panel_focus_signal.connect(sigc::mem_fun(*this, &control::on_panel_focus_changed)); // Don't set it to NORMAL else the focus color won't show set_shadow_type(Gtk::SHADOW_ETCHED_IN); image_toggle_button::control* const pinned_control = new image_toggle_button::control( image_toggle_button::model(pinned, pinned.name()), 0, load_icon("pinned", Gtk::ICON_SIZE_BUTTON), load_icon("unpinned", Gtk::ICON_SIZE_BUTTON)) << set_tooltip(_("Pin Panel")); pinned_control->signal_clicked().connect(sigc::mem_fun(*this, &control::grab_panel_focus)); decorations.changed_signal().connect(sigc::mem_fun(*this, &control::on_decorations_changed)); Gtk::EventBox* const title_event_box = new Gtk::EventBox(); title_event_box->add(m_title); title_event_box->add_events(Gdk::BUTTON_PRESS_MASK); title_event_box->signal_button_press_event().connect(sigc::bind_return(sigc::hide(sigc::mem_fun(*this, &control::on_grab_focus)), false)); m_model = Gtk::ListStore::create(m_columns); m_panel_type.set_model(m_model); m_panel_type.pack_start(m_columns.icon, false); m_panel_type.pack_start(m_columns.label); m_panel_type.get_accessible()->set_name("panel_type"); m_panel_type_connection = m_panel_type.signal_changed().connect(sigc::mem_fun(*this, &control::on_panel_type_changed)); m_decorations.pack_start(*Gtk::manage(pinned_control), Gtk::PACK_SHRINK); m_decorations.pack_start(m_panel_type, Gtk::PACK_SHRINK); m_decorations.pack_start(*Gtk::manage(title_event_box), Gtk::PACK_EXPAND_WIDGET); m_frame.set_shadow_type(Gtk::SHADOW_NONE); m_decorations.get_accessible()->set_name("decorations"); m_frame.get_accessible()->set_name("content"); Gtk::VBox* const vbox1 = new Gtk::VBox(false); vbox1->get_accessible()->set_name("vbox"); vbox1->pack_start(m_decorations, Gtk::PACK_SHRINK); vbox1->pack_start(m_frame, Gtk::PACK_EXPAND_WIDGET); base::add(*manage(vbox1)); set_choices(); show_all(); } control::~control() { // Prevent a crash caused by self-updating after we're gone ... m_panel_focus_changed_connection.disconnect(); // If we have the panel focus, give it up ... if(m_panel_focus) { m_panel_focus = false; m_panel_focus_signal.emit(0); } } void control::add(Widget& widget) { base::add(widget); } void control::remove() { base::remove(); } void control::grab_panel_focus() { m_panel_focus_signal.emit(this); } void control::mount_panel(panel::control& Panel, const k3d::string_t& Type) { get_accessible()->set_name(Type); unmount(); m_grab_focus_connection = Panel.connect_focus_signal(sigc::mem_fun(*this, &control::on_grab_focus)); m_frame.add(dynamic_cast(Panel)); m_panel_type_connection.block(); m_panel_type.set_active(index(Type)); m_panel_type_connection.unblock(); } void control::mount_panel(const k3d::string_t& Type, bool RequestCamera) { get_accessible()->set_name(Type); if("NGUIViewportPanel" == Type) { const std::vector gl_engines = k3d::node::lookup(m_document_state.document()); k3d::gl::irender_viewport* const glengine1 = gl_engines.size() ? gl_engines[0] : 0; k3d::icamera* camera = 0; if (RequestCamera) { camera = pick_camera(m_document_state); } else { const std::vector cameras = k3d::node::lookup(m_document_state.document()); camera = cameras.size() ? cameras[0] : 0; } if(glengine1 && camera) { viewport::control* const control = new viewport::control(m_document_state); control->set_camera(camera); control->set_gl_engine(glengine1); mount_panel(*Gtk::manage(control), Type); m_document_state.set_focus_viewport(control); } return; } if(m_type_plugin_map.count(Type)) { k3d::iplugin_factory* const plugin = m_type_plugin_map[Type]; return_if_fail(plugin); panel::control* const panel = k3d::plugin::create(*plugin); return_if_fail(panel); panel->initialize(m_document_state); Gtk::manage(dynamic_cast(panel)); mount_panel(*panel, Type); return; } k3d::log() << error << "Couldn't mount panel of type : " << Type << std::endl; } void control::on_mount_panel(const k3d::string_t& Type) { mount_panel(Type); } void control::unmount() { unset_bg_color(); m_grab_focus_connection.disconnect(); viewport::control* control = dynamic_cast(m_frame.get_child()); if (control == m_document_state.get_focus_viewport()) m_document_state.set_focus_viewport(0); delete m_frame.get_child(); } void control::float_panel() { if(!m_frame.get_child()) return; m_grab_focus_connection.disconnect(); detail::floating_window* const window = new detail::floating_window(m_document_state); m_frame.get_child()->reparent(*window); window->show(); } void control::set_bg_color(const Gdk::Color& color) { modify_bg(Gtk::STATE_NORMAL, color); } void control::unset_bg_color() { unset_bg(Gtk::STATE_NORMAL); } panel::control* const control::mounted_panel() { return dynamic_cast(m_frame.get_child()); } void control::save(k3d::xml::element& Document) { k3d::xml::element& panel = Document.append(k3d::xml::element("panel")); if(mounted_panel()) panel.append(k3d::xml::attribute("type", mounted_panel()->panel_type())); panel.append(k3d::xml::attribute("pinned", pinned.internal_value())); panel.append(k3d::xml::attribute("visible", is_visible())); panel.append(k3d::xml::attribute("automagic", automagic.internal_value())); panel.append(k3d::xml::attribute("decorations", decorations.internal_value())); } void control::load(k3d::xml::element& Element) { return_if_fail("panel" == Element.name); const k3d::string_t type = attribute_text(Element, "type"); const k3d::string_t is_pinned = attribute_text(Element, "pinned"); const k3d::string_t is_visible = attribute_text(Element, "visible"); const k3d::string_t is_automagic = attribute_text(Element, "automagic"); const k3d::string_t is_decorated = attribute_text(Element, "decorations"); mount_panel(type); pinned.set_value("true" == is_pinned); automagic.set_value("true" == is_automagic); decorations.set_value("true" == is_decorated); if("true" == is_visible) show(); else hide(); } void control::on_panel_focus_changed(control* Container) { m_panel_focus = Container == this; m_frame.set_shadow_type(m_panel_focus ? Gtk::SHADOW_IN : Gtk::SHADOW_NONE); } void control::on_grab_focus() { grab_panel_focus(); } void control::set_choices() { m_model->clear(); add_choice("NGUIViewportPanel", quiet_load_icon("viewport_panel", Gtk::ICON_SIZE_SMALL_TOOLBAR), _("Viewport"), sigc::bind(sigc::mem_fun(*this, &control::on_mount_panel), "NGUIViewportPanel")); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); for(k3d::plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { k3d::iplugin_factory::metadata_t metadata = (**factory).metadata(); if(metadata["ngui:component-type"] != "panel") continue; const k3d::string_t panel_type = (**factory).name(); const k3d::string_t panel_label = metadata["ngui:panel-label"]; if(panel_label.empty()) { k3d::log() << error << "Panel plugin [" << panel_type << "] without ngui:panel-label metadata will be ignored" << std::endl; continue; } m_type_plugin_map[panel_type] = *factory; add_choice(panel_type, quiet_load_icon(panel_type + "_panel", Gtk::ICON_SIZE_SMALL_TOOLBAR), panel_label, sigc::bind(sigc::mem_fun(*this, &control::on_mount_panel), panel_type)); } m_model->set_sort_column(m_columns.label, Gtk::SORT_ASCENDING); } void control::add_choice(const k3d::string_t& PanelType, const Glib::RefPtr Icon, const Glib::ustring& Label, sigc::slot Slot) { Gtk::TreeRow row = *m_model->append(); row[m_columns.type] = PanelType; row[m_columns.label] = Label; row[m_columns.slot] = Slot; row[m_columns.icon] = Icon; } void control::on_panel_type_changed() { return_if_fail(m_panel_type.get_active() != m_model->children().end()); Gtk::TreeRow row = *m_panel_type.get_active(); sigc::slot slot = row.get_value(m_columns.slot); slot(); } void control::on_decorations_changed(k3d::iunknown*) { if(decorations.internal_value()) m_decorations.show(); else m_decorations.hide(); } const unsigned long control::index(const k3d::string_t& PanelType) { const Gtk::TreeModel::Children children = m_model->children(); for(unsigned long i = 0; i != children.size(); ++i) { if(children[i][m_columns.type] == PanelType) return i; } k3d::log() << error << k3d_file_reference << ": error looking-up panel [" << PanelType << "]" << std::endl; return 0; } } // namespace panel_frame } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/panel_frame.h ================================================ #ifndef K3DSDK_NGUI_PANEL_FRAME_H #define K3DSDK_NGUI_PANEL_FRAME_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include namespace k3d { class icamera; } namespace k3d { class iplugin_factory; } namespace k3d { namespace xml { class element; } } namespace k3d { namespace ngui { class document_state; namespace image_toggle_button { class control; } namespace panel { class control; } namespace panel_frame { /// Provides a "panel frame" control that can "mount" a panel control class control : public Gtk::Frame, public k3d::property_collection { typedef Gtk::Frame base; public: typedef sigc::signal panel_focus_signal_t; control(document_state& Document, panel_focus_signal_t& PanelFocusSignal); ~control(); /// Assigns the frame the panel focus void grab_panel_focus(); /// Mounts a panel to the frame (note: mainly for hacking purposes, prefer mount_panel(const k3d::string_t& Type) instead) void mount_panel(panel::control& Panel, const k3d::string_t& Type); /// Mounts a panel based on type void mount_panel(const k3d::string_t& Type, bool RequestCamera = false); /// Unmounts a mounted panel void unmount(); /// Unmounts a mounted panel, placing it in a floating window void float_panel(); /// Highlights panel void set_bg_color(const Gdk::Color& color); /// Restores normal background void unset_bg_color(); /// Returns the mounted panel, if any (could return NULL) panel::control* const mounted_panel(); /// Serializes panel state void save(k3d::xml::element& Document); /// Deserializes panel state void load(k3d::xml::element& Element); /// Stores the pinned state of the frame k3d_data(bool, immutable_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) pinned; /// Stores the automagic state of the frame k3d_data(bool, immutable_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) automagic; /// Stores the state of the frame decorations (standard buttons, chooser, etc) k3d_data(bool, immutable_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) decorations; private: void add(Widget&); void remove(); void on_mount_panel(const k3d::string_t& Type); void on_panel_focus_changed(control* Container); void on_grab_focus(); void on_panel_type_changed(); void on_decorations_changed(k3d::iunknown*); const unsigned long index(const k3d::string_t& Type); /// Called to update the contents of the combo-box for choosing panels void set_choices(); /// Called to add a choice to the combo-box for choosing panels void add_choice(const k3d::string_t& PanelType, const Glib::RefPtr Icon, const Glib::ustring& Label, sigc::slot Slot); class columns : public Gtk::TreeModelColumnRecord { public: columns() { add(type); add(label); add(slot); add(icon); } Gtk::TreeModelColumn type; Gtk::TreeModelColumn label; Gtk::TreeModelColumn > slot; Gtk::TreeModelColumn > icon; }; columns m_columns; Glib::RefPtr m_model; /// Stores a mapping from panel type to external plugin factory std::map m_type_plugin_map; Gtk::HBox m_decorations; /// Provides a combo-box for choosing from available panel types Gtk::ComboBox m_panel_type; /// Displays the title of mounted panels Gtk::Label m_title; /// Stores a reference to the owning document document_state& m_document_state; /// Stores a frame that will contain the mounted panel Gtk::Frame m_frame; /// Stores a connection to the mounted panel's focus signal sigc::connection m_grab_focus_connection; /// Stores a connection to the frame's panel type combo box sigc::connection m_panel_type_connection; /// Stores a reference to a signal for notifying observers when we get the panel focus panel_focus_signal_t& m_panel_focus_signal; /// Stores the connection between m_panel_focus_signal and on_panel_focus_changed() sigc::connection m_panel_focus_changed_connection; /// Set to true iff this panel has the focus bool m_panel_focus; }; /// Defines a collection of panel frames typedef std::vector controls; } // namespace panel_frame } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PANEL_FRAME_H ================================================ FILE: k3dsdk/ngui/panel_mediator.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace ngui { namespace panel { ///////////////////////////////////////////////////////////////////////////// // mediator::implementation class mediator::implementation { public: static implementation& instance(idocument& Document) { typedef std::map cache_t; static cache_t cache; cache_t::iterator result = cache.find(&Document); if(result == cache.end()) result = cache.insert(std::make_pair(&Document, new implementation(Document))).first; return *result->second; } idocument& document; sigc::signal node_focus_signal; private: implementation(idocument& Document) : document(Document) { } }; ///////////////////////////////////////////////////////////////////////////// // mediator mediator::mediator(idocument& Document) : internal(implementation::instance(Document)) { } void mediator::set_focus(inode& Node) { internal.node_focus_signal.emit(&Node, 0); } void mediator::set_focus(inode& Node, iunknown& Sender) { internal.node_focus_signal.emit(&Node, &Sender); } sigc::connection mediator::connect_focus_node_signal(const sigc::slot& Slot) { return internal.node_focus_signal.connect(Slot); } } // namespace panel } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/panel_mediator.h ================================================ #ifndef K3DSDK_NGUI_PANEL_MEDIATOR_H #define K3DSDK_NGUI_PANEL_MEDIATOR_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { class idocument; class inode; class iunknown; namespace ngui { namespace panel { class control; /// Mediates interaction between panels on a per-document basis. class mediator { public: mediator(idocument& Document); /// Called to "focus" the given node. Typically, this means that the node will be displayed /// in one-or-more panels. void set_focus(inode& Node); /// Called to "focus" the given node. Typically, this means that the node will be displayed /// in one-or-more panels. void set_focus(inode& Node, iunknown& Sender); /// Connects a slot to a signal that will be emitted whenever a node receives the "focus". sigc::connection connect_focus_node_signal(const sigc::slot& Slot); private: class implementation; implementation& internal; }; } // namespace panel } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PANEL_MEDIATOR_H ================================================ FILE: k3dsdk/ngui/path_chooser.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace path_chooser { /// Specialization of k3d::path_chooser::data_proxy for use with k3d::iproperty objects template<> class data_proxy : public idata_proxy { public: typedef k3d::iproperty data_t; data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_readable_data(Data), m_writable_data(dynamic_cast(&Data)), m_path_data(dynamic_cast(&Data)), m_watched_data(dynamic_cast(&Data)) { } const k3d::ipath_property::mode_t mode() { return m_path_data ? m_path_data->property_path_mode() : k3d::ipath_property::READ; } const std::string type() { return m_path_data ? m_path_data->property_path_type() : "unknown"; } const k3d::ipath_property::reference_t reference() { return m_path_data ? m_path_data->property_path_reference() : k3d::ipath_property::RELATIVE_REFERENCE; } void set_reference(const k3d::ipath_property::reference_t Reference) { return_if_fail(m_path_data); m_path_data->set_property_path_reference(Reference); } const k3d::ipath_property::pattern_filters_t pattern_filters() { return m_path_data ? m_path_data->pattern_filters() : k3d::ipath_property::pattern_filters_t(); } const k3d::filesystem::path value() { return boost::any_cast(m_readable_data.property_internal_value()); } void set_value(const k3d::filesystem::path& Value) { return_if_fail(m_writable_data); m_writable_data->property_set_value(Value); } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } /// True if the underlying path can be watched for changes const k3d::bool_t is_watchable() const { return m_watched_data; } /// True if the path is watchable and is actually being watched const k3d::bool_t is_watched() const { return m_watched_data ? m_watched_data->is_watched() : false; } void watch(const k3d::bool_t Watched) { return_if_fail(m_watched_data); m_watched_data->watch(Watched); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_readable_data; k3d::iwritable_property* const m_writable_data; k3d::ipath_property* const m_path_data; k3d::iwatched_path_property* const m_watched_data; }; std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : base(false, 0), m_entry(new hotkey_entry), m_button(new Gtk::Button("...")), m_combo(new Gtk::ComboBox()), m_toggle_button(0), m_data(std::move(Data)), m_disable_set_value(false) { m_entry->signal_focus_out_event().connect(sigc::mem_fun(*this, &control::on_focus_out_event)); m_entry->signal_activate().connect(sigc::mem_fun(*this, &control::on_activate)); m_button->set_tooltip_text(_("Browse for a file ...")); m_button->signal_clicked().connect(sigc::mem_fun(*this, &control::on_browse)); Glib::RefPtr model = Gtk::ListStore::create(m_columns); Gtk::TreeRow row; row = *model->append(); row[m_columns.reference] = k3d::ipath_property::ABSOLUTE_REFERENCE; row[m_columns.label] = _("Absolute"); row = *model->append(); row[m_columns.reference] = k3d::ipath_property::RELATIVE_REFERENCE; row[m_columns.label] = _("Relative"); row = *model->append(); row[m_columns.reference] = k3d::ipath_property::INLINE_REFERENCE; row[m_columns.label] = _("Inline"); m_combo->set_model(model); m_combo->pack_start(m_columns.label); m_combo->set_tooltip_text(_("Choose whether to store absolute or relative filepaths")); m_combo->signal_changed().connect(sigc::mem_fun(*this, &control::on_pick_reference_type)); pack_start(*manage(m_entry), Gtk::PACK_EXPAND_WIDGET); pack_start(*manage(m_button), Gtk::PACK_SHRINK); pack_start(*manage(m_combo), Gtk::PACK_SHRINK); if(m_data.get() && m_data->is_watchable()) { m_toggle_button = new Gtk::ToggleButton(_("Watch"), true); m_toggle_button->set_active(true); m_toggle_button->signal_toggled().connect(sigc::mem_fun(*this, &control::on_watch_toggle)); m_toggle_button->set_tooltip_text(_("Watch/unwatch file for changes")); pack_start(*manage(m_toggle_button), Gtk::PACK_SHRINK); } data_changed(0); if(m_data.get()) m_data->changed_signal().connect(sigc::mem_fun(*this, &control::data_changed)); show_all(); } bool control::on_focus_out_event(GdkEventFocus* Event) { set_value(); return false; } void control::on_activate() { set_value(); } void control::on_browse() { return_if_fail(m_data.get()); k3d::filesystem::path new_value; { file_chooser_dialog dialog("", m_data->type(), m_data->mode(), m_data->value()); const k3d::ipath_property::pattern_filters_t filters = m_data->pattern_filters(); for(k3d::ipath_property::pattern_filters_t::const_iterator filter = filters.begin(); filter != filters.end(); ++filter) dialog.add_pattern_filter(filter->name, filter->pattern); if(!filters.empty()) dialog.add_all_files_filter(); if(!dialog.get_file_path(new_value)) return; } // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); // Update everything with the new value ... m_data->set_value(new_value); // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), m_data->change_message + " " + new_value.native_utf8_string().raw(), K3D_CHANGE_SET_CONTEXT); } void control::on_pick_reference_type() { return_if_fail(m_data.get()); return_if_fail(m_combo->get_active() != m_combo->get_model()->children().end()); m_data->set_reference(m_combo->get_active()->get_value(m_columns.reference)); } void control::on_watch_toggle() { if(m_disable_set_value) return; return_if_fail(m_data.get()); m_data->watch(!m_data->is_watched()); } void control::set_value() { if(m_disable_set_value) return; return_if_fail(m_data.get()); m_disable_set_value = true; k3d::filesystem::path new_value; try { new_value = k3d::filesystem::native_path(k3d::ustring::from_utf8(m_entry->get_text())); } catch(std::exception& e) { k3d::log() << error << e.what() << std::endl; m_disable_set_value = false; return; } // If the value didn't change, we're done ... if(m_data->value().generic_utf8_string() == new_value.generic_utf8_string()) { m_disable_set_value = false; return; } // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); // Update everything with the new value ... m_data->set_value(new_value); // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), m_data->change_message + " " + new_value.native_utf8_string().raw(), K3D_CHANGE_SET_CONTEXT); m_disable_set_value = false; } void control::data_changed(k3d::ihint* Hint) { return_if_fail(m_data.get()); m_entry->set_text(m_data->value().leaf().raw()); m_entry->set_tooltip_text(m_data->value().native_utf8_string().raw()); m_combo->set_active(m_data->reference()); if(m_toggle_button) { m_disable_set_value = true; m_toggle_button->set_active(m_data->is_watched()); m_disable_set_value = false; } } void control::on_reference_type_changed() { m_combo->set_active(m_data->reference()); } } // namespace path_chooser } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/path_chooser.h ================================================ #ifndef K3DSDK_NGUI_PATH_CHOOSER_H #define K3DSDK_NGUI_PATH_CHOOSER_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace Gtk { class Button; } namespace Gtk { class ComboBox; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { class hotkey_entry; namespace path_chooser { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for an path control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Returns the path "mode" (input or output) virtual const k3d::ipath_property::mode_t mode() = 0; /// Returns the path "type" (category) virtual const std::string type() = 0; virtual const k3d::ipath_property::reference_t reference() = 0; virtual void set_reference(const k3d::ipath_property::reference_t Reference) = 0; virtual const k3d::ipath_property::pattern_filters_t pattern_filters() = 0; /// Called to return the underlying data value virtual const k3d::filesystem::path value() = 0; /// Called to set a new data value virtual void set_value(const k3d::filesystem::path& Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// True if the underlying path can be watched for changes virtual const k3d::bool_t is_watchable() const = 0; /// True if the path is watchable and is actually being watched virtual const k3d::bool_t is_watched() const = 0; /// Watch the path virtual void watch(const k3d::bool_t Watched) = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a standard UI control for manipulating filepath data (i.e. the view and the controller from model-view-controller) class control : public Gtk::HBox { typedef Gtk::HBox base; public: control(std::unique_ptr Data); private: /// Called when the control loses the keyboard focus bool on_focus_out_event(GdkEventFocus* Event); /// Called when the control is activated void on_activate(); /// Called when the user clicks the "browse" button void on_browse(); /// Called when the user changes the reference type void on_pick_reference_type(); /// Called when the user finishes editing data void set_value(); /// Called whenever the underlying data changes void data_changed(k3d::ihint*); /// Called whenever the underlying data reference changes void on_reference_type_changed(); /// Called whenever the watch change toggle button is toggled void on_watch_toggle(); /// Stores an entry widget for displaying the current value hotkey_entry* const m_entry; /// Stores a button widget for browsing the filesystem Gtk::Button* const m_button; /// Stores a combo-box for picking absolute, relative, or inline path behavior Gtk::ComboBox* const m_combo; /// Stores a toggle button to set if the file should be watched, if the path property is watchable Gtk::ToggleButton* m_toggle_button; /// Stores a reference to the underlying data object std::unique_ptr m_data; /// Prevent set_value() and on_watch_toggle from being called recursively (a hack) bool m_disable_set_value; class reference_columns : public Gtk::TreeModelColumnRecord { public: reference_columns() { add(reference); add(label); } Gtk::TreeModelColumn reference; Gtk::TreeModelColumn label; }; reference_columns m_columns; }; /// Provides an implementation of k3d::path_chooser::idata_proxy that supports any data source that supports the value(), set_value(), and changed_signal() concepts template class data_proxy : public idata_proxy { public: data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_data(Data) { } const k3d::filesystem::path value() { return m_data.value(); } void set_value(const k3d::filesystem::path& Value) { m_data.set_value(Value); } changed_signal_t& changed_signal() { return m_data.changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_data; }; /// Convenience factory function for creating idata_proxy objects template std::unique_ptr proxy(data_t& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } /// Convenience factory function for creating idata_proxy objects std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()); } // namespace path_chooser } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PATH_CHOOSER_H ================================================ FILE: k3dsdk/ngui/pipeline.cpp ================================================ // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace pipeline { namespace detail { /// Duplicates mesh source into a FrozenMesh and instantiate the new object k3d::inode* duplicate_mesh(k3d::idocument& Document, k3d::inode& Node) { // Get the upstream property k3d::iproperty_collection* property_collection = dynamic_cast(&Node); return_val_if_fail(property_collection, 0); k3d::imesh_sink* const downstream_sink = dynamic_cast(&Node); return_val_if_fail(downstream_sink, 0); k3d::iproperty& downstream_input = downstream_sink->mesh_sink_input(); k3d::iproperty* const upstream_output = Document.pipeline().dependency(downstream_input); return_val_if_fail(upstream_output, 0); k3d::imesh_source* const upstream_mesh_source = dynamic_cast(upstream_output->property_node()); return_val_if_fail(upstream_mesh_source, 0); // Create a new FrozenMesh and a copy of upstream mesh instance ... k3d::inode* frozen_mesh = k3d::plugin::create(k3d::classes::FrozenMesh(), Document); return_val_if_fail(frozen_mesh, 0); const std::string frozen_mesh_name = k3d::unique_name(Document.nodes(), upstream_output->property_node()->name()); frozen_mesh->set_name(frozen_mesh_name); k3d::inode* mesh_instance = k3d::plugin::create(k3d::classes::MeshInstance(), Document); return_val_if_fail(mesh_instance, 0); mesh_instance->set_name(k3d::unique_name(Document.nodes(), frozen_mesh_name + " Instance")); // Set DAG dependencies k3d::imesh_sink* const mesh_instance_sink = dynamic_cast(mesh_instance); return_val_if_fail(mesh_instance_sink, 0); k3d::imesh_source* const frozen_mesh_source = dynamic_cast(frozen_mesh); return_val_if_fail(frozen_mesh_source, 0); k3d::ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&mesh_instance_sink->mesh_sink_input(), &frozen_mesh_source->mesh_source_output())); Document.pipeline().set_dependencies(dependencies); // Duplicate transformation, if any freeze_transformation(Node, *mesh_instance, Document); // Copy property values const k3d::iproperty_collection::properties_t properties = property_collection->properties(); for(k3d::iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { const std::string name = (*property)->property_name(); if(name != "output_matrix" // Property not writable && name != "name" && name != "input_mesh" && name != "output_mesh") { k3d::property::set_internal_value(*mesh_instance, name, (*property)->property_internal_value()); } } // Copy upstream mesh to our new FrozenMesh ... if(k3d::mesh* const upstream_mesh = boost::any_cast(k3d::property::pipeline_value(upstream_mesh_source->mesh_source_output()))) { if(k3d::imesh_storage* const frozen_mesh_storage = dynamic_cast(frozen_mesh)) { k3d::mesh* const new_mesh = new k3d::mesh(); k3d::mesh::deep_copy(*upstream_mesh, *new_mesh); frozen_mesh_storage->reset_mesh(new_mesh); } } return mesh_instance; } k3d::inode* duplicate_node(k3d::idocument& Document, k3d::inode& Node) { // Get node's properties k3d::iproperty_collection* property_collection = dynamic_cast(&Node); return_val_if_fail(property_collection, 0); // Clone the node k3d::inode* clone = k3d::plugin::create(Node.factory(), Document); return_val_if_fail(clone, 0); clone->set_name(k3d::unique_name(Document.nodes(), Node.name())); // Duplicate transformation, if any freeze_transformation(Node, *clone, Document); // Copy property values const k3d::iproperty_collection::properties_t properties = property_collection->properties(); for(k3d::iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { const std::string name = (*property)->property_name(); if(name != "output_matrix" // Property not writable && name != "name" && name != "input_mesh" && name != "output_mesh" && !(Node.factory().factory_id() == k3d::classes::Camera() && name == "navigation_target")) // Skip Camera's navigation target property { k3d::property::set_internal_value(*clone, name, (*property)->property_internal_value()); } } return clone; } } // namespace detail inode* default_gl_painter(idocument& Document) { const std::vector nodes = k3d::node::lookup(Document, "GL Default Painter"); return (1 == nodes.size()) ? nodes[0] : 0; } inode* default_ri_painter(idocument& Document) { const std::vector nodes = k3d::node::lookup(Document, "RenderMan Default Painter"); return (1 == nodes.size()) ? nodes[0] : 0; } inode* create_node(idocument& Document, iplugin_factory& Factory) { // Switch to node selection mode if(selection::NODE != selection::state(Document).current_mode()) selection::state(Document).set_current_mode(selection::NODE); // Create the requested node ... k3d::record_state_change_set changeset(Document, k3d::string_cast(boost::format(_("Create %1%")) % Factory.name()), K3D_CHANGE_SET_CONTEXT); const std::string node_name = k3d::unique_name(Document.nodes(), Factory.name()); k3d::inode* const node = k3d::plugin::create(Factory, Document, node_name); return_val_if_fail(node, 0); // Keep track of the node to be selected ... k3d::inode* to_be_selected = node; // Keep track of every new node created ... std::vector new_nodes; new_nodes.push_back(node); // Prepare to make connections to other nodes ... k3d::ipipeline::dependencies_t dependencies; // If the new node is a mesh source (but not a MeshInstance!), create a MeshInstance node and attach it so it's immediately visible ... k3d::imesh_source* const mesh_source = dynamic_cast(node); if(mesh_source && k3d::classes::MeshInstance() != Factory.factory_id()) { // Create a mesh instance ... k3d::inode* const mesh_instance = pipeline::instantiate_mesh(Document, *node); return_val_if_fail(mesh_instance, 0); new_nodes.push_back(mesh_instance); // In this case, we want to select the mesh instance instead of the mesh source ... to_be_selected = mesh_instance; } // If the new node is a material sink, assign a default material ... if(k3d::imaterial_sink* const material_sink = dynamic_cast(node)) { const std::vector materials = k3d::node::lookup(Document); if(materials.size()) k3d::property::set_internal_value(material_sink->material_sink_input(), dynamic_cast(*materials.rbegin())); } // If the new node is a time sink, connect it to the document time source ... if(k3d::itime_sink* const time_sink = dynamic_cast(node)) dependencies.insert(std::make_pair(&time_sink->time_sink_input(), k3d::get_time(Document))); if(!dependencies.empty()) Document.pipeline().set_dependencies(dependencies); // If the new node is a camera, orient it horizontally if(k3d::classes::Camera() == Factory.factory_id()) k3d::set_matrix(*node, k3d::rotate3(k3d::radians(90.0), k3d::vector3(1, 0, 0))); // If the new node is a multiple mesh sink, add two mesh inputs if(Factory.implements(typeid(k3d::imulti_mesh_sink))) { k3d::property::create(*node, "input_mesh1", "Input Mesh 1", "", static_cast(0)); k3d::property::create(*node, "input_mesh2", "Input Mesh 2", "", static_cast(0)); } // If the new node is a render-engine, default to making every node in the document visible ... if(k3d::inode_collection_sink* const node_collection_sink = dynamic_cast(node)) { const k3d::inode_collection_sink::properties_t properties = node_collection_sink->node_collection_properties(); for(k3d::inode_collection_sink::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) k3d::property::set_internal_value(**property, Document.nodes().collection()); } // By default, make the new node visible in any node collection sinks that already exist ... k3d::node::show(Document, new_nodes); // Give nodes a chance to initialize their property values based on their inputs, if any ... if(k3d::ireset_properties* const reset_properties = dynamic_cast(node)) reset_properties->reset_properties(); // Replace the current selection selection::state(Document).deselect_all(); selection::state(Document).select(*to_be_selected); // Make the newly-created node properties visible ... panel::mediator(Document).set_focus(*node); k3d::gl::redraw_all(Document, k3d::gl::irender_viewport::ASYNCHRONOUS); return node; } /// Duplicates first node's transformation into a FrozenMatrixa and connects it to second node void freeze_transformation(k3d::inode& FromNode, k3d::inode& ToNode, k3d::idocument& Document) { // Check for "input_matrix" property k3d::iproperty* const transformation_property = k3d::property::get(FromNode, "input_matrix"); if(!transformation_property) return; // Check whether it's connected if(!Document.pipeline().dependency(*transformation_property)) return; // Duplicate input matrix into a new FrozenMatrix k3d::inode* frozen_transformation = k3d::plugin::create(k3d::classes::FrozenMatrix(), Document); return_if_fail(frozen_transformation); frozen_transformation->set_name(k3d::unique_name(Document.nodes(), ToNode.name() + " Transformation")); // Connect new FrozenMatrix and ToNode k3d::imatrix_sink* const transformation_sink = dynamic_cast(&ToNode); return_if_fail(transformation_sink); k3d::imatrix_source* const transformation_source = dynamic_cast(frozen_transformation); return_if_fail(transformation_source); k3d::ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&transformation_sink->matrix_sink_input(), &transformation_source->matrix_source_output())); Document.pipeline().set_dependencies(dependencies); // Copy transformation value const k3d::matrix4 transformation = k3d::node_to_world_matrix(FromNode); k3d::property::set_internal_value(*frozen_transformation, "matrix", transformation); } inode* instantiate_mesh(idocument& Document, inode& Node) { inode* mesh_instance = 0; iproperty* mesh_source_property = 0; if(classes::MeshInstance() == Node.factory().factory_id()) // Instantiate the input in case of a mesh instance { imesh_sink* sink = dynamic_cast(&Node); mesh_source_property = Document.pipeline().dependency(sink->mesh_sink_input()); if(mesh_source_property) mesh_instance = k3d::plugin::create(k3d::classes::MeshInstance(), Document, k3d::unique_name(Document.nodes(), Node.name() + " Instance")); } else { k3d::ipipeline& pipeline = Document.pipeline(); const k3d::ipipeline::dependencies_t& dependencies = pipeline.dependencies(); k3d::imesh_source* mesh_source = dynamic_cast(&Node); if(!mesh_source) return 0; mesh_source_property = &(mesh_source->mesh_source_output()); if(mesh_source_property) mesh_instance = k3d::plugin::create(k3d::classes::MeshInstance(), Document, k3d::unique_name(Document.nodes(), Node.name() + " Instance")); k3d::iproperty* instance_mesh_source_property = &dynamic_cast(mesh_instance)->mesh_source_output(); k3d::iproperty* instance_matrix_source_property = &dynamic_cast(mesh_instance)->matrix_source_output(); k3d::imatrix_source* matrix_source = dynamic_cast(&Node); k3d::iproperty* matrix_source_property = 0; if(matrix_source) matrix_source_property = &(matrix_source->matrix_source_output()); // Connect the MeshInstance outputs to the inputs of the downstream node, if any k3d::ipipeline::dependencies_t new_dependencies; for(k3d::ipipeline::dependencies_t::const_iterator dependency = dependencies.begin(); dependency != dependencies.end(); ++dependency) { if(dependency->second == mesh_source_property) { dependency->first->property_set_dependency(0); new_dependencies.insert(std::make_pair(dependency->first, instance_mesh_source_property)); } if(matrix_source_property && dependency->second == matrix_source_property) { dependency->first->property_set_dependency(0); new_dependencies.insert(std::make_pair(dependency->first, instance_matrix_source_property)); } } pipeline.set_dependencies(new_dependencies); } if(!mesh_source_property) return 0; // Assign a default painter ... k3d::property::set_internal_value(*mesh_instance, "gl_painter", default_gl_painter(Document)); k3d::property::set_internal_value(*mesh_instance, "ri_painter", default_ri_painter(Document)); // Connect the mesh instance to the source ... k3d::ipipeline::dependencies_t dependencies; k3d::imesh_sink* const mesh_sink = dynamic_cast(mesh_instance); if(mesh_sink) dependencies.insert(std::make_pair(&mesh_sink->mesh_sink_input(), mesh_source_property)); Document.pipeline().set_dependencies(dependencies); freeze_transformation(Node, *mesh_instance, Document); return mesh_instance; } void instantiate_selected_nodes(idocument& Document) { // Save selection const k3d::nodes_t nodes = selection::state(Document).selected_nodes(); if(!nodes.size()) return; // Record action std::string action = "Instantiate Nodes"; if(nodes.size() == 1) action = k3d::string_cast(boost::format(_("Instantiate %1%")) % (*nodes.begin())->name()); k3d::record_state_change_set changeset(Document, action, K3D_CHANGE_SET_CONTEXT); // Deselect all selection::state(Document).deselect_all(); // Instantiate nodes and select new ones k3d::nodes_t new_nodes; for(k3d::nodes_t::const_iterator selected_node = nodes.begin(); selected_node != nodes.end(); ++selected_node) { if(k3d::inode* new_node = instantiate_mesh(Document, **selected_node)) { selection::state(Document).select(*new_node); new_nodes.push_back(new_node); } } k3d::node::show(Document, new_nodes); // Show the new instance properties if only one was processed if(new_nodes.size() == 1) panel::mediator(Document).set_focus(**new_nodes.begin()); } void duplicate_selected_nodes(idocument& Document) { // Save selection const k3d::nodes_t nodes = selection::state(Document).selected_nodes(); if(!nodes.size()) return; // Record action std::string action = "Duplicate Nodes"; if(nodes.size() == 1) action = k3d::string_cast(boost::format(_("Duplicate %1%")) % (*nodes.begin())->name()); k3d::record_state_change_set changeset(Document, action, K3D_CHANGE_SET_CONTEXT); // Deselect all selection::state(Document).deselect_all(); // Instantiate nodes and select new ones k3d::nodes_t new_nodes; for(k3d::nodes_t::const_iterator selected_node = nodes.begin(); selected_node != nodes.end(); ++selected_node) { k3d::inode* new_node = 0; if(k3d::classes::MeshInstance() == (*selected_node)->factory().factory_id()) new_node = detail::duplicate_mesh(Document, **selected_node); else new_node = detail::duplicate_node(Document, **selected_node); if(new_node) { selection::state(Document).select(*new_node); new_nodes.push_back(new_node); } } k3d::node::show(Document, new_nodes); // Show duplicated node properties if only one was processed if(new_nodes.size() == 1) panel::mediator(Document).set_focus(**new_nodes.begin()); } } // namespace pipeline } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/pipeline.h ================================================ #ifndef K3DSDK_NGUI_PIPELINE_H #define K3DSDK_NGUI_PIPELINE_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include namespace k3d { class idocument; class inode; class iplugin_factory; namespace ngui { namespace pipeline { /// Creates a new node, performing many standard initialization operations. inode* create_node(idocument& Document, iplugin_factory& Factory); /// Duplicates first node's transformation into a FrozenMatrixa and connects it to second node void freeze_transformation(inode& FromNode, inode& ToNode, idocument& Document); /// Instantiates the given node, returning the mesh instance if it was a mesh or null otherwise inode* instantiate_mesh(idocument& Document, inode& Node); /// Instantiates (creates MeshInstance outputs for) nodes - note, only mesh sources are instantiable. void instantiate_selected_nodes(idocument& Document); /// Duplicates nodes with their input transformation, if any void duplicate_selected_nodes(idocument& Document); } // namespace pipeline } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PIPELINE_H ================================================ FILE: k3dsdk/ngui/point3.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace point { namespace detail { /// Adapts a k3d::iproperty object for use with point::control class data_proxy : public idata_proxy { public: data_proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } bool writable() { return m_writable_data ? true : false; } const k3d::point3 value() { const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::point3)) return boost::any_cast(m_readable_data.property_internal_value()); else if(type == typeid(k3d::vector3)) return k3d::to_point(boost::any_cast(m_readable_data.property_internal_value())); else if(type == typeid(k3d::normal3)) return k3d::to_point(boost::any_cast(m_readable_data.property_internal_value())); else k3d::log() << error << k3d_file_reference << "unknown property type: " << type.name() << std::endl; return k3d::point3(0, 0, 0); } void set_value(const k3d::point3& Value) { return_if_fail(m_writable_data); const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::point3)) m_writable_data->property_set_value(Value); else if(type == typeid(k3d::vector3)) m_writable_data->property_set_value(k3d::to_vector(Value)); else if(type == typeid(k3d::normal3)) m_writable_data->property_set_value(k3d::to_normal(Value)); else k3d::log() << error << k3d_file_reference << "unknown property type: " << type.name() << std::endl; } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } private: k3d::iproperty& m_readable_data; k3d::iwritable_property* const m_writable_data; }; } // namespace detail /// Adapts a spin button to control a single point coordinate (indentified by index) class spin_button_model : public spin_button::imodel { public: spin_button_model(point::idata_proxy& Data, const unsigned int Index) : m_data(Data), m_index(Index) { assert_warning(m_index < 3); } const Glib::ustring label() { return ""; } k3d::bool_t writable() { return m_data.writable(); } k3d::double_t value() { return m_data.value()[m_index]; } void set_value(const double Value) { k3d::point3 coords = m_data.value(); coords[m_index] = Value; m_data.set_value(coords); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_data.changed_signal().connect(sigc::hide(Slot)); } k3d::double_t step_increment() { return 0.1; } const std::type_info& units() { return typeid(k3d::measurement::distance); } private: point::idata_proxy& m_data; const int m_index; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : base(3, 3, false), m_data(std::move(Data)), m_reset_button(0) { spin_button::control* const x = new spin_button::control(new spin_button_model(*m_data, 0), m_data->state_recorder); spin_button::control* const y = new spin_button::control(new spin_button_model(*m_data, 1), m_data->state_recorder); spin_button::control* const z = new spin_button::control(new spin_button_model(*m_data, 2), m_data->state_recorder); attach(*Gtk::manage(new Gtk::Label(_("X"))), 0, 1, 0, 1); attach(*Gtk::manage(x), 1, 2, 0, 1); attach(*Gtk::manage(new Gtk::Label(_("Y"))), 0, 1, 1, 2); attach(*Gtk::manage(y), 1, 2, 1, 2); attach(*Gtk::manage(new Gtk::Label(_("Z"))), 0, 1, 2, 3); attach(*Gtk::manage(z), 1, 2, 2, 3); if(m_data.get() && m_data->writable()) { m_reset_button = new Gtk::Button(_("Reset")); attach(*Gtk::manage(m_reset_button << connect_button(sigc::mem_fun(*this, &control::on_reset))), 2, 3, 1, 2); } } void control::on_reset() { return_if_fail(m_data.get()); // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_data->set_value(k3d::point3(0, 0, 0)); // Turn this into an undo/redo -able event ... if(m_data->state_recorder) m_data->state_recorder->commit_change_set(m_data->state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), m_data->change_message + " reset", K3D_CHANGE_SET_CONTEXT); } ///////////////////////////////////////////////////////////////////////////// // proxy std::unique_ptr proxy(k3d::iproperty& Property, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new detail::data_proxy(Property, StateRecorder, ChangeMessage)); } } // namespace point } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/point3.h ================================================ #ifndef K3DSDK_NGUI_POINT3_H #define K3DSDK_NGUI_POINT3_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace Gtk { class Button; } namespace k3d { class ihint; } namespace k3d { class iproperty; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace point { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a point control (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Returns true iff the underlying data source is writable virtual bool writable() = 0; /// Called to return the underlying data value virtual const k3d::point3 value() = 0; /// Called to set a new data value virtual void set_value(const k3d::point3& Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for modifying the point of an object class control : public Gtk::Table { typedef Gtk::Table base; public: control(std::unique_ptr Data); private: /// Called to reset the object point to the origin void on_reset(); /// Stores a reference to the underlying data object std::unique_ptr m_data; /// Stores the reset button Gtk::Button* m_reset_button; }; ///////////////////////////////////////////////////////////////////////////// // proxy /// Convenience factory function for creating k3d::spin_button::idata_proxy objects, specialized for k3d::iproperty std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = Glib::ustring()); } // namespace point } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_POINT3_H ================================================ FILE: k3dsdk/ngui/property.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace property { /////////////////////////////////////////////////////////////////////////////// // create_dialog /// Implements a dialog for adding custom user properties to a node class create_dialog : public node_window, public k3d::property_collection // needed for enumeration properties { typedef node_window base; public: create_dialog(k3d::inode& Node) : base(Node), m_property_type(init_owner(*this) + init_name("property_type") + init_label("") + init_description("") + init_value(string_t("generic_property")) + init_enumeration(property_type_values())), m_name(init_value(string_t(""))), m_label(init_value(string_t(""))), m_description(init_value(string_t(""))), m_generic_type(init_owner(*this) + init_name("user_type") + init_label("") + init_description("") + init_value(string_t("k3d::bool_t")) + init_enumeration(generic_type_values())), m_renderman_type(init_owner(*this) + init_name("renderman_type") + init_label("") + init_description("") + init_value(string_t("k3d::int32_t")) + init_enumeration(renderman_type_values())), m_renderman_name(init_value(string_t(""))), m_ignore_name_change(false), m_ignore_label_change(false), m_label_tracks_name(true), m_generic_type_label(0), m_renderman_type_label(0), m_renderman_name_label(0), m_generic_type_control(0), m_renderman_type_control(0), m_name_control(0), m_renderman_name_control(0) { set_title(_("Add User Property:")); set_role("add_user_property"); set_position(Gtk::WIN_POS_CENTER); Gtk::Table* const table = new Gtk::Table(6, 2, false); table->set_col_spacings(4); table->attach(*Gtk::manage(new Gtk::Label(_("Property Type"))), 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); table->attach(*Gtk::manage(new enumeration_chooser::control(enumeration_chooser::model(m_property_type))), 1, 2, 0, 1); m_generic_type_label = new Gtk::Label(_("Data Type")); m_generic_type_control = new enumeration_chooser::control(enumeration_chooser::model(m_generic_type)); table->attach(*Gtk::manage(m_generic_type_label), 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); table->attach(*Gtk::manage(m_generic_type_control), 1, 2, 1, 2); m_renderman_type_label = new Gtk::Label(_("Data Type")); m_renderman_type_control = new enumeration_chooser::control(enumeration_chooser::model(m_renderman_type)); table->attach(*Gtk::manage(m_renderman_type_label), 0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK); table->attach(*Gtk::manage(m_renderman_type_control), 1, 2, 2, 3); m_renderman_name_label = new Gtk::Label(_("Attribute Name")); m_renderman_name_control = new entry::control(entry::model(m_renderman_name), 0); table->attach(*Gtk::manage(m_renderman_name_label), 0, 1, 4, 5, Gtk::SHRINK, Gtk::SHRINK); table->attach(*Gtk::manage(m_renderman_name_control), 1, 2, 4, 5); m_name_control = new entry::control(entry::model(m_name), 0) << connect_signal_changed(sigc::mem_fun(*this, &create_dialog::on_name_changed)); table->attach(*Gtk::manage(new Gtk::Label(_("Name"))), 0, 1, 5, 6, Gtk::SHRINK, Gtk::SHRINK); table->attach(*Gtk::manage(m_name_control), 1, 2, 5, 6); table->attach(*Gtk::manage(new Gtk::Label(_("Label"))), 0, 1, 6, 7, Gtk::SHRINK, Gtk::SHRINK); table->attach(*Gtk::manage(new entry::control(entry::model(m_label), 0) << connect_signal_changed(sigc::mem_fun(*this, &create_dialog::on_label_changed))), 1, 2, 6, 7); table->attach(*Gtk::manage(new Gtk::Label(_("Description"))), 0, 1, 7, 8, Gtk::SHRINK, Gtk::SHRINK); table->attach(*Gtk::manage(new entry::control(entry::model(m_description), 0)), 1, 2, 7, 8); Gtk::HButtonBox* const button_box = new Gtk::HButtonBox(Gtk::BUTTONBOX_END); button_box->pack_start(*Gtk::manage(button::create(_("Cancel"), Gtk::Stock::CANCEL) << connect_button(sigc::mem_fun(*this, &create_dialog::close)))); button_box->pack_start(*Gtk::manage(button::create(_("Add"), Gtk::Stock::ADD) << connect_button(sigc::mem_fun(*this, &create_dialog::on_add)))); Gtk::VBox* const vbox = Gtk::manage(new Gtk::VBox(false, 10)); vbox->set_border_width(10); vbox->pack_start(*Gtk::manage(new Gtk::Label(k3d::string_cast(boost::format(_("Add a user property to %1%:")) % node().name()))), Gtk::PACK_SHRINK); vbox->pack_start(*Gtk::manage(table), Gtk::PACK_SHRINK); vbox->pack_start(*Gtk::manage(button_box), Gtk::PACK_SHRINK); add(*vbox); show_all(); m_property_type.changed_signal().connect(sigc::hide(sigc::mem_fun(*this, &create_dialog::on_property_type_changed))); on_property_type_changed(); } private: void on_property_type_changed() { const string_t property_type = m_property_type.internal_value(); m_generic_type_label->property_visible().set_value(property_type == "generic_property"); m_generic_type_control->property_visible().set_value(property_type == "generic_property"); m_renderman_type_label->property_visible().set_value(property_type == "renderman_attribute" || property_type == "renderman_option"); m_renderman_type_control->property_visible().set_value(property_type == "renderman_attribute" || property_type == "renderman_option"); m_renderman_name_label->set_label(property_type == "renderman_attribute" ? _("Attribute Name") : _("Option Name")); m_renderman_name_label->property_visible().set_value(property_type == "renderman_attribute" || property_type == "renderman_option"); m_renderman_name_control->property_visible().set_value(property_type == "renderman_attribute" || property_type == "renderman_option"); } void on_name_changed() { if(m_ignore_name_change) return; m_ignore_name_change = true; string_t name_text = m_name_control->get_text(); std::replace(name_text.begin(), name_text.end(), ' ', '_'); m_name.set_value(name_text); m_ignore_name_change = false; if(m_label_tracks_name) { m_ignore_label_change = true; string_t label_text = name_text; bool capitalize = true; for(k3d::uint_t i = 0; i != label_text.size(); ++i) { if(capitalize) { label_text[i] = std::toupper(label_text[i]); capitalize = false; } if(label_text[i] == '_') { label_text[i] = ' '; capitalize = true; } } m_label.set_value(label_text); m_ignore_label_change = false; } } void on_label_changed() { if(m_ignore_label_change) return; m_label_tracks_name = false; } void on_add() { k3d::iproperty_collection* const property_collection = dynamic_cast(&node()); return_if_fail(property_collection); k3d::ipersistent_collection* const persistent_collection = dynamic_cast(&node()); return_if_fail(persistent_collection); const string_t property_type = m_property_type.internal_value(); const string_t name = m_name.internal_value(); const string_t label = m_label.internal_value(); const string_t description = m_description.internal_value(); const string_t generic_type = m_generic_type.internal_value(); const string_t renderman_type = m_renderman_type.internal_value(); const string_t renderman_name = m_renderman_name.internal_value(); if(name.empty()) { error_message(_("You must provide a Name to create a property.")); return; } if(label.empty()) { error_message(_("You must provide a Label to create a property.")); return; } if(property_type == "renderman_attribute" && renderman_name.empty()) { error_message(_("You must provide an Attribute Name to create a RenderMan Attribute.")); return; } if(property_type == "renderman_option" && renderman_name.empty()) { error_message(_("You must provide an Option Name to create a RenderMan Option.")); return; } k3d::record_state_change_set change_set(node().document(), "Add user property " + name, K3D_CHANGE_SET_CONTEXT); if(node().document().state_recorder().current_change_set()) node().document().state_recorder().current_change_set()->record_old_state(new k3d::user::property_container(node())); iproperty* new_property = 0; if(property_type == "generic_property") new_property = k3d::property::create(node(), generic_type, name, label, description); else if(property_type == "renderman_attribute") new_property = k3d::property::ri::create_attribute(node(), renderman_type, renderman_name, name, label, description); else if(property_type == "renderman_option") new_property = k3d::property::ri::create_option(node(), renderman_type, renderman_name, name, label, description); if(new_property) undoable_new(new_property, node().document()); if(node().document().state_recorder().current_change_set()) node().document().state_recorder().current_change_set()->record_new_state(new k3d::user::property_container(node())); if(!new_property) { error_message(_("Internal error creating user property.")); return; } close(); } static const k3d::ienumeration_property::enumeration_values_t& property_type_values() { static k3d::ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(k3d::ienumeration_property::enumeration_value_t("Generic Property", "generic_property","")); values.push_back(k3d::ienumeration_property::enumeration_value_t("RenderMan Attribute", "renderman_attribute","")); values.push_back(k3d::ienumeration_property::enumeration_value_t("RenderMan Option", "renderman_option", "")); } return values; } static const k3d::ienumeration_property::enumeration_values_t& generic_type_values() { static k3d::ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(k3d::ienumeration_property::enumeration_value_t("Boolean", "k3d::bool_t","")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Integer", "k3d::int32_t","")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Scalar", "k3d::double_t", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("String", "k3d::string_t", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("3D Point", "k3d::point3", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("3D Vector", "k3d::vector3", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("3D Normal", "k3d::normal3", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("4D Point", "k3d::point4", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("4x4 Matrix", "k3d::matrix4", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Color", "k3d::color", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Mesh", "k3d::mesh*", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("OpenGL Mesh Painter", "k3d::gl::imesh_painter*", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("RenderMan Mesh Painter", "k3d::ri::imesh_painter*", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Material", "k3d::imaterial*", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Filesystem Path", "k3d::filesystem::path", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Generic Node", "k3d::inode*", "")); } return values; } static const k3d::ienumeration_property::enumeration_values_t& renderman_type_values() { static k3d::ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(k3d::ienumeration_property::enumeration_value_t("Integer", "k3d::int32_t", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Real", "k3d::double_t", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("String", "k3d::string_t", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Point", "k3d::point3", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Vector", "k3d::vector3", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Normal", "k3d::normal3", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("HPoint", "k3d::point4", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Matrix", "k3d::matrix4", "")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Color", "k3d::color" ,"")); } return values; } k3d_data(string_t, immutable_name, change_signal, no_undo, local_storage, no_constraint, enumeration_property, no_serialization) m_property_type; k3d_data(string_t, no_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) m_name; k3d_data(string_t, no_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) m_label; k3d_data(string_t, no_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) m_description; k3d_data(string_t, immutable_name, change_signal, no_undo, local_storage, no_constraint, enumeration_property, no_serialization) m_generic_type; k3d_data(string_t, immutable_name, change_signal, no_undo, local_storage, no_constraint, enumeration_property, no_serialization) m_renderman_type; k3d_data(string_t, no_name, change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) m_renderman_name; k3d::bool_t m_ignore_name_change; k3d::bool_t m_ignore_label_change; k3d::bool_t m_label_tracks_name; Gtk::Label* m_generic_type_label; Gtk::Label* m_renderman_type_label; Gtk::Label* m_renderman_name_label; enumeration_chooser::control* m_generic_type_control; enumeration_chooser::control* m_renderman_type_control; entry::control* m_name_control; entry::control* m_renderman_name_control; }; //////////////////////////////////////////////////////////////////////////////////// // create void create(inode& Node) { new create_dialog(Node); } } // namespace property } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/property.h ================================================ #ifndef K3DSDK_NGUI_PROPERTY_H #define K3DSDK_NGUI_PROPERTY_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { class inode; namespace ngui { namespace property { /// Displays a dialog for adding new properties to a node void create(inode& Node); } // namespace property } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PROPERTY_H ================================================ FILE: k3dsdk/ngui/property_button.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements the property_button::control, which provides a MVC UI for connecting properties in the DAG \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace property_button { ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : base(std::move(Data)), m_image(new Gtk::Image()) { set_name("k3d-property-button"); set_tooltip_text(_("LMB-Click to make connections with other properties. RMB-Click for context menu.")); add(*manage(m_image)); data_changed(); m_data->document().document().pipeline().dependency_signal().connect(sigc::mem_fun(*this, &control::on_dependencies_changed)); signal_button_press_event().connect(sigc::mem_fun(*this, &base::button_press_event)); signal_button_release_event().connect(sigc::mem_fun(*this, &base::button_release_event)); } void control::data_changed() { static const Glib::RefPtr connected = load_icon("connected_plug", Gtk::ICON_SIZE_BUTTON); static const Glib::RefPtr disconnected = load_icon("plug_tool", Gtk::ICON_SIZE_BUTTON); if(m_data->document().document().pipeline().dependency(m_data->property())) m_image->set(connected); else m_image->set(disconnected); } void control::on_dependencies_changed(const k3d::ipipeline::dependencies_t& Dependencies) { if(Dependencies.count(&m_data->property())) data_changed(); } } // namespace property_button } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/property_button.h ================================================ #ifndef K3DSDK_NGUI_PROPERTY_BUTTON_H #define K3DSDK_NGUI_PROPERTY_BUTTON_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares property_button, which provides a standard MVC UI for linking properties to channels \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include namespace Gtk { class Image; } namespace k3d { namespace ngui { namespace property_button { ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating properties (i.e. the view and the controller from model-view-controller) class control : public event_button, public property_widget::control { typedef property_widget::control base; public: control(std::unique_ptr Data); private: /// Called whenever the state of the underlying data has changed void data_changed(); /// Called by the signal system whenever property dependencies change void on_dependencies_changed(const k3d::ipipeline::dependencies_t& Dependencies); /// Displays an image indicating the state of the property (connected / unconnected) Gtk::Image* const m_image; }; } // namespace property_button } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PROPERTY_BUTTON_H ================================================ FILE: k3dsdk/ngui/property_label.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements the property_label::control, which provides a MVC UI for connecting properties in the DAG \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace property_label { ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : base(std::move(Data)) { set_name("k3d-property-label"); const std::string label = m_data->property().property_label().empty() ? m_data->property().property_name() : m_data->property().property_label(); const std::string description = m_data->property().property_description(); Gtk::Label* gtk_label = new Gtk::Label(" " + label + " "); gtk_label->set_alignment(Gtk::ALIGN_LEFT); add(*Gtk::manage(gtk_label)); if(!description.empty()) set_tooltip_text(description); data_changed(); m_data->document().document().pipeline().dependency_signal().connect(sigc::mem_fun(*this, &control::on_dependencies_changed)); signal_button_press_event().connect(sigc::mem_fun(*this, &control::button_press_event)); signal_button_release_event().connect(sigc::mem_fun(*this, &control::button_release_event)); } void control::data_changed() { } void control::on_dependencies_changed(const k3d::ipipeline::dependencies_t& Dependencies) { if(Dependencies.count(&m_data->property())) data_changed(); } } // namespace property_label } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/property_label.h ================================================ #ifndef K3DSDK_NGUI_PROPERTY_LABEL_H #define K3DSDK_NGUI_PROPERTY_LABEL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares property_label, which provides a standard MVC UI for linking properties to channels \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include namespace k3d { namespace ngui { namespace property_label { ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating properties (i.e. the view and the controller from model-view-controller) class control : public Gtk::EventBox, public property_widget::control { typedef property_widget::control base; public: control(std::unique_ptr Data); private: /// Called whenever the state of the underlying data has changed void data_changed(); /// Called by the signal system whenever property dependencies change void on_dependencies_changed(const k3d::ipipeline::dependencies_t& Dependencies); }; } // namespace property_label } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PROPERTY_LABEL_H ================================================ FILE: k3dsdk/ngui/property_widget.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements the property_widget::control, which provides a MVC UI for connecting properties in the DAG \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace property_widget { ///////////////////////////////////////////////////////////////////////////// // control control::control(std::unique_ptr Data) : m_data(std::move(Data)), m_show_connected(0), m_disconnect(0) { assert_warning(m_data.get()); } control::~control() { } bool control::button_press_event(GdkEventButton* Event) { // Open context menu with left or right mouse if(Event->button != 1 && Event->button != 3) return false; show_menu(true); return true; } void control::show_menu(const bool UserAction) { // Reset menu m_disconnect = 0; m_menu_items.clear(); m_show_connected = 0; m_menu.reset(new Gtk::Menu()); // If the property's connected ... k3d::iproperty* const dependency = m_data->document().document().pipeline().dependency(m_data->property()); if(dependency) { k3d::inode* const node = k3d::find_node(m_data->document().document().nodes(), *dependency); m_show_connected = new Gtk::MenuItem(_("Show Connected")); m_show_connected << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &control::on_show_connected), node)); m_menu->items().push_back(*Gtk::manage(m_show_connected)); m_disconnect = new Gtk::MenuItem(_("Disconnect")); m_disconnect << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &control::on_disconnect), node)); m_menu->items().push_back(*Gtk::manage(m_disconnect)); } // Get the list of compatible properties Gtk::Menu* const connect_submenu = new Gtk::Menu(); m_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Connect to ..."), *manage(connect_submenu))); typedef std::map node_menu_items_t; node_menu_items_t items_map; for(k3d::inode_collection::nodes_t::const_iterator node = m_data->document().document().nodes().collection().begin(); node != m_data->document().document().nodes().collection().end(); ++node) { k3d::iproperty_collection* const property_collection = dynamic_cast(*node); if(!property_collection) continue; typedef std::map properties_t; properties_t properties_map; k3d::iproperty_collection::properties_t all_properties = property_collection->properties(); for(k3d::iproperty_collection::properties_t::iterator p = all_properties.begin(); p != all_properties.end(); ++p) { if(m_data->property().property_type() != (*p)->property_type()) continue; const std::string label = (*p)->property_label(); properties_map.insert(std::make_pair(label, *p)); } if(!properties_map.size()) continue; // Add compatible properties for this node to the 'connect' submenu Gtk::Menu* const node_submenu = new Gtk::Menu(); items_map.insert(std::make_pair((*node)->name(), node_submenu)); for(properties_t::const_iterator property = properties_map.begin(); property != properties_map.end(); ++property) { Gtk::MenuItem* const menu_item = new Gtk::MenuItem(property->first); menu_item << connect_menu_item(sigc::bind(sigc::mem_fun(*this, &control::on_connect_to), property->second)); m_menu_items.insert(std::make_pair(property->second, menu_item)); node_submenu->items().push_back(*Gtk::manage(menu_item)); } } // Sort nodes by name for(node_menu_items_t::const_iterator item = items_map.begin(); item != items_map.end(); ++item) { connect_submenu->items().push_back(Gtk::Menu_Helpers::MenuElem(item->first, *manage(item->second))); } m_menu->show_all(); if(UserAction) m_menu->popup(1, gtk_get_current_event_time()); else m_menu->popup(0, GDK_CURRENT_TIME); } bool control::button_release_event(GdkEventButton* Event) { if(Event->button != 1) return false; return true; } void control::on_show_connected(k3d::inode* Node) { show_connected(Node); } void control::show_connected(k3d::inode* Node) { return_if_fail(Node); panel::mediator(m_data->document().document()).set_focus(*Node); } void control::on_connect_to(k3d::iproperty* Property) { k3d::record_state_change_set changeset(m_data->document().document(), _("Connect Properties"), K3D_CHANGE_SET_CONTEXT); connect_to(Property); } void control::connect_to(k3d::iproperty* Property) { return_if_fail(Property); // If the property's already connected, disconnect it first if(m_data->document().document().pipeline().dependency(m_data->property())) { k3d::ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&m_data->property(), static_cast(0))); m_data->document().document().pipeline().set_dependencies(dependencies); } // Make connection k3d::ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&m_data->property(), Property)); m_data->document().document().pipeline().set_dependencies(dependencies); } void control::on_disconnect(k3d::inode* Node) { k3d::record_state_change_set changeset(m_data->document().document(), m_data->change_message + " Disconnect", K3D_CHANGE_SET_CONTEXT); disconnect(Node); } void control::disconnect(k3d::inode* Node) { return_if_fail(Node); k3d::ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&m_data->property(), static_cast(0))); m_data->document().document().pipeline().set_dependencies(dependencies); } } // namespace property_widget } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/property_widget.h ================================================ #ifndef K3DSDK_NGUI_PROPERTY_WIDGET_H #define K3DSDK_NGUI_PROPERTY_WIDGET_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares property_widget, which provides a standard MVC UI for linking properties to channels \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include namespace Gtk { class Menu; } namespace Gtk { class MenuItem; } namespace k3d { class inode; } namespace k3d { class iproperty; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { class document_state; namespace property_widget { ///////////////////////////////////////////////////////////////////////////// // idata_proxy /// Abstract interface for an object that proxies a data source for a property_widget (i.e. the "model" in model-view-controller) class idata_proxy { public: virtual ~idata_proxy() {} /// Called to return the document containing the underlying data property virtual document_state& document() = 0; /// Called to return the underlying data property virtual k3d::iproperty& property() = 0; /// Stores an optional state recorder for recording undo/redo data k3d::istate_recorder* const state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring change_message; protected: idata_proxy(k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : state_recorder(StateRecorder), change_message(ChangeMessage) { } private: idata_proxy(const idata_proxy& RHS); idata_proxy& operator=(const idata_proxy& RHS); }; ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating properties (i.e. the view and the controller from model-view-controller) class control { public: control(std::unique_ptr Data); virtual ~control(); bool button_press_event(GdkEventButton* Event); bool button_release_event(GdkEventButton* Event); protected: void show_menu(const bool UserAction); void on_show_connected(k3d::inode* Object); void show_connected(k3d::inode* Object); void on_connect_to(k3d::iproperty* Property); void connect_to(k3d::iproperty* Property); void on_disconnect(k3d::inode* Object); void disconnect(k3d::inode* Object); /// Stores a reference to the underlying data object std::unique_ptr m_data; /// Context menu displayed when the user clicks on the widget std::unique_ptr m_menu; /// Caches the "show connected" widget for tutorial playback Gtk::MenuItem* m_show_connected; /// Maps properties to widgets for tutorial playback std::map m_menu_items; /// Caches the "disconnect" widget for tutorial playback Gtk::MenuItem* m_disconnect; }; /// Provides an implementation of property_widget::idata_proxy that supports any data source that supports the property() concept template class data_proxy : public idata_proxy { public: data_proxy(document_state& DocumentState, data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_document_state(DocumentState), m_data(Data) { } document_state& document() { return m_document_state; } k3d::iproperty& property() { return m_data.property(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); document_state& m_document_state; data_t& m_data; }; /// Specialization of property_widget::data_proxy for use directly with iproperty objects template<> class data_proxy : public idata_proxy { public: typedef k3d::iproperty data_t; data_proxy(document_state& DocumentState, data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_document_state(DocumentState), m_data(Data) { } document_state& document() { return m_document_state; } k3d::iproperty& property() { return m_data; } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); document_state& m_document_state; data_t& m_data; }; /// Convenience factory function for creating property_widget::idata_proxy objects template std::unique_ptr proxy(document_state& DocumentState, data_t& Data, k3d::istate_recorder* const StateRecorder = 0, const Glib::ustring& ChangeMessage = "") { return std::unique_ptr(new data_proxy(DocumentState, Data, StateRecorder, ChangeMessage)); } } // namespace property_widget } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_PROPERTY_WIDGET_H ================================================ FILE: k3dsdk/ngui/render.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { class camera_columns : public Gtk::TreeModelColumnRecord { public: camera_columns() { add(node); add(factory); add(label); add(icon); add(separator); } Gtk::TreeModelColumn node; Gtk::TreeModelColumn factory; Gtk::TreeModelColumn label; Gtk::TreeModelColumn > icon; Gtk::TreeModelColumn separator; }; class camera_separators : public sigc::trackable { public: camera_separators(camera_columns& Columns) : columns(Columns) { } bool is_separator(const Glib::RefPtr& Model, const Gtk::TreeModel::iterator& Row) { return (*Row)[columns.separator]; } private: camera_columns& columns; }; /// Prompt the user to choose an existing camera from within a document, or create a new one k3d::icamera* pick_camera(document_state& DocumentState, const std::vector& Cameras, const k3d::plugin::factory::collection_t& Factories, const k3d::icamera* CurrentCamera, const k3d::string_t& Title, const k3d::string_t& Message) { camera_columns columns; Glib::RefPtr model = Gtk::ListStore::create(columns); int index = 0; int active_row = 0; for(std::vector::const_iterator camera = Cameras.begin(); camera != Cameras.end(); ++camera) { k3d::inode* const node = dynamic_cast(*camera); Gtk::TreeRow row = *model->append(); row[columns.node] = node; row[columns.factory] = 0; row[columns.label] = node->name(); row[columns.icon] = quiet_load_icon(node->factory().name(), Gtk::ICON_SIZE_MENU); row[columns.separator] = false; if(CurrentCamera == (*camera)) active_row = index; ++index; } if(Cameras.size() && Factories.size()) { Gtk::TreeRow row = *model->append(); row[columns.node] = 0; row[columns.factory] = 0; row[columns.separator] = true; } for(k3d::plugin::factory::collection_t::const_iterator factory = Factories.begin(); factory != Factories.end(); ++factory) { k3d::string_t markup; if(k3d::iplugin_factory::EXPERIMENTAL == (*factory)->quality()) { markup = k3d::string_cast(boost::format(_("Create %1% (Experimental)")) % (*factory)->name()); } else if(k3d::iplugin_factory::DEPRECATED == (*factory)->quality()) { markup = k3d::string_cast(boost::format(_("Create %1% (Deprecated)")) % (*factory)->name()); } else { markup = k3d::string_cast(boost::format(_("Create %1%")) % (*factory)->name()); } Gtk::TreeRow row = *model->append(); row[columns.node] = 0; row[columns.factory] = *factory; row[columns.label] = markup; row[columns.icon] = quiet_load_icon((*factory)->name(), Gtk::ICON_SIZE_MENU); row[columns.separator] = false; } Gtk::ComboBox combo(Glib::RefPtr::cast_dynamic(model)); combo.pack_start(columns.icon, false); Gtk::CellRendererText* const label_renderer = new Gtk::CellRendererText(); combo.pack_start(*manage(label_renderer)); combo.add_attribute(label_renderer->property_markup(), columns.label); camera_separators separators(columns); combo.set_row_separator_func(sigc::mem_fun(separators, &camera_separators::is_separator)); combo.set_active(active_row); Gtk::Dialog dialog(Title, true); dialog.set_border_width(5); dialog.get_vbox()->pack_start(*Gtk::manage(new Gtk::Label(Message)), Gtk::PACK_SHRINK, 5); dialog.get_vbox()->pack_start(combo, Gtk::PACK_SHRINK, 5); dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.set_position(Gtk::WIN_POS_CENTER); dialog.show_all(); if(Gtk::RESPONSE_OK == dialog.run()) { return_val_if_fail(combo.get_active() != model->children().end(), 0); if(k3d::inode* const node = combo.get_active()->get_value(columns.node)) return dynamic_cast(node); if(k3d::iplugin_factory* const factory = combo.get_active()->get_value(columns.factory)) return dynamic_cast(pipeline::create_node(DocumentState.document(), *factory)); } return 0; } class render_engine_columns : public Gtk::TreeModelColumnRecord { public: render_engine_columns() { add(object); add(factory); add(label); add(icon); add(separator); } Gtk::TreeModelColumn object; Gtk::TreeModelColumn factory; Gtk::TreeModelColumn label; Gtk::TreeModelColumn > icon; Gtk::TreeModelColumn separator; }; class render_engine_separators : public sigc::trackable { public: render_engine_separators(render_engine_columns& Columns) : columns(Columns) { } bool is_separator(const Glib::RefPtr& Model, const Gtk::TreeModel::iterator& Row) { return (*Row)[columns.separator]; } private: render_engine_columns& columns; }; /// Prompt the user to choose an existing render engine from within a document, or create a new one template interface_t* pick_render_engine(document_state& DocumentState, const std::vector& RenderEngines, const k3d::plugin::factory::collection_t& Factories, const k3d::string_t& Title, const k3d::string_t& Message) { render_engine_columns columns; Glib::RefPtr model = Gtk::ListStore::create(columns); for(typename std::vector::const_iterator object = RenderEngines.begin(); object != RenderEngines.end(); ++object) { k3d::inode* const node = dynamic_cast(*object); Gtk::TreeRow row = *model->append(); row[columns.object] = node; row[columns.factory] = 0; row[columns.label] = node->name(); row[columns.icon] = quiet_load_icon(node->factory().name(), Gtk::ICON_SIZE_MENU); row[columns.separator] = false; } if(RenderEngines.size() && Factories.size()) { Gtk::TreeRow row = *model->append(); row[columns.object] = 0; row[columns.factory] = 0; row[columns.separator] = true; } for(k3d::plugin::factory::collection_t::const_iterator factory = Factories.begin(); factory != Factories.end(); ++factory) { k3d::string_t markup; if(k3d::iplugin_factory::EXPERIMENTAL == (*factory)->quality()) { markup = k3d::string_cast(boost::format(_("Create %1% (Experimental)")) % (*factory)->name()); } else if(k3d::iplugin_factory::DEPRECATED == (*factory)->quality()) { markup = k3d::string_cast(boost::format(_("Create %1% (Deprecated)")) % (*factory)->name()); } else { markup = k3d::string_cast(boost::format(_("Create %1%")) % (*factory)->name()); } Gtk::TreeRow row = *model->append(); row[columns.object] = 0; row[columns.factory] = *factory; row[columns.label] = markup; row[columns.icon] = quiet_load_icon((*factory)->name(), Gtk::ICON_SIZE_MENU); row[columns.separator] = false; } Gtk::ComboBox combo(Glib::RefPtr::cast_dynamic(model)); combo.pack_start(columns.icon, false); Gtk::CellRendererText* const label_renderer = new Gtk::CellRendererText(); combo.pack_start(*manage(label_renderer)); combo.add_attribute(label_renderer->property_markup(), columns.label); render_engine_separators separators(columns); combo.set_row_separator_func(sigc::mem_fun(separators, &render_engine_separators::is_separator)); combo.set_active(0); Gtk::Dialog dialog(Title, true); dialog.set_border_width(5); dialog.get_vbox()->pack_start(*Gtk::manage(new Gtk::Label(Message)), Gtk::PACK_SHRINK, 5); dialog.get_vbox()->pack_start(combo, Gtk::PACK_SHRINK, 5); dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK)->grab_focus(); dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.set_position(Gtk::WIN_POS_CENTER); dialog.show_all(); if(Gtk::RESPONSE_OK == dialog.run()) { return_val_if_fail(combo.get_active() != model->children().end(), 0); if(k3d::inode* const object = combo.get_active()->get_value(columns.object)) return dynamic_cast(object); if(k3d::iplugin_factory* const factory = combo.get_active()->get_value(columns.factory)) { k3d::inode* const node = k3d::plugin::create(*factory, DocumentState.document(), k3d::unique_name(DocumentState.document().nodes(), factory->name())); if(node) panel::mediator(DocumentState.document()).set_focus(*node); return dynamic_cast(node); } } return 0; } /// Performs sanity checks to see if a RenderMan render engine is installed and usable void test_renderman_render_engine(k3d::iunknown& Engine) { k3d::inode* const node = dynamic_cast(&Engine); if(!node) return; if(node->factory().factory_id() != k3d::classes::RenderManEngine()) return; try { k3d::ri::irender_engine* const render_engine = dynamic_cast(boost::any_cast(k3d::property::pipeline_value(Engine, "render_engine"))); if(!render_engine) { error_message( _("Choose RenderMan Implementation"), _("You must choose the specific RenderMan implementation to use with this render engine.")); return; } if(!render_engine->installed()) { error_message( _("RenderMan Implementation Unavailable"), _("The requested RenderMan implementation could not be found. Check to ensure that you have it installed and your PATH is up-to-date.")); return; } } catch(...) { k3d::log() << error << "uncaught exception" << std::endl; } } /// Performs sanity checks to see if Yafray is installed and usable void test_yafray_render_engine(k3d::iunknown& Engine) { static bool test_performed = false; if(test_performed) return; k3d::inode* const node = dynamic_cast(&Engine); if(!node) return; if(node->factory().factory_id() != k3d::uuid(0xef38bf93, 0x66654f9f, 0x992ca91b, 0x62bae139)) return; test_performed = true; if(k3d::system::find_executable("yafray").empty()) { error_message( _("Could not locate the yafray executable."), _("Check to ensure that you have Yafray installed, and that the PATH environment variable points to the Yafray installation directory.")); return; } } class animation_sample_columns : public Gtk::TreeModelColumnRecord { public: animation_sample_columns() { add(file); } Gtk::TreeModelColumn file; }; /// Prompt the user to choose a range of files for saving an animation class animation_chooser_dialog : public Gtk::FileChooserDialog { typedef Gtk::FileChooserDialog base; public: animation_chooser_dialog() : base(_("Choose animation output files:"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER), model(Gtk::ListStore::create(columns)) { } bool get_files(k3d::file_range& Files) { files = &Files; // Create widgets that will be added to the dialog. We do this on the stack // so the same buttons don't get added to the widget multiple times if get_files() is // called more-than-once. Gtk::Label file_label(_("Choose the format for output files:")); file_label.set_alignment(0.0, 0.5); before.set_text(Files.before.raw()); before.signal_changed().connect(sigc::mem_fun(*this, &animation_chooser_dialog::before_changed)); Gtk::Entry digits; digits.set_editable(false); digits.set_text(Glib::ustring(Files.digits, '0')); digits.set_max_length(Files.digits); after.set_text(Files.after.raw()); after.signal_changed().connect(sigc::mem_fun(*this, &animation_chooser_dialog::after_changed)); Gtk::HBox file(false, 0); file.pack_start(before); file.pack_start(digits); file.pack_start(after); Gtk::Label samples_label(_("Generated filenames:")); samples_label.set_alignment(0.0, 0.5); generate_samples(); Gtk::TreeView samples(model); samples.set_headers_visible(false); samples.set_reorderable(false); samples.append_column("", columns.file); Gtk::ScrolledWindow samples_window; samples_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); samples_window.add(samples); Gtk::VBox extra_widget(false, 5); extra_widget.pack_start(file_label); extra_widget.pack_start(file); extra_widget.pack_start(samples_label); extra_widget.pack_start(samples_window, Gtk::PACK_EXPAND_WIDGET); set_extra_widget(extra_widget); Gtk::Button cancel_widget(Gtk::Stock::CANCEL); cancel_widget.set_flags(cancel_widget.get_flags() | Gtk::CAN_DEFAULT); cancel_widget.show(); Gtk::Button save_widget(Gtk::Stock::SAVE); save_widget.set_flags(save_widget.get_flags() | Gtk::CAN_DEFAULT); save_widget.show(); // Add the K-3D share path as a shortcut ... add_shortcut_folder(k3d::share_path().native_utf8_string().raw()); add_action_widget(cancel_widget, Gtk::RESPONSE_CANCEL); add_action_widget(save_widget, Gtk::RESPONSE_OK); set_default_response(Gtk::RESPONSE_OK); // Setup the initial path to display ... k3d::filesystem::path start_path = Files.directory; if(start_path.empty()) start_path = k3d::options::get_path(k3d::options::path::render_animation()); if(start_path.empty()) start_path = k3d::system::get_home_directory(); if(k3d::filesystem::exists(start_path) && k3d::filesystem::is_directory(start_path)) set_current_folder(start_path.native_filesystem_string()); // Run the dialog ... set_position(Gtk::WIN_POS_CENTER); extra_widget.show_all(); if(Gtk::RESPONSE_OK != run()) return false; Files.directory = k3d::filesystem::native_path(k3d::ustring::from_utf8(Glib::filename_to_utf8(get_filename()).raw())); /* // Prompt the user if they're about to overwrite an existing file ... if(!prompt_file_overwrite(Result)) return false; */ // Record the path for posterity ... k3d::options::set_path(k3d::options::path::render_animation(), Files.directory); return true; } private: void before_changed() { files->before = k3d::ustring::from_utf8(before.get_text()); generate_samples(); } void after_changed() { files->after = k3d::ustring::from_utf8(after.get_text()); generate_samples(); } void generate_samples() { model->clear(); for(size_t file = files->begin; file != files->end; ++file) { Gtk::TreeRow row = *model->append(); row[columns.file] = files->file(file).native_utf8_string().raw(); } } k3d::file_range* files; Gtk::Entry before; Gtk::Entry after; animation_sample_columns columns; const Glib::RefPtr model; }; const bool generate_frames(document_state& DocumentState, k3d::frames& Frames) { // Ensure that the document has animation capabilities, first ... k3d::iproperty* const start_time_property = k3d::get_start_time(DocumentState.document()); k3d::iproperty* const end_time_property = k3d::get_end_time(DocumentState.document()); k3d::iproperty* const frame_rate_property = k3d::get_frame_rate(DocumentState.document()); if(!(start_time_property && end_time_property && frame_rate_property)) { error_message(_("Document does not contain a TimeSource, cannot render animation.")); return false; } // Generate a uniform sampling of "frames" within time-range of the animation ... const double start_time = boost::any_cast(k3d::property::pipeline_value(*start_time_property)); const double end_time = boost::any_cast(k3d::property::pipeline_value(*end_time_property)); const double frame_rate = boost::any_cast(k3d::property::pipeline_value(*frame_rate_property)); if(start_time > end_time) { error_message(_("Animation start time must be less-than end time.")); return false; } if(0 == frame_rate) { error_message(_("Cannot render animation with zero frame rate.")); return false; } const double frame_delta = 1.0 / frame_rate; for(k3d::uint_t frame = 0, next_frame = 1; start_time + (next_frame * frame_delta) < end_time; ++frame, ++next_frame) Frames.push_back(k3d::frame(start_time + (frame * frame_delta), start_time + (next_frame * frame_delta))); return true; } const bool assign_destinations(k3d::iunknown& Engine, k3d::frames& Frames) { k3d::file_range files; files.before = k3d::ustring::from_utf8("output"); files.begin = 0; files.end = Frames.size(); // Try to infer the correct file extension behavior ... if(dynamic_cast(&Engine)) { files.after = k3d::ustring::from_utf8(".pnm"); } else if(k3d::inode* const node = dynamic_cast(&Engine)) { if(node->factory().factory_id() == k3d::classes::RenderManEngine()) { files.after = k3d::ustring::from_utf8(".tiff"); } else if(node->factory().factory_id() == k3d::uuid(0xef38bf93, 0x66654f9f, 0x992ca91b, 0x62bae139)) { files.after = k3d::ustring::from_utf8(".tga"); } } // Make sure the supplied filepath has enough digits to render the entire animation ... while(files.max_file_count() < Frames.size()) files.digits += 1; // Prompt the user for destination details ... detail::animation_chooser_dialog dialog; if(!dialog.get_files(files)) return false; k3d::uint_t frame_index = 0; for(k3d::frames::iterator frame = Frames.begin(); frame != Frames.end(); ++frame, ++frame_index) frame->destination = files.file(frame_index); return true; } } // namespace detail k3d::icamera* default_camera(document_state& DocumentState) { const std::vector cameras = k3d::node::lookup(DocumentState.document()); return cameras.size() == 1 ? cameras[0] : 0; } k3d::irender_preview* default_preview_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); return render_engines.size() == 1 ? render_engines[0] : 0; } k3d::irender_frame* default_still_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); return render_engines.size() == 1 ? render_engines[0] : 0; } k3d::irender_animation* default_animation_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); return render_engines.size() == 1 ? render_engines[0] : 0; } k3d::irender_camera_preview* default_camera_preview_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); return render_engines.size() == 1 ? render_engines[0] : 0; } k3d::irender_camera_frame* default_camera_still_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); return render_engines.size() == 1 ? render_engines[0] : 0; } k3d::irender_camera_animation* default_camera_animation_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); return render_engines.size() == 1 ? render_engines[0] : 0; } k3d::gl::irender_viewport* default_gl_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); return render_engines.size() == 1 ? render_engines[0] : 0; } k3d::icamera* pick_camera(document_state& DocumentState, const k3d::icamera* CurrentCamera) { const std::vector cameras = k3d::node::lookup(DocumentState.document()); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); return detail::pick_camera(DocumentState, cameras, factories, CurrentCamera, _("Pick Camera:"), _("Choose a camera")); } k3d::irender_preview* pick_preview_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); return detail::pick_render_engine(DocumentState, render_engines, factories, _("Pick Preview Render Engine:"), _("Choose a render engine to be used for preview image rendering")); } k3d::irender_frame* pick_still_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); return detail::pick_render_engine(DocumentState, render_engines, factories, _("Pick Still Render Engine:"), _("Choose a render engine to be used for still image rendering")); } k3d::irender_animation* pick_animation_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); return detail::pick_render_engine(DocumentState, render_engines, factories, _("Pick Animation Render Engine:"), _("Choose a render engine to be used for animation rendering")); } k3d::irender_camera_preview* pick_camera_preview_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); return detail::pick_render_engine(DocumentState, render_engines, factories, _("Pick Preview Render Engine:"), _("Choose a render engine to be used for preview image rendering")); } k3d::irender_camera_frame* pick_camera_still_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); return detail::pick_render_engine(DocumentState, render_engines, factories, _("Pick Still Render Engine:"), _("Choose a render engine to be used for still image rendering")); } k3d::irender_camera_animation* pick_camera_animation_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); return detail::pick_render_engine(DocumentState, render_engines, factories, _("Pick Animation Render Engine:"), _("Choose a render engine to be used for animation rendering")); } k3d::gl::irender_viewport* pick_gl_render_engine(document_state& DocumentState) { const std::vector render_engines = k3d::node::lookup(DocumentState.document()); const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); return detail::pick_render_engine(DocumentState, render_engines, factories, _("Pick OpenGL Render Engine:"), _("Choose an OpenGL render engine to be used for drawing")); } void test_render_engine(k3d::iunknown& Engine) { detail::test_renderman_render_engine(Engine); detail::test_yafray_render_engine(Engine); } void render(k3d::irender_preview& Engine) { test_render_engine(Engine); assert_warning(Engine.render_preview()); } void render(k3d::irender_frame& Engine) { k3d::filesystem::path file; { file_chooser_dialog dialog(_("Render Frame:"), k3d::options::path::render_frame(), Gtk::FILE_CHOOSER_ACTION_SAVE); if(!dialog.get_file_path(file)) return; } test_render_engine(Engine); assert_warning(Engine.render_frame(file, true)); } void render(document_state& DocumentState, k3d::irender_animation& Engine) { test_render_engine(Engine); k3d::frames frames; if(!detail::generate_frames(DocumentState, frames)) return; if(!detail::assign_destinations(Engine, frames)) return; // See if the user wants to view frames as they're completed ... std::vector buttons; buttons.push_back("Yes"); buttons.push_back("No"); buttons.push_back("Cancel"); const unsigned long result = query_message("Do you want to see rendered frames as they're completed?", 1, buttons); if(0 == result || 3 == result) return; const bool viewcompleted = (1 == result); assert_warning(Engine.render_animation(*k3d::get_time(DocumentState.document()), frames, viewcompleted)); } void render(k3d::icamera& Camera, k3d::irender_camera_preview& Engine) { test_render_engine(Engine); assert_warning(Engine.render_camera_preview(Camera)); } void render(k3d::icamera& Camera, k3d::irender_camera_frame& Engine) { k3d::filesystem::path file; { file_chooser_dialog dialog(_("Render Frame:"), k3d::options::path::render_frame(), Gtk::FILE_CHOOSER_ACTION_SAVE); // Try to infer the correct file extension behavior ... if(dynamic_cast(&Engine)) { dialog.add_pattern_filter(_("PNM Image (*.pnm)"), "*.pnm"); dialog.add_all_files_filter(); dialog.append_extension(".pnm"); } else if(k3d::inode* const node = dynamic_cast(&Engine)) { if(node->factory().factory_id() == k3d::classes::RenderManEngine()) { dialog.add_pattern_filter(_("TIFF Image (*.tiff)"), "*.tiff"); dialog.add_all_files_filter(); dialog.append_extension(".tiff"); } else if(node->factory().factory_id() == k3d::uuid(0xef38bf93, 0x66654f9f, 0x992ca91b, 0x62bae139)) { dialog.add_pattern_filter(_("Targa Image (*.tga)"), "*.tga"); dialog.add_all_files_filter(); dialog.append_extension(".tga"); } } if(!dialog.get_file_path(file)) return; } test_render_engine(Engine); assert_warning(Engine.render_camera_frame(Camera, file, true)); } void render(document_state& DocumentState, k3d::icamera& Camera, k3d::irender_camera_animation& Engine) { test_render_engine(Engine); k3d::frames frames; if(!detail::generate_frames(DocumentState, frames)) return; if(!detail::assign_destinations(Engine, frames)) return; // See if the user wants to view frames as they're completed ... std::vector buttons; buttons.push_back("Yes"); buttons.push_back("No"); buttons.push_back("Cancel"); const unsigned long result = query_message("Do you want to see rendered frames as they're completed?", 1, buttons); if(0 == result || 3 == result) return; const bool viewcompleted = (1 == result); assert_warning(Engine.render_camera_animation(Camera, *k3d::get_time(DocumentState.document()), frames, viewcompleted)); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/render.h ================================================ #ifndef K3DSDK_NGUI_RENDER_H #define K3DSDK_NGUI_RENDER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { class icamera; } namespace k3d { class irender_preview; } namespace k3d { class irender_frame; } namespace k3d { class irender_animation; } namespace k3d { class irender_camera_preview; } namespace k3d { class irender_camera_frame; } namespace k3d { class irender_camera_animation; } namespace k3d { namespace gl { class irender_viewport; } } namespace k3d { namespace ngui { class document_state; /// Returns a default camera, or 0 k3d::icamera* default_camera(document_state& DocumentState); /// Returns a default preview render engine, or 0 k3d::irender_preview* default_preview_render_engine(document_state& DocumentState); /// Returns a default still render engine, or 0 k3d::irender_frame* default_still_render_engine(document_state& DocumentState); /// Returns a default animation render engine, or 0 k3d::irender_animation* default_animation_render_engine(document_state& DocumentState); /// Returns a default preview render engine, or 0 k3d::irender_camera_preview* default_camera_preview_render_engine(document_state& DocumentState); /// Returns a default still render engine, or 0 k3d::irender_camera_frame* default_camera_still_render_engine(document_state& DocumentState); /// Returns a default animation render engine, or 0 k3d::irender_camera_animation* default_camera_animation_render_engine(document_state& DocumentState); /// Returns a default OpenGL render engine, or 0 k3d::gl::irender_viewport* default_gl_render_engine(document_state& DocumentState); /// Prompts the user to choose a camera, returns 0 on cancellation k3d::icamera* pick_camera(document_state& DocumentState, const k3d::icamera* CurrentCamera = 0); /// Prompts the user to choose a preview render engine, returns 0 on cancellation k3d::irender_preview* pick_preview_render_engine(document_state& DocumentState); /// Prompts the user to choose a still render engine, returns 0 on cancellation k3d::irender_frame* pick_still_render_engine(document_state& DocumentState); /// Prompts the user to choose an animation render engine, returns 0 on cancellation k3d::irender_animation* pick_animation_render_engine(document_state& DocumentState); /// Prompts the user to choose a preview render engine, returns 0 on cancellation k3d::irender_camera_preview* pick_camera_preview_render_engine(document_state& DocumentState); /// Prompts the user to choose a still render engine, returns 0 on cancellation k3d::irender_camera_frame* pick_camera_still_render_engine(document_state& DocumentState); /// Prompts the user to choose an animation render engine, returns 0 on cancellation k3d::irender_camera_animation* pick_camera_animation_render_engine(document_state& DocumentState); /// Prompts the user to choose an OpenGL render engine, returns 0 on cancellation k3d::gl::irender_viewport* pick_gl_render_engine(document_state& DocumentState); void test_render_engine(k3d::iunknown& Engine); void render(k3d::irender_preview& Engine); void render(k3d::irender_frame& Engine); void render(document_state& DocumentState, k3d::irender_animation& Engine); void render(k3d::icamera& Camera, k3d::irender_camera_preview& Engine); void render(k3d::icamera& Camera, k3d::irender_camera_frame& Engine); void render(document_state& DocumentState, k3d::icamera& Camera, k3d::irender_camera_animation& Engine); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_RENDER_H ================================================ FILE: k3dsdk/ngui/rotate_tool.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { class rotate_manipulators : public imanipulators { private: struct constraint : public k3d::selectable { constraint(const std::string& Label, Glib::RefPtr Cursor, const k3d::selection::token& SelectionToken) : m_selection_token(SelectionToken), m_label(Label), m_cursor(Cursor), m_plane(k3d::vector3(0, 0, 1), 0), m_axis(0, 0, 0) { assert_warning(!m_label.empty()); } const std::string label() { return m_label; } Glib::RefPtr cursor() { return m_cursor; } void set_plane(const k3d::plane& Plane, const k3d::vector3& Axis) { m_plane = Plane; m_axis = Axis; } void begin_mouse_move(const k3d::point2& Mouse, const k3d::point3& Origin) { m_first_mouse = Mouse; m_rotation_origin = Origin; } k3d::angle_axis mouse_move(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { const k3d::point2 current_mouse(Coordinates); const k3d::point2 origin = Viewport.project(m_rotation_origin); const k3d::vector2 v1 = m_first_mouse - origin; const k3d::vector2 v2 = current_mouse - origin; // First or current mouse is on the origin if(!v1.length2() || !v2.length2()) return k3d::angle_axis(0, m_axis); // Angle between v1 and v2 const double dot_product = v1 * v2; double angle = acos(dot_product / v1.length() / v2.length()); // Check for rotation manipulator direction const k3d::matrix4 screen_matrix = k3d::node_to_world_matrix(*Viewport.camera()); // Forward camera vector is +Z const k3d::vector3 camera_forward = screen_matrix * k3d::vector3(0, 0, 1); if(camera_forward * m_axis < 0) angle = -angle; // Test whether current_mouse point is below line defined by (m_first_mouse, origin) : if(m_first_mouse[0] == origin[0]) { // Vertical line, test left or right instead if(current_mouse[0] > origin[0]) angle = -angle; } else { // Check whether m_first_mouse was in the left or right quadrants if(m_first_mouse[0] > origin[0]) angle = -angle; // Project current_mouse vertically on line defined by (m_first_mouse, origin) const double a = (current_mouse[0] - m_first_mouse[0]) / (origin[0] - m_first_mouse[0]); const double y = m_first_mouse[1] + a * (origin[1] - m_first_mouse[1]); if(y > current_mouse[1]) angle = -angle; } return k3d::angle_axis(angle, m_axis); } const k3d::vector3 axis() { return m_axis; } const k3d::selection::token m_selection_token; const std::string m_label; const Glib::RefPtr m_cursor; /// Stores the constraint plane in world coordinates k3d::plane m_plane; /// Stores the rotation axis in world coordinates k3d::vector3 m_axis; k3d::point2 m_first_mouse; k3d::point3 m_rotation_origin; }; public: rotate_manipulators() : m_current_constraint(&m_screen_z_constraint), m_screen_z_constraint(_("Rotate Screen Z"), load_icon("move_cursor_screen_xy", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 0)), m_x_constraint(_("Rotate X"), load_icon("move_cursor_x", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 1)), m_y_constraint(_("Rotate Y"), load_icon("move_cursor_y", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 2)), m_z_constraint(_("Rotate Z"), load_icon("move_cursor_z", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 3)) { } void activate() { try { k3d::filesystem::ifstream layout_stream(k3d::share_path() / k3d::filesystem::generic_path("ngui/tool_layout.k3d")); k3d::xml::element layout_xml; layout_stream >> layout_xml; k3d::xml::element& xml_rotate = layout_xml.safe_element("application").safe_element("user_interface").safe_element("tools").safe_element("rotate"); m_manipulators_size = k3d::xml::attribute_value(xml_rotate, "size", 10); m_current_color = k3d::xml::attribute_value(xml_rotate, "current_color", k3d::color(1, 1, 0)); m_x_color = k3d::xml::attribute_value(xml_rotate, "x_color", k3d::color(1, 0, 0)); m_y_color = k3d::xml::attribute_value(xml_rotate, "y_color", k3d::color(0, 1, 0)); m_z_color = k3d::xml::attribute_value(xml_rotate, "z_color", k3d::color(0, 0, 1)); m_screen_z_color = k3d::xml::attribute_value(xml_rotate, "screen_z_color", k3d::color(0.9, 0.9, 0.9)); m_handle_size = k3d::xml::attribute_value(xml_rotate, "handle_size", 5); m_handle_major_radius = k3d::xml::attribute_value(xml_rotate, "handle_major_radius", 1.0); m_handle_minor_radius = k3d::xml::attribute_value(xml_rotate, "handle_minor_radius", 0.03); m_handle_u_segments = k3d::xml::attribute_value(xml_rotate, "handle_u_segments", 16); m_handle_v_segments = k3d::xml::attribute_value(xml_rotate, "handle_v_segments", 4); m_screen_z_handle_size = k3d::xml::attribute_value(xml_rotate, "screen_z_size", 8); } catch(std::exception& e) { k3d::log() << error << e.what() << std::endl; } set_constraint("screen_z"); } void redraw(viewport::control& Viewport, const bool Visible, const k3d::point3& Position, const k3d::matrix4& Orientation, tool_selection::motion_t Motion, const k3d::point3& Scaling) { // Sanity checks return_if_fail(Viewport.gl_engine()); return_if_fail(Viewport.camera()); // Update constraints const k3d::matrix4 screen_matrix = k3d::node_to_world_matrix(*Viewport.camera()); const k3d::vector3 screen_normal = screen_matrix * k3d::vector3(0, 0, 1); // Update the screen xy constraint so it always aligns with the camera direction vector in world coordinates m_screen_z_constraint.set_plane(k3d::plane(screen_normal, Position), screen_normal); // Update axis constraints so their planes are always as perpendicular to the screen as-possible m_x_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(1, 0, 0)) ^ ((Orientation * k3d::vector3(1, 0, 0)) ^ screen_normal), Position), k3d::vector3(1, 0, 0)); m_y_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(0, 1, 0)) ^ ((Orientation * k3d::vector3(0, 1, 0)) ^ screen_normal), Position), k3d::vector3(0, 1, 0)); m_z_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(0, 0, 1)) ^ ((Orientation * k3d::vector3(0, 0, 1)) ^ screen_normal), Position), k3d::vector3(0, 0, 1)); // Draw manipulators if(!Visible) return; k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(k3d::to_vector(Position))); glClear(GL_DEPTH_BUFFER_BIT); // Scale manipulators to show them at constant size (except on mouse drag) if(tool_selection::MOTION_NONE == Motion) m_scale = detail::manipulators_scale(Viewport, Position, m_manipulators_size); glScaled(m_scale, m_scale, m_scale); // Draw manipulators const bool motion = (tool_selection::MOTION_DRAG == Motion) || (tool_selection::MOTION_CLICK_DRAG == Motion); glPushMatrix(); k3d::gl::push_matrix(Orientation); if(!motion || &m_x_constraint == m_current_constraint) draw_handle(m_current_constraint == &m_x_constraint ? m_current_color : m_x_color, k3d::rotate3(k3d::radians(90.0), k3d::vector3(0, 1, 0)), m_handle_size); if(!motion || &m_y_constraint == m_current_constraint) draw_handle(m_current_constraint == &m_y_constraint ? m_current_color : m_y_color, k3d::rotate3(k3d::radians(90.0), k3d::vector3(1, 0, 0)), m_handle_size); if(!motion || &m_z_constraint == m_current_constraint) draw_handle(m_current_constraint == &m_z_constraint ? m_current_color : m_z_color, k3d::rotate3(k3d::radians(0.0), k3d::vector3(1, 0, 0)), m_handle_size); glPopMatrix(); if(!motion || &m_screen_z_constraint == m_current_constraint) { k3d::matrix4 screen_matrix = k3d::node_to_world_matrix(*Viewport.camera()); // Zero translation screen_matrix[0][3] = screen_matrix[1][3] = screen_matrix[2][3] = 0; draw_handle(m_current_constraint == &m_screen_z_constraint ? m_current_color : m_screen_z_color, screen_matrix, m_screen_z_handle_size); } glMatrixMode(GL_MODELVIEW); glPopMatrix(); } void select(viewport::control& Viewport, const k3d::point3& Position, const k3d::matrix4& Orientation) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(k3d::to_vector(Position))); glDisable(GL_LIGHTING); glClear(GL_DEPTH_BUFFER_BIT); // Scale manipulators glScaled(m_scale, m_scale, m_scale); // Draw manipulators glPushMatrix(); k3d::gl::push_matrix(Orientation); select_handle(m_x_constraint, k3d::rotate3(k3d::radians(90.0), k3d::vector3(0, 1, 0)), m_handle_size); select_handle(m_y_constraint, k3d::rotate3(k3d::radians(90.0), k3d::vector3(1, 0, 0)), m_handle_size); select_handle(m_z_constraint, k3d::rotate3(k3d::radians(0.0), k3d::vector3(1, 0, 0)), m_handle_size); glPopMatrix(); k3d::matrix4 screen_matrix = k3d::node_to_world_matrix(*Viewport.camera()); screen_matrix[0][3] = screen_matrix[1][3] = screen_matrix[2][3] = 0; select_handle(m_screen_z_constraint, screen_matrix, m_screen_z_handle_size); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } std::string get_constraint_name() { return_val_if_fail(m_current_constraint, ""); return m_current_constraint->label(); } // Set manipulator constraint Glib::RefPtr set_constraint(const std::string& Name) { if(Name == "screen_z") m_current_constraint = &m_screen_z_constraint; else if(Name == "x_axis") m_current_constraint = &m_x_constraint; else if(Name == "y_axis") m_current_constraint = &m_y_constraint; else if(Name == "z_axis") m_current_constraint = &m_z_constraint; else { k3d::log() << error << "Unknown constraint : '" << Name << "'" << std::endl; assert_not_reached(); } return m_current_constraint->cursor(); } std::string constraint_name(const k3d::selection::id ID) { if(ID == m_screen_z_constraint.m_selection_token.id) return "screen_z"; else if(ID == m_x_constraint.m_selection_token.id) return "x_axis"; else if(ID == m_y_constraint.m_selection_token.id) return "y_axis"; else if(ID == m_z_constraint.m_selection_token.id) return "z_axis"; return ""; } std::string cycle_constraint(constraint* Constraint) { if(Constraint == &m_x_constraint) return "y_axis"; if(Constraint == &m_y_constraint) return "z_axis"; if(Constraint == &m_z_constraint) return "x_axis"; return ""; } void update_constraint(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { // Cycle through X - Screen - Y - Screen - Z - Screen - X - etc if(m_current_constraint == &m_x_constraint || m_current_constraint == &m_y_constraint || m_current_constraint == &m_z_constraint) { // Save current constraint m_previous_constraint = m_current_constraint; // Go back to screeen mode set_constraint("screen_z"); } else if(m_previous_constraint) { // An axis was previously chosen, cycle to next one set_constraint(cycle_constraint(m_previous_constraint)); } else { // Constrain movement to the "nearest" axis const k3d::point2 mouse(Coordinates); const k3d::point2 coords = Viewport.project(Position); std::map constraints; constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(1, 0, 0))))), "x_axis")); constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(0, 1, 0))))), "y_axis")); constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(0, 0, 1))))), "z_axis")); set_constraint(constraints.begin()->second); } begin_mouse_move(Coordinates, Position); } void begin_mouse_move(const k3d::point2& Coords, const k3d::point3& Origin) { m_current_constraint->begin_mouse_move(Coords, Origin); } k3d::angle_axis mouse_move(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { return m_current_constraint->mouse_move(Viewport, Coordinates, Position, Orientation); } private: // Manipulator drawing/selection functions void draw_handle(const k3d::color& Color, const k3d::matrix4& Matrix, const double Size) { k3d::gl::store_attributes attributes; k3d::gl::color3d(Color); glEnable(GL_LIGHTING); k3d::gl::material(GL_FRONT_AND_BACK, GL_AMBIENT, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_DIFFUSE, Color); k3d::gl::material(GL_FRONT_AND_BACK, GL_SPECULAR, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_EMISSION, k3d::color(0, 0, 0)); draw_gl_handle(Matrix, Size); } void select_handle(constraint& Constraint, const k3d::matrix4& Matrix, const double Size) { k3d::gl::store_attributes attributes; k3d::gl::push_selection_token(Constraint.m_selection_token); glDisable(GL_LIGHTING); draw_gl_handle(Matrix, Size); k3d::gl::pop_selection_token(); } void draw_gl_handle(const k3d::matrix4& Matrix, const double Size) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(Matrix); double major_step = k3d::pi_times_2() / static_cast(m_handle_u_segments); double minor_step = k3d::pi_times_2() / static_cast(m_handle_v_segments); for(unsigned long i = 0; i < m_handle_u_segments; ++i) { double phi = static_cast(i) * major_step; double phi2 = phi + major_step; double x0 = cos(phi) * Size; double y0 = sin(phi) * Size; double x1 = cos(phi2) * Size; double y1 = sin(phi2) * Size; glBegin(GL_TRIANGLE_STRIP); for(unsigned long j = 0; j <= m_handle_v_segments; ++j) { double b = static_cast(j) * minor_step; double c = cos(b); double r = m_handle_minor_radius * c + m_handle_major_radius; double z = sin(b) * Size; glNormal3d(x0*c, y0*c, z); glVertex3d(x0*r, y0*r, z * m_handle_minor_radius); glNormal3d(x1*c, y1*c, z); glVertex3d(x1*r, y1*r, z * m_handle_minor_radius); } glEnd(); } glPopMatrix(); } /// Stores the constraint that was in effect when rotation began (if any) constraint* m_current_constraint; /// Stores the constraint that was in effect before m_current_constraint constraint* m_previous_constraint; // These are placeholders, used to identify hotspots in the manipulators constraint m_screen_z_constraint; constraint m_x_constraint; constraint m_y_constraint; constraint m_z_constraint; // Parameters that control the on-screen appearance of the tool double m_manipulators_size; double m_scale; k3d::color m_current_color; k3d::color m_x_color; k3d::color m_y_color; k3d::color m_z_color; k3d::color m_screen_z_color; double m_handle_size; double m_handle_major_radius; double m_handle_minor_radius; unsigned long m_handle_u_segments; unsigned long m_handle_v_segments; double m_screen_z_handle_size; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // rotate_tool rotate_tool::rotate_tool(document_state& DocumentState, const std::string& Name) : transform_tool_base(DocumentState.document(), DocumentState, Name), m_mutex(false), m_rotation(init_owner(*this) + init_name("rotation") + init_label(_("Rotation")) + init_description(_("Rotation")) + init_value(k3d::angle_axis(0, 1, 0, 0))), m_center(init_owner(*this) + init_name("center") + init_label(_("Center")) + init_description(_("Center")) + init_value(k3d::point3(0, 0, 0))), m_auto_center(init_owner(*this) + init_name("auto_center") + init_label(_("Auto Center")) + init_description(_("Center")) + init_value(true)) { m_rotation.connect_explicit_change_signal(sigc::mem_fun(*this, &rotate_tool::on_rotate)); m_center.connect_explicit_change_signal(sigc::mem_fun(*this, &rotate_tool::on_rotate)); m_auto_center.connect_explicit_change_signal(sigc::mem_fun(*this, &rotate_tool::on_rotate)); m_input_model.connect_lbutton_down(sigc::mem_fun(*this, &rotate_tool::on_lbutton_down)); m_input_model.connect_lbutton_click(sigc::mem_fun(*this, &rotate_tool::on_lbutton_click)); m_input_model.connect_lbutton_start_drag(sigc::mem_fun(*this, &rotate_tool::on_lbutton_start_drag)); m_input_model.connect_lbutton_drag(sigc::mem_fun(*this, &rotate_tool::on_lbutton_drag)); m_input_model.connect_lbutton_end_drag(sigc::mem_fun(*this, &rotate_tool::on_lbutton_end_drag)); m_input_model.connect_mbutton_click(sigc::mem_fun(*this, &rotate_tool::on_mbutton_click)); m_input_model.connect_rbutton_click(sigc::mem_fun(*this, &rotate_tool::on_rbutton_click)); m_input_model.connect_mouse_move(sigc::mem_fun(*this, &rotate_tool::on_mouse_move)); m_manipulators = new detail::rotate_manipulators(); } rotate_tool::~rotate_tool() { delete m_manipulators; } void rotate_tool::on_activate() { m_manipulators->activate(); m_visible_manipulators.set_value(true); on_document_selection_changed(); tool_selection::redraw_all(); } void rotate_tool::on_deactivate() { if(MOTION_NONE != m_current_motion) cancel_mouse_move(); clear_targets(); m_document_state.clear_cursor_signal().emit(); tool_selection::redraw_all(); } void rotate_tool::on_document_selection_changed() { target_list_changed(); update_targets(); reset(); //set_center(world_position()); } void rotate_tool::on_redraw(viewport::control& Viewport) { // Update target list update_targets(); // Redraw manipulators m_manipulators->redraw(Viewport, (m_visible_manipulators.internal_value() && target_number()), world_position(), world_orientation(), m_current_motion, k3d::point3(1.0, 1.0, 1.0)); } void rotate_tool::on_select(viewport::control& Viewport) { if(m_visible_manipulators.internal_value() && target_number()) m_manipulators->select(Viewport, world_position(), world_orientation()); } k3d::iproperty_collection* rotate_tool::get_property_collection() { return dynamic_cast(this); } viewport_input_model& rotate_tool::get_input_model() { return input_model(); } // LMB drag actions k3d::angle_axis rotate_tool::mouse_move_to_3d(viewport::control& Viewport, const k3d::point2& Coordinates) { // Transform mouse move to a world rotation const k3d::point3 origin = world_position(); const k3d::matrix4 orientation = world_orientation(); const k3d::angle_axis rotation = m_manipulators->mouse_move(Viewport, Coordinates, origin, orientation); return rotation; } k3d::angle_axis rotate_tool::lbutton_drag(viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_DRAG == m_current_motion) { const k3d::angle_axis rotation = mouse_move_to_3d(Viewport, Coordinates); rotate_selection(rotation); return rotation; } if(MOTION_BOX_SELECT == m_current_motion) lmb_drag_box_select(Viewport, Coordinates); return k3d::angle_axis(0, 1, 0, 0); } k3d::angle_axis rotate_tool::mouse_move_action(viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_CLICK_DRAG == m_current_motion) { const k3d::angle_axis rotation = mouse_move_to_3d(Viewport, Coordinates); rotate_selection(rotation); return rotation; } return k3d::angle_axis(0, 1, 0, 0); } void rotate_tool::rotate_selection(const k3d::angle_axis& Rotation) { if(!Rotation.angle) return; m_rotation.set_value(Rotation); } k3d::point3 rotate_tool::world_position() { if (m_auto_center.pipeline_value()) return transform_tool_base::world_position(); else return m_center.pipeline_value(); } void rotate_tool::on_rotate(k3d::iunknown*) { if(m_mutex) return; rotate_targets(k3d::rotate3(m_rotation.internal_value())); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/rotate_tool.h ================================================ #ifndef K3DSDK_NGUI_ROTATE_TOOL_H #define K3DSDK_NGUI_ROTATE_TOOL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // rotate_tool /// Tool implementation that provides object/mesh rotation behavior class rotate_tool : public transform_tool { typedef transform_tool transform_tool_base; public: rotate_tool(document_state& DocumentState, const std::string& Name); ~rotate_tool(); const k3d::string_t tool_type() { return "rotate_tool"; } protected: k3d::point3 world_position(); private: virtual void on_activate(); virtual void on_deactivate(); virtual void on_document_selection_changed(); virtual void on_redraw(viewport::control& Viewport); virtual void on_select(viewport::control& Viewport); k3d::iproperty_collection* get_property_collection(); viewport_input_model& get_input_model(); void on_lbutton_down(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); const k3d::key_modifiers modifiers = convert(Event.state); lbutton_down(Viewport, coordinates, modifiers); } void on_lbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_click(Viewport, coordinates); } void on_lbutton_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_start_drag(Viewport, coordinates); } void on_lbutton_drag(viewport::control& Viewport, const GdkEventMotion& Event) { k3d::point2 coordinates(Event.x, Event.y); // Off-screen wrap off_screen_warp(Viewport, coordinates); const k3d::angle_axis rotation = lbutton_drag(Viewport, coordinates); } void on_lbutton_end_drag(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_end_drag(Viewport, coordinates); } void on_mbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); const k3d::key_modifiers modifiers = convert(Event.state); mbutton_click(Viewport, coordinates, modifiers); } void on_rbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); rbutton_click(Viewport, coordinates); } void on_mouse_move(viewport::control& Viewport, const GdkEventMotion& Event) { if(MOTION_CLICK_DRAG != m_current_motion) return; k3d::point2 coordinates(Event.x, Event.y); // Off-screen wrap off_screen_warp(Viewport, coordinates); const k3d::angle_axis rotation = mouse_move_action(Viewport, coordinates); } // Manipulator functions virtual std::string manipulator_name(const k3d::selection::id ID) { return m_manipulators->constraint_name(ID); } virtual std::string get_manipulator(const manipulators_t& Manipulators) { if(!Manipulators.size()) return std::string(""); return *Manipulators.begin(); } virtual void set_manipulator(const std::string ManipulatorName) { m_document_state.set_cursor_signal().emit(m_manipulators->set_constraint(ManipulatorName)); } virtual std::string get_constraint_name() { return m_manipulators->get_constraint_name(); } virtual void begin_mouse_move(const k3d::point2& Coordinates) { start_rotation(); reset(); m_manipulators->begin_mouse_move(Coordinates, world_position()); } virtual void update_constraint(viewport::control& Viewport, const k3d::point2& Coordinates) { m_manipulators->update_constraint(Viewport, Coordinates, world_position(), world_orientation()); begin_mouse_move(Coordinates); } virtual void reset() { m_mutex = true; m_rotation.set_value(k3d::angle_axis(0, 1, 0, 0)); m_mutex = false; } // LMB drag actions k3d::angle_axis mouse_move_to_3d(viewport::control& Viewport, const k3d::point2& Coordinates); k3d::angle_axis lbutton_drag(viewport::control& Viewport, const k3d::point2& Coordinates); k3d::angle_axis mouse_move_action(viewport::control& Viewport, const k3d::point2& Coordinates); void rotate_selection(const k3d::angle_axis& Rotation); void on_rotate(k3d::iunknown*); /// Stores manipulators detail::imanipulators* m_manipulators; // Rotation value bool m_mutex; k3d_data(k3d::angle_axis, immutable_name, explicit_change_signal, with_undo, local_storage, no_constraint, writable_property, no_serialization) m_rotation; // Rotation center k3d_data(k3d::point3, immutable_name, explicit_change_signal, with_undo, local_storage, no_constraint, writable_property, no_serialization) m_center; k3d_data(bool, immutable_name, explicit_change_signal, with_undo, local_storage, no_constraint, writable_property, no_serialization) m_auto_center; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_ROTATE_TOOL_H ================================================ FILE: k3dsdk/ngui/safe_close_dialog.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace safe_close_dialog { namespace detail { class unsaved_document_columns : public Gtk::TreeModelColumnRecord { public: unsaved_document_columns() { add(label); add(save); } Gtk::TreeModelColumn label; Gtk::TreeModelColumn save; }; } // namespace detail int run(Gtk::Window& Parent, const std::string& Title) { Gtk::MessageDialog dialog(Parent, "", false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); dialog.set_message(string_cast(boost::format(_("Save the changes to document \"%1%\" before closing?")) % Title)); dialog.set_secondary_text( _("If you don't save, changes will be permanently lost (no undo).")); Gtk::Button* const close_button = new Gtk::Button(_("Cl_ose without Saving"), true); close_button->show(); dialog.add_action_widget(*Gtk::manage(close_button), Gtk::RESPONSE_CLOSE); dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); dialog.set_default_response(Gtk::RESPONSE_OK); const int result = dialog.run(); return result; } int run(Gtk::Window& Parent, entries_t& UnsavedDocuments) { return_val_if_fail(UnsavedDocuments.size(), Gtk::RESPONSE_NONE); if(1 == UnsavedDocuments.size()) return run(Parent, UnsavedDocuments.front().document->unsaved_document_title()); Gtk::MessageDialog dialog(Parent, "", false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE); dialog.set_message(string_cast(boost::format(_("There are %1% documents with unsaved changes. Save changes before closing?")) % UnsavedDocuments.size())); dialog.set_secondary_text(_("Select the documents you want to save:")); detail::unsaved_document_columns columns; Glib::RefPtr model = Gtk::ListStore::create(columns); for(entries_t::iterator unsaved_document = UnsavedDocuments.begin(); unsaved_document != UnsavedDocuments.end(); ++unsaved_document) { Gtk::TreeRow row = *model->append(); row[columns.label] = unsaved_document->document->unsaved_document_title(); row[columns.save] = true; } Gtk::TreeView view(model); view.set_headers_visible(false); view.append_column_editable("Save", columns.save); view.append_column("Document", columns.label); Gtk::Frame frame; frame.set_shadow_type(Gtk::SHADOW_IN); frame.add(view); Gtk::Label label3(_("If you don't save, all your changes will be permanently lost (no undo)."), Gtk::ALIGN_LEFT); label3.set_selectable(true); std::vector vbox_children = dialog.get_vbox()->get_children(); return_val_if_fail(vbox_children.size(), Gtk::RESPONSE_NONE); Gtk::HBox* const hbox = dynamic_cast(vbox_children.front()); return_val_if_fail(hbox, Gtk::RESPONSE_NONE); std::vector hbox_children = hbox->get_children(); return_val_if_fail(hbox_children.size(), Gtk::RESPONSE_NONE); Gtk::VBox* const vbox = dynamic_cast(hbox_children[1]); return_val_if_fail(vbox, Gtk::RESPONSE_NONE); vbox->pack_start(frame, Gtk::PACK_EXPAND_WIDGET); vbox->pack_start(label3, Gtk::PACK_SHRINK); dialog.get_vbox()->show_all(); Gtk::Button* const close_button = new Gtk::Button(_("Cl_ose without Saving"), true); close_button->show(); dialog.add_action_widget(*Gtk::manage(close_button), Gtk::RESPONSE_CLOSE); dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); dialog.set_default_response(Gtk::RESPONSE_OK); const int result = dialog.run(); return result; } } // namespace safe_close_dialog } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/safe_close_dialog.h ================================================ #ifndef K3DSDK_NGUI_SAFE_CLOSE_DIALOG_H #define K3DSDK_NGUI_SAFE_CLOSE_DIALOG_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace Gtk { class Window; } namespace k3d { namespace ngui { class unsaved_document; /// Provides a standard "safe close" dialog for closing windows with unsaved data. namespace safe_close_dialog { /// Encapsulates an entry in the safe close dialog class entry { public: entry() : document(0), save(true) { } entry(unsaved_document* Document) : document(Document), save(true) { } unsaved_document* document; bool_t save; }; /// Defines a collection of entries in the safe close dialog typedef std::vector entries_t; /** Prompts the user with a modal dialog and returns returns Gtk::RESPONSE_NONE (cancel closing), * Gtk::RESPONSE_CLOSE (close without saving), Gtk::RESPONSE_CANCEL (cancel closing), or * Gtk::RESPONSE_OK (save before closing) */ int run(Gtk::Window& Parent, const string_t& Title); /** Prompts the user with a modal dialog and returns returns Gtk::RESPONSE_NONE (cancel closing), * Gtk::RESPONSE_CLOSE (close without saving), Gtk::RESPONSE_CANCEL (cancel closing), or * Gtk::RESPONSE_OK (save before closing) */ int run(Gtk::Window& Parent, entries_t& UnsavedDocuments); } // namespace safe_close_dialog } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SAFE_CLOSE_DIALOG_H ================================================ FILE: k3dsdk/ngui/savable_application_window.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // savable_application_window savable_application_window::savable_application_window() : base(Gtk::WINDOW_TOPLEVEL) { application_state::instance().connect_safe_close_signal(sigc::mem_fun(*this, &savable_application_window::on_safe_close)); k3d::application().connect_close_signal(sigc::mem_fun(*this, &savable_application_window::close)); } savable_application_window::~savable_application_window() { } k3d::bool_t savable_application_window::on_key_press_event(GdkEventKey* event) { if(event->keyval == GDK_Escape) { safe_close(); return true; } return base::on_key_press_event(event); } k3d::bool_t savable_application_window::on_delete_event(GdkEventAny* event) { safe_close(); return true; } unsaved_document* savable_application_window::on_safe_close() { return this; } const k3d::bool_t savable_application_window::save_changes() { if(k3d::batch_mode() || !unsaved_changes()) return true; switch(safe_close_dialog::run(*this, unsaved_document_title())) { case Gtk::RESPONSE_NONE: case Gtk::RESPONSE_CANCEL: case Gtk::RESPONSE_DELETE_EVENT: return false; case Gtk::RESPONSE_CLOSE: return true; case Gtk::RESPONSE_OK: return save_unsaved_changes(); } assert_not_reached(); return false; } void savable_application_window::safe_close() { if(k3d::batch_mode() || !unsaved_changes()) { close(); return; } switch(safe_close_dialog::run(*this, unsaved_document_title())) { case Gtk::RESPONSE_NONE: case Gtk::RESPONSE_CANCEL: case Gtk::RESPONSE_DELETE_EVENT: return; case Gtk::RESPONSE_CLOSE: close(); return; case Gtk::RESPONSE_OK: if(save_unsaved_changes()) close(); } } void savable_application_window::close() { on_close(); delete this; } void savable_application_window::on_close() { } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/savable_application_window.h ================================================ #ifndef K3DSDK_NGUI_SAVABLE_APPLICATION_WINDOW_H #define K3DSDK_NGUI_SAVABLE_APPLICATION_WINDOW_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // savable_application_window /// Provides a standard top-level window for application-level documents that can be saved class savable_application_window : public Gtk::Window, public k3d::ngui::unsaved_document { typedef Gtk::Window base; public: savable_application_window(); virtual ~savable_application_window(); k3d::bool_t on_key_press_event(GdkEventKey* event); k3d::bool_t on_delete_event(GdkEventAny* event); /// Gives the user a chance to save changes, returns true iff all changes have been saved. const k3d::bool_t save_changes(); /// Closes the window safely, giving the user a chance to save changes or cancel. void safe_close(); /// Closes the window. void close(); private: k3d::ngui::unsaved_document* on_safe_close(); /// Override in derived classes to handle cleanup when the window is closed virtual void on_close(); }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SAVABLE_APPLICATION_WINDOW_H ================================================ FILE: k3dsdk/ngui/savable_document_window.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // savable_document_window savable_document_window::savable_document_window() : base(Gtk::WINDOW_TOPLEVEL), m_document(0) { application_state::instance().connect_safe_close_signal(sigc::mem_fun(*this, &savable_document_window::on_safe_close)); } savable_document_window::~savable_document_window() { } void savable_document_window::initialize(document_state& Document) { assert(!m_document); m_document = &Document; m_document->connect_safe_close_signal(sigc::mem_fun(*this, &savable_document_window::on_safe_close)); m_document->document().close_signal().connect(sigc::mem_fun(*this, &savable_document_window::close)); } k3d::idocument& savable_document_window::document() { assert(m_document); return m_document->document(); } k3d::bool_t savable_document_window::on_key_press_event(GdkEventKey* event) { if(event->keyval == GDK_Escape) { safe_close(); return true; } return base::on_key_press_event(event); } k3d::bool_t savable_document_window::on_delete_event(GdkEventAny* event) { safe_close(); return true; } unsaved_document* savable_document_window::on_safe_close() { return this; } const k3d::bool_t savable_document_window::save_changes() { if(k3d::batch_mode() || !unsaved_changes()) return true; switch(safe_close_dialog::run(*this, unsaved_document_title())) { case Gtk::RESPONSE_NONE: case Gtk::RESPONSE_CANCEL: case Gtk::RESPONSE_DELETE_EVENT: return false; case Gtk::RESPONSE_CLOSE: return true; case Gtk::RESPONSE_OK: return save_unsaved_changes(); } assert_not_reached(); return false; } void savable_document_window::safe_close() { if(k3d::batch_mode() || !unsaved_changes()) { close(); return; } switch(safe_close_dialog::run(*this, unsaved_document_title())) { case Gtk::RESPONSE_NONE: case Gtk::RESPONSE_CANCEL: case Gtk::RESPONSE_DELETE_EVENT: return; case Gtk::RESPONSE_CLOSE: close(); return; case Gtk::RESPONSE_OK: if(save_unsaved_changes()) close(); } } void savable_document_window::close() { on_close(); delete this; } void savable_document_window::on_close() { } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/savable_document_window.h ================================================ #ifndef K3DSDK_NGUI_SAVABLE_DOCUMENT_WINDOW_H #define K3DSDK_NGUI_SAVABLE_DOCUMENT_WINDOW_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class idocument; } namespace k3d { namespace ngui { class document_state; /////////////////////////////////////////////////////////////////////////////// // savable_document_window /// Provides a standard document-level window class savable_document_window : public Gtk::Window, public k3d::ngui::unsaved_document { typedef Gtk::Window base; public: savable_document_window(); virtual ~savable_document_window(); /// Called once after startup to complete initialization (we do this in a separate method for plugins that can't take constructor arguments). void initialize(document_state& Document); k3d::idocument& document(); k3d::bool_t on_key_press_event(GdkEventKey* event); k3d::bool_t on_delete_event(GdkEventAny* event); /// Gives the user a chance to save changes, returns true iff all changes have been saved. const k3d::bool_t save_changes(); /// Closes the window safely, giving the user a chance to save changes or cancel. void safe_close(); /// Closes the window. void close(); private: k3d::ngui::unsaved_document* on_safe_close(); /// Override in derived classes to handle cleanup when the window is closed virtual void on_close(); k3d::ngui::document_state* m_document; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SAVABLE_DOCUMENT_WINDOW_H ================================================ FILE: k3dsdk/ngui/scale_tool.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { class scale_manipulators : public imanipulators { private: struct constraint : public k3d::selectable { constraint(const std::string& Label, Glib::RefPtr Cursor, const k3d::selection::token& SelectionToken, const bool RelativeMove = false) : m_selection_token(SelectionToken), m_label(Label), m_cursor(Cursor), m_relative_move(RelativeMove), m_plane(k3d::vector3(0, 0, 1), 0), m_x_sensitivity(0), m_y_sensitivity(0), m_z_sensitivity(0) { assert_warning(!m_label.empty()); } const std::string label() { return m_label; } Glib::RefPtr cursor() { return m_cursor; } void set_plane(const k3d::plane& Plane, const double XSensitivity, const double YSensitivity, const double ZSensitivity) { m_plane = Plane; m_x_sensitivity = XSensitivity; m_y_sensitivity = YSensitivity; m_z_sensitivity = ZSensitivity; } void begin_mouse_move(const k3d::point2& Mouse, const k3d::point3& Origin) { m_first_mouse = Mouse; m_scaling_origin = Origin; m_last_mouse = Mouse; m_current_scale = 1; } k3d::point3 mouse_move(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { const k3d::point2 current_mouse(Coordinates); const k3d::point2 origin = Viewport.project(m_scaling_origin); const double sign = k3d::sign((m_first_mouse - origin) * (current_mouse - origin)); if(m_relative_move) { // Relative move const k3d::vector2 difference = current_mouse - m_last_mouse; m_last_mouse = current_mouse; double delta = 0; const double horizontal_length = difference[0]; const double vertical_length = difference[1]; if(std::abs(horizontal_length) > std::abs(vertical_length)) { // Dragging mostly horizontally : 1/10th unit increase delta = 0.1 * horizontal_length; } else { // Dragging mostly vertically : one unit increase delta = - vertical_length; } delta = 1 + 0.02 * delta; m_current_scale *= delta; return k3d::point3(m_x_sensitivity ? m_current_scale * m_x_sensitivity : 1.0, m_y_sensitivity ? m_current_scale * m_y_sensitivity : 1.0, m_z_sensitivity ? m_current_scale * m_z_sensitivity : 1.0); } // Absolute move // Turn mouse coordinates into lines in world coordinates ... k3d::line3 first_line = mouse_to_world(Viewport, m_first_mouse); k3d::line3 current_line = mouse_to_world(Viewport, current_mouse); // Calculate intersections with our plane in world coordinates ... k3d::point3 first_intersection; return_val_if_fail(k3d::intersect(m_plane, first_line, first_intersection), k3d::point3(1, 1, 1)); double factor = k3d::distance(first_intersection, Position); if(!factor) factor = 1.0; k3d::point3 current_intersection; return_val_if_fail(k3d::intersect(m_plane, current_line, current_intersection), k3d::point3(1, 1, 1)); // Calculate scaling from distance to origin const double delta = sign * k3d::distance(current_intersection, Position) / factor; return k3d::point3(m_x_sensitivity ? delta * m_x_sensitivity : 1.0, m_y_sensitivity ? delta * m_y_sensitivity : 1.0, m_z_sensitivity ? delta * m_z_sensitivity : 1.0); } const k3d::selection::token m_selection_token; const std::string m_label; const Glib::RefPtr m_cursor; const bool m_relative_move; /// Stores the constraint plane in world coordinates k3d::plane m_plane; double m_x_sensitivity; double m_y_sensitivity; double m_z_sensitivity; k3d::point2 m_last_mouse; k3d::point2 m_first_mouse; k3d::point3 m_scaling_origin; double m_current_scale; }; public: scale_manipulators() : m_current_constraint(&m_xyz_constraint), m_xyz_constraint(_("Scale XYZ"), load_icon("move_cursor_screen_xy", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 0), true), m_x_constraint(_("Scale X"), load_icon("move_cursor_x", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 1)), m_y_constraint(_("Scale Y"), load_icon("move_cursor_y", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 2)), m_z_constraint(_("Scale Z"), load_icon("move_cursor_z", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 3)), m_xy_constraint(_("Scale XY"), load_icon("move_cursor_xy", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 4)), m_xz_constraint(_("Scale XZ"), load_icon("move_cursor_xz", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 5)), m_yz_constraint(_("Scale YZ"), load_icon("move_cursor_yz", Gtk::ICON_SIZE_BUTTON), k3d::selection::token(k3d::selection::USER1, 6)) { } void activate() { // Load parameters from configuration file try { k3d::filesystem::ifstream layout_stream(k3d::share_path() / k3d::filesystem::generic_path("ngui/tool_layout.k3d")); k3d::xml::element layout_xml; layout_stream >> layout_xml; k3d::xml::element& xml_scale = layout_xml.safe_element("application").safe_element("user_interface").safe_element("tools").safe_element("scale"); m_manipulators_size = k3d::xml::attribute_value(xml_scale, "size", 10); m_current_color = k3d::xml::attribute_value(xml_scale, "current_color", k3d::color(1, 1, 0)); m_x_color = k3d::xml::attribute_value(xml_scale, "x_color", k3d::color(1, 0, 0)); m_y_color = k3d::xml::attribute_value(xml_scale, "y_color", k3d::color(0, 1, 0)); m_z_color = k3d::xml::attribute_value(xml_scale, "z_color", k3d::color(0, 0, 1)); m_screen_xy_color = k3d::xml::attribute_value(xml_scale, "screen_xy_color", k3d::color(0.9, 0.9, 0.9)); m_plane_offset = k3d::xml::attribute_value(xml_scale, "plane_offset", 5); m_plane_size = k3d::xml::attribute_value(xml_scale, "plane_size", 4.8); m_axis_start = k3d::xml::attribute_value(xml_scale, "axis_start", 0); m_axis_end = k3d::xml::attribute_value(xml_scale, "axis_end", 10); m_axis_line_width = k3d::xml::attribute_value(xml_scale, "axis_line_width", 1); m_axis_box_size = k3d::xml::attribute_value(xml_scale, "axis_box_size", 0.5); } catch(std::exception& e) { k3d::log() << error << e.what() << std::endl; } set_constraint("xyz_constraint"); } void redraw(viewport::control& Viewport, const bool Visible, const k3d::point3& Position, const k3d::matrix4& Orientation, tool_selection::motion_t Motion, const k3d::point3& Scaling) { // Sanity checks return_if_fail(Viewport.gl_engine()); return_if_fail(Viewport.camera()); // Update constraints const k3d::matrix4 screen_matrix = k3d::node_to_world_matrix(*Viewport.camera()); const k3d::vector3 screen_normal = screen_matrix * k3d::vector3(0, 0, 1); // Update the screen xy constraint so it always aligns with the camera direction vector in world coordinates m_xyz_constraint.set_plane(k3d::plane(screen_normal, Position), 1, 1, 1); // Update axis constraints so their planes are always as perpendicular to the screen as-possible m_x_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(1, 0, 0)) ^ ((Orientation * k3d::vector3(1, 0, 0)) ^ screen_normal), Position), 1, 0, 0); m_y_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(0, 1, 0)) ^ ((Orientation * k3d::vector3(0, 1, 0)) ^ screen_normal), Position), 0, 1, 0); m_z_constraint.set_plane(k3d::plane((Orientation * k3d::vector3(0, 0, 1)) ^ ((Orientation * k3d::vector3(0, 0, 1)) ^ screen_normal), Position), 0, 0, 1); // Update plane constraints so they have the correct positions in world coordinates m_xy_constraint.set_plane(k3d::plane(Orientation * k3d::vector3(0, 0, 1), Position), 1, 1, 0); m_xz_constraint.set_plane(k3d::plane(Orientation * k3d::vector3(0, 1, 0), Position), 1, 0, 1); m_yz_constraint.set_plane(k3d::plane(Orientation * k3d::vector3(1, 0, 0), Position), 0, 1, 1); // Draw manipulators if(!Visible) return; k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); const bool motion = (tool_selection::MOTION_DRAG == Motion) || (tool_selection::MOTION_CLICK_DRAG == Motion); if(motion) k3d::gl::push_matrix(k3d::translate3(k3d::to_vector(Position)) * Orientation * k3d::scale3(Scaling[0], Scaling[1], Scaling[2])); else k3d::gl::push_matrix(k3d::translate3(k3d::to_vector(Position)) * Orientation); glClear(GL_DEPTH_BUFFER_BIT); // Scale manipulators to show them at constant size (except on mouse drag) if(tool_selection::MOTION_NONE == Motion) m_scale = detail::manipulators_scale(Viewport, Position, m_manipulators_size); glScaled(m_scale, m_scale, m_scale); // Draw manipulators k3d::vector3 px; k3d::vector3 py; k3d::vector3 pz; if(!motion || &m_x_constraint == m_current_constraint || &m_xy_constraint == m_current_constraint || &m_xz_constraint == m_current_constraint) { if(is_front_facing(Viewport, k3d::vector3(1, 0, 0), Position, Orientation)) { px = k3d::vector3(1, 0, 0); draw_axis(m_x_color, m_current_constraint == &m_x_constraint ? m_current_color : m_x_color, k3d::rotate3(k3d::radians(90.0), k3d::vector3(0, 1, 0))); } else { px = k3d::vector3(-1, 0, 0); draw_axis(m_x_color, m_current_constraint == &m_x_constraint ? m_current_color : m_x_color, k3d::rotate3(k3d::radians(-90.0), k3d::vector3(0, 1, 0))); } } if(!motion || &m_y_constraint == m_current_constraint || &m_xy_constraint == m_current_constraint || &m_yz_constraint == m_current_constraint) { if(is_front_facing(Viewport, k3d::vector3(0, -1, 0), Position, Orientation)) { py = k3d::vector3(0, -1, 0); draw_axis(m_y_color, m_current_constraint == &m_y_constraint ? m_current_color : m_y_color, k3d::rotate3(k3d::radians(90.0), k3d::vector3(1, 0, 0))); } else { py = k3d::vector3(0, 1, 0); draw_axis(m_y_color, m_current_constraint == &m_y_constraint ? m_current_color : m_y_color, k3d::rotate3(k3d::radians(-90.0), k3d::vector3(1, 0, 0))); } } if(!motion || &m_z_constraint == m_current_constraint || &m_xz_constraint == m_current_constraint || &m_yz_constraint == m_current_constraint) { if(is_front_facing(Viewport, k3d::vector3(0, 0, 1), Position, Orientation)) { pz = k3d::vector3(0, 0, 1); draw_axis(m_z_color, m_current_constraint == &m_z_constraint ? m_current_color : m_z_color, k3d::rotate3(k3d::radians(0.0), k3d::vector3(0, 1, 0))); } else { pz = k3d::vector3(0, 0, -1); draw_axis(m_z_color, m_current_constraint == &m_z_constraint ? m_current_color : m_z_color, k3d::rotate3(k3d::radians(180.0), k3d::vector3(0, 1, 0))); } } if(!motion || &m_yz_constraint == m_current_constraint) draw_plane(m_current_constraint == &m_yz_constraint ? m_current_color : m_x_color, py, py + pz, pz); if(!motion || &m_xz_constraint == m_current_constraint) draw_plane(m_current_constraint == &m_xz_constraint ? m_current_color : m_y_color, px, px + pz, pz); if(!motion || &m_xy_constraint == m_current_constraint) draw_plane(m_current_constraint == &m_xy_constraint ? m_current_color : m_z_color, px, px + py, py); if(!motion || &m_xyz_constraint == m_current_constraint) draw_xyz(Viewport, m_current_constraint == &m_xyz_constraint ? m_current_color : m_screen_xy_color); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } void select(viewport::control& Viewport, const k3d::point3& Position, const k3d::matrix4& Orientation) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(k3d::to_vector(Position)) * Orientation); glDisable(GL_LIGHTING); glClear(GL_DEPTH_BUFFER_BIT); // Scale manipulators glScaled(m_scale, m_scale, m_scale); // Draw manipulators k3d::vector3 px; k3d::vector3 py; k3d::vector3 pz; if(is_front_facing(Viewport, k3d::vector3(1, 0, 0), Position, Orientation)) { px = k3d::vector3(1, 0, 0); select_axis(m_x_constraint, k3d::rotate3(k3d::radians(90.0), k3d::vector3(0, 1, 0))); } else { px = k3d::vector3(-1, 0, 0); select_axis(m_x_constraint, k3d::rotate3(k3d::radians(-90.0), k3d::vector3(0, 1, 0))); } if(is_front_facing(Viewport, k3d::vector3(0, -1, 0), Position, Orientation)) { py = k3d::vector3(0, -1, 0); select_axis(m_y_constraint, k3d::rotate3(k3d::radians(90.0), k3d::vector3(1, 0, 0))); } else { py = k3d::vector3(0, 1, 0); select_axis(m_y_constraint, k3d::rotate3(k3d::radians(-90.0), k3d::vector3(1, 0, 0))); } if(is_front_facing(Viewport, k3d::vector3(0, 0, 1), Position, Orientation)) { pz = k3d::vector3(0, 0, 1); select_axis(m_z_constraint, k3d::rotate3(k3d::radians(0.0), k3d::vector3(0, 1, 0))); } else { pz = k3d::vector3(0, 0, -1); select_axis(m_z_constraint, k3d::rotate3(k3d::radians(180.0), k3d::vector3(0, 1, 0))); } select_plane(m_yz_constraint, py, py + pz, pz); select_plane(m_xz_constraint, px, px + pz, pz); select_plane(m_xy_constraint, px, px + py, py); select_xyz(m_xyz_constraint); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } std::string get_constraint_name() { return_val_if_fail(m_current_constraint, ""); return m_current_constraint->label(); } // Set manipulator constraint Glib::RefPtr set_constraint(const std::string& Name) { if(Name == "xyz_constraint") m_current_constraint = &m_xyz_constraint; else if(Name == "x_axis") m_current_constraint = &m_x_constraint; else if(Name == "y_axis") m_current_constraint = &m_y_constraint; else if(Name == "z_axis") m_current_constraint = &m_z_constraint; else if(Name == "xy_plane") m_current_constraint = &m_xy_constraint; else if(Name == "xz_plane") m_current_constraint = &m_xz_constraint; else if(Name == "yz_plane") m_current_constraint = &m_yz_constraint; else assert_not_reached(); return m_current_constraint->cursor(); } std::string constraint_name(const k3d::selection::id ID) { if(ID == m_xyz_constraint.m_selection_token.id) return "xyz_constraint"; else if(ID == m_x_constraint.m_selection_token.id) return "x_axis"; else if(ID == m_y_constraint.m_selection_token.id) return "y_axis"; else if(ID == m_z_constraint.m_selection_token.id) return "z_axis"; else if(ID == m_xy_constraint.m_selection_token.id) return "xy_plane"; else if(ID == m_xz_constraint.m_selection_token.id) return "xz_plane"; else if(ID == m_yz_constraint.m_selection_token.id) return "yz_plane"; return ""; } std::string cycle_constraint(constraint* Constraint) { if(Constraint == &m_x_constraint) return "y_axis"; if(Constraint == &m_y_constraint) return "z_axis"; if(Constraint == &m_z_constraint) return "x_axis"; return ""; } void update_constraint(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { // Cycle through X - Screen - Y - Screen - Z - Screen - X - etc if(m_current_constraint == &m_x_constraint || m_current_constraint == &m_y_constraint || m_current_constraint == &m_z_constraint) { // Save current constraint m_previous_constraint = m_current_constraint; // Go back to screeen mode set_constraint("xyz_constraint"); } else if(m_previous_constraint) { // An axis was previously chosen, cycle to next one set_constraint(cycle_constraint(m_previous_constraint)); } else { // Constrain movement to the "nearest" axis const k3d::point2 mouse(Coordinates); const k3d::point2 coords = Viewport.project(Position); std::map constraints; constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(1, 0, 0))))), "x_axis")); constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(0, 1, 0))))), "y_axis")); constraints.insert(std::make_pair(k3d::distance(mouse, k3d::line2(coords, Viewport.project(Position + (Orientation * k3d::vector3(0, 0, 1))))), "z_axis")); set_constraint(constraints.begin()->second); } begin_mouse_move(Coordinates, Position); } void begin_mouse_move(const k3d::point2& Coordinates, const k3d::point3& Position) { m_current_constraint->begin_mouse_move(Coordinates, Position); } k3d::point3 mouse_move(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) { return m_current_constraint->mouse_move(Viewport, Coordinates, Position, Orientation); } private: // Manipulator drawing/selection functions void draw_xyz(viewport::control& Viewport, const k3d::color& Color) { k3d::gl::store_attributes attributes; k3d::gl::color3d(Color); k3d::gl::material(GL_FRONT_AND_BACK, GL_AMBIENT, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_DIFFUSE, Color); k3d::gl::material(GL_FRONT_AND_BACK, GL_SPECULAR, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_EMISSION, Color * 0.2); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glEnable(GL_LIGHTING); k3d::gl::draw(k3d::bounding_box3(m_axis_box_size, -m_axis_box_size, m_axis_box_size, -m_axis_box_size, m_axis_box_size, -m_axis_box_size)); glPopMatrix(); } void select_xyz(constraint& Constraint) { k3d::gl::store_attributes attributes; k3d::gl::push_selection_token(Constraint.m_selection_token); k3d::gl::draw(k3d::bounding_box3(m_axis_box_size, -m_axis_box_size, m_axis_box_size, -m_axis_box_size, m_axis_box_size, -m_axis_box_size)); k3d::gl::pop_selection_token(); } void draw_axis(const k3d::color& ArrowColor, const k3d::color& AxisColor, const k3d::matrix4& Matrix) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(Matrix); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(0, 0, m_axis_end)); glEnable(GL_LIGHTING); k3d::gl::material(GL_FRONT_AND_BACK, GL_AMBIENT, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_DIFFUSE, AxisColor); k3d::gl::material(GL_FRONT_AND_BACK, GL_SPECULAR, k3d::color(0, 0, 0)); k3d::gl::material(GL_FRONT_AND_BACK, GL_EMISSION, AxisColor * 0.2); k3d::gl::draw(k3d::bounding_box3(m_axis_box_size, -m_axis_box_size, m_axis_box_size, -m_axis_box_size, m_axis_box_size, -m_axis_box_size)); glPopMatrix(); glDisable(GL_LIGHTING); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glEnable(GL_LINE_SMOOTH); glLineWidth(m_axis_line_width); k3d::gl::color3d(AxisColor); glBegin(GL_LINES); glVertex3d(0, 0, m_axis_start); glVertex3d(0, 0, m_axis_end); glEnd(); glPopMatrix(); } void select_axis(constraint& Constraint, const k3d::matrix4& Matrix) { k3d::gl::store_attributes attributes; glMatrixMode(GL_MODELVIEW); glPushMatrix(); k3d::gl::push_matrix(Matrix); k3d::gl::push_selection_token(Constraint.m_selection_token); glPushMatrix(); k3d::gl::push_matrix(k3d::translate3(0, 0, m_axis_end)); k3d::gl::draw(k3d::bounding_box3(m_axis_box_size, -m_axis_box_size, m_axis_box_size, -m_axis_box_size, m_axis_box_size, -m_axis_box_size)); glPopMatrix(); glBegin(GL_LINES); glVertex3d(0, 0, m_axis_start); glVertex3d(0, 0, m_axis_end); glEnd(); k3d::gl::pop_selection_token(); glPopMatrix(); } void draw_plane(const k3d::color& Color, const k3d::vector3& P1, const k3d::vector3& P2, const k3d::vector3& P3) { k3d::gl::store_attributes attributes; k3d::gl::color3d(Color); glDisable(GL_LIGHTING); glLineWidth(m_axis_line_width); glBegin(GL_LINE_STRIP); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P1 * m_plane_size)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P2 * m_plane_size)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P3 * m_plane_size)); glEnd(); } void select_plane(constraint& Constraint, const k3d::vector3& P1, const k3d::vector3& P2, const k3d::vector3& P3) { k3d::gl::store_attributes attributes; k3d::gl::push_selection_token(Constraint.m_selection_token); glDisable(GL_LIGHTING); glBegin(GL_QUADS); k3d::gl::vertex3d(k3d::point3(0, 0, 0)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P1 * m_plane_size)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P2 * m_plane_size)); k3d::gl::vertex3d(k3d::point3(0, 0, 0) + (P3 * m_plane_size)); glEnd(); k3d::gl::pop_selection_token(); } /// Stores the constraint that was in effect when scaling began (if any) constraint* m_current_constraint; /// Stores the constraint that was in effect before m_current_constraint constraint* m_previous_constraint; // These are placeholders, used to identify hotspots in the manipulators constraint m_xyz_constraint; constraint m_x_constraint; constraint m_y_constraint; constraint m_z_constraint; constraint m_xy_constraint; constraint m_xz_constraint; constraint m_yz_constraint; // Parameters that control the on-screen appearance of the tool double m_manipulators_size; double m_scale; k3d::color m_current_color; k3d::color m_x_color; k3d::color m_y_color; k3d::color m_z_color; k3d::color m_screen_xy_color; double m_plane_offset; double m_plane_size; double m_axis_start; double m_axis_end; double m_axis_line_width; double m_axis_box_size; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // scale_tool scale_tool::scale_tool(document_state& DocumentState, const std::string& Name) : transform_tool_base(DocumentState.document(), DocumentState, Name), m_scaling(init_owner(*this) + init_name("scaling") + init_label(_("Scaling")) + init_description(_("Scaling")) + init_value(k3d::point3(1, 1, 1))), m_center(init_owner(*this) + init_name("center") + init_label(_("Center")) + init_description(_("Center")) + init_value(k3d::point3(0, 0, 0))), m_auto_center(init_owner(*this) + init_name("auto_center") + init_label(_("Auto Center")) + init_description(_("Center")) + init_value(true)) { m_scaling.connect_explicit_change_signal(sigc::mem_fun(*this, &scale_tool::on_scale)); m_center.connect_explicit_change_signal(sigc::mem_fun(*this, &scale_tool::on_scale)); m_auto_center.connect_explicit_change_signal(sigc::mem_fun(*this, &scale_tool::on_scale)); m_input_model.connect_lbutton_down(sigc::mem_fun(*this, &scale_tool::on_lbutton_down)); m_input_model.connect_lbutton_click(sigc::mem_fun(*this, &scale_tool::on_lbutton_click)); m_input_model.connect_lbutton_start_drag(sigc::mem_fun(*this, &scale_tool::on_lbutton_start_drag)); m_input_model.connect_lbutton_drag(sigc::mem_fun(*this, &scale_tool::on_lbutton_drag)); m_input_model.connect_lbutton_end_drag(sigc::mem_fun(*this, &scale_tool::on_lbutton_end_drag)); m_input_model.connect_mbutton_click(sigc::mem_fun(*this, &scale_tool::on_mbutton_click)); m_input_model.connect_rbutton_click(sigc::mem_fun(*this, &scale_tool::on_rbutton_click)); m_input_model.connect_mouse_move(sigc::mem_fun(*this, &scale_tool::on_mouse_move)); m_manipulators = new detail::scale_manipulators(); } scale_tool::~scale_tool() { delete m_manipulators; } void scale_tool::on_activate() { m_manipulators->activate(); m_visible_manipulators.set_value(true); on_document_selection_changed(); tool_selection::redraw_all(); } void scale_tool::on_deactivate() { if(MOTION_NONE != m_current_motion) cancel_mouse_move(); clear_targets(); m_document_state.clear_cursor_signal().emit(); tool_selection::redraw_all(); } void scale_tool::on_document_selection_changed() { target_list_changed(); update_targets(); m_scaling.set_value(k3d::point3(1, 1, 1)); //set_center(world_position()); m_original_scaling = k3d::point3(1, 1, 1); } void scale_tool::on_redraw(viewport::control& Viewport) { // Update target list update_targets(); // Redraw manipulators m_manipulators->redraw(Viewport, (m_visible_manipulators.internal_value() && target_number()), world_position(), world_orientation(), m_current_motion, get_scaling()); } void scale_tool::on_select(viewport::control& Viewport) { if(m_visible_manipulators.internal_value() && target_number()) m_manipulators->select(Viewport, world_position(), world_orientation()); } k3d::iproperty_collection* scale_tool::get_property_collection() { return dynamic_cast(this); } viewport_input_model& scale_tool::get_input_model() { return input_model(); } // LMB drag/move actions k3d::point3 scale_tool::mouse_move_to_3d(viewport::control& Viewport, const k3d::point2& Coordinates) { // Transform mouse move to a scaling const k3d::point3 origin = world_position(); const k3d::matrix4 orientation = world_orientation(); const k3d::point3 scaling = m_manipulators->mouse_move(Viewport, Coordinates, origin, orientation); return scaling; } k3d::point3 scale_tool::lbutton_drag(viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_DRAG == m_current_motion) { const k3d::point3 scaling = mouse_move_to_3d(Viewport, Coordinates); scale_selection(scaling); return scaling; } if(MOTION_BOX_SELECT == m_current_motion) lmb_drag_box_select(Viewport, Coordinates); return k3d::point3(1, 1, 1); } k3d::point3 scale_tool::mouse_move_action(viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_CLICK_DRAG == m_current_motion) { const k3d::point3 scaling = mouse_move_to_3d(Viewport, Coordinates); scale_selection(scaling); return scaling; } return k3d::point3(1, 1, 1); } void scale_tool::scale_selection(const k3d::point3& Scaling) { if(Scaling == k3d::point3(1, 1, 1)) return; m_scaling.set_value(Scaling); } k3d::point3 scale_tool::world_position() { if (m_auto_center.pipeline_value()) return transform_tool_base::world_position(); else return m_center.pipeline_value(); } k3d::point3 scale_tool::get_scaling() { return m_scaling.internal_value(); } void scale_tool::on_scale(k3d::iunknown*) { scale_targets(m_scaling.internal_value()); } k3d::point3 scale_tool::get_center() { return world_position(); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/scale_tool.h ================================================ #ifndef K3DSDK_NGUI_SCALE_TOOL_H #define K3DSDK_NGUI_SCALE_TOOL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // scale_tool /// Tool implementation that provides standard node/mesh scaling class scale_tool : public transform_tool { typedef transform_tool transform_tool_base; public: scale_tool(document_state& DocumentState, const std::string& Name); ~scale_tool(); const k3d::string_t tool_type() { return "scale_tool"; } protected: k3d::point3 world_position(); private: void on_activate(); void on_deactivate(); void on_document_selection_changed(); void on_redraw(viewport::control& Viewport); void on_select(viewport::control& Viewport); k3d::iproperty_collection* get_property_collection(); viewport_input_model& get_input_model(); void on_lbutton_down(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); const k3d::key_modifiers modifiers = convert(Event.state); lbutton_down(Viewport, coordinates, modifiers); } void on_lbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_click(Viewport, coordinates); } void on_lbutton_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_start_drag(Viewport, coordinates); } void on_lbutton_drag(viewport::control& Viewport, const GdkEventMotion& Event) { k3d::point2 coordinates(Event.x, Event.y); // Off-screen wrap off_screen_warp(Viewport, coordinates); const k3d::point3 scaling = lbutton_drag(Viewport, coordinates); } void on_lbutton_end_drag(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); lbutton_end_drag(Viewport, coordinates); } void on_mbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); const k3d::key_modifiers modifiers = convert(Event.state); mbutton_click(Viewport, coordinates, modifiers); } void on_rbutton_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::point2 coordinates(Event.x, Event.y); rbutton_click(Viewport, coordinates); } void on_mouse_move(viewport::control& Viewport, const GdkEventMotion& Event) { if(MOTION_CLICK_DRAG != m_current_motion) return; k3d::point2 coordinates(Event.x, Event.y); // Off-screen wrap off_screen_warp(Viewport, coordinates); const k3d::point3 scaling = mouse_move_action(Viewport, coordinates); } // Manipulator functions virtual std::string manipulator_name(const k3d::selection::id ID) { return m_manipulators->constraint_name(ID); } virtual std::string get_manipulator(const manipulators_t& Manipulators) { if(!Manipulators.size()) return std::string(""); // Give priority to the middle cube if(std::find(Manipulators.begin(), Manipulators.end(), std::string("xyz_constraint")) != Manipulators.end()) return std::string("xyz_constraint"); return *Manipulators.begin(); } virtual void set_manipulator(const std::string ManipulatorName) { m_document_state.set_cursor_signal().emit(m_manipulators->set_constraint(ManipulatorName)); } virtual std::string get_constraint_name() { return m_manipulators->get_constraint_name(); } virtual void begin_mouse_move(const k3d::point2& Coordinates) { start_scaling(); m_original_scaling = get_scaling(); m_manipulators->begin_mouse_move(Coordinates, world_position()); } virtual void update_constraint(viewport::control& Viewport, const k3d::point2& Coordinates) { m_manipulators->update_constraint(Viewport, Coordinates, world_position(), world_orientation()); begin_mouse_move(Coordinates); } virtual void reset() { } // LMB drag/move actions k3d::point3 mouse_move_to_3d(viewport::control& Viewport, const k3d::point2& Coordinates); k3d::point3 lbutton_drag(viewport::control& Viewport, const k3d::point2& Coordinates); k3d::point3 mouse_move_action(viewport::control& Viewport, const k3d::point2& Coordinates); void scale_selection(const k3d::point3& Scaling); k3d::point3 get_scaling(); void on_scale(k3d::iunknown*); k3d::point3 get_center(); /// Stores manipulators detail::imanipulators* m_manipulators; // Scaling value k3d::point3 m_original_scaling; k3d_data(k3d::point3, immutable_name, explicit_change_signal, with_undo, local_storage, no_constraint, writable_property, no_serialization) m_scaling; // Scaling center k3d_data(k3d::point3, immutable_name, explicit_change_signal, with_undo, local_storage, no_constraint, writable_property, no_serialization) m_center; k3d_data(bool, immutable_name, explicit_change_signal, with_undo, local_storage, no_constraint, writable_property, no_serialization) m_auto_center; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SCALE_TOOL_H ================================================ FILE: k3dsdk/ngui/screen_overlay.cpp ================================================ // SDPGTK // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Implements the screen_overlay class \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////////////////////// // screen_overlay screen_overlay::screen_overlay(const Gdk::Rectangle& Geometry, const k3d::color& Color) : base(Gtk::WINDOW_POPUP) { // const unsigned long width = get_screen()->get_width(); // const unsigned long height = get_screen()->get_height(); // resize(width, height); move(Geometry.get_x(), Geometry.get_y()); resize(Geometry.get_width(), Geometry.get_height()); set_color(Color); Gdk::Color white; white.set_rgb(0xffff, 0xffff, 0xffff); Gdk::Color black; black.set_rgb(0x0000, 0x0000, 0x0000); realize(); std::vector buffer(Geometry.get_width() * Geometry.get_height(), 0x00); m_mask = Gdk::Bitmap::create(&buffer[0], Geometry.get_width(), Geometry.get_height()); m_mask_gc = Gdk::GC::create(m_mask); m_mask_gc->set_function(Gdk::SET); m_mask_gc->set_foreground(white); m_mask_gc->set_background(black); //m_mask->draw_rectangle(m_mask_gc, true, 100, 100, 100, 100); shape_combine_mask(m_mask, 0, 0); } screen_overlay::~screen_overlay() { hide(); } void screen_overlay::set_color(const k3d::color& Color) { Gdk::Color color; color.set_rgb_p(Color.red, Color.green, Color.blue); modify_bg(Gtk::STATE_NORMAL, color); modify_bg(Gtk::STATE_ACTIVE, color); modify_bg(Gtk::STATE_PRELIGHT, color); modify_bg(Gtk::STATE_SELECTED, color); modify_bg(Gtk::STATE_INSENSITIVE, color); queue_draw(); handle_pending_events(); } const Glib::RefPtr& screen_overlay::mask() const { return m_mask; } const Glib::RefPtr& screen_overlay::mask_gc() const { return m_mask_gc; } void screen_overlay::update() { get_window()->shape_combine_mask(m_mask, 0, 0); queue_draw(); handle_pending_events(); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/screen_overlay.h ================================================ #ifndef K3DSDK_NGUI_SCREEN_OVERLAY_H #define K3DSDK_NGUI_SCREEN_OVERLAY_H // SDPGTK // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Provides an interface for drawing transparent displays over the top of the user's screen \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { ////////////////////////////////////////////////////////////////////////// // screen_overlay /// Provides an interface for drawing transparent displays over the top of the user's screen class screen_overlay : public Gtk::Window { typedef Gtk::Window base; public: screen_overlay(const Gdk::Rectangle& Geometry, const k3d::color& Color); ~screen_overlay(); /// Updates the overlay color void set_color(const k3d::color& Color); /// Returns a mask that you can draw on to determine the shape of the overlay const Glib::RefPtr& mask() const; /// Returns a gc that you can use to draw on the overlay mask const Glib::RefPtr& mask_gc() const; /// Called to update the overlay after changes have been using mask() and mask_gc() void update(); private: /// Stores the mask that controls the shape of the overlay Glib::RefPtr m_mask; /// Stores the gc for drawing on the overlay mask Glib::RefPtr m_mask_gc; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SCREEN_OVERLAY_H ================================================ FILE: k3dsdk/ngui/script_button.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace script_button { ///////////////////////////////////////////////////////////////////////////// // property_model /// Implementation of script_button::imodel for use with iproperty objects class property_model : public imodel { public: property_model(iproperty& Data) : m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } iproperty* property() { return &m_readable_data; } const string_t value() { return boost::any_cast(m_readable_data.property_internal_value()); } void set_value(const string_t& Value) { return_if_fail(m_writable_data); m_writable_data->property_set_value(Value); } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } private: iproperty& m_readable_data; iwritable_property* const m_writable_data; }; ///////////////////////////////////////////////////////////////////////////// // model imodel* const model(iproperty& Property) { return new property_model(Property); } ///////////////////////////////////////////////////////////////////////////// // control control::control(imodel* const Model, istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : base(false, 0), m_load(_("Load")), m_save(_("Save")), m_edit(_("Edit Script")), m_model(Model), m_state_recorder(StateRecorder), m_change_message(ChangeMessage) { m_load.signal_clicked().connect(sigc::mem_fun(*this, &control::on_load)); m_save.signal_clicked().connect(sigc::mem_fun(*this, &control::on_save)); m_edit.signal_clicked().connect(sigc::mem_fun(*this, &control::on_edit)); pack_start(m_load, Gtk::PACK_SHRINK); pack_start(m_save, Gtk::PACK_SHRINK); pack_start(m_edit, Gtk::PACK_EXPAND_WIDGET); m_load.set_tooltip_text(_("Load a script from disk, replacing the current script")); m_save.set_tooltip_text(_("Save the current script to disk")); m_edit.set_tooltip_text(_("Open the current script for editing")); set_name("k3d-script-button"); // Update the display and ensure we get a notification anytime the data source changes ... return_if_fail(m_model); update(0); m_model->changed_signal().connect(sigc::mem_fun(*this, &control::update)); } control::~control() { delete m_model; } void control::update(ihint*) { return_if_fail(m_model); } void control::on_load() { return_if_fail(m_model); filesystem::path input_path; { file_chooser_dialog dialog(_("Load Script:"), options::path::scripts(), Gtk::FILE_CHOOSER_ACTION_OPEN); if(!dialog.get_file_path(input_path)) return; } std::stringstream buffer; filesystem::ifstream input_stream(input_path); input_stream >> buffer.rdbuf(); input_stream.close(); if(buffer.str() != m_model->value()) { if(m_state_recorder) m_state_recorder->start_recording(create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_model->set_value(buffer.str()); if(m_state_recorder) m_state_recorder->commit_change_set(m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), m_change_message, K3D_CHANGE_SET_CONTEXT); } } void control::on_save() { return_if_fail(m_model); filesystem::path output_path; { file_chooser_dialog dialog(_("Save Script:"), options::path::scripts(), Gtk::FILE_CHOOSER_ACTION_SAVE); if(!dialog.get_file_path(output_path)) return; } filesystem::ofstream output_stream(output_path); output_stream << m_model->value(); } void control::on_edit() { return_if_fail(m_model); if(Gtk::Window* const window = plugin::create("NGUITextEditorDialog")) { if(m_model->property()) { if(iproperty_sink* const property_sink = dynamic_cast(window)) property_sink->set_property(m_model->property()); } if(istate_recorder_sink* const state_recorder_sink = dynamic_cast(window)) state_recorder_sink->set_state_recorder(m_state_recorder); if(Gtk::Window* const top_level = dynamic_cast(get_toplevel())) window->set_transient_for(*top_level); } } } // namespace script_button } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/script_button.h ================================================ #ifndef K3DSDK_NGUI_SCRIPT_BUTTON_H #define K3DSDK_NGUI_SCRIPT_BUTTON_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { class ihint; class iproperty; class istate_recorder; namespace ngui { namespace script_button { ///////////////////////////////////////////////////////////////////////////// // imodel /// Abstract interface for an object that proxies a data source for a script button control (i.e. the "model" in model-view-controller) class imodel { public: virtual ~imodel() {} /// Called to return the underlying data property (if any, could return NULL) virtual iproperty* property() = 0; /// Called to return the underlying data value virtual const string_t value() = 0; /// Called to set a new data value virtual void set_value(const string_t& Value) = 0; /// Signal emitted if the underlying data changes typedef sigc::signal changed_signal_t; /// Signal emitted if the underlying data changes virtual changed_signal_t& changed_signal() = 0; protected: imodel() {} private: imodel(const imodel&); imodel& operator=(const imodel&); }; /// Factory method for creating an imodel object given a suitably-typed property imodel* const model(iproperty& Property); ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating script data (i.e. the view and the controller from model-view-controller) class control : public Gtk::HBox { typedef Gtk::HBox base; public: control(imodel* const Model, istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage); ~control(); private: Gtk::Button m_load; Gtk::Button m_save; Gtk::Button m_edit; /// Called to update the state of the widget when the underlying data source changes void update(ihint*); /// Called to replace the current data with a script from disk void on_load(); /// Called to store the current data to disk void on_save(); /// Called to edit the current data void on_edit(); /// Storeas a reference to the underlying data object imodel* const m_model; /// Stores an optional state recorder for recording undo/redo data istate_recorder* const m_state_recorder; /// Stores an optional message for labelling undo/redo state changes const Glib::ustring m_change_message; }; } // namespace script_button } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SCRIPT_BUTTON_H ================================================ FILE: k3dsdk/ngui/scripting.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { /// Keeps track of running script engines, so they can be halted if the user hits "escape" std::stack script_engine_stack; /// Halts any running scripts if the user hits "escape" int script_escape_handler(Gtk::Widget* Widget, GdkEventKey* Event) { if(Event->type != GDK_KEY_RELEASE) return false; if(Event->keyval != GDK_Escape) return false; return_val_if_fail(script_engine_stack.size(), false); std::vector buttons; buttons.push_back(_("Yes")); buttons.push_back(_("No")); if(1 == query_message(_("Halt running script?"), 2, buttons)) script_engine_stack.top()->halt(); return true; } /// Executes a script using the given plugin factory to create the script engine bool execute_script(const k3d::script::code& Script, const std::string& ScriptName, k3d::iscript_engine::context& Context, const k3d::script::language& Language) { // Sanity checks ... return_val_if_fail(ScriptName.size(), false); if(!Language.factory()) { error_message( _("Could not determine scripting language. K-3D supports multiple scripting languages, but the language for this script was " "not recognized. Most K-3D script engines use some type of \"magic token\" at the beginning of a script to recognize it, e.g. \"#python\" " "in the first 7 characters of a script for K-3D's Python engine. If you are writing a K-3D script, check the documentation " "for the scripting language you're writing in to see how to make it recognizable.")); return false; } // Get the requested scripting engine ... boost::scoped_ptr engine(k3d::plugin::create(*Language.factory())); if(!engine) { error_message( _("Error creating the scripting engine to run this script. Usually this means that your system is missing appropriate libraries " "or that there was an error in installation.")); return false; } // Intercept global key events ... script_engine_stack.push(engine.get()); sigc::connection script_escape_handler_connection = Gtk::Main::signal_key_snooper().connect(sigc::ptr_fun(script_escape_handler)); // Run that bad-boy ... const bool result = engine->execute(ScriptName, Script.source(), Context); script_escape_handler_connection.disconnect(); script_engine_stack.pop(); if(!result) { error_message( _("Error executing script")); } return result; } } // namespace detail bool execute_script(const k3d::script::code& Script, const std::string& ScriptName, k3d::iscript_engine::context& Context, const k3d::script::language& Language) { return detail::execute_script(Script, ScriptName, Context, Language); } bool execute_script(const k3d::script::code& Script, const std::string& ScriptName, k3d::iscript_engine::context& Context) { return detail::execute_script(Script, ScriptName, Context, k3d::script::language(Script)); } bool execute_script(const k3d::filesystem::path& Script, k3d::iscript_engine::context& Context) { if(!k3d::filesystem::exists(Script)) { error_message( k3d::string_cast(boost::format(_("Requested script file %1% doesn't exist.")) % Script.native_utf8_string().raw())); return false; } k3d::filesystem::ifstream file(Script); const k3d::script::code script(file); const k3d::script::language language(script); return detail::execute_script(script, Script.native_utf8_string().raw(), Context, language); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/scripting.h ================================================ #ifndef K3DSDK_NGUI_SCRIPTING_H #define K3DSDK_NGUI_SCRIPTING_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares convenience functions for working with scripts \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace filesystem { class path; } } namespace k3d { namespace ngui { /// Executes a script using a specific language and providing user feedback for errors bool execute_script(const k3d::script::code& Script, const std::string& ScriptName, k3d::iscript_engine::context& Context, const k3d::script::language& Language); /// Executes a script, attempting to automatically recognize the language and providing user feedback for errors bool execute_script(const k3d::script::code& Script, const std::string& ScriptName, k3d::iscript_engine::context& Context); /// Executes a script, attempting to automatically recognize the language and providing user feedback for errors bool execute_script(const k3d::filesystem::path& Script, k3d::iscript_engine::context& Context); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SCRIPTING_H ================================================ FILE: k3dsdk/ngui/selection.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace selection { namespace detail { /// Uses an update policy to replace each selection in a set of MeshInstance nodes. /// Each update policy must generate a k3d::selection::set based on the current state of the MeshInstance output mesh. /// Use replace_selection() to apply selection algorithms to an existing mesh. template void replace_selection(const nodes_t& Nodes, const UpdatePolicyT& UpdatePolicy, const bool_t VisibleSelection) { for(nodes_t::const_iterator node = Nodes.begin(); node != Nodes.end(); ++node) { if(classes::MeshInstance() != (*node)->factory().factory_id()) continue; imesh_selection_sink* const mesh_selection_sink = dynamic_cast(*node); if(!mesh_selection_sink) continue; imesh_source* const mesh_source = dynamic_cast(*node); if(!mesh_source) continue; const k3d::mesh* const mesh = boost::any_cast(mesh_source->mesh_source_output().property_internal_value()); if(!mesh) continue; const k3d::selection::set current_selection = boost::any_cast(mesh_selection_sink->mesh_selection_sink_input().property_internal_value()); property::set_internal_value(mesh_selection_sink->mesh_selection_sink_input(), UpdatePolicy(*mesh, current_selection)); property::set_internal_value(**node, "show_component_selection", VisibleSelection); } } /// Update policy for use with replace_selection() that selects all points in a mesh. struct select_all_points { const k3d::selection::set operator()(const mesh& Mesh, const k3d::selection::set& CurrentSelection) const { k3d::selection::set results; boost::scoped_ptr point_selection(geometry::point_selection::create(results)); geometry::point_selection::append(*point_selection, 1.0); boost::scoped_ptr primitive_selection(geometry::primitive_selection::create(results)); geometry::primitive_selection::append(*primitive_selection, k3d::selection::CONSTANT, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::CURVE, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::EDGE, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::FACE, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::PARAMETER, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::PATCH, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::SURFACE, 0.0); return results; } }; /// Update policy for use with replace_selection() that selects all components of a given type in a mesh. struct select_all_components { select_all_components(const k3d::selection::type Component) : component(Component) { } const k3d::selection::set operator()(const mesh& Mesh, const k3d::selection::set& CurrentSelection) const { k3d::selection::set results; boost::scoped_ptr point_selection(geometry::point_selection::create(results)); geometry::point_selection::append(*point_selection, 0.0); boost::scoped_ptr primitive_selection(geometry::primitive_selection::create(results)); geometry::primitive_selection::append(*primitive_selection, k3d::selection::CONSTANT, component == k3d::selection::CONSTANT ? 1.0 : 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::CURVE, component == k3d::selection::CURVE ? 1.0 : 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::FACE, component == k3d::selection::FACE ? 1.0 : 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::PARAMETER, component == k3d::selection::PARAMETER ? 1.0 : 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::PATCH, component == k3d::selection::PATCH ? 1.0 : 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::EDGE, component == k3d::selection::EDGE ? 1.0 : 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::SURFACE, component == k3d::selection::SURFACE ? 1.0 : 0.0); return results; } const k3d::selection::type component; }; /// Update policy for use with replace_selection() that inverts the selection of all points in a mesh. struct invert_points { const k3d::selection::set operator()(const k3d::mesh& Mesh, const k3d::selection::set& CurrentSelection) const { const k3d::mesh::selection_t* current_point_selection = Mesh.point_selection.get(); if(!current_point_selection) return CurrentSelection; k3d::selection::set results = CurrentSelection; boost::scoped_ptr point_selection(geometry::point_selection::create(results)); for(k3d::uint_t i = 0; i != current_point_selection->size(); ++i) { point_selection->index_begin.push_back(i); point_selection->index_end.push_back(i + 1); point_selection->weight.push_back((*current_point_selection)[i] ? 0.0 : 1.0); } return results; } }; /// Update policy for use with replace_selection() that inverts the selection of a specific component type in a mesh. struct invert_components { invert_components(const k3d::selection::type Component) : component(Component) { } struct generate_selection { generate_selection(const uint_t Primitive, const k3d::selection::type Component, k3d::selection::set& Results) : primitive(Primitive), component(Component), component_string(string_cast(Component)), results(Results) { } void operator()(const string_t& StructureName, const table& Structure, const string_t& ArrayName, const pipeline_data& Array) { if(StructureName != component_string) return; if(Array->get_metadata_value(metadata::key::role()) != metadata::value::selection_role()) return; const mesh::selection_t* const array = dynamic_cast(Array.get()); if(!array) { log() << error << "unexpected type for array [" << ArrayName << "]" << std::endl; return; } boost::scoped_ptr primitive_selection(geometry::primitive_selection::create(results)); primitive_selection->primitive_begin.push_back(primitive); primitive_selection->primitive_end.push_back(primitive + 1); primitive_selection->primitive_selection_type.push_back(component); primitive_selection->primitive_first_range.push_back(0); primitive_selection->primitive_range_count.push_back(array->size()); for(uint_t i = 0; i != array->size(); ++i) { primitive_selection->index_begin.push_back(i); primitive_selection->index_end.push_back(i+1); primitive_selection->weight.push_back((*array)[i] ? 0.0 : 1.0); } } const uint_t primitive; const k3d::selection::type component; const string_t component_string; k3d::selection::set& results; }; const k3d::selection::set operator()(const k3d::mesh& Mesh, const k3d::selection::set& CurrentSelection) const { k3d::selection::set results = CurrentSelection; for(k3d::uint_t primitive = 0; primitive != Mesh.primitives.size(); ++primitive) { k3d::mesh::visit_arrays(*Mesh.primitives[primitive], generate_selection(primitive, component, results)); } return results; } const k3d::selection::type component; }; /// Update policy for use with replace_selection() that deselects all points and primitives in a mesh. struct deselect_all { const k3d::selection::set operator()(const mesh& Mesh, const k3d::selection::set& CurrentSelection) const { return geometry::selection::create(0); } }; /// Uses an update policy to convert the supplied selection into updates to MeshInstance mesh selections template void merge_interactive_selection(const nodes_t& Nodes, const UpdatePolicyT& UpdatePolicy, const k3d::selection::records& InteractiveSelection) { for(nodes_t::const_iterator node = Nodes.begin(); node != Nodes.end(); ++node) { if(classes::MeshInstance() != (*node)->factory().factory_id()) continue; imesh_selection_sink* const mesh_selection_sink = dynamic_cast(*node); if(!mesh_selection_sink) continue; imesh_source* const mesh_source = dynamic_cast(*node); if(!mesh_source) continue; const k3d::mesh* const mesh = boost::any_cast(mesh_source->mesh_source_output().property_internal_value()); if(!mesh) continue; const k3d::selection::set current_selection = boost::any_cast(mesh_selection_sink->mesh_selection_sink_input().property_internal_value()); property::set_internal_value(mesh_selection_sink->mesh_selection_sink_input(), UpdatePolicy(*node, *mesh, current_selection, InteractiveSelection)); property::set_internal_value(**node, "show_component_selection", true); } } /// Policy class that updates a mesh_selection to select the given points struct select_points { select_points(const double_t Weight) : weight(Weight) { } const k3d::selection::set operator()(k3d::inode* const Node, const k3d::mesh& Mesh, const k3d::selection::set& CurrentSelection, const k3d::selection::records& InteractiveSelection) const { k3d::selection::set results = CurrentSelection; boost::scoped_ptr point_selection; for(k3d::selection::records::const_iterator record = InteractiveSelection.begin(); record != InteractiveSelection.end(); ++record) { if(k3d::selection::get_node(*record) != Node) continue; if(!point_selection) point_selection.reset(geometry::point_selection::create(results)); for(k3d::selection::record::tokens_t::const_iterator token = record->tokens.begin(); token != record->tokens.end(); ++token) { switch(token->type) { case k3d::selection::POINT: point_selection->index_begin.push_back(token->id); point_selection->index_end.push_back(token->id + 1); point_selection->weight.push_back(weight); continue; default: continue; } } } return results; } const double_t weight; }; /// Policy class that updates a mesh_selection to select the given components struct select_component { select_component(const k3d::selection::type& Component, const double_t Weight) : component(Component), weight(Weight) { } const k3d::selection::set operator()(k3d::inode* const Node, const k3d::mesh& Mesh, const k3d::selection::set& CurrentSelection, const k3d::selection::records& InteractiveSelection) const { k3d::selection::set results = CurrentSelection; boost::scoped_ptr primitive_selection; for(k3d::selection::records::const_iterator record = InteractiveSelection.begin(); record != InteractiveSelection.end(); ++record) { if(k3d::selection::get_node(*record) != Node) continue; if(!primitive_selection) primitive_selection.reset(geometry::primitive_selection::create(results)); bool_t found_primitive = false; for(k3d::selection::record::tokens_t::const_iterator token = record->tokens.begin(); token != record->tokens.end(); ++token) { if(token->type == k3d::selection::PRIMITIVE) { found_primitive = true; if(primitive_selection->primitive_begin.empty() || primitive_selection->primitive_begin.back() != token->id) { primitive_selection->primitive_begin.push_back(token->id); primitive_selection->primitive_end.push_back(token->id + 1); primitive_selection->primitive_selection_type.push_back(component); primitive_selection->primitive_first_range.push_back(primitive_selection->index_begin.size()); primitive_selection->primitive_range_count.push_back(0); } } else if(token->type == component) { if(!found_primitive) { log() << error << "Selection records missing primitive token" << std::endl; break; } primitive_selection->primitive_range_count.back() += 1; primitive_selection->index_begin.push_back(token->id); primitive_selection->index_end.push_back(token->id + 1); primitive_selection->weight.push_back(weight); } } } return results; } const k3d::selection::type component; const double_t weight; }; /// Policy class that updates a mesh_selection to select the given edges struct select_edges { select_edges(const bool_t SelectAdjacent, const double_t Weight) : select_adjacent(SelectAdjacent), weight(Weight) { } const k3d::selection::set operator()(k3d::inode* const Node, const k3d::mesh& Mesh, const k3d::selection::set& CurrentSelection, const k3d::selection::records& InteractiveSelection) const { k3d::selection::set results = CurrentSelection; // Extract the set of edges to be selected ... mesh::indices_t edges; mesh::indices_t edge_primitives; for(k3d::selection::records::const_iterator record = InteractiveSelection.begin(); record != InteractiveSelection.end(); ++record) { if(k3d::selection::get_node(*record) != Node) continue; for(k3d::selection::record::tokens_t::const_iterator primitive_token = record->tokens.begin(); primitive_token != record->tokens.end(); ++primitive_token) { if(primitive_token->type != k3d::selection::PRIMITIVE) continue; for(k3d::selection::record::tokens_t::const_iterator edge_token = primitive_token + 1; edge_token != record->tokens.end(); ++edge_token) { if(edge_token->type != k3d::selection::EDGE) continue; edges.push_back(edge_token->id); edge_primitives.push_back(primitive_token->id); break; } break; } } // Get the set of unique primitives ... std::set primitives(edge_primitives.begin(), edge_primitives.end()); // Optionally select adjacent edges ... if(select_adjacent) { const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + edges.size(); for(std::set::const_iterator primitive = primitives.begin(); primitive != primitives.end(); ++primitive) { if(Mesh.primitives.size() <= *primitive) continue; boost::scoped_ptr polyhedron(polyhedron::validate(Mesh, *Mesh.primitives[*primitive])); if(!polyhedron) continue; mesh::bools_t boundary_edges; mesh::indices_t adjacent_edges; polyhedron::create_edge_adjacency_lookup(polyhedron->vertex_points, polyhedron->clockwise_edges, boundary_edges, adjacent_edges); std::set primitive_edges; for(uint_t edge = edge_begin; edge != edge_end; ++edge) { if(edge_primitives[edge] != *primitive) continue; primitive_edges.insert(edges[edge]); } for(std::set::const_iterator edge = primitive_edges.begin(); edge != primitive_edges.end(); ++edge) { if(boundary_edges[*edge]) continue; if(primitive_edges.count(adjacent_edges[*edge])) continue; edges.push_back(adjacent_edges[*edge]); edge_primitives.push_back(*primitive); } } } // Add all our edges to the output selection ... if(edges.size()) { const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + edges.size(); boost::scoped_ptr primitive_selection(geometry::primitive_selection::create(results)); for(std::set::const_iterator primitive = primitives.begin(); primitive != primitives.end(); ++primitive) { primitive_selection->primitive_begin.push_back(*primitive); primitive_selection->primitive_end.push_back(*primitive + 1); primitive_selection->primitive_selection_type.push_back(k3d::selection::EDGE); primitive_selection->primitive_first_range.push_back(primitive_selection->index_begin.size()); primitive_selection->primitive_range_count.push_back(0); for(uint_t edge = edge_begin; edge != edge_end; ++edge) { if(edge_primitives[edge] != *primitive) continue; primitive_selection->primitive_range_count.back() += 1; primitive_selection->index_begin.push_back(edges[edge]); primitive_selection->index_end.push_back(edges[edge] + 1); primitive_selection->weight.push_back(weight); } } } return results; } const bool_t select_adjacent; const double_t weight; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // mode std::ostream& operator<<(std::ostream& Stream, const mode& RHS) { switch(RHS) { case CURVE: Stream << "curve"; break; case FACE: Stream << "face"; break; case NODE: Stream << "node"; break; case PATCH: Stream << "patch"; break; case POINT: Stream << "point"; break; case EDGE: Stream << "edge"; break; case SURFACE: Stream << "surface"; break; } return Stream; } std::istream& operator>>(std::istream& Stream, mode& RHS) { std::string text; Stream >> text; if(text == "curve") RHS = CURVE; else if(text == "face") RHS = FACE; else if(text == "node") RHS = NODE; else if(text == "patch") RHS = PATCH; else if(text == "point") RHS = POINT; else if(text == "edge") RHS = EDGE; else if(text == "surface") RHS = SURFACE; else log() << error << "Unknown enumeration [" << text << "]"<< std::endl; return Stream; } /// Provides human-readable labels for the selection::mode enumeration static const ienumeration_property::enumeration_values_t& mode_values() { static ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(ienumeration_property::enumeration_value_t(_("Curves"), "curve", _("Select Curves"))); values.push_back(ienumeration_property::enumeration_value_t(_("Faces"), "face", _("Select Faces"))); values.push_back(ienumeration_property::enumeration_value_t(_("Nodes"), "node", _("Select Nodes"))); values.push_back(ienumeration_property::enumeration_value_t(_("Patches"), "patch", _("Select Patches"))); values.push_back(ienumeration_property::enumeration_value_t(_("Points"), "point", _("Select Points"))); values.push_back(ienumeration_property::enumeration_value_t(_("Split Edges"), "split_edge", _("Select Split Edges"))); values.push_back(ienumeration_property::enumeration_value_t(_("Uniform"), "uniform", _("Select Uniform"))); } return values; } ///////////////////////////////////////////////////////////////////////////// // state::implementation class state::implementation { public: static implementation& instance(idocument& Document) { typedef std::map cache_t; static cache_t cache; cache_t::iterator result = cache.find(&Document); if(result == cache.end()) result = cache.insert(std::make_pair(&Document, new implementation(Document))).first; return *result->second; } inode_selection* node_selection() { if(!m_node_selection) { const std::vector nodes = node::lookup(document, "ngui:unique_node", "node_selection"); if(nodes.size() != 1) return 0; m_node_selection = nodes[0]; // Make sure the node gets updated whenever the metadata is changed or the node is deleted imetadata* metadata = dynamic_cast(nodes[0]); m_node_selection_metadata_connection = metadata->connect_metadata_changed_signal(sigc::mem_fun(*this, &implementation::on_node_selection_node_changed)); m_node_selection_deleted_connection = dynamic_cast(m_node_selection)->deleted_signal().connect(sigc::mem_fun(*this, &implementation::on_node_selection_node_changed)); } return m_node_selection; } const nodes_t selected_nodes() { nodes_t result; return_val_if_fail(node_selection(), result); const inode_selection::selected_nodes_t nodes = node_selection()->selected_nodes(); result.assign(nodes.begin(), nodes.end()); result.erase(std::remove(result.begin(), result.end(), static_cast(0)), result.end()); return result; } inode* rubber_band() { if(!m_rubber_band) { std::vector nodes = node::lookup(document, uuid(0x72d36e00, 0x0a4621f4, 0xfdc8e69d, 0x621eadc8)); if(nodes.empty()) { nodes.push_back(plugin::create(uuid(0x72d36e00, 0x0a4621f4, 0xfdc8e69d, 0x621eadc8), document, "RubberBand")); } nodes.erase(std::remove(nodes.begin(), nodes.end(), static_cast(0)), nodes.end()); if(nodes.empty()) return 0; m_rubber_band = nodes[0]; } return m_rubber_band; } idocument& document; /// Defines storage for the current document-wide selection mode /** \todo Restore undo/redo capability */ // k3d_data(selection::mode, immutable_name, explicit_change_signal, with_undo, local_storage, no_constraint, no_property, no_serialization) current_mode; k3d_data(selection::mode, immutable_name, explicit_change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) current_mode; /// Defines storage for the document-wide keep-selection mode k3d_data(bool_t, immutable_name, explicit_change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) keep_selection; /// Defines storage for the document-wide convert-selection mode k3d_data(bool_t, immutable_name, explicit_change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) convert_selection; /// Defines storage for the document-wide select-adjacent-edges state k3d_data(bool_t, immutable_name, explicit_change_signal, no_undo, local_storage, no_constraint, no_property, no_serialization) select_adjacent_edges; private: implementation(idocument& Document) : document(Document), current_mode(init_name("selection_mode") + init_label(_("Selection Type")) + init_description(_("Sets selection mode (nodes, faces, edges, points, etc)")) + init_value(selection::NODE) + init_values(mode_values())), keep_selection(init_name("keep_selection") + init_label(_("Keep Selection")) + init_description(_("Keep the current selection when changing the selection mode.")) + init_value(false)), convert_selection(init_name("convert_selection") + init_label(_("Convert Selection")) + init_description(_("Convert the current selection when changing the selection mode.")) + init_value(true)), select_adjacent_edges(init_name("select_adjacent_edges") + init_label(_("Select Adjacent Edges")) + init_description(_("When selecting edges, automatically expand the selection to include adjacent edges.")) + init_value(true)), m_node_selection(0), m_rubber_band(0) { current_mode.connect_explicit_change_signal(sigc::mem_fun(*this, &implementation::on_selection_mode_changed)); } /// Called by the signal system when the selection mode changes void on_selection_mode_changed(k3d::iunknown*) { const nodes_t nodes = selected_nodes(); for(nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { if(classes::MeshInstance() != (*node)->factory().factory_id()) continue; imesh_selection_sink* const mesh_selection_sink = dynamic_cast(*node); if(!mesh_selection_sink) continue; imesh_source* const mesh_source = dynamic_cast(*node); if(!mesh_source) continue; const k3d::mesh* const mesh = boost::any_cast(mesh_source->mesh_source_output().property_internal_value()); if(!mesh) continue; k3d::selection::set new_selection; if(keep_selection.internal_value()) { new_selection = boost::any_cast(mesh_selection_sink->mesh_selection_sink_input().property_internal_value()); } else { boost::scoped_ptr point_selection(geometry::point_selection::create(new_selection)); geometry::point_selection::append(*point_selection, 0.0); boost::scoped_ptr primitive_selection(geometry::primitive_selection::create(new_selection)); geometry::primitive_selection::append(*primitive_selection, k3d::selection::CONSTANT, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::CURVE, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::EDGE, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::FACE, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::PARAMETER, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::PATCH, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::SURFACE, 0.0); geometry::primitive_selection::append(*primitive_selection, k3d::selection::VERTEX, 0.0); } if(convert_selection.internal_value()) { switch(current_mode.internal_value()) { case CURVE: { static imesh_selection_algorithm* conversion = plugin::create("MakeCurveSelection"); return_if_fail(conversion); k3d::selection::set::append(conversion->create_mesh_selection(*mesh), new_selection); break; } case EDGE: { static imesh_selection_algorithm* conversion = plugin::create("MakeEdgeSelection"); return_if_fail(conversion); k3d::selection::set::append(conversion->create_mesh_selection(*mesh), new_selection); break; } case FACE: { static imesh_selection_algorithm* conversion = plugin::create("MakeFaceSelection"); return_if_fail(conversion); k3d::selection::set::append(conversion->create_mesh_selection(*mesh), new_selection); break; } case NODE: { break; } case PATCH: { static imesh_selection_algorithm* conversion = plugin::create("MakePatchSelection"); return_if_fail(conversion); k3d::selection::set::append(conversion->create_mesh_selection(*mesh), new_selection); break; } case POINT: { static imesh_selection_algorithm* conversion = plugin::create("MakePointSelection"); return_if_fail(conversion); k3d::selection::set::append(conversion->create_mesh_selection(*mesh), new_selection); break; } case SURFACE: { break; } } } property::set_internal_value(mesh_selection_sink->mesh_selection_sink_input(), new_selection); property::set_internal_value(**node, "show_component_selection", true); } } void on_node_selection_node_changed() { m_node_selection_metadata_connection.disconnect(); m_node_selection_deleted_connection.disconnect(); m_node_selection = 0; } /// Cached pointer to the document node selection node inode_selection* m_node_selection; sigc::connection m_node_selection_metadata_connection; sigc::connection m_node_selection_deleted_connection; /// Cached pointer to the rubber band highlighting node inode* m_rubber_band; }; ///////////////////////////////////////////////////////////////////////////// // state state::state(idocument& Document) : internal(implementation::instance(Document)) { } const mode state::current_mode() { return internal.current_mode.internal_value(); } void state::set_current_mode(const mode Mode) { internal.current_mode.set_value(Mode); } sigc::connection state::connect_current_mode_changed_signal(const sigc::slot& Slot) { return internal.current_mode.changed_signal().connect(Slot); } bool_t state::keep_selection() { return internal.keep_selection.internal_value(); } void state::set_keep_selection(const bool_t Keep) { internal.keep_selection.set_value(Keep); } sigc::connection state::connect_keep_selection_changed_signal(const sigc::slot& Slot) { return internal.keep_selection.changed_signal().connect(Slot); } bool_t state::convert_selection() { return internal.convert_selection.internal_value(); } void state::set_convert_selection(const bool_t Convert) { internal.convert_selection.set_value(Convert); } sigc::connection state::connect_convert_selection_changed_signal(const sigc::slot& Slot) { return internal.convert_selection.changed_signal().connect(Slot); } bool_t state::select_adjacent_edges() { return internal.select_adjacent_edges.internal_value(); } void state::set_select_adjacent_edges(const bool_t Expand) { internal.select_adjacent_edges.set_value(Expand); } sigc::connection state::connect_select_adjacent_edges_changed_signal(const sigc::slot& Slot) { return internal.select_adjacent_edges.changed_signal().connect(Slot); } const nodes_t state::selected_nodes() { return internal.selected_nodes(); } void state::select(inode& Node) { return_if_fail(internal.node_selection()); internal.node_selection()->select(Node, 1.0); } void state::select(const k3d::selection::record& Selection) { select(k3d::selection::records(1, Selection)); } void state::select(const k3d::selection::records& Selection) { switch(internal.current_mode.internal_value()) { case CURVE: detail::merge_interactive_selection(selected_nodes(), detail::select_component(k3d::selection::CURVE, 1.0), Selection); break; case FACE: detail::merge_interactive_selection(selected_nodes(), detail::select_component(k3d::selection::FACE, 1.0), Selection); break; case NODE: select_nodes(Selection); break; case PATCH: detail::merge_interactive_selection(selected_nodes(), detail::select_component(k3d::selection::PATCH, 1.0), Selection); break; case POINT: detail::merge_interactive_selection(selected_nodes(), detail::select_points(1.0), Selection); break; case EDGE: detail::merge_interactive_selection(selected_nodes(), detail::select_edges(internal.select_adjacent_edges.internal_value(), 1.0), Selection); break; case SURFACE: detail::merge_interactive_selection(selected_nodes(), detail::select_component(k3d::selection::SURFACE, 1.0), Selection); break; } } void state::select_nodes(const k3d::selection::records& Selection) { for(k3d::selection::records::const_iterator record = Selection.begin(); record != Selection.end(); ++record) { if(inode* const node = k3d::selection::get_node(*record)) { select(*node); } } } void state::select_nodes(const nodes_t& Selection) { for(nodes_t::const_iterator node = Selection.begin(); node != Selection.end(); ++node) select(**node); } void state::select_all() { switch(internal.current_mode.internal_value()) { case CURVE: detail::replace_selection(selected_nodes(), detail::select_all_components(k3d::selection::CURVE), true); break; case FACE: detail::replace_selection(selected_nodes(), detail::select_all_components(k3d::selection::FACE), true); break; case NODE: select_all_nodes(); break; case PATCH: detail::replace_selection(selected_nodes(), detail::select_all_components(k3d::selection::PATCH), true); break; case POINT: detail::replace_selection(selected_nodes(), detail::select_all_points(), true); break; case EDGE: detail::replace_selection(selected_nodes(), detail::select_all_components(k3d::selection::EDGE), true); break; case SURFACE: detail::replace_selection(selected_nodes(), detail::select_all_components(k3d::selection::SURFACE), true); break; } } void state::select_all_nodes() { const nodes_t& nodes = internal.document.nodes().collection(); for(nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) select(**node); } void state::invert_selection() { switch(internal.current_mode.internal_value()) { case CURVE: detail::replace_selection(internal.document.nodes().collection(), detail::invert_components(k3d::selection::CURVE), true); break; case FACE: detail::replace_selection(internal.document.nodes().collection(), detail::invert_components(k3d::selection::FACE), true); break; case NODE: invert_all_nodes(); break; case PATCH: detail::replace_selection(internal.document.nodes().collection(), detail::invert_components(k3d::selection::PATCH), true); break; case POINT: detail::replace_selection(internal.document.nodes().collection(), detail::invert_points(), true); break; case EDGE: detail::replace_selection(internal.document.nodes().collection(), detail::invert_components(k3d::selection::EDGE), true); break; case SURFACE: detail::replace_selection(internal.document.nodes().collection(), detail::invert_components(k3d::selection::SURFACE), true); break; } } void state::invert_all_nodes() { for(k3d::inode_collection::nodes_t::const_iterator node = internal.document.nodes().collection().begin(); node != internal.document.nodes().collection().end(); ++node) { if(is_selected(**node)) deselect(**node); else select(**node); } } const bool_t state::is_selected(inode& Node) { if(internal.node_selection()) return internal.node_selection()->selection_weight(Node); } static const bool_t is_curve_selected(const k3d::selection::record& Record) { k3d::selection::id node_id = k3d::selection::null_id(); k3d::inode* node = 0; k3d::selection::id mesh_id = k3d::selection::null_id(); k3d::mesh* mesh = 0; k3d::selection::id primitive_id = k3d::selection::null_id(); const k3d::mesh::primitive* primitive = 0; for(k3d::selection::record::tokens_t::const_iterator token = Record.tokens.begin(); token != Record.tokens.end(); ++token) { switch(token->type) { case k3d::selection::NODE: { node_id = token->id; node = k3d::selection::get_node(Record); return_val_if_fail(node, false); break; } case k3d::selection::MESH: { mesh_id = token->id; mesh = selection::get_mesh(node, mesh_id); return_val_if_fail(mesh, false); break; } case k3d::selection::PRIMITIVE: { primitive_id = token->id; return_val_if_fail(mesh, false); return_val_if_fail(primitive_id < mesh->primitives.size(), false); primitive = mesh->primitives[primitive_id].get(); break; } case k3d::selection::CURVE: { return_val_if_fail(mesh, false); return_val_if_fail(primitive, false); const k3d::selection::id curve = token->id; boost::scoped_ptr linear_curve(k3d::linear_curve::validate(*mesh, *primitive)); if(linear_curve) { return_val_if_fail(curve < linear_curve->curve_selections.size(), false); return linear_curve->curve_selections[curve]; } boost::scoped_ptr cubic_curve(k3d::cubic_curve::validate(*mesh, *primitive)); if(cubic_curve) { return_val_if_fail(curve < cubic_curve->curve_selections.size(), false); return cubic_curve->curve_selections[curve]; } boost::scoped_ptr nurbs_curve(k3d::nurbs_curve::validate(*mesh, *primitive)); if(nurbs_curve) { return_val_if_fail(curve < nurbs_curve->curve_selections.size(), false); return nurbs_curve->curve_selections[curve]; } } } } return false; } static const bool_t is_edge_selected(const k3d::selection::record& Record) { k3d::selection::id node_id = k3d::selection::null_id(); k3d::inode* node = 0; k3d::selection::id mesh_id = k3d::selection::null_id(); k3d::mesh* mesh = 0; k3d::selection::id primitive_id = k3d::selection::null_id(); const k3d::mesh::primitive* primitive = 0; for(k3d::selection::record::tokens_t::const_iterator token = Record.tokens.begin(); token != Record.tokens.end(); ++token) { switch(token->type) { case k3d::selection::NODE: { node_id = token->id; node = k3d::selection::get_node(Record); return_val_if_fail(node, false); break; } case k3d::selection::MESH: { mesh_id = token->id; mesh = selection::get_mesh(node, mesh_id); return_val_if_fail(mesh, false); break; } case k3d::selection::PRIMITIVE: { primitive_id = token->id; return_val_if_fail(mesh, false); return_val_if_fail(primitive_id < mesh->primitives.size(), false); primitive = mesh->primitives[primitive_id].get(); break; } case k3d::selection::EDGE: { return_val_if_fail(mesh, false); return_val_if_fail(primitive, false); boost::scoped_ptr polyhedron(k3d::polyhedron::validate(*mesh, *primitive)); return_val_if_fail(polyhedron, false); const k3d::selection::id edge = token->id; return_val_if_fail(edge < polyhedron->clockwise_edges.size(), false); return polyhedron->edge_selections[edge]; } } } return false; } static const bool_t is_face_selected(const k3d::selection::record& Record) { k3d::selection::id node_id = k3d::selection::null_id(); k3d::inode* node = 0; k3d::selection::id mesh_id = k3d::selection::null_id(); k3d::mesh* mesh = 0; k3d::selection::id primitive_id = k3d::selection::null_id(); const k3d::mesh::primitive* primitive = 0; for(k3d::selection::record::tokens_t::const_iterator token = Record.tokens.begin(); token != Record.tokens.end(); ++token) { switch(token->type) { case k3d::selection::NODE: { node_id = token->id; node = k3d::selection::get_node(Record); return_val_if_fail(node, false); break; } case k3d::selection::MESH: { mesh_id = token->id; mesh = selection::get_mesh(node, mesh_id); return_val_if_fail(mesh, false); break; } case k3d::selection::PRIMITIVE: { primitive_id = token->id; return_val_if_fail(mesh, false); return_val_if_fail(primitive_id < mesh->primitives.size(), false); primitive = mesh->primitives[primitive_id].get(); break; } case k3d::selection::FACE: { return_val_if_fail(mesh, false); return_val_if_fail(primitive, false); boost::scoped_ptr polyhedron(k3d::polyhedron::validate(*mesh, *primitive)); return_val_if_fail(polyhedron, false); const k3d::selection::id face = token->id; return_val_if_fail(face < polyhedron->face_first_loops.size(), false); return polyhedron->face_selections[face]; } } } return false; } static const bool_t is_patch_selected(const k3d::selection::record& Record) { k3d::selection::id node_id = k3d::selection::null_id(); k3d::inode* node = 0; k3d::selection::id mesh_id = k3d::selection::null_id(); k3d::mesh* mesh = 0; k3d::selection::id primitive_id = k3d::selection::null_id(); const k3d::mesh::primitive* primitive = 0; for(k3d::selection::record::tokens_t::const_iterator token = Record.tokens.begin(); token != Record.tokens.end(); ++token) { switch(token->type) { case k3d::selection::NODE: { node_id = token->id; node = k3d::selection::get_node(Record); return_val_if_fail(node, false); break; } case k3d::selection::MESH: { mesh_id = token->id; mesh = selection::get_mesh(node, mesh_id); return_val_if_fail(mesh, false); break; } case k3d::selection::PRIMITIVE: { primitive_id = token->id; return_val_if_fail(mesh, false); return_val_if_fail(primitive_id < mesh->primitives.size(), false); primitive = mesh->primitives[primitive_id].get(); break; } case k3d::selection::PATCH: { return_val_if_fail(mesh, false); return_val_if_fail(primitive, false); const k3d::selection::id patch = token->id; boost::scoped_ptr bilinear_patch(k3d::bilinear_patch::validate(*mesh, *primitive)); if(bilinear_patch) { return_val_if_fail(patch < bilinear_patch->patch_selections.size(), false); return bilinear_patch->patch_selections[patch]; } boost::scoped_ptr bicubic_patch(k3d::bicubic_patch::validate(*mesh, *primitive)); if(bicubic_patch) { return_val_if_fail(patch < bicubic_patch->patch_selections.size(), false); return bicubic_patch->patch_selections[patch]; } boost::scoped_ptr nurbs_patch(k3d::nurbs_patch::validate(*mesh, *primitive)); if(nurbs_patch) { return_val_if_fail(patch < nurbs_patch->patch_selections.size(), false); return nurbs_patch->patch_selections[patch]; } } } } return false; } static const bool_t is_point_selected(const k3d::selection::record& Record) { k3d::selection::id node_id = k3d::selection::null_id(); k3d::inode* node = 0; k3d::selection::id mesh_id = k3d::selection::null_id(); k3d::mesh* mesh = 0; for(k3d::selection::record::tokens_t::const_iterator token = Record.tokens.begin(); token != Record.tokens.end(); ++token) { switch(token->type) { case k3d::selection::NODE: { node_id = token->id; node = k3d::selection::get_node(Record); return_val_if_fail(node, false); break; } case k3d::selection::MESH: { mesh_id = token->id; mesh = selection::get_mesh(node, mesh_id); return_val_if_fail(mesh, false); return_val_if_fail(mesh->point_selection, false); break; } case k3d::selection::POINT: { return_val_if_fail(mesh, false); const k3d::selection::id point = token->id; return_val_if_fail(point < mesh->point_selection->size(), false); return (*mesh->point_selection)[point]; } } } return false; } const bool_t state::is_selected(const k3d::selection::record& Record) { switch(internal.current_mode.internal_value()) { case CURVE: return is_curve_selected(Record); case EDGE: return is_edge_selected(Record); case FACE: return is_face_selected(Record); case NODE: { k3d::inode* const node = k3d::selection::get_node(Record); return node ? is_selected(*node) : false; } case PATCH: return is_patch_selected(Record); case POINT: return is_point_selected(Record); case SURFACE: assert_not_implemented(); return false; } return false; } void state::deselect(inode& Node) { if(internal.node_selection()) internal.node_selection()->select(Node, 0.0); } void state::deselect(const k3d::selection::record& Selection) { deselect(k3d::selection::records(1, Selection)); } void state::deselect(const k3d::selection::records& Selection) { switch(internal.current_mode.internal_value()) { case CURVE: detail::merge_interactive_selection(selected_nodes(), detail::select_component(k3d::selection::CURVE, 0.0), Selection); break; case FACE: detail::merge_interactive_selection(selected_nodes(), detail::select_component(k3d::selection::FACE, 0.0), Selection); break; case NODE: deselect_nodes(Selection); break; case PATCH: detail::merge_interactive_selection(selected_nodes(), detail::select_component(k3d::selection::PATCH, 0.0), Selection); break; case POINT: detail::merge_interactive_selection(selected_nodes(), detail::select_points(0.0), Selection); break; case EDGE: detail::merge_interactive_selection(selected_nodes(), detail::select_edges(internal.select_adjacent_edges.internal_value(), 0.0), Selection); break; case SURFACE: detail::merge_interactive_selection(selected_nodes(), detail::select_component(k3d::selection::SURFACE, 0.0), Selection); break; } } void state::deselect_nodes(const k3d::selection::records& Selection) { for(k3d::selection::records::const_iterator record = Selection.begin(); record != Selection.end(); ++record) { if(k3d::inode* const node = k3d::selection::get_node(*record)) deselect(*node); } } void state::deselect_nodes(const nodes_t& Selection) { for(nodes_t::const_iterator node = Selection.begin(); node != Selection.end(); ++node) deselect(**node); } void state::deselect_all() { switch(internal.current_mode.internal_value()) { case NODE: deselect_all_nodes(); break; case CURVE: case FACE: case PATCH: case POINT: case EDGE: case SURFACE: detail::replace_selection(internal.document.nodes().collection(), detail::deselect_all(), false); break; } } void state::deselect_all_nodes() { if(internal.node_selection()) internal.node_selection()->deselect_all(); } inode* state::rubber_band() { return internal.rubber_band(); } mesh* get_mesh(inode* Node, const k3d::selection::id& MeshID) { return_val_if_fail(Node, 0); return_val_if_fail(MeshID == 0, 0); // Should never get a node with more than one mesh! imesh_source* const mesh_source = dynamic_cast(Node); return_val_if_fail(mesh_source, 0); return boost::any_cast(mesh_source->mesh_source_output().property_internal_value()); } } // namespace selection } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/selection.h ================================================ #ifndef K3DSDK_NGUI_SELECTION_H #define K3DSDK_NGUI_SELECTION_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { class idocument; class inode; namespace ngui { namespace selection { /// Enumerates available interactive selection modes enum mode { /// Select curve components CURVE, /// Select face components FACE, /// Select individual nodes NODE, /// Select patches PATCH, /// Select points POINT, /// Select polyhedron split-edges EDGE, /// Select surface components SURFACE, }; std::ostream& operator<<(std::ostream& Stream, const mode& Value); std::istream& operator>>(std::istream& Stream, mode& Value); /// Provides convenience methods for manipulating the selection state of a document. class state { public: state(idocument& Document); /// Returns the current selection mode. const mode current_mode(); /// Sets the current selection mode. void set_current_mode(const mode Mode); /// Connect a slot to a signal that will be emitted whenever the selection mode changes. sigc::connection connect_current_mode_changed_signal(const sigc::slot& Slot); /// Returns whether the current selection should be retained when switching the selection mode bool_t keep_selection(); /// Sets whether the current selection should be retained when switching the selection mode void set_keep_selection(const bool_t Keep); /// Connect a slot to a signal that will be emitted whenever the keep selection mode changes. sigc::connection connect_keep_selection_changed_signal(const sigc::slot& Slot); /// Returns whether the current selection should be converted when switching the selection mode bool_t convert_selection(); /// Sets whether the current selection should be converted when switching the selection mode void set_convert_selection(const bool_t Convert); /// Connect a slot to a signal that will be emitted whenever the convert selection mode changes. sigc::connection connect_convert_selection_changed_signal(const sigc::slot& Slot); /// Returns whether edge selections should be automatically expanded to include adjacent edges. bool_t select_adjacent_edges(); /// Sets whether edge selections should be automatically expanded to include adjacent edges. void set_select_adjacent_edges(const bool_t Expand); /// Connect a slot to a signal that will be emitted whenever the adjacent edge selection state changes. sigc::connection connect_select_adjacent_edges_changed_signal(const sigc::slot& Slot); /// Returns the current set of selected nodes. const nodes_t selected_nodes(); /// Selects one node. void select(inode& Node); /// Selects a collection of components. void select(const k3d::selection::record& Selection); /// Selects a collection of components. void select(const k3d::selection::records& Selection); /// Selects a collection of nodes. void select_nodes(const k3d::selection::records& Selection); /// Selects a collection of nodes. void select_nodes(const nodes_t& Selection); /// Selects all nodes or components (depending on current selection mode). void select_all(); /// Selects all nodes. void select_all_nodes(); /// Inverts current selection. void invert_selection(); /// Inverts all nodes. void invert_all_nodes(); /// Returns true iff the given node is selected. const bool_t is_selected(inode& Node); /// Returns true iff the given component is already selected. const bool_t is_selected(const k3d::selection::record& Record); /// Deselects one node. void deselect(inode& Node); /// Deselects a collection of components. void deselect(const k3d::selection::record& Selection); /// Deselects a collection of components. void deselect(const k3d::selection::records& Selection); /// Deselects a collection of nodes. void deselect_nodes(const k3d::selection::records& Selection); /// Deselects a collection of nodes. void deselect_nodes(const nodes_t& Selection); /// Deselects all nodes or components (depending on current selection mode). void deselect_all(); /// Deselects all nodes. void deselect_all_nodes(); /// Returns a node suitable for interactive rubber-band operations inode* rubber_band(); private: class implementation; implementation& internal; }; mesh* get_mesh(inode* Node, const k3d::selection::id& MeshID); } // namespace selection } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SELECTION_H ================================================ FILE: k3dsdk/ngui/selection_input_model.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // selection_input_model::implementation struct selection_input_model::implementation : public k3d::property_collection { implementation(document_state& DocumentState) : m_document_state(DocumentState), m_start_selection(k3d::selection::record::empty_record()), m_motion_type(MOTION_NONE), m_extended_mode(true), m_extended_component_mode(true), m_paint_mode(true), m_double_click_mode(true), m_pick_backfacing(false), m_paint_backfacing(false), m_rubber_band_backfacing(true) { } k3d::idocument& document() { return m_document_state.document(); } void on_button_down(viewport::control& Viewport, const GdkEventButton& Event) { m_start_selection = Viewport.pick_object(k3d::point2(Event.x, Event.y), m_pick_backfacing); m_motion_type = MOTION_NONE; } void on_button_click(viewport::control& Viewport, const GdkEventButton& Event) { const k3d::key_modifiers modifiers = convert(Event.state); enum { NONE, SELECT, DESELECT, REPLACE } operation = NONE; if(modifiers.shift()) { operation = SELECT; } else if(modifiers.control()) { operation = DESELECT; } else { operation = REPLACE; // If something's under the mouse cursor if(k3d::selection::get_node(m_start_selection)) { bool extended_mode; switch(selection::state(m_document_state.document()).current_mode()) { case selection::NODE: // Extended selection extended_mode = m_extended_mode; break; default: // Extended component selection extended_mode = m_extended_component_mode; } if(extended_mode) operation = selection::state(m_document_state.document()).is_selected(m_start_selection) ? DESELECT : SELECT; } } switch(operation) { case NONE: break; case SELECT: { k3d::record_state_change_set change_set(m_document_state.document(), _("Select"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).select(m_start_selection); break; } case DESELECT: { k3d::record_state_change_set change_set(m_document_state.document(), _("Deselect"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect(m_start_selection); break; } case REPLACE: { k3d::record_state_change_set change_set(m_document_state.document(), _("Replace"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect_all(); selection::state(m_document_state.document()).select(m_start_selection); break; } } switch(operation) { case SELECT: case REPLACE: { if(selection::NODE == selection::state(m_document_state.document()).current_mode()) { if(k3d::inode* const node = k3d::selection::get_node(m_start_selection)) { panel::mediator(m_document_state.document()).set_focus(*node, *this); } } break; } } } void on_button_double_click(viewport::control& Viewport, const GdkEventButton& Event) { if(!m_double_click_mode) return; switch(selection::state(m_document_state.document()).current_mode()) { case selection::NODE: { k3d::record_state_change_set change_set(m_document_state.document(), _("Deselect All"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect_all(); break; } default: { k3d::record_state_change_set change_set(m_document_state.document(), _("Node Selection"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).set_current_mode(selection::NODE); break; } } } void on_button_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { m_timer.restart(); const k3d::key_modifiers modifiers = convert(Event.state); if(modifiers.shift()) { //m_motion_type = (m_paint_mode && !m_start_selection.empty()) ? MOTION_PAINT_SELECT : MOTION_RUBBER_BAND_SELECT; m_motion_type = MOTION_RUBBER_BAND_SELECT; } else if(modifiers.control()) { //m_motion_type = (m_paint_mode && !m_start_selection.empty()) ? MOTION_PAINT_DESELECT : MOTION_RUBBER_BAND_DESELECT; m_motion_type = MOTION_RUBBER_BAND_DESELECT; } else { if(m_start_selection.empty()) { m_motion_type = MOTION_RUBBER_BAND_REPLACE; } else { if(m_paint_mode) { m_motion_type = selection::state(m_document_state.document()).is_selected(m_start_selection) ? MOTION_PAINT_DESELECT : MOTION_PAINT_SELECT; } else { m_motion_type = selection::state(m_document_state.document()).is_selected(m_start_selection) ? MOTION_RUBBER_BAND_DESELECT : MOTION_RUBBER_BAND_SELECT; } } } switch(m_motion_type) { case MOTION_NONE: break; case MOTION_PAINT_SELECT: { k3d::start_state_change_set(m_document_state.document(), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).select(m_start_selection); break; } case MOTION_PAINT_DESELECT: { k3d::start_state_change_set(m_document_state.document(), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect(m_start_selection); break; } case MOTION_RUBBER_BAND_REPLACE: case MOTION_RUBBER_BAND_SELECT: case MOTION_RUBBER_BAND_DESELECT: { if(inode* const rubber_band = selection::state(m_document_state.document()).rubber_band()) { property::set_internal_value(*rubber_band, "camera", dynamic_cast(Viewport.camera())); property::set_internal_value(*rubber_band, "color", color(1, 0, 0)); property::set_internal_value(*rubber_band, "opacity", 0.1); property::set_internal_value(*rubber_band, "border_color", color(1, 0, 0)); property::set_internal_value(*rubber_band, "border_opacity", 0.5); property::set_internal_value(*rubber_band, "rectangle", rectangle(Event.x, Event.x, Viewport.get_height() - Event.y, Viewport.get_height() - Event.y)); } break; } } } void on_button_drag(viewport::control& Viewport, const GdkEventMotion& Event) { switch(m_motion_type) { case MOTION_NONE: break; case MOTION_PAINT_SELECT: { const k3d::selection::record selection = Viewport.pick_object(k3d::point2(Event.x, Event.y), m_paint_backfacing); if(!selection::state(m_document_state.document()).is_selected(selection)) { selection::state(m_document_state.document()).select(selection); } else { } break; } case MOTION_PAINT_DESELECT: { const k3d::selection::record selection = Viewport.pick_object(k3d::point2(Event.x, Event.y), m_paint_backfacing); if(selection::state(m_document_state.document()).is_selected(selection)) { selection::state(m_document_state.document()).deselect(selection); } else { } break; } case MOTION_RUBBER_BAND_REPLACE: case MOTION_RUBBER_BAND_SELECT: case MOTION_RUBBER_BAND_DESELECT: { if(inode* const rubber_band = selection::state(m_document_state.document()).rubber_band()) { rectangle new_rectangle = property::pipeline_value(*rubber_band, "rectangle"); new_rectangle.x2 = Event.x; new_rectangle.y2 = Viewport.get_height() - Event.y; property::set_internal_value(*rubber_band, "rectangle", new_rectangle); } break; } } } void on_button_end_drag(viewport::control& Viewport, const GdkEventButton& Event) { switch(m_motion_type) { case MOTION_NONE: break; case MOTION_PAINT_SELECT: { k3d::finish_state_change_set(m_document_state.document(), _("Paint Select"), K3D_CHANGE_SET_CONTEXT); break; } case MOTION_PAINT_DESELECT: { k3d::finish_state_change_set(m_document_state.document(), _("Paint Deselect"), K3D_CHANGE_SET_CONTEXT); break; } case MOTION_RUBBER_BAND_REPLACE: { rectangle selection_rectangle; if(inode* const rubber_band = selection::state(m_document_state.document()).rubber_band()) { selection_rectangle = property::pipeline_value(*rubber_band, "rectangle"); selection_rectangle.y1 = Viewport.get_height() - selection_rectangle.y1; selection_rectangle.y2 = Viewport.get_height() - selection_rectangle.y2; property::set_internal_value(*rubber_band, "camera", static_cast(0)); } const k3d::selection::records selection = Viewport.get_object_selectables(selection_rectangle, m_rubber_band_backfacing); k3d::record_state_change_set change_set(m_document_state.document(), _("Rubber Band Replace"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect_all(); selection::state(m_document_state.document()).select(selection); break; } case MOTION_RUBBER_BAND_SELECT: { rectangle selection_rectangle; if(inode* const rubber_band = selection::state(m_document_state.document()).rubber_band()) { selection_rectangle = property::pipeline_value(*rubber_band, "rectangle"); selection_rectangle.y1 = Viewport.get_height() - selection_rectangle.y1; selection_rectangle.y2 = Viewport.get_height() - selection_rectangle.y2; property::set_internal_value(*rubber_band, "camera", static_cast(0)); } const k3d::selection::records selection = Viewport.get_object_selectables(selection_rectangle, m_rubber_band_backfacing); k3d::record_state_change_set change_set(m_document_state.document(), _("Rubber Band Select"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).select(selection); break; } case MOTION_RUBBER_BAND_DESELECT: { rectangle selection_rectangle; if(inode* const rubber_band = selection::state(m_document_state.document()).rubber_band()) { selection_rectangle = property::pipeline_value(*rubber_band, "rectangle"); selection_rectangle.y1 = Viewport.get_height() - selection_rectangle.y1; selection_rectangle.y2 = Viewport.get_height() - selection_rectangle.y2; property::set_internal_value(*rubber_band, "camera", static_cast(0)); } const k3d::selection::records selection = Viewport.get_object_selectables(selection_rectangle, m_rubber_band_backfacing); k3d::record_state_change_set change_set(m_document_state.document(), _("Rubber Band Deselect"), K3D_CHANGE_SET_CONTEXT); selection::state(m_document_state.document()).deselect(selection); break; } } m_motion_type = MOTION_NONE; } /// Stores a reference to the owning document document_state& m_document_state; k3d::selection::record m_start_selection; enum { MOTION_NONE, MOTION_PAINT_SELECT, MOTION_PAINT_DESELECT, MOTION_RUBBER_BAND_REPLACE, MOTION_RUBBER_BAND_SELECT, MOTION_RUBBER_BAND_DESELECT, } m_motion_type; bool m_extended_mode; bool m_extended_component_mode; bool m_paint_mode; bool m_double_click_mode; bool m_pick_backfacing; bool m_paint_backfacing; bool m_rubber_band_backfacing; k3d::timer m_timer; }; ///////////////////////////////////////////////////////////////////////////// // selection_input_model selection_input_model::selection_input_model(document_state& DocumentState) : m_implementation(new implementation(DocumentState)) { } selection_input_model::~selection_input_model() { delete m_implementation; } void selection_input_model::set_extended_mode(const bool Enabled) { m_implementation->m_extended_mode = Enabled; } void selection_input_model::set_extended_component_mode(const bool Enabled) { m_implementation->m_extended_component_mode = Enabled; } void selection_input_model::set_paint_mode(const bool Enabled) { m_implementation->m_paint_mode = Enabled; } void selection_input_model::set_double_click_mode(const bool Enabled) { m_implementation->m_double_click_mode = Enabled; } void selection_input_model::set_pick_backfacing(const bool Enabled) { m_implementation->m_pick_backfacing = Enabled; } void selection_input_model::set_paint_backfacing(const bool Enabled) { m_implementation->m_paint_backfacing = Enabled; } void selection_input_model::set_rubber_band_backfacing(const bool Enabled) { m_implementation->m_rubber_band_backfacing = Enabled; } void selection_input_model::on_button_down(viewport::control& Viewport, const GdkEventButton& Event) { m_implementation->on_button_down(Viewport, Event); } void selection_input_model::on_button_click(viewport::control& Viewport, const GdkEventButton& Event) { m_implementation->on_button_click(Viewport, Event); } void selection_input_model::on_button_double_click(viewport::control& Viewport, const GdkEventButton& Event) { m_implementation->on_button_double_click(Viewport, Event); } void selection_input_model::on_button_start_drag(viewport::control& Viewport, const GdkEventMotion& Event) { m_implementation->on_button_start_drag(Viewport, Event); } void selection_input_model::on_button_drag(viewport::control& Viewport, const GdkEventMotion& Event) { m_implementation->on_button_drag(Viewport, Event); } void selection_input_model::on_button_end_drag(viewport::control& Viewport, const GdkEventButton& Event) { m_implementation->on_button_end_drag(Viewport, Event); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/selection_input_model.h ================================================ #ifndef K3DSDK_NGUI_SELECTION_INPUT_MODEL_H #define K3DSDK_NGUI_SELECTION_INPUT_MODEL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // selection_input_model /// Input model implementation that handles interactive selection class selection_input_model { public: selection_input_model(document_state& DocumentState); ~selection_input_model(); void set_extended_mode(const bool Enabled); void set_extended_component_mode(const bool Enabled); void set_paint_mode(const bool Enabled); void set_double_click_mode(const bool Enabled); void set_pick_backfacing(const bool Enabled); void set_paint_backfacing(const bool Enabled); void set_rubber_band_backfacing(const bool Enabled); void on_button_down(viewport::control& Viewport, const GdkEventButton& Event); void on_button_click(viewport::control& Viewport, const GdkEventButton& Event); void on_button_double_click(viewport::control& Viewport, const GdkEventButton& Event); void on_button_start_drag(viewport::control& Viewport, const GdkEventMotion& Event); void on_button_drag(viewport::control& Viewport, const GdkEventMotion& Event); void on_button_end_drag(viewport::control& Viewport, const GdkEventButton& Event); private: struct implementation; implementation* const m_implementation; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SELECTION_INPUT_MODEL_H ================================================ FILE: k3dsdk/ngui/selection_tool.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { typedef k3d_data(bool, immutable_name, change_signal, no_undo, local_storage, no_constraint, writable_property, no_serialization) bool_property_t; namespace detail { /// Toggles the value of the given boolean property void toggle_property(bool_property_t& Property) { if (Property.internal_value()) Property.set_value(false); else Property.set_value(true); } } ///////////////////////////////////////////////////////////////////////////// // selection_tool::implementation class selection_tool::implementation : public k3d::property_collection { public: implementation(document_state& DocumentState) : m_document_state(DocumentState), m_navigation_model(DocumentState), m_selection_model(DocumentState), m_extended_mode(init_owner(*this) + init_name("extended_mode") + init_label(_("Extended Selection Mode")) + init_description(_("Extended mode adds newly clicked geometry instead of replacing selection")) + init_value(false)), m_extended_component_mode(init_owner(*this) + init_name("extended_component_mode") + init_label(_("Extended Component Selection Mode")) + init_description(_("Extended mode adds newly clicked components instead of replacing selection")) + init_value(false)), m_paint_mode(init_owner(*this) + init_name("component_paint_mode") + init_label(_("Component Paint Mode")) + init_description(_("Use mouse pointer to paint-select geometry components")) + init_value(true)), m_double_click_mode(init_owner(*this) + init_name("double_click_mode") + init_label(_("Double Click Mode")) + init_description(_("Double click switches back to object selection mode when clicking on nothing")) + init_value(true)), m_pick_backfacing(init_owner(*this) + init_name("pick_backfacing") + init_label(_("Pick Backfacing")) + init_description(_("Select backfacing components when picking (clicking)")) + init_value(false)), m_paint_backfacing(init_owner(*this) + init_name("paint_backfacing") + init_label(_("Paint Backfacing")) + init_description(_("Select backfacing components when painting a selection")) + init_value(false)), m_rubber_band_backfacing(init_owner(*this) + init_name("rubber_band_backfacing") + init_label(_("Rubber Band Backfacing")) + init_description(_("Select backfacing components when rubber band selecting")) + init_value(true)) { m_input_model.connect_lbutton_down(sigc::mem_fun(m_selection_model, &selection_input_model::on_button_down)); m_input_model.connect_lbutton_click(sigc::mem_fun(m_selection_model, &selection_input_model::on_button_click)); m_input_model.connect_lbutton_double_click(sigc::mem_fun(m_selection_model, &selection_input_model::on_button_double_click)); m_input_model.connect_lbutton_start_drag(sigc::mem_fun(m_selection_model, &selection_input_model::on_button_start_drag)); m_input_model.connect_lbutton_drag(sigc::mem_fun(m_selection_model, &selection_input_model::on_button_drag)); m_input_model.connect_lbutton_end_drag(sigc::mem_fun(m_selection_model, &selection_input_model::on_button_end_drag)); m_input_model.connect_mbutton_click(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button1_click)); m_input_model.connect_mbutton_start_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button1_start_drag)); m_input_model.connect_mbutton_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button1_drag)); m_input_model.connect_mbutton_end_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button1_end_drag)); m_input_model.connect_rbutton_click(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button2_click)); m_input_model.connect_rbutton_start_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button2_start_drag)); m_input_model.connect_rbutton_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button2_drag)); m_input_model.connect_rbutton_end_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button2_end_drag)); m_input_model.connect_scroll(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_scroll)); m_selection_model.set_extended_mode(m_extended_mode.internal_value()); m_selection_model.set_extended_component_mode(m_extended_component_mode.internal_value()); m_selection_model.set_paint_mode(m_paint_mode.internal_value()); m_selection_model.set_double_click_mode(m_double_click_mode.internal_value()); m_extended_mode.changed_signal().connect(sigc::mem_fun(*this, &implementation::on_extended_mode_changed)); m_extended_component_mode.changed_signal().connect(sigc::mem_fun(*this, &implementation::on_extended_component_mode_changed)); m_paint_mode.changed_signal().connect(sigc::mem_fun(*this, &implementation::on_paint_mode_changed)); m_double_click_mode.changed_signal().connect(sigc::mem_fun(*this, &implementation::on_double_click_mode_changed)); m_pick_backfacing.changed_signal().connect(sigc::mem_fun(*this, &implementation::on_pick_backfacing_changed)); m_paint_backfacing.changed_signal().connect(sigc::mem_fun(*this, &implementation::on_paint_backfacing_changed)); m_rubber_band_backfacing.changed_signal().connect(sigc::mem_fun(*this, &implementation::on_rubber_band_backfacing_changed)); } k3d::idocument& document() { return m_document_state.document(); } void on_extended_mode_changed(k3d::iunknown*) { m_selection_model.set_extended_mode(m_extended_mode.internal_value()); } void on_extended_component_mode_changed(k3d::iunknown*) { m_selection_model.set_extended_component_mode(m_extended_component_mode.internal_value()); } void on_paint_mode_changed(k3d::iunknown*) { m_selection_model.set_paint_mode(m_paint_mode.internal_value()); } void on_double_click_mode_changed(k3d::iunknown*) { m_selection_model.set_double_click_mode(m_double_click_mode.internal_value()); } void on_pick_backfacing_changed(k3d::iunknown*) { m_selection_model.set_pick_backfacing(m_pick_backfacing.internal_value()); } void on_paint_backfacing_changed(k3d::iunknown*) { m_selection_model.set_paint_backfacing(m_paint_backfacing.internal_value()); } void on_rubber_band_backfacing_changed(k3d::iunknown*) { m_selection_model.set_rubber_band_backfacing(m_rubber_band_backfacing.internal_value()); } document_state& m_document_state; /// Provides interactive navigation behavior navigation_input_model m_navigation_model; /// Provides interactive selection behavior selection_input_model m_selection_model; /// Dispatches incoming user input events basic_viewport_input_model m_input_model; /// Stores extended selection toggle bool_property_t m_extended_mode; /// Stores extended component selection toggle bool_property_t m_extended_component_mode; /// Store box selection / paint mode toggle bool_property_t m_paint_mode; /// Enables double-click actions bool_property_t m_double_click_mode; /// Pick backfacing elements bool_property_t m_pick_backfacing; /// Paint-select backfacing elements bool_property_t m_paint_backfacing; /// Rubber-band select backfacing elements bool_property_t m_rubber_band_backfacing; }; ///////////////////////////////////////////////////////////////////////////// // selection_tool selection_tool::selection_tool(document_state& DocumentState, const std::string& Name) : base(DocumentState, Name), m_implementation(new implementation(DocumentState)) { } selection_tool::~selection_tool() { delete m_implementation; } bool selection_tool::pick_backfacing() { return m_implementation->m_pick_backfacing.internal_value(); } bool selection_tool::paint_backfacing() { return m_implementation->m_paint_backfacing.internal_value(); } bool selection_tool::rubber_band_backfacing() { return m_implementation->m_rubber_band_backfacing.internal_value(); } k3d::iproperty_collection* selection_tool::get_property_collection() { return m_implementation; } viewport_input_model& selection_tool::get_input_model() { return m_implementation->m_input_model; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/selection_tool.h ================================================ #ifndef K3DSDK_NGUI_SELECTION_TOOL_H #define K3DSDK_NGUI_SELECTION_TOOL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include namespace k3d { namespace ngui { class document_state; ///////////////////////////////////////////////////////////////////////////// // selection_tool /// tool implementation that provides geometry selection and viewport navigation class selection_tool : public tool { typedef tool base; public: selection_tool(document_state& DocumentState, const std::string& Name); ~selection_tool(); const k3d::string_t tool_type() { return "selection_tool"; } /// True if backfacing components are to be picked bool pick_backfacing(); /// True if backfacing components are to be paint-selected bool paint_backfacing(); /// True if backfacing components are to be rubber-band selected bool rubber_band_backfacing(); protected: virtual k3d::iproperty_collection* get_property_collection(); virtual viewport_input_model& get_input_model(); class implementation; implementation* const m_implementation; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SELECTION_TOOL_H ================================================ FILE: k3dsdk/ngui/spin_button.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead \author Dan Erikson \author Romain Behar */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace k3d::measurement; namespace k3d { namespace ngui { namespace spin_button { ///////////////////////////////////////////////////////////////////////////// // property_model /// Implementation of spin_button::imodel for use with k3d::iproperty objects class property_model : public imodel { public: property_model(k3d::iproperty& Data) : m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } const Glib::ustring label() { Glib::ustring result = m_readable_data.property_label(); if(m_readable_data.property_node()) result = m_readable_data.property_node()->name() + " " + result; return result; } k3d::bool_t writable() { return m_writable_data ? true : false; } k3d::double_t value() { const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::int32_t)) return boost::any_cast(m_readable_data.property_internal_value()); else if(type == typeid(k3d::uint32_t)) return boost::any_cast(m_readable_data.property_internal_value()); else if(type == typeid(k3d::float_t)) return boost::any_cast(m_readable_data.property_internal_value()); else if(type == typeid(k3d::double_t)) return boost::any_cast(m_readable_data.property_internal_value()); else k3d::log() << error << k3d_file_reference << ": unknown property type: " << type.name() << std::endl; return 0; } void set_value(const double Value) { return_if_fail(m_writable_data); const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::int32_t)) m_writable_data->property_set_value(static_cast(k3d::round(Value))); else if(type == typeid(k3d::uint32_t)) m_writable_data->property_set_value(static_cast(k3d::round(Value))); else if(type == typeid(k3d::float_t)) m_writable_data->property_set_value(static_cast(Value)); else if(type == typeid(k3d::double_t)) m_writable_data->property_set_value(static_cast(Value)); else k3d::log() << error << k3d_file_reference << ": unknown property type: " << type.name() << std::endl; } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_readable_data.property_changed_signal().connect(sigc::hide(Slot)); } k3d::double_t step_increment() { if(k3d::imeasurement_property* const measurement_property = dynamic_cast(&m_readable_data)) return measurement_property->property_step_increment(); return 1.0; } const std::type_info& units() { if(k3d::imeasurement_property* const measurement_property = dynamic_cast(&m_readable_data)) return measurement_property->property_units(); return typeid(k3d::measurement::scalar); } private: property_model(const property_model& RHS); property_model& operator=(const property_model& RHS); ~property_model() {} k3d::iproperty& m_readable_data; k3d::iwritable_property* const m_writable_data; }; ///////////////////////////////////////////////////////////////////////////// // model imodel* const model(k3d::iproperty& Property) { return new property_model(Property); } ///////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_model(Model), m_state_recorder(StateRecorder), m_step_increment(Model->step_increment()), m_units(&Model->units()), m_entry(new hotkey_entry()), m_up_button(new Gtk::Button()), m_down_button(new Gtk::Button()), m_dragging(false), m_up_button_pressed(false), m_drag_increment(0), m_drag_first_timeout(false), m_tap_started(false) { assert(m_model.get()); m_up_button->get_accessible()->set_name("up"); m_down_button->get_accessible()->set_name("down"); } /// Stores a reference to the underlying data object const boost::scoped_ptr m_model; /// Stores a reference to the (optional) object for recording undo/redo data k3d::istate_recorder* const m_state_recorder; /// Stores the increment used to modify the button's value using the spin controls double m_step_increment; /// Stores the type of type of real-world-units to use for formatting & parsing const std::type_info* m_units; /// Entry control for display and manual input hotkey_entry* const m_entry; /// Button control for incremental input Gtk::Button* const m_up_button; /// Button control for incremental input Gtk::Button* const m_down_button; /// Set to true during dragging bool m_dragging; /// Stores whether the 'up' button was pressed bool m_up_button_pressed; /// Stores the increment used to modify data during dragging double m_drag_increment; /// Stores the most recent mouse position in screen coordinates during dragging k3d::point2 m_last_mouse; /// Stores the drag timeout connection sigc::connection m_drag_timeout; /// Stores whether this is the first drag timeout bool m_drag_first_timeout; /// Prevents keyboard auto-repeat from sending drag-sensitivity through the roof bool m_tap_started; k3d::timer m_timer; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder) : base(2, 8, true), m_implementation(new implementation(Model, StateRecorder)) { set_name("k3d-spin-button"); m_implementation->m_entry->set_name("entry"); m_implementation->m_entry->set_width_chars(8); m_implementation->m_entry->signal_focus_out_event().connect(sigc::mem_fun(*this, &control::on_entry_focus_out_event)); m_implementation->m_entry->signal_activate().connect(sigc::mem_fun(*this, &control::on_entry_activated)); attach(*manage(m_implementation->m_entry), 0, 6, 0, 2); if(m_implementation->m_model->writable()) { // Setup up and down buttons setup_arrow_button(m_implementation->m_up_button, Gtk::ARROW_UP, true); setup_arrow_button(m_implementation->m_down_button, Gtk::ARROW_DOWN, false); // Setup VBox containing arrows attach(*manage(m_implementation->m_up_button), 6, 7, 0, 1); attach(*manage(m_implementation->m_down_button), 6, 7, 1, 2); m_implementation->m_entry->set_tooltip_text(_("Enter a new value. Real-world units and simple math expressions are allowed.")); m_implementation->m_up_button->set_tooltip_text(_("LMB-Drag to modify, LMB-Click to step, Tap Shift and Control while dragging to change sensitivity.")); m_implementation->m_down_button->set_tooltip_text(_("LMB-Drag to modify, LMB-Click to step, Tap Shift and Control while dragging to change sensitivity.")); // Make sure buttons can't get the focus (makes tabbing difficult) m_implementation->m_up_button->unset_flags(Gtk::CAN_FOCUS); m_implementation->m_down_button->unset_flags(Gtk::CAN_FOCUS); } else { m_implementation->m_entry->set_editable(false); } // Synchronize the view with the data source ... on_data_changed(); // We want to be notified if the data source changes ... m_implementation->m_model->connect_changed_signal(sigc::mem_fun(*this, &control::on_data_changed)); } control::~control() { delete m_implementation; } void control::set_step_increment(const double StepIncrement) { m_implementation->m_step_increment = StepIncrement; on_data_changed(); } void control::set_units(const std::type_info& Units) { m_implementation->m_units = &Units; on_data_changed(); } void control::setup_arrow_button(Gtk::Button* Button, const Gtk::ArrowType ArrowType, const bool Up) { Gtk::Arrow* const arrow = Gtk::manage(new Gtk::Arrow(ArrowType, Gtk::SHADOW_NONE)); arrow->set_size_request(0, 0); Button->set_size_request(0, 0); Button->add(*arrow); Button->signal_pressed().connect(sigc::bind(sigc::mem_fun(*this, &control::on_drag_pressed), Up)); Button->signal_released().connect(sigc::mem_fun(*this, &control::on_drag_released)); if(Up) Button->signal_clicked().connect(sigc::mem_fun(*this, &control::increment)); else Button->signal_clicked().connect(sigc::mem_fun(*this, &control::decrement)); Button->add_events(Gdk::BUTTON_MOTION_MASK | Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK); Button->signal_motion_notify_event().connect(sigc::mem_fun(*this, &control::on_drag_motion_notify_event)); Button->signal_key_press_event().connect(sigc::mem_fun(*this, &control::on_drag_key_press_event)); Button->signal_key_release_event().connect(sigc::mem_fun(*this, &control::on_drag_key_release_event)); } void control::on_data_changed() { display_value(m_implementation->m_model->value()); } void control::display_value(const double Value) { std::ostringstream buffer; if(*m_implementation->m_units == typeid(k3d::measurement::angle)) // Display angles in degrees, even though the internal unit is radians buffer << k3d::string_cast(boost::format("%g") % k3d::measurement::convert(k3d::measurement::quantity(Value, k3d::measurement::angle_units("rad")), k3d::measurement::angle_units("deg")).value()) << " deg"; else if(*m_implementation->m_units == typeid(k3d::measurement::area)) buffer << k3d::string_cast(boost::format("%g") % Value) << " m^2"; else if(*m_implementation->m_units == typeid(k3d::measurement::distance)) buffer << k3d::string_cast(boost::format("%g") % Value) << " m"; else if(*m_implementation->m_units == typeid(k3d::measurement::force)) buffer << k3d::string_cast(boost::format("%g") % Value) << " N"; else if(*m_implementation->m_units == typeid(k3d::measurement::mass)) buffer << k3d::string_cast(boost::format("%g") % Value) << " Kg"; else if(*m_implementation->m_units == typeid(k3d::measurement::pressure)) buffer << k3d::string_cast(boost::format("%g") % Value) << " Pa"; else if(*m_implementation->m_units == typeid(k3d::measurement::time)) buffer << k3d::string_cast(boost::format("%g") % Value) << " s"; else if(*m_implementation->m_units == typeid(k3d::measurement::volume)) buffer << k3d::string_cast(boost::format("%g") % Value) << " m^3"; else if(*m_implementation->m_units == typeid(scalar)) buffer << k3d::string_cast(boost::format("%g") % Value); else k3d::log() << error << "Unknown physical unit - " << m_implementation->m_units->name() << std::endl; m_implementation->m_entry->set_text(buffer.str()); } bool control::on_entry_focus_out_event(GdkEventFocus* Event) { on_manual_value(); return false; } void control::on_entry_activated() { on_manual_value(); /** \todo What the heck is this? */ // Set focus to the arrows such as hotkeys work again m_implementation->m_down_button->set_flags(Gtk::CAN_FOCUS); m_implementation->m_down_button->grab_focus(); m_implementation->m_down_button->unset_flags(Gtk::CAN_FOCUS); } void control::on_manual_value() { m_implementation->m_entry->select_region(0, 0); const k3d::string_t new_text = m_implementation->m_entry->get_text(); // Default our results to the current value, in case it doesn't parse ... const double original_value = m_implementation->m_model->value(); double new_value = original_value; // Parse the input expression into value converting it to SI units automatically (it can do mathematical expressions, too, for fun) if(!k3d::measurement::parse(new_text, new_value, m_implementation->m_units)) { k3d::log() << error << "Couldn't parse expression: " << new_text << " restoring original value" << std::endl; display_value(original_value); return; } // If the value has changed, record it ... if(new_value != original_value) { // Turn this into an undo/redo -able event ... if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); m_implementation->m_model->set_value(new_value); // Turn this into an undo/redo -able event ... if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->commit_change_set(m_implementation->m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), change_message(m_implementation->m_model->value()), K3D_CHANGE_SET_CONTEXT); } else { display_value(new_value); } } void control::on_drag_pressed(const bool Up) { // Save which button was pressed m_implementation->m_up_button_pressed = Up; m_implementation->m_up_button->set_flags(Gtk::CAN_FOCUS); m_implementation->m_down_button->set_flags(Gtk::CAN_FOCUS); m_implementation->m_up_button->grab_focus(); m_implementation->m_down_button->grab_focus(); // Get the current mouse coordinates ... m_implementation->m_last_mouse = interactive::get_pointer(); // Calculate the increment we should use while dragging ... m_implementation->m_drag_increment = std::abs(m_implementation->m_step_increment) * 0.2; if(!m_implementation->m_drag_increment) m_implementation->m_drag_increment = 0.002; // Connect idle timeout handler, called every 200ms m_implementation->m_drag_timeout = Glib::signal_timeout().connect(sigc::mem_fun(*this, &control::on_drag_timeout), 200); m_implementation->m_drag_first_timeout = true; // Turn this into an undo/redo -able event ... if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); } bool control::on_drag_motion_notify_event(GdkEventMotion* Event) { // Get new mouse coordinates const k3d::point2 mouse = interactive::get_pointer(); // Don't switch to drag mode until the mouse really moved if(!m_implementation->m_dragging) { if(k3d::distance(mouse, m_implementation->m_last_mouse) < 10) return false; m_implementation->m_dragging = true; m_implementation->m_timer.restart(); } // Update everything ... const double horizontal_length = m_implementation->m_last_mouse[0] - mouse[0]; const double vertical_length = m_implementation->m_last_mouse[1] - mouse[1]; double new_value = m_implementation->m_model->value(); if(std::abs(horizontal_length) > std::abs(vertical_length)) { // Dragging mostly horizontally : 1/10th unit increase new_value += m_implementation->m_drag_increment * 0.1 * (mouse[0] - m_implementation->m_last_mouse[0]); } else { // Dragging mostly vertically : one unit increase new_value += m_implementation->m_drag_increment * (m_implementation->m_last_mouse[1] - mouse[1]); } m_implementation->m_model->set_value(new_value); m_implementation->m_last_mouse = mouse; // Wrap the mouse if it goes off the top-or-bottom of the screen ... const int screen_height = Gdk::Display::get_default()->get_default_screen()->get_height(); const int border = 5; if(mouse[1] < border) { m_implementation->m_last_mouse = k3d::point2(mouse[0], screen_height - (border + 1)); interactive::warp_pointer(m_implementation->m_last_mouse); } else if(screen_height - mouse[1] < border) { m_implementation->m_last_mouse = k3d::point2(mouse[0], (border + 1)); interactive::warp_pointer(m_implementation->m_last_mouse); } // Wrap the mouse if it goes off the left-or-right of the screen ... const int screen_width = Gdk::Display::get_default()->get_default_screen()->get_width(); if(mouse[0] < border) { m_implementation->m_last_mouse = k3d::point2(screen_width - (border + 1), mouse[1]); interactive::warp_pointer(m_implementation->m_last_mouse); } else if(screen_width - mouse[0] < border) { m_implementation->m_last_mouse = k3d::point2((border + 1), mouse[1]); interactive::warp_pointer(m_implementation->m_last_mouse); } return false; } bool control::on_drag_key_press_event(GdkEventKey* Event) { if(!m_implementation->m_tap_started && Event->keyval == GDK_Shift_L || Event->keyval == GDK_Shift_R) { m_implementation->m_tap_started = true; m_implementation->m_drag_increment *= 10.0; return true; } else if(!m_implementation->m_tap_started && Event->keyval == GDK_Control_L || Event->keyval == GDK_Control_R) { m_implementation->m_tap_started = true; m_implementation->m_drag_increment *= 0.1; return true; } return false; } bool control::on_drag_key_release_event(GdkEventKey* Event) { m_implementation->m_tap_started = false; return false; } bool control::on_drag_timeout() { // Step increment if the user doesn't move if(!m_implementation->m_dragging) { if(m_implementation->m_drag_first_timeout) { // Don't change value on first timeout m_implementation->m_drag_first_timeout = false; return true; } if(m_implementation->m_up_button_pressed) { increment(); } else { decrement(); } } return true; } void control::on_drag_released() { // Disconnect idle timeout m_implementation->m_drag_timeout.disconnect(); // Turn this into an undo/redo -able event ... if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->commit_change_set(m_implementation->m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), change_message(m_implementation->m_model->value()), K3D_CHANGE_SET_CONTEXT); m_implementation->m_up_button->unset_flags(Gtk::CAN_FOCUS); m_implementation->m_down_button->unset_flags(Gtk::CAN_FOCUS); m_implementation->m_dragging = false; } void control::increment() { m_implementation->m_model->set_value(m_implementation->m_model->value() + m_implementation->m_step_increment); } void control::decrement() { m_implementation->m_model->set_value(m_implementation->m_model->value() - m_implementation->m_step_increment); } const k3d::string_t control::change_message(const double Value) { std::stringstream value_buffer; value_buffer << std::setprecision(3) << Value; return k3d::string_cast(boost::format(_("Change %1% to %2%")) % m_implementation->m_model->label().raw() % value_buffer.str()); } } // namespace spin_button } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/spin_button.h ================================================ #ifndef K3DSDK_NGUI_SPIN_BUTTON_H #define K3DSDK_NGUI_SPIN_BUTTON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares the spin_button control, which provides a standard MVC UI for scalar values \author Tim Shead (tshead@k-3d.com) \author Dan Erikson */ #include #include #include namespace Gtk { class Button; } namespace k3d { class iproperty; class istate_recorder; namespace ngui { namespace spin_button { ///////////////////////////////////////////////////////////////////////////// // imodel /// Abstract data model for a spin_button::control class imodel { public: virtual ~imodel() {} /// Returns a human-readable label for the underlying data virtual const Glib::ustring label() = 0; /// Returns true iff the underlying data source is writable virtual k3d::bool_t writable() = 0; /// Called to return the underlying data value virtual k3d::double_t value() = 0; /// Called to set a new data value virtual void set_value(const k3d::double_t Value) = 0; /// Connects a slot to a signal that will be emitted if the underlying data changes virtual sigc::connection connect_changed_signal(const sigc::slot& Slot) = 0; virtual k3d::double_t step_increment() = 0; virtual const std::type_info& units() = 0; protected: imodel() {} private: imodel(const imodel&); imodel& operator=(const imodel&); }; /// Factory method for creating an imodel object given a suitably-typed property imodel* const model(k3d::iproperty& Property); /// Provides an implementation of spin_button::imodel that can "wrap" any data source that supports the internal_value(), set_value(), and changed_signal() concepts template class generic_model_t : public imodel { public: generic_model_t(data_t& Data, const Glib::ustring& Label, const value_t StepIncrement, const std::type_info& Units) : m_data(Data), m_label(Label), m_step_increment(StepIncrement), m_units(Units) { } const Glib::ustring label() { return m_label; } k3d::bool_t writable() { return true; } k3d::double_t value() { return m_data.internal_value(); } void set_value(const k3d::double_t Value) { m_data.set_value(static_cast(Value)); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_data.changed_signal().connect(sigc::hide(Slot)); } k3d::double_t step_increment() { return m_step_increment; } const std::type_info& units() { return m_units; } private: data_t& m_data; const Glib::ustring m_label; const value_t m_step_increment; const std::type_info& m_units; }; /// Convenience factory function for creating generic_model_t objects template imodel* model(data_t& Data, const Glib::ustring& Label = "", const value_t StepIncrement = 1, const std::type_info& Units = typeid(k3d::measurement::scalar)) { return new generic_model_t(Data, Label, StepIncrement, Units); } ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating scalar quantities (i.e. the view and the controller from model-view-controller) class control : public Gtk::Table { typedef Gtk::Table base; public: control(imodel* const Model, k3d::istate_recorder* const StateRecorder); ~control(); /// Sets the step increment between values when the user clicks on the up or down arrows void set_step_increment(const double StepIncrement); /// Sets the physical unit-of-measure that should be used to display values void set_units(const std::type_info& Units); private: /// Creates up or down button void setup_arrow_button(Gtk::Button* Button, const Gtk::ArrowType ArrowType, const bool Up); /// Called whenever the underlying data changes void on_data_changed(); /// Formats a value and displays it in the entry void display_value(const double Value); /// Called when the entry control loses the keyboard focus bool on_entry_focus_out_event(GdkEventFocus* Event); /// Called when the entry control is activated void on_entry_activated(); /// Sets the proxied value from the entry widget void on_manual_value(); /// Called when the user pressed the "drag" button void on_drag_pressed(const bool Up); /// Called when the user drags the mouse over the "drag" button bool on_drag_motion_notify_event(GdkEventMotion*); /// Called when a key is pressed during dragging bool on_drag_key_press_event(GdkEventKey* Event); /// Called when a key is released during dragging bool on_drag_key_release_event(GdkEventKey* Event); /// Called by the idle timeout during dragging bool on_drag_timeout(); /// Called when the user releases the "drag" button void on_drag_released(); /// Called to increment the current value void increment(); /// Called to decrement the current value void decrement(); const k3d::string_t change_message(const double Value); class implementation; implementation* const m_implementation; }; } // namespace spin_button } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_SPIN_BUTTON_H ================================================ FILE: k3dsdk/ngui/target.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { /// Expands a bounding box around the visited points class point_visitor { public: point_visitor(k3d::bounding_box3& BBox, k3d::mesh::points_t& Points, const k3d::matrix4& Matrix) : m_bbox(BBox), m_points(Points), m_matrix(Matrix) {} void operator()(k3d::uint_t PointIndex, const k3d::point3& Point) { const k3d::point3 transformed_point = m_matrix * Point; m_bbox.insert(transformed_point); if (m_inserted_points.insert(PointIndex).second) { m_points.push_back(transformed_point); } } private: k3d::bounding_box3& m_bbox; k3d::mesh::points_t& m_points; const k3d::matrix4& m_matrix; std::set m_inserted_points; }; /// Traverse selected mesh points template void traverse_selected_points(const k3d::mesh& Mesh, visitor_t& Visitor) { for (k3d::uint_t point = 0; point != Mesh.points->size(); ++point) { if (Mesh.point_selection->at(point)) { Visitor(point, Mesh.points->at(point)); } } } /// For each selected edge, visit the start and end point (multiple visits per point possible!) template void traverse_selected_edge_points(const k3d::mesh& Mesh, visitor_t& Visitor) { /* boost::scoped_ptr polyhedron(k3d::polyhedron::validate(Mesh)); return_if_fail(polyhedron); const k3d::mesh::points_t& points = *Mesh.points; const k3d::mesh::indices_t& edge_points = *Mesh.polyhedra->edge_points; const k3d::mesh::indices_t& clockwise_edges = *Mesh.polyhedra->clockwise_edges; const k3d::mesh::selection_t& edge_selection = *Mesh.polyhedra->edge_selection; for (k3d::uint_t edge = 0; edge != edge_points.size(); ++edge) { if (edge_selection[edge]) { Visitor(edge_points[edge], points[edge_points[edge]]); Visitor(edge_points[clockwise_edges[edge]], points[edge_points[clockwise_edges[edge]]]); } } */ } // For each selected face, visit all of its points (multiple visits per point possible!) template void traverse_selected_face_points(const k3d::mesh& Mesh, visitor_t& Visitor) { /* boost::scoped_ptr polyhedron(k3d::polyhedron::validate(Mesh)); return_if_fail(polyhedron); const k3d::mesh::points_t& points = *Mesh.points; const k3d::mesh::indices_t& face_first_loops = *Mesh.polyhedra->face_first_loops; const k3d::mesh::counts_t& face_loop_counts = *Mesh.polyhedra->face_loop_counts; const k3d::mesh::indices_t& loop_first_edges = *Mesh.polyhedra->loop_first_edges; const k3d::mesh::indices_t& edge_points = *Mesh.polyhedra->edge_points; const k3d::mesh::indices_t& clockwise_edges = *Mesh.polyhedra->clockwise_edges; const k3d::mesh::selection_t& face_selection = *Mesh.polyhedra->face_selection; for(k3d::uint_t face = 0; face != face_first_loops.size(); ++face) { if (!face_selection[face]) continue; const k3d::uint_t loop_begin = face_first_loops[face]; const k3d::uint_t loop_end = loop_begin + face_loop_counts[face]; for(k3d::uint_t loop = loop_begin; loop != loop_end; ++loop) { const k3d::uint_t first_edge = loop_first_edges[loop]; for(k3d::uint_t edge = first_edge; ; ) { Visitor(edge_points[edge], points[edge_points[edge]]); edge = clockwise_edges[edge]; if(edge == first_edge) break; } } } */ } /// Computes the average position of selected nodes, returns false when no selected node was found. bool selection_position(const selection::mode& SelectionMode, const k3d::nodes_t& Selection, k3d::bounding_box3& BoundingBox, k3d::mesh::points_t& Points) { // Expand the bounding box around the selection for(k3d::nodes_t::const_iterator node = Selection.begin(); node != Selection.end(); ++node) { if(!dynamic_cast(*node)) continue; const k3d::matrix4 transformation = k3d::node_to_world_matrix(**node); point_visitor visitor(BoundingBox, Points, transformation); if(SelectionMode == selection::NODE) { if(k3d::ibounded* bounded = dynamic_cast(*node)) { BoundingBox.insert(transformation * bounded->extents()); } else { BoundingBox.insert(k3d::world_position(**node)); } } if(!(*node)->factory().implements(typeid(k3d::imesh_source))) continue; const k3d::mesh* mesh = k3d::property::pipeline_value(dynamic_cast(*node)->mesh_source_output()); if(!mesh) continue; if(!mesh->points) continue; if(SelectionMode == selection::NODE) { const k3d::mesh::points_t& points = *mesh->points; for (k3d::uint_t point = 0; point != points.size(); ++point) Points.push_back(transformation * points[point]); } if(SelectionMode == selection::POINT) { traverse_selected_points(*mesh, visitor); } if(SelectionMode == selection::EDGE) { traverse_selected_edge_points(*mesh, visitor); } if(SelectionMode == selection::FACE) { traverse_selected_face_points(*mesh, visitor); } } // Nothing was selected... if (BoundingBox.empty()) { return false; } if (Points.empty()) { Points.push_back(k3d::point3(BoundingBox.nx, BoundingBox.ny, BoundingBox.nz)); Points.push_back(k3d::point3(BoundingBox.px, BoundingBox.ny, BoundingBox.nz)); Points.push_back(k3d::point3(BoundingBox.px, BoundingBox.py, BoundingBox.nz)); Points.push_back(k3d::point3(BoundingBox.nx, BoundingBox.py, BoundingBox.nz)); Points.push_back(k3d::point3(BoundingBox.nx, BoundingBox.ny, BoundingBox.pz)); Points.push_back(k3d::point3(BoundingBox.px, BoundingBox.ny, BoundingBox.pz)); Points.push_back(k3d::point3(BoundingBox.nx, BoundingBox.py, BoundingBox.pz)); Points.push_back(k3d::point3(BoundingBox.px, BoundingBox.py, BoundingBox.pz)); } return true; } } // namespace detail void aim_selection(document_state& DocumentState, viewport::control& Viewport) { // Get the bounding box of the current selection k3d::bounding_box3 bbox; k3d::mesh::points_t points; if(!detail::selection_position(selection::state(DocumentState.document()).current_mode(), selection::state(DocumentState.document()).selected_nodes(), bbox, points)) return; k3d::point3 target = bbox.center(); const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look_vector = k3d::look_vector(view_matrix); const k3d::vector3 right_vector = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); const k3d::vector3 new_look_vector = target - position; const k3d::vector3 new_right_vector = new_look_vector ^ Viewport.get_up_axis(); const k3d::vector3 new_up_vector = new_right_vector ^ new_look_vector; Viewport.set_view_matrix(k3d::view_matrix(new_look_vector, new_up_vector, position)); Viewport.set_target(bbox.center()); } void frame_selection(document_state& DocumentState, viewport::control& Viewport) { // Get the bounding box of the current selection k3d::bounding_box3 bbox; k3d::mesh::points_t points; if(!detail::selection_position(selection::state(DocumentState.document()).current_mode(), selection::state(DocumentState.document()).selected_nodes(), bbox, points)) return; k3d::point3 target = bbox.center(); const k3d::matrix4 view_matrix = Viewport.get_view_matrix(); const k3d::vector3 look_vector = k3d::look_vector(view_matrix); const k3d::vector3 up_vector = k3d::up_vector(view_matrix); const k3d::vector3 right_vector = k3d::right_vector(view_matrix); const k3d::point3 position = k3d::position(view_matrix); k3d::point3 old_target = Viewport.get_target(); // translation to center const k3d::vector3 pan_translation = target - old_target; // Get the zoom factor by comparing view area and bounding box return_if_fail(Viewport.camera()); k3d::iprojection* camera_projection = &(Viewport.camera()->projection()); double near = 1; double left = 0; double right = 0; double top = 0; double bottom = 0; if (k3d::iorthographic* projection = dynamic_cast(camera_projection)) { left = k3d::property::pipeline_value(projection->left()); right = k3d::property::pipeline_value(projection->right()); top = k3d::property::pipeline_value(projection->top()); bottom = k3d::property::pipeline_value(projection->bottom()); } else if (k3d::iperspective* projection = dynamic_cast(camera_projection)) { near = k3d::property::pipeline_value(projection->near()); left = k3d::property::pipeline_value(projection->left()); right = k3d::property::pipeline_value(projection->right()); top = k3d::property::pipeline_value(projection->top()); bottom = k3d::property::pipeline_value(projection->bottom()); } else { assert_not_reached(); } // Transformation to camera coordinates (x = right, y = look, z = up) k3d::matrix4 view_transformation( k3d::vector4(right_vector[0], right_vector[1], right_vector[2], -right_vector*k3d::to_vector(pan_translation + position)), k3d::vector4(look_vector[0], look_vector[1], look_vector[2], -look_vector*k3d::to_vector(pan_translation + position)), k3d::vector4(up_vector[0], up_vector[1], up_vector[2], -up_vector*k3d::to_vector(pan_translation + position)), k3d::vector4(0,0,0,1)); // Find the point with the largest viewing angle double factor = std::numeric_limits::max(); for (k3d::uint_t point = 0; point != points.size(); ++point) { k3d::point3 p = view_transformation * points[point]; points[point] = p; double x = p[0]; double y = p[1]; double z = p[2]; double testfactor = x < 0 ? y - (x * near / left) : y - (x * near / right); factor = testfactor < factor ? testfactor : factor; testfactor = z < 0 ? y - (z * near / bottom) : y - (z * near / top); factor = testfactor < factor ? testfactor : factor; } // Check and correct if the zoom factor found makes the selection intersect the near plane for (k3d::uint_t point = 0; point != points.size(); ++point) { double y = points[point][1]; if ((y - factor) < near) { factor = y - near; } } const k3d::vector3 dolly_translation = factor * look_vector; Viewport.set_view_matrix(k3d::view_matrix(look_vector, up_vector, position + pan_translation + dolly_translation)); Viewport.set_target(target); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/target.h ================================================ #ifndef K3DSDK_NGUI_TARGET_H #define K3DSDK_NGUI_TARGET_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ namespace k3d { namespace ngui { class document_state; namespace viewport { class control; } /// Centers the current selection in the given viewport by changing the viewport orientation void aim_selection(document_state& DocumentState, viewport::control& Viewport); /// Frames the current selection in the given viewport by changing the viewport position void frame_selection(document_state& DocumentState, viewport::control& Viewport); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_TARGET_H ================================================ FILE: k3dsdk/ngui/text.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace text { ///////////////////////////////////////////////////////////////////////////// // property_model /// Implementation of text::imodel for use with k3d::iproperty objects class property_model : public imodel { public: property_model(k3d::iproperty& Data) : m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } const Glib::ustring label() { Glib::ustring result = m_readable_data.property_label(); if(m_readable_data.property_node()) result = m_readable_data.property_node()->name() + " " + result; return result; } const k3d::bool_t writable() { return m_writable_data ? true : false; } const k3d::string_t value() { const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::string_t)) return boost::any_cast(m_readable_data.property_internal_value()); k3d::log() << error << k3d_file_reference << ": unknown property type: " << type.name() << std::endl; return k3d::string_t(); } void set_value(const k3d::string_t& Value) { return_if_fail(m_writable_data); const std::type_info& type = m_readable_data.property_type(); if(type == typeid(k3d::string_t)) m_writable_data->property_set_value(Value); else k3d::log() << error << k3d_file_reference << ": unknown property type: " << type.name() << std::endl; } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_readable_data.property_changed_signal().connect(sigc::hide(Slot)); } private: property_model(const property_model& RHS); property_model& operator=(const property_model& RHS); k3d::iproperty& m_readable_data; k3d::iwritable_property* const m_writable_data; }; ///////////////////////////////////////////////////////////////////////////// // model imodel* const model(k3d::iproperty& Property) { return new property_model(Property); } ///////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_model(Model), m_state_recorder(StateRecorder) { assert(m_model.get()); } /// Stores a reference to the underlying data object const boost::scoped_ptr m_model; /// Stores a reference to the (optional) object for recording undo/redo data k3d::istate_recorder* const m_state_recorder; /// Stores the global accel group while the control has the keyboard focus Glib::RefPtr m_disabled_accel_group; /// Provides the main view widget Gtk::TextView m_text_view; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_implementation(new implementation(Model, StateRecorder)) { set_name("k3d-text"); Gtk::ScrolledWindow* const scrolled_window = new Gtk::ScrolledWindow(); scrolled_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolled_window->add(m_implementation->m_text_view); pack_start(*Gtk::manage(scrolled_window), Gtk::PACK_EXPAND_WIDGET); if(m_implementation->m_model->writable()) { m_implementation->m_text_view.set_editable(true); Gtk::Button* const apply_button = new Gtk::Button(_("Apply")) << connect_button(sigc::mem_fun(*this, &control::on_apply)) << set_tooltip(_("Apply modifications.")); Gtk::Button* const reset_button = new Gtk::Button(_("Reset")) << connect_button(sigc::mem_fun(*this, &control::on_reset)) << set_tooltip(_("Reset modifications.")); Gtk::HButtonBox* const bbox = new Gtk::HButtonBox(Gtk::BUTTONBOX_END); bbox->pack_start(*Gtk::manage(apply_button)); bbox->pack_start(*Gtk::manage(reset_button)); pack_start(*Gtk::manage(bbox)); } else { m_implementation->m_text_view.set_editable(false); } // Keep track of when the TextView control receives/loses the keyboard focus, so we can disable/enable hotkeys ... m_implementation->m_text_view.signal_focus_in_event().connect(sigc::mem_fun(*this, &control::on_focus_in_event)); m_implementation->m_text_view.signal_focus_out_event().connect(sigc::mem_fun(*this, &control::on_focus_out_event)); // We want to be notified if the data source changes ... m_implementation->m_model->connect_changed_signal(sigc::mem_fun(*this, &control::on_reset)); // Synchronize the view with the data source ... on_reset(); } control::~control() { delete m_implementation; } bool control::on_focus_in_event(GdkEventFocus* Event) { // Disable accelerators for this window if(Gtk::Window* const window = dynamic_cast(get_toplevel())) { m_implementation->m_disabled_accel_group = window->get_accel_group(); window->remove_accel_group(window->get_accel_group()); } return base::on_focus_in_event(Event); } bool control::on_focus_out_event(GdkEventFocus* Event) { // Enable accelerators for this window if(Gtk::Window* const window = dynamic_cast(get_toplevel())) { window->add_accel_group(m_implementation->m_disabled_accel_group); m_implementation->m_disabled_accel_group.clear(); } return base::on_focus_out_event(Event); } void control::on_apply() { // If the value didn't change, we're done ... const k3d::string_t new_value = m_implementation->m_text_view.get_buffer()->get_text(); if(new_value == m_implementation->m_model->value()) return; // Turn this into an undo/redo -able event ... if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); // Update everything with the new value ... m_implementation->m_model->set_value(new_value); // Turn this into an undo/redo -able event ... if(m_implementation->m_state_recorder) m_implementation->m_state_recorder->commit_change_set(m_implementation->m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), change_message(m_implementation->m_model->value()), K3D_CHANGE_SET_CONTEXT); } void control::on_reset() { m_implementation->m_text_view.get_buffer()->set_text(m_implementation->m_model->value()); } const k3d::string_t control::change_message(const k3d::string_t& Value) { return k3d::string_cast(boost::format(_("Change %1%")) % m_implementation->m_model->label().raw()); } } // namespace text } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/text.h ================================================ #ifndef K3DSDK_NGUI_TEXT_H #define K3DSDK_NGUI_TEXT_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class iproperty; } namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace text { ///////////////////////////////////////////////////////////////////////////// // imodel /// Abstract data model for an text::control class imodel { public: virtual ~imodel() {} /// Returns a human-readable label for the underlying data virtual const Glib::ustring label() = 0; /// Returns true iff the underlying data source is writable virtual const k3d::bool_t writable() = 0; /// Called to return the underlying data value virtual const k3d::string_t value() = 0; /// Called to set a new data value virtual void set_value(const k3d::string_t& Value) = 0; /// Connects a slot to a signal that will be emitted if the underlying data changes virtual sigc::connection connect_changed_signal(const sigc::slot& Slot) = 0; protected: imodel() {} private: imodel(const imodel&); imodel& operator=(const imodel&); }; /// Factory method for creating an imodel object given a suitably-typed property imodel* const model(k3d::iproperty& Property); /// Provides an implementation of text::imodel that can "wrap" any data source that supports the internal_value(), set_value(), and changed_signal() concepts template class generic_model_t : public imodel { public: generic_model_t(data_t& Data, const Glib::ustring& Label) : m_data(Data), m_label(Label) { } const Glib::ustring label() { return m_label; } const k3d::bool_t writable() { return true; } const k3d::string_t value() { return m_data.internal_value(); } void set_value(const k3d::string_t& Value) { m_data.set_value(Value); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_data.changed_signal().connect(sigc::hide(Slot)); } private: data_t& m_data; const Glib::ustring m_label; }; /// Convenience factory function for creating generic_model_t objects template imodel* model(data_t& Data, const Glib::ustring& Label = "") { return new generic_model_t(Data, Label); } ///////////////////////////////////////////////////////////////////////////// // control /// Provides a standard UI control for manipulating text fields (i.e. the view and the controller from model-view-controller) class control : public Gtk::VBox { typedef Gtk::VBox base; public: control(imodel* const Model, k3d::istate_recorder* const StateRecorder); ~control(); private: /// Called when the control gains the keyboard focus bool on_focus_in_event(GdkEventFocus* Event); /// Called when the control loses the keyboard focus bool on_focus_out_event(GdkEventFocus* Event); /// Called when the user finishes editing data void on_apply(); /// Called to synchronize the control with the current model value void on_reset(); const k3d::string_t change_message(const k3d::string_t& Value); class implementation; implementation* const m_implementation; }; } // namespace text } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_TEXT_H ================================================ FILE: k3dsdk/ngui/toggle_button.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { namespace ngui { namespace toggle_button { /* /// Specialization of k3d::toggle_button::data_proxy for use with k3d::iproperty objects template<> class data_proxy : public idata_proxy { public: typedef k3d::iproperty data_t; data_proxy(data_t& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) : idata_proxy(StateRecorder, ChangeMessage), m_readable_data(Data), m_writable_data(dynamic_cast(&Data)) { } bool value() { return boost::any_cast(m_readable_data.property_internal_value()); } void set_value(const bool Value) { return_if_fail(m_writable_data); m_writable_data->property_set_value(Value); } changed_signal_t& changed_signal() { return m_readable_data.property_changed_signal(); } private: data_proxy(const data_proxy& RHS); data_proxy& operator=(const data_proxy& RHS); data_t& m_readable_data; k3d::iwritable_property* const m_writable_data; }; std::unique_ptr proxy(k3d::iproperty& Data, k3d::istate_recorder* const StateRecorder, const Glib::ustring& ChangeMessage) { return std::unique_ptr(new data_proxy(Data, StateRecorder, ChangeMessage)); } */ ///////////////////////////////////////////////////////////////////////////// // control control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_model(Model), m_state_recorder(StateRecorder) { set_name("k3d-toggle-button"); attach(); } control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder, const Glib::ustring& label, bool mnemonic) : base(label, mnemonic), m_model(Model), m_state_recorder(StateRecorder) { set_name("k3d-toggle-button"); attach(); } void control::attach() { // Update the display ... update(); // We want to be notified if the data source changes ... if(m_model) m_model->connect_changed_signal(sigc::mem_fun(*this, &control::update)); } void control::on_update() { } void control::update() { if(m_model) { const k3d::bool_t new_value = m_model->value(); if(new_value != get_active()) set_active(new_value); } on_update(); } void control::on_toggled() { if(m_model) { // Get the control value ... const bool new_value = get_active(); // If the value hasn't changed, we're done ... if(new_value != m_model->value()) { // Turn this into an undo/redo -able event ... if(m_state_recorder) m_state_recorder->start_recording(k3d::create_state_change_set(K3D_CHANGE_SET_CONTEXT), K3D_CHANGE_SET_CONTEXT); // Update everything with the new value ... m_model->set_value(new_value); // Turn this into an undo/redo -able event ... if(m_state_recorder) m_state_recorder->commit_change_set(m_state_recorder->stop_recording(K3D_CHANGE_SET_CONTEXT), new_value ? m_model->label() + " \"On\"" : m_model->label() + " \"Off\"", K3D_CHANGE_SET_CONTEXT); } } else { update(); } base::on_toggled(); update(); } } // namespace toggle_button } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/toggle_button.h ================================================ #ifndef K3DSDK_NGUI_TOGGLE_BUTTON_H #define K3DSDK_NGUI_TOGGLE_BUTTON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class istate_recorder; } namespace k3d { namespace ngui { namespace toggle_button { ///////////////////////////////////////////////////////////////////////////// // imodel /// Abstract data model for toggle_button::control objects class imodel { public: virtual ~imodel() {} /// Returns a human-readable label for the underlying data virtual const Glib::ustring label() = 0; /// Called to return the underlying data value virtual const k3d::bool_t value() = 0; /// Called to set a new data value virtual void set_value(const k3d::bool_t Value) = 0; /// Connects a slot to a signal that will be emitted if the underlying data changes virtual sigc::connection connect_changed_signal(const sigc::slot& Slot) = 0; protected: imodel() {} private: imodel(const imodel&); imodel& operator=(const imodel&); }; /// Provides an implementation of k3d::toggle_button::imodel that can "wrap" any data source that supports the value(), set_value(), and changed_signal() concepts template class generic_model_t : public imodel { public: generic_model_t(data_t& Data, const Glib::ustring& Label) : m_data(Data), m_label(Label) { } const Glib::ustring label() { return m_label; } const k3d::bool_t value() { return m_data.internal_value(); } void set_value(const k3d::bool_t Value) { m_data.set_value(Value); } sigc::connection connect_changed_signal(const sigc::slot& Slot) { return m_data.changed_signal().connect(sigc::hide(Slot)); } private: data_t& m_data; const Glib::ustring m_label; }; /// Convenience factory function for creating generic_model_t objects template imodel* model(data_t& Data, const Glib::ustring& Label = "") { return new generic_model_t(Data, Label); } ///////////////////////////////////////////////////////////////////////////// // control /// Provides a UI for manipulating boolean quantities (i.e. the view and the controller from model-view-controller) class control : public Gtk::ToggleButton { typedef Gtk::ToggleButton base; public: control(imodel* const Model, k3d::istate_recorder* const StateRecorder); control(imodel* const Model, k3d::istate_recorder* const StateRecorder, const Glib::ustring& label, bool mnemonic = false); void on_toggled(); private: /// Called to update the state of the widget when the underlying data source changes virtual void on_update(); /// Common construction code void attach(); /// Called when the underlying data source changes void update(); /// Storeas a reference to the underlying data object imodel* const m_model; k3d::istate_recorder* const m_state_recorder; }; } // namespace toggle_button } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_TOGGLE_BUTTON_H ================================================ FILE: k3dsdk/ngui/tool.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // tool tool::tool() : m_document_state(0) { } tool::tool(document_state& DocumentState, const k3d::string_t& Name) : m_document_state(&DocumentState) { } tool::~tool() { } void tool::initialize(document_state& DocumentState) { // This should never be called more-than-once ... assert(!m_document_state); m_document_state = &DocumentState; on_initialize(DocumentState); } void tool::activate() { on_activate(); } void tool::deactivate() { on_deactivate(); } void tool::document_selection_changed() { on_document_selection_changed(); } void tool::redraw(viewport::control& Viewport) { on_redraw(Viewport); } void tool::select(viewport::control& Viewport) { on_select(Viewport); } k3d::iproperty_collection* tool::properties() { return get_property_collection(); } viewport_input_model& tool::input_model() { return get_input_model(); } void tool::redraw_all() { k3d::gl::redraw_all(m_document_state->document(), k3d::gl::irender_viewport::ASYNCHRONOUS); } void tool::on_initialize(document_state&) { } void tool::on_activate() { } void tool::on_deactivate() { } void tool::on_document_selection_changed() { } void tool::on_redraw(viewport::control& Viewport) { } void tool::on_select(viewport::control& Viewport) { } k3d::iproperty_collection* tool::get_property_collection() { return 0; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/tool.h ================================================ #ifndef K3DSDK_NGUI_TOOL_H #define K3DSDK_NGUI_TOOL_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class inode; } namespace k3d { class iproperty_collection; } namespace k3d { class iviewport; } namespace k3d { namespace ngui { class document_state; class viewport_input_model; namespace viewport { class control; } ///////////////////////////////////////////////////////////////////////////// // tool /// Abstract base class for Tools - objects that generate state changes based on user interaction with viewports class tool { public: virtual ~tool(); /// Set the document for this tool - this is ugly, but application plugins don't take ctor arguments void initialize(document_state& DocumentState); /// Returns a unique string identifying the tool type virtual const k3d::string_t tool_type() = 0; /// Called to activate the tool void activate(); /// Called to deactivate the tool void deactivate(); /// Called when document selection changed void document_selection_changed(); /// Called to give the tool a chance to draw in the viewport void redraw(viewport::control& Viewport); /// Called to give the tool a chance to draw in the viewport void select(viewport::control& Viewport); /// Returns tool's property collection k3d::iproperty_collection* properties(); /// Returns the tool's user input model viewport_input_model& input_model(); /// Convenience function that schedules a screen update for all viewports void redraw_all(); protected: tool(); tool(document_state& DocumentState, const k3d::string_t& Name); private: /// Called when the tool is initialized virtual void on_initialize(document_state& DocumentState); /// Called when the tool is activated - override in derived classes to implement custom behavior virtual void on_activate(); /// Called when the tool is deactivated - override in derived classes to implement custom behavior virtual void on_deactivate(); /// Called when the document selection changed - override in derived classes to implement custom behavior virtual void on_document_selection_changed(); /// Called to give the tool a chance to draw in the viewport virtual void on_redraw(viewport::control& Viewport); /// Called to give the tool a chance to draw in the viewport virtual void on_select(viewport::control& Viewport); /// Asks for tool's property collection virtual k3d::iproperty_collection* get_property_collection(); /// Returns the tool's user input model virtual viewport_input_model& get_input_model() = 0; /// Stores a reference to the owning document document_state* m_document_state; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_TOOL_H ================================================ FILE: k3dsdk/ngui/tool_selection.h ================================================ #ifndef K3DSDK_NGUI_TOOL_SELECTION_H #define K3DSDK_NGUI_TOOL_SELECTION_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // tool_selection class tool_selection { public: tool_selection(k3d::idocument& Document, document_state& DocumentState) : m_document(Document), m_document_state(DocumentState), m_current_motion(MOTION_NONE), m_box_selection(0, 0, 0, 0) { } k3d::idocument& document() { return m_document; } void redraw_all(k3d::iunknown* const Hint = 0) { k3d::gl::redraw_all(m_document, k3d::gl::irender_viewport::ASYNCHRONOUS); } /// Enumerates motions typedef enum { MOTION_NONE, MOTION_CLICK_DRAG, // LMB click + drag MOTION_DRAG, // LMB down + drag MOTION_BOX_SELECT, // LMB down + drag draws selection window MOTION_PAINT_SELECT } motion_t; protected: /// Enumerates selection types typedef enum { SELECTION_ADD, SELECTION_SUBTRACT, SELECTED_OBJECT, DESELECTED_OBJECT, NOTHING } mouse_down_content_t; /// Stores the owning document k3d::idocument& m_document; document_state& m_document_state; /// Saves current selection motion motion_t m_current_motion; /// Saves mouse down action mouse_down_content_t m_mouse_down_content; /// Stores the current selection window k3d::rectangle m_box_selection; /// Saves clicked selection k3d::selection::record m_mouse_down_selection; void pick_selectables(k3d::selection::records& PickedSelectables, viewport::control& Viewport, const k3d::point2& Coordinates) { // Check if we need to pick backfacing items bool pick_backfacing = m_document_state.pick_backfacing(); // Find what's under the mouse pointer m_mouse_down_selection = Viewport.pick_object(Coordinates, PickedSelectables, pick_backfacing); // Nullify selection in component mode if the parent node isn't selected if(k3d::inode* node = k3d::selection::get_node(m_mouse_down_selection)) { switch(selection::state(m_document_state.document()).current_mode()) { case selection::CURVE: case selection::FACE: case selection::POINT: case selection::EDGE: case selection::SURFACE: if(!selection::state(m_document_state.document()).is_selected(*node)) m_mouse_down_selection = k3d::selection::record::empty_record();; break; case selection::NODE: break; default: assert_not_reached(); break; } } } const k3d::rectangle normalize(const k3d::rectangle& Rectangle) { return k3d::rectangle::normalize(Rectangle); } /// Stores a GC for drawing selections Glib::RefPtr m_selection_gc; /// Returns a GC for drawing selections Glib::RefPtr selection_gc(viewport::control& Viewport) { if(!m_selection_gc) { Gdk::Color selection_color = convert(k3d::color(0.2, 1.0, 1.0)); Viewport.get_default_colormap()->alloc_color(selection_color); m_selection_gc = Gdk::GC::create(Viewport.get_window()); m_selection_gc->set_foreground(selection_color); m_selection_gc->set_function(Gdk::XOR); m_selection_gc->set_line_attributes(1, Gdk::LINE_ON_OFF_DASH, Gdk::CAP_BUTT, Gdk::JOIN_MITER); } return m_selection_gc; } /// Draws selection window void draw_rubber_band(viewport::control& Viewport) { Glib::RefPtr Drawable = Viewport.get_window(); Glib::RefPtr GC = selection_gc(Viewport); const k3d::rectangle rectangle = normalize(m_box_selection); Drawable->draw_rectangle(GC, false, static_cast(rectangle.x1), static_cast(rectangle.y1), static_cast(rectangle.width()), static_cast(rectangle.height())); } void on_box_select_motion(viewport::control& Viewport, const k3d::point2& Coordinates) { draw_rubber_band(Viewport); m_box_selection.x2 = Coordinates[0]; m_box_selection.y2 = Coordinates[1]; draw_rubber_band(Viewport); } void on_box_select_objects(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::rectangle& SelectionRegion) { bool rubber_band_backfacing = m_document_state.rubber_band_backfacing(); const k3d::selection::records selection = Viewport.get_object_selectables(normalize(SelectionRegion), rubber_band_backfacing); switch(m_mouse_down_content) { //case MOTION_RUBBER_BAND_SELECT: case SELECTION_ADD: selection::state(m_document_state.document()).select(selection); break; //case MOTION_RUBBER_BAND_DESELECT: case SELECTION_SUBTRACT: selection::state(m_document_state.document()).deselect(selection); break; case SELECTED_OBJECT: case DESELECTED_OBJECT: case NOTHING: selection::state(m_document_state.document()).deselect_all(); selection::state(m_document_state.document()).select(selection); break; default: assert_not_reached(); } } }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_TOOL_SELECTION_H ================================================ FILE: k3dsdk/ngui/toolbar.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace ngui { namespace toolbar { ///////////////////////////////////////////////////////////////////////////// // control control::control() : base(false, 0) { set_name("k3d-toolbar"); } Gtk::HBox& control::row(const unsigned int Row) { while(get_children().size() < Row + 1) { Gtk::HBox* hbox = new Gtk::HBox(false, 0); std::stringstream atk_name; atk_name << "row" << get_children().size(); hbox->get_accessible()->set_name(atk_name.str()); base::pack_start(*Gtk::manage(hbox)); } std::vector rows = get_children(); Gtk::HBox* const row = dynamic_cast(rows[Row]); assert_critical(row); return *row; } } // namespace toolbar } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/toolbar.h ================================================ #ifndef K3DSDK_NGUI_TOOLBAR_H #define K3DSDK_NGUI_TOOLBAR_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { namespace toolbar { ///////////////////////////////////////////////////////////////////////////// // control /// Provides a standard toolbar control class control : public Gtk::VBox { typedef Gtk::VBox base; public: control(); Gtk::HBox& row(const unsigned int Row); private: void pack_start(); void pack_end(); // void pack_start(Gtk::Widget& child, bool expand, bool fill, guint padding); // void pack_start(Gtk::Widget& child, Gtk::PackOptions options, guint padding); // void pack_end(Gtk::Widget& child, bool expand, bool fill, guint padding); // void pack_end(Gtk::Widget& child, Gtk::PackOptions options, guint padding); }; } // namespace toolbar } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_TOOLBAR_H ================================================ FILE: k3dsdk/ngui/transform.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { const transform_history_t parent_to_node_history(k3d::inode& Object) { k3d::iparentable* const parentable = dynamic_cast(&Object); k3d::inode* const parent = parentable ? boost::any_cast(parentable->parent().property_internal_value()) : 0; transform_history_t results; for(k3d::inode* object = &Object; object; ) { results.push_back(object); k3d::imatrix_sink* const matrix_sink = dynamic_cast(object); if(!matrix_sink) break; k3d::iproperty* const dependency = Object.document().pipeline().dependency(matrix_sink->matrix_sink_input()); if(!dependency) break; object = dependency->property_node(); if(object == parent) break; } std::reverse(results.begin(), results.end()); return results; } std::ostream& operator<<(std::ostream& Stream, const show_history& RHS) { for(transform_history_t::const_iterator object = RHS.history.begin(); object != RHS.history.end(); ++object) { if(object != RHS.history.begin()) k3d::log() << " -> "; Stream << (*object)->name(); } return Stream; } void unparent(k3d::inode& Node) { k3d::iparentable* const parentable = dynamic_cast(&Node); return_if_fail(parentable); k3d::inode* const parent = boost::any_cast(parentable->parent().property_internal_value()); if(!parent) return; const k3d::matrix4 unparent_compensation = k3d::node_to_world_matrix(*parent); const transform_history_t history = parent_to_node_history(Node); if(!history.empty()) { if(k3d::imatrix_sink* const matrix_sink = dynamic_cast(history.front())) { const transform_modifier modifier = create_transform_modifier(Node.document(), k3d::classes::FrozenMatrix(), "Unparent Compensation"); if(modifier) { k3d::property::set_internal_value(*modifier.node, "matrix", unparent_compensation); k3d::ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&matrix_sink->matrix_sink_input(), &modifier.source->matrix_source_output())); Node.document().pipeline().set_dependencies(dependencies); } } } if(k3d::iwritable_property* const writable_parent = dynamic_cast(&parentable->parent())) writable_parent->property_set_value(static_cast(0)); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/transform.h ================================================ #ifndef K3DSDK_NGUI_TRANSFORM_H #define K3DSDK_NGUI_TRANSFORM_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class inode; } namespace k3d { namespace ngui { /// Defines an ordered collection of objects whose transformation properties are chained together typedef std::vector transform_history_t; /// Returns the set of objects that makeup the transformation history from an object's parent up-to-and-including the object itself const transform_history_t parent_to_node_history(k3d::inode& Object); /// Helper class for dumping history to a stream for debugging struct show_history { show_history(const transform_history_t& History) : history(History) {} const transform_history_t history; }; std::ostream& operator<<(std::ostream&, const show_history&); /// Unparents a node void unparent(k3d::inode& Node); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_TRANSFORM_H ================================================ FILE: k3dsdk/ngui/transform_tool.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include namespace k3d { namespace ngui { namespace detail { double manipulators_scale(viewport::control& Viewport, const k3d::point3& Origin, const double Size) { k3d::icamera* camera = Viewport.camera(); return_val_if_fail(camera, 0); // Project unit axis on screen space const k3d::matrix4 screen_matrix = k3d::node_to_world_matrix(*Viewport.camera()); const k3d::vector3 screen_parallel = screen_matrix * k3d::vector3(1, 0, 0); const k3d::point2 position = Viewport.project(Origin); const k3d::point2 x_axis = Viewport.project(Origin + screen_parallel); const double length = k3d::distance(position, x_axis); return_val_if_fail(length, 0); return Size / length; } bool is_front_facing(viewport::control& Viewport, const k3d::vector3& Normal, const k3d::point3& Origin, const k3d::matrix4& Orientation) { return_val_if_fail(Viewport.gl_engine(), false); return_val_if_fail(Viewport.camera(), false); const k3d::matrix4 matrix = k3d::inverse(k3d::node_to_world_matrix(*Viewport.camera())); const k3d::point3 a = Origin + (Orientation * Normal); const k3d::point3 b = Origin + (Orientation * -Normal); return k3d::to_vector(matrix * a).length2() < k3d::to_vector(matrix * b).length2(); } k3d::point3 get_selected_points(selection::mode SelectionMode, const k3d::mesh& Mesh, component_points_t& PointList) { PointList.clear(); k3d::point3 component_center(0, 0, 0); return_val_if_fail(Mesh.points, component_center); return_val_if_fail(Mesh.point_selection, component_center); const k3d::mesh::points_t& points = *Mesh.points; const k3d::mesh::selection_t& point_selection = *Mesh.point_selection; // Flag points that are explicitly selected by the user ... k3d::mesh::bools_t selected_point(point_selection.begin(), point_selection.end()); // Flag points that are implicitly selected by edges or faces ... for(k3d::mesh::primitives_t::const_iterator primitive = Mesh.primitives.begin(); primitive != Mesh.primitives.end(); ++primitive) { boost::scoped_ptr polyhedron(k3d::polyhedron::validate(Mesh, **primitive)); if(!polyhedron) continue; const k3d::uint_t face_begin = 0; const k3d::uint_t face_end = face_begin + polyhedron->face_shells.size(); for(k3d::uint_t face = face_begin; face != face_end; ++face) { const k3d::uint_t loop_begin = polyhedron->face_first_loops[face]; const k3d::uint_t loop_end = loop_begin + polyhedron->face_loop_counts[face]; for(k3d::uint_t loop = loop_begin; loop != loop_end; ++loop) { const k3d::uint_t first_edge = polyhedron->loop_first_edges[loop]; for(k3d::uint_t edge = first_edge; ;) { if(polyhedron->face_selections[face]) { selected_point[polyhedron->vertex_points[edge]] = true; } else if(polyhedron->edge_selections[edge]) { selected_point[polyhedron->vertex_points[edge]] = true; selected_point[polyhedron->vertex_points[polyhedron->clockwise_edges[edge]]] = true; } else if(polyhedron->vertex_selections[edge]) { selected_point[polyhedron->vertex_points[edge]] = true; } edge = polyhedron->clockwise_edges[edge]; if(edge == first_edge) break; } } } } /* if(Mesh.polyhedra) { // Get selected lines const k3d::mesh::polyhedra_t& polyhedra = *Mesh.polyhedra; return_val_if_fail(polyhedra.clockwise_edges, component_center); return_val_if_fail(polyhedra.edge_points, component_center); return_val_if_fail(polyhedra.edge_selection, component_center); const k3d::mesh::indices_t& clockwise_edges = *polyhedra.clockwise_edges; const k3d::mesh::indices_t& edge_points = *polyhedra.edge_points; const k3d::mesh::selection_t& edge_selection = *polyhedra.edge_selection; const k3d::uint_t edge_count = edge_points.size(); std::set pointset; //ensure each point gets added only once for (k3d::uint_t edge = 0; edge < edge_count; ++edge) { if (edge_selection[edge]) { pointset.insert(edge_points[edge]); pointset.insert(edge_points[clockwise_edges[edge]]); } } // Selected faces .. return_val_if_fail(Mesh.polyhedra, component_center); return_val_if_fail(polyhedra.face_first_loops, component_center); return_val_if_fail(polyhedra.loop_first_edges, component_center); return_val_if_fail(polyhedra.face_selection, component_center); const k3d::mesh::indices_t& face_first_loops = *polyhedra.face_first_loops; const k3d::mesh::indices_t& loop_first_edges = *polyhedra.loop_first_edges; const k3d::mesh::selection_t& face_selection = *polyhedra.face_selection; const k3d::uint_t face_count = face_first_loops.size(); for(k3d::uint_t face = 0; face != face_count; ++face) { if (face_selection[face]) { const k3d::uint_t first_edge = loop_first_edges[face_first_loops[face]]; for(k3d::uint_t edge = first_edge; ; ) { pointset.insert(edge_points[edge]); edge = clockwise_edges[edge]; if(edge == first_edge) break; } } } for (std::set::const_iterator point = pointset.begin(); point != pointset.end(); ++ point) { PointList.push_back(*point); component_center += to_vector(points[*point]); } } */ // Create the list of selected point indices ... const k3d::uint_t point_begin = 0; const k3d::uint_t point_end = point_begin + points.size(); for(k3d::uint_t point = point_begin; point != point_end; ++point) { if(selected_point[point]) PointList.push_back(point); } // Return the average position of the selected points ... for(k3d::uint_t point = point_begin; point != point_end; ++point) { if(selected_point[point]) component_center += k3d::to_vector(points[point]); } const k3d::double_t point_count = static_cast(PointList.size()); if(point_count) component_center /= point_count; return component_center; } } // namespace detail transform_tool::itarget::~itarget() { for(connections_t::iterator connection = m_connections.begin(); connection != m_connections.end(); ++connection) { connection->disconnect(); } } k3d::matrix4 transform_tool::itarget::world_orientation() { if(LOCAL == current_system_type) return k3d::extract_rotation(k3d::node_to_world_matrix(*node)); if(PARENT == current_system_type) return k3d::extract_rotation(k3d::parent_to_world_matrix(*node)); return k3d::identity3(); } void transform_tool::itarget::set_transform_modifier(k3d::inode* Modifier) { modifier = Modifier; m_connections.push_back(Modifier->deleted_signal().connect(sigc::mem_fun(*this, &itarget::reset_transform_modifier))); } void transform_tool::itarget::reset_transform_modifier() { modifier = 0; } void transform_tool::itarget::set_coordinate_system_change_matrices() { switch(current_system_type) { case GLOBAL: m_system_matrix = k3d::inverse(k3d::node_to_world_matrix(*node)); m_system_matrix_inverse = k3d::node_to_world_matrix(*node); // Zero translation components m_system_matrix[0][3] = m_system_matrix[1][3] = m_system_matrix[2][3] = 0; m_system_matrix_inverse[0][3] = m_system_matrix_inverse[1][3] = m_system_matrix_inverse[2][3] = 0; break; case LOCAL: m_system_matrix = k3d::identity3(); m_system_matrix_inverse = k3d::identity3(); break; case PARENT: m_system_matrix = k3d::inverse(k3d::node_to_world_matrix(*node)) * k3d::parent_to_world_matrix(*node); m_system_matrix_inverse = k3d::inverse(m_system_matrix); // Zero translation components m_system_matrix[0][3] = m_system_matrix[1][3] = m_system_matrix[2][3] = 0; m_system_matrix_inverse[0][3] = m_system_matrix_inverse[1][3] = m_system_matrix_inverse[2][3] = 0; break; default: assert_not_reached(); } } // transform_target implementation transform_tool::transform_target::transform_target(k3d::inode* Node) { node = Node; // Sanity check return_if_fail(node); } k3d::point3 transform_tool::transform_target::world_position() { return k3d::world_position(*node); } unsigned long transform_tool::transform_target::target_number() { // There's always one object to move return 1; } void transform_tool::transform_target::reset() { } void transform_tool::transform_target::start_move() { if(create_transform_modifier(k3d::classes::FrozenMatrix(), "Move ")) assert_warning(k3d::property::set_internal_value(*modifier, "matrix", k3d::identity3())); // Setup matrices set_original_matrix(); set_coordinate_system_change_matrices(); } void transform_tool::transform_target::move(const k3d::vector3& Move) { if(!modifier) start_move(); const k3d::matrix4 translation = k3d::translate3(m_system_matrix * Move); assert_warning(k3d::property::set_internal_value(*modifier, "matrix", m_original_matrix * translation)); } void transform_tool::transform_target::start_rotation() { if(create_transform_modifier(k3d::classes::FrozenMatrix(), "Rotate ")) assert_warning(k3d::property::set_internal_value(*modifier, "matrix", k3d::identity3())); // Setup matrices set_original_matrix(); set_coordinate_system_change_matrices(); } void transform_tool::transform_target::rotate(const k3d::matrix4& RotationMatrix, const k3d::point3& WorldCenter) { if(!modifier) start_rotation(); k3d::vector3 translation = WorldCenter - m_original_matrix * k3d::point3(0,0,0); const k3d::matrix4 current_coordinate_system_rotation = m_system_matrix * k3d::translate3(translation) * RotationMatrix * k3d::translate3(-translation) * m_system_matrix_inverse; assert_warning(k3d::property::set_internal_value(*modifier, "matrix", m_original_matrix * current_coordinate_system_rotation)); } void transform_tool::transform_target::start_scaling() { if(create_transform_modifier(k3d::classes::FrozenMatrix(), "Scale ")) assert_warning(k3d::property::set_internal_value(*modifier, "matrix", k3d::identity3())); // Setup matrices set_original_matrix(); set_coordinate_system_change_matrices(); } void transform_tool::transform_target::scale(const k3d::point3& Scaling, const k3d::point3& WorldCenter) { if(!modifier) start_scaling(); k3d::vector3 translation = WorldCenter - m_original_matrix * k3d::point3(0,0,0); const k3d::matrix4 current_coordinate_system_scaling = m_system_matrix * k3d::translate3(translation) * k3d::scale3(Scaling[0], Scaling[1], Scaling[2]) * k3d::translate3(-translation) * m_system_matrix_inverse; assert_warning(k3d::property::set_internal_value(*modifier, "matrix", m_original_matrix * current_coordinate_system_scaling)); } void transform_tool::transform_target::end_drag_motion() { } bool transform_tool::transform_target::create_transform_modifier(const k3d::uuid& Class, const std::string& Name) { if(modifier) return false; return_val_if_fail(node, false); // Check for an existing transform modifier k3d::inode* upstream_node = 0; k3d::imatrix_sink* const downstream_sink = dynamic_cast(node); return_val_if_fail(downstream_sink, false); k3d::iproperty& downstream_input = downstream_sink->matrix_sink_input(); k3d::iproperty* upstream_output = node->document().pipeline().dependency(downstream_input); // Check upstream object if(upstream_output) upstream_node = upstream_output->property_node(); /** \todo check for same name too */ if(upstream_node && (Class == upstream_node->factory().factory_id())) { set_transform_modifier(upstream_node); return false; } else if (upstream_node && dynamic_cast(upstream_node)) { k3d::ikeyframer* keyframer = dynamic_cast(upstream_node); k3d::iproperty& downstream_input2 = keyframer->input_property(); upstream_output = node->document().pipeline().dependency(downstream_input2); if(upstream_output) upstream_node = upstream_output->property_node(); if(upstream_node && (Class == upstream_node->factory().factory_id())) { set_transform_modifier(upstream_node); return false; } else { const std::string modifier_name = Name + node->name(); modifier = k3d::plugin::create(Class, node->document(), modifier_name); return_val_if_fail(modifier, false); k3d::ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&dynamic_cast(modifier)->matrix_sink_input(), upstream_output)); dependencies.insert(std::make_pair(&downstream_input2, &dynamic_cast(modifier)->matrix_source_output())); node->document().pipeline().set_dependencies(dependencies); return true; } } const std::string modifier_name = Name + node->name(); set_transform_modifier(insert_transform_modifier(*node, Class, modifier_name)); return true; } void transform_tool::transform_target::set_original_matrix() { return_if_fail(node && modifier); k3d::matrix4 node_input_matrix = boost::any_cast(k3d::property::pipeline_value(*node, "input_matrix")); k3d::matrix4 modifier_input_matrix = boost::any_cast(k3d::property::pipeline_value(*modifier, "input_matrix")); // Calculate the original matrix back from the current node matrix, in case it got changed by i.e. an animation track m_original_matrix = inverse(modifier_input_matrix) * node_input_matrix; } // mesh_target implementation transform_tool::mesh_target::mesh_target(document_state& DocumentState, k3d::inode* Node, k3d::iproperty& MeshSourceProperty) : m_document_state(DocumentState), mesh_source_property(MeshSourceProperty), component_center(k3d::point3(0, 0, 0)), m_mesh_changed(true), m_drag_mutex(false) { node = Node; // Sanity checks return_if_fail(node); // Connect to mesh_source change_signal to be acknowledged of changes m_mesh_change_signal = mesh_source_property.property_changed_signal().connect(sigc::mem_fun(*this, &transform_tool::mesh_target::mesh_changed)); reset_selection(); } k3d::point3 transform_tool::mesh_target::world_position() { if(!m_drag_mutex && m_mesh_changed) reset_selection(); return k3d::node_to_world_matrix(*node) * component_center; } unsigned long transform_tool::mesh_target::target_number() { return selected_points.size(); } void transform_tool::mesh_target::reset_selection() { if(m_drag_mutex) return; const k3d::mesh* const mesh = k3d::property::pipeline_value(mesh_source_property); return_if_fail(mesh); // Get selection component_center = detail::get_selected_points(selection::state(m_document_state.document()).current_mode(), *mesh, selected_points); // Set initial positions (needs to be a copy, since the given property is the output mesh) initial_positions = *mesh->points; m_mesh_changed = false; } void transform_tool::mesh_target::reset() { if(m_drag_mutex) return; // Reset position reset_selection(); modifier = 0; } void transform_tool::mesh_target::init_transformation() { set_coordinate_system_change_matrices(); } void transform_tool::mesh_target::start_move() { create_mesh_modifier("Move "); init_transformation(); m_origin = component_center; } void transform_tool::mesh_target::move(const k3d::vector3& Move) { if(!modifier) start_move(); m_drag_mutex = true; for(k3d::uint_t i = 0; i != selected_points.size(); ++i) point_positions.push_back(m_system_matrix * Move + initial_positions[selected_points[i]]); // Update manipulators position component_center = m_system_matrix * Move + m_origin; update_mesh_modifier(); } void transform_tool::mesh_target::start_rotation() { create_mesh_modifier("Rotate "); init_transformation(); } void transform_tool::mesh_target::rotate(const k3d::matrix4& RotationMatrix, const k3d::point3& WorldCenter) { if(!modifier) start_rotation(); m_drag_mutex = true; const k3d::matrix4 current_coordinate_system_rotation = m_system_matrix * RotationMatrix * m_system_matrix_inverse; const k3d::point3 center = k3d::inverse(k3d::node_to_world_matrix(*node)) * WorldCenter; for(k3d::uint_t i = 0; i != selected_points.size(); ++i) point_positions.push_back(current_coordinate_system_rotation * (initial_positions[selected_points[i]] - center) + center); update_mesh_modifier(); } void transform_tool::mesh_target::start_scaling() { create_mesh_modifier("Scale "); init_transformation(); } void transform_tool::mesh_target::scale(const k3d::point3& Scaling, const k3d::point3& WorldCenter) { if(!modifier) start_scaling(); m_drag_mutex = true; const k3d::matrix4 current_coordinate_system_scaling = m_system_matrix * k3d::scale3(Scaling[0], Scaling[1], Scaling[2]) * m_system_matrix_inverse; const k3d::point3 center = k3d::inverse(k3d::node_to_world_matrix(*node)) * WorldCenter; for(k3d::uint_t i = 0; i != selected_points.size(); ++i) point_positions.push_back(current_coordinate_system_scaling * (initial_positions[selected_points[i]] - center) + center); update_mesh_modifier(); } void transform_tool::mesh_target::end_drag_motion() { m_drag_mutex = false; } void transform_tool::mesh_target::create_mesh_modifier(const std::string& Name) { if (!modifier) { return_if_fail(node); // Modify with TweakPoints const k3d::uuid tweak_points(0xed302b87, 0x49bf4fe6, 0x99064963, 0x17ec12d9); // Check for an existing mesh modifier k3d::inode* upstream_node = upstream_mesh_modifier(*node); if(upstream_node && (tweak_points == upstream_node->factory().factory_id())) { set_transform_modifier(upstream_node); } else { const std::string modifier_name = Name + node->name() + " components"; set_transform_modifier(insert_mesh_modifier(*node, tweak_points, modifier_name)); } } } void transform_tool::mesh_target::update_mesh_modifier() { assert_warning(k3d::property::set_internal_value(*modifier, "tweaks", std::make_pair(selected_points, point_positions))); point_positions.clear(); } // transform_tool implementation transform_tool::~transform_tool() { for(connections_t::iterator connection = m_connections.begin(); connection != m_connections.end(); ++connection) { connection->disconnect(); } clear_targets(); } void transform_tool::lbutton_down(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::key_modifiers& Modifiers) { // Return if an action is in progress if(MOTION_CLICK_DRAG == m_current_motion) return; assert_warning(MOTION_NONE == m_current_motion); // Init action m_mouse_down_content = NOTHING; // Find what's under the mouse pointer k3d::selection::records picked_selectables; pick_selectables(picked_selectables, Viewport, Coordinates); // Shift modifier starts ADD action if(Modifiers.shift()) { lmb_down_add(); return; } // Control modifier starts SUBTRACT action if(Modifiers.control()) { lmb_down_subtract(); return; } // Manipulator selection starts move detail::manipulators_t manipulators; for(k3d::selection::records::iterator record = picked_selectables.begin(); record != picked_selectables.end(); ++record) { for(k3d::selection::record::tokens_t::const_iterator token = record->tokens.begin(); token != record->tokens.end(); ++token) { if(token->type == k3d::selection::USER1) manipulators.push_back(manipulator_name(token->id)); } } const std::string manipulator = get_manipulator(manipulators); if(manipulator != "") { lmb_down_manipulator(manipulator); return; } // If a node was hit ... if(k3d::selection::get_node(m_mouse_down_selection)) { if(selection::state(m_document_state.document()).is_selected(m_mouse_down_selection)) lmb_down_selected(); else lmb_down_deselected(); return; } lmb_down_nothing(); } // LMB down actions void transform_tool::lmb_down_add() { k3d::start_state_change_set(m_document, K3D_CHANGE_SET_CONTEXT); m_mouse_down_content = SELECTION_ADD; } void transform_tool::lmb_down_subtract() { k3d::start_state_change_set(m_document, K3D_CHANGE_SET_CONTEXT); m_mouse_down_content = SELECTION_SUBTRACT; } void transform_tool::lmb_down_manipulator(const std::string& ManipulatorName) { k3d::start_state_change_set(m_document, K3D_CHANGE_SET_CONTEXT); set_manipulator(ManipulatorName); set_motion(MOTION_DRAG); m_mouse_down_content = SELECTED_OBJECT; } void transform_tool::lmb_down_selected() { k3d::start_state_change_set(m_document, K3D_CHANGE_SET_CONTEXT); m_mouse_down_content = SELECTED_OBJECT; } void transform_tool::lmb_down_deselected() { k3d::start_state_change_set(m_document, K3D_CHANGE_SET_CONTEXT); m_mouse_down_content = DESELECTED_OBJECT; // Deselect all selection::state(m_document_state.document()).deselect_all(); // Select clicked object selection::state(m_document_state.document()).select(m_mouse_down_selection); } void transform_tool::lmb_down_nothing() { k3d::start_state_change_set(m_document, K3D_CHANGE_SET_CONTEXT); m_mouse_down_content = NOTHING; } void transform_tool::lbutton_click(viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_CLICK_DRAG == m_current_motion) { // Stop click-drag lmb_click_stop_motion(); return; } switch(m_mouse_down_content) { case SELECTION_ADD: lmb_click_add(Viewport, Coordinates); break; case SELECTION_SUBTRACT: lmb_click_subtract(Viewport, Coordinates); break; case SELECTED_OBJECT: lmb_click_start_motion(Coordinates); break; case DESELECTED_OBJECT: lmb_click_replace(Viewport, Coordinates); break; case NOTHING: lmb_click_deselect_all(); break; default: assert_not_reached(); } } // LMB click actions void transform_tool::lmb_click_add(viewport::control& Viewport, const k3d::point2& Coordinates) { // Shift key modifier always adds to the selection // interactive::move_pointer(Viewport, Coordinates); selection::state(m_document_state.document()).select(Viewport.pick_object(Coordinates, m_document_state.pick_backfacing())); k3d::finish_state_change_set(m_document, "Selection add", K3D_CHANGE_SET_CONTEXT); tool_selection::redraw_all(); } void transform_tool::lmb_click_subtract(viewport::control& Viewport, const k3d::point2& Coordinates) { // Control key modifier always adds to the selection // interactive::move_pointer(Viewport, Coordinates); selection::state(m_document_state.document()).deselect(Viewport.pick_object(Coordinates, m_document_state.pick_backfacing())); k3d::finish_state_change_set(m_document, "Selection subtract", K3D_CHANGE_SET_CONTEXT); tool_selection::redraw_all(); } void transform_tool::lmb_click_replace(viewport::control& Viewport, const k3d::point2& Coordinates) { // interactive::move_pointer(Viewport, Coordinates); selection::state(m_document_state.document()).select(Viewport.pick_object(Coordinates, m_document_state.pick_backfacing())); k3d::finish_state_change_set(m_document, "Selection replace", K3D_CHANGE_SET_CONTEXT); tool_selection::redraw_all(); } void transform_tool::lmb_click_start_motion(const k3d::point2& Coordinates) { disconnect_navigation_input_model(); set_motion(MOTION_CLICK_DRAG); begin_mouse_move(Coordinates); tool_selection::redraw_all(); } void transform_tool::lmb_click_stop_motion() { end_drag_motion(); const std::string label = complete_mouse_move(); k3d::finish_state_change_set(m_document, label, K3D_CHANGE_SET_CONTEXT); connect_navigation_input_model(); tool_selection::redraw_all(); } void transform_tool::lmb_click_deselect_all() { // Deselect all selection::state(m_document_state.document()).deselect_all(); k3d::finish_state_change_set(m_document, "Deselect all", K3D_CHANGE_SET_CONTEXT); tool_selection::redraw_all(); } void transform_tool::lbutton_start_drag(viewport::control& Viewport, const k3d::point2& Coordinates) { disconnect_navigation_input_model(); switch(m_mouse_down_content) { case SELECTED_OBJECT: case DESELECTED_OBJECT: lmb_start_drag_start_motion(Coordinates); break; case SELECTION_ADD: case SELECTION_SUBTRACT: case NOTHING: lmb_start_drag_box_select(Viewport, Coordinates); break; default: assert_not_reached(); } } // LMB start drag actions void transform_tool::lmb_start_drag_start_motion(const k3d::point2& Coordinates) { m_off_screen_offset = k3d::point2(0, 0); set_motion(MOTION_DRAG); begin_mouse_move(Coordinates); } void transform_tool::lmb_start_drag_box_select(viewport::control& Viewport, const k3d::point2& Coordinates) { set_motion(MOTION_BOX_SELECT); m_box_selection = k3d::rectangle(Coordinates[0], Coordinates[0], Coordinates[1], Coordinates[1]); draw_rubber_band(Viewport); } void transform_tool::lmb_drag_box_select(viewport::control& Viewport, const k3d::point2& Coordinates) { on_box_select_motion(Viewport, Coordinates); } void transform_tool::lbutton_end_drag(viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_DRAG == m_current_motion) lmb_end_drag_stop_motion(); else if(MOTION_BOX_SELECT == m_current_motion) lmb_end_drag_box_select(Viewport, Coordinates); connect_navigation_input_model(); } // LMB end drag actions void transform_tool::lmb_end_drag_stop_motion() { end_drag_motion(); const std::string label = complete_mouse_move(); k3d::finish_state_change_set(m_document, label, K3D_CHANGE_SET_CONTEXT); tool_selection::redraw_all(); } void transform_tool::lmb_end_drag_box_select(viewport::control& Viewport, const k3d::point2& Coordinates) { draw_rubber_band(Viewport); on_box_select_objects(Viewport, Coordinates, m_box_selection); // Stop motion set_motion(MOTION_NONE); k3d::finish_state_change_set(m_document, "Box selection", K3D_CHANGE_SET_CONTEXT); tool_selection::redraw_all(); } void transform_tool::mbutton_click(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::key_modifiers& Modifiers) { // Motion mode if(MOTION_NONE != m_current_motion) { mmb_click_next_constraint(Viewport, Coordinates); return; } // We aren't moving if(Modifiers.control()) { mmb_click_switch_coordinate_system(); } else if(Modifiers.shift()) { mmb_click_manipulators_next_selection(); } else { mmb_click_toggle_manipulators_visibility(); } } void transform_tool::mmb_click_toggle_manipulators_visibility() { // Toggle the visible state of the manipulators m_visible_manipulators.set_value(!m_visible_manipulators.internal_value()); tool_selection::redraw_all(); } void transform_tool::mmb_click_manipulators_next_selection() { // Show manipulators on the next selection m_current_target = m_targets.size() ? (m_current_target + 1) % m_targets.size() : 0; tool_selection::redraw_all(); } void transform_tool::mmb_click_switch_coordinate_system() { // Switch coordinate system between global and local modes switch(m_coordinate_system.internal_value()) { case GLOBAL: set_coordinate_system(LOCAL); break; case LOCAL: set_coordinate_system(GLOBAL); break; default: break; } tool_selection::redraw_all(); } void transform_tool::mmb_click_next_constraint(viewport::control& Viewport, const k3d::point2& Coordinates) { // Set next constraint update_constraint(Viewport, Coordinates); /* // Mouse warp const k3d::point2 coords = Viewport.project(world_position()); int root_x = 0; int root_y = 0; Viewport.get_window()->get_origin(root_x, root_y); const k3d::point2 screen_coords = k3d::point2(coords[0] + root_x, coords[1] + root_y); // We temporarily disable motion, so warping the pointer doesn't cause unintended side effects const motion_t current_motion = m_current_motion; m_current_motion = MOTION_NONE; interactive::warp_pointer(screen_coords); handle_pending_events(); // Acknowledge new mouse position m_current_constraint->begin_mouse_move(coords); m_current_motion = current_motion; */ tool_selection::redraw_all(); } void transform_tool::rbutton_click(const viewport::control& Viewport, const k3d::point2& Coordinates) { if(MOTION_NONE == m_current_motion) rmb_click_selection_tool(); else rmb_click_cancel_move(); } // RMB click actions void transform_tool::rmb_click_selection_tool() { k3d::start_state_change_set(m_document, K3D_CHANGE_SET_CONTEXT); m_document_state.set_active_tool(m_document_state.selection_tool()); k3d::finish_state_change_set(m_document, "Selection tool", K3D_CHANGE_SET_CONTEXT); tool_selection::redraw_all(); } void transform_tool::rmb_click_cancel_move() { cancel_mouse_move(); tool_selection::redraw_all(); } void transform_tool::cancel_mouse_move() { // Stop motion set_motion(MOTION_NONE); end_drag_motion(); // Undo changes k3d::cancel_state_change_set(m_document, K3D_CHANGE_SET_CONTEXT); // Reset targets for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->reset(); reset(); tool_selection::redraw_all(); } std::string transform_tool::complete_mouse_move() { set_motion(MOTION_NONE); return get_constraint_name(); } void transform_tool::set_motion(const motion_t Motion) { m_current_motion = Motion; } /// Returns current target's world position k3d::point3 transform_tool::world_position() { if(target_number()) { if(selection::NODE == selection::state(m_document_state.document()).current_mode()) { m_current_target = m_current_target % m_targets.size(); itarget* t = m_targets[m_current_target]; return t->world_position(); } else { k3d::point3 position(0, 0, 0); unsigned long count = 0; for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) { if((*target)->target_number()) { position += to_vector((*target)->world_position()); count++; } } position /= static_cast(count); return position; } } return k3d::point3(0, 0, 0); } /// Returns current target's world orientation k3d::matrix4 transform_tool::world_orientation() { if(target_number()) { m_current_target = m_current_target % m_targets.size(); itarget* t = m_targets[m_current_target]; return t->world_orientation(); } return k3d::identity3(); } void transform_tool::update_manipulators_scale(viewport::control& Viewport, const k3d::point3& Origin) { k3d::icamera* camera = Viewport.camera(); return_if_fail(camera); // Project unit axis on screen space const k3d::matrix4 screen_matrix = k3d::node_to_world_matrix(*Viewport.camera()); const k3d::vector3 screen_parallel = screen_matrix * k3d::vector3(1, 0, 0); const k3d::point2 position = Viewport.project(Origin); const k3d::point2 x_axis = Viewport.project(Origin + screen_parallel); const double length = k3d::distance(position, x_axis); return_if_fail(length); m_manipulators_scale = m_manipulators_size / length; } bool transform_tool::front_facing(viewport::control& Viewport, const k3d::vector3& Normal, const k3d::point3& Origin) { return_val_if_fail(Viewport.gl_engine(), false); return_val_if_fail(Viewport.camera(), false); const k3d::matrix4 matrix = k3d::inverse(k3d::node_to_world_matrix(*Viewport.camera())); const k3d::matrix4 orientation = world_orientation(); const k3d::point3 a = Origin + (orientation * Normal); const k3d::point3 b = Origin + (orientation * -Normal); return k3d::to_vector(matrix * a).length2() < k3d::to_vector(matrix * b).length2(); } void transform_tool::off_screen_warp(viewport::control& Viewport, k3d::point2& NewCoordinates) { // Get mouse coordinates int x, y; Gdk::ModifierType modifiers; Gdk::Display::get_default()->get_pointer(x, y, modifiers); k3d::point2 mouse(x, y); // Check for screen warp bool screen_warp = false; const k3d::point2 previous_offset = m_off_screen_offset; // Wrap the mouse if it goes off the top-or-bottom of the screen ... const int screen_height = Gdk::Display::get_default()->get_default_screen()->get_height(); if(y == 0) { mouse = k3d::point2(mouse[0], screen_height - 2); screen_warp = true; m_off_screen_offset[1] -= screen_height; } else if(screen_height - 1 == y) { mouse = k3d::point2(mouse[0], 1); screen_warp = true; m_off_screen_offset[1] += screen_height; } // Wrap the mouse if it goes off the left-or-right of the screen ... const int screen_width = Gdk::Display::get_default()->get_default_screen()->get_width(); if(x == 0) { mouse = k3d::point2(screen_width - 2, mouse[1]); screen_warp = true; m_off_screen_offset[0] -= screen_width; } else if(screen_width - 1 == x) { mouse = k3d::point2(1, mouse[1]); screen_warp = true; m_off_screen_offset[0] += screen_width; } if(!screen_warp) { // No warp NewCoordinates += k3d::to_vector(m_off_screen_offset); } else { // Warp mouse pointer interactive::warp_pointer(mouse); // Set new position NewCoordinates += k3d::to_vector(previous_offset); } } void transform_tool::clear_targets() { for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) { delete *target; } m_targets.clear(); } /// Retrieves the current document selection, refreshing the target list void transform_tool::get_current_selection() { // Convert the current document selection into the set of targets to be moved interactively clear_targets(); const k3d::nodes_t nodes = selection::state(m_document_state.document()).selected_nodes(); if(selection::NODE == selection::state(m_document_state.document()).current_mode()) { // Save transformable nodes as targets for(k3d::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { if(!dynamic_cast(*node)) continue; if(!dynamic_cast(*node)) continue; m_targets.push_back(new transform_target(*node)); m_connections.push_back((*node)->deleted_signal().connect(sigc::mem_fun(*this, &transform_tool::target_list_changed))); } } else { // Component mode : save mesh nodes as targets for(k3d::nodes_t::const_iterator node = nodes.begin(); node != nodes.end(); ++node) { if(!dynamic_cast(*node)) continue; // Get node's mesh k3d::imesh_source* const mesh_source = dynamic_cast(*node); if(!mesh_source) continue; // Get non-transformed mesh output k3d::iproperty& property = mesh_source->mesh_source_output(); m_targets.push_back(new mesh_target(m_document_state, *node, property)); m_connections.push_back((*node)->deleted_signal().connect(sigc::mem_fun(*this, &transform_tool::target_list_changed))); } } update_coordinate_system(0); } unsigned long transform_tool::target_number() { unsigned long target_count = 0; for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) target_count += (*target)->target_number(); return target_count; } void transform_tool::update_targets() { // Update selection on new or deleted node(s) if(m_node_selection_changed) { get_current_selection(); m_node_selection_changed = false; } } void transform_tool::start_move() { for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->start_move(); } void transform_tool::move_targets(const k3d::vector3& Move) { for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->move(Move); tool_selection::redraw_all(); } void transform_tool::start_rotation() { for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->start_rotation(); } void transform_tool::rotate_targets(const k3d::matrix4& Rotation) { if(!m_targets.size()) return; for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->rotate(Rotation, world_position()); tool_selection::redraw_all(); } void transform_tool::start_scaling() { for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->start_scaling(); } void transform_tool::scale_targets(const k3d::point3& Scaling) { if(!m_targets.size()) return; for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->scale(Scaling, world_position()); tool_selection::redraw_all(); } void transform_tool::end_drag_motion() { for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->end_drag_motion(); } void transform_tool::set_coordinate_system(const coordinate_system_t CoordinateSystem) { m_coordinate_system.set_value(CoordinateSystem); } /// Updates all targets : tells them what's the new coordinate system void transform_tool::update_coordinate_system(k3d::iunknown*) { switch(m_coordinate_system.internal_value()) { case GLOBAL: for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->set_global(); break; case LOCAL: for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->set_local(); break; case PARENT: for(targets_t::iterator target = m_targets.begin(); target != m_targets.end(); ++target) (*target)->set_parent(); break; default: assert_not_reached(); } tool_selection::redraw_all(); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/transform_tool.h ================================================ #ifndef K3DSDK_NGUI_TRANSFORM_TOOL_H #define K3DSDK_NGUI_TRANSFORM_TOOL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) \author Romain Behar (romainbehar@yahoo.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { typedef std::vector manipulators_t; // typedef struct // { // unsigned long index; // k3d::point3 initial_position; // k3d::point3 tweak_value; // } component_point_t; typedef k3d::mesh::indices_t component_points_t; /// Lists selected points in a mesh and returns average component position k3d::point3 get_selected_points(selection::mode SelectionMode, const k3d::mesh& Mesh, component_points_t& PointList); template class imanipulators { public: virtual ~imanipulators() {} virtual void activate() = 0; virtual void redraw(viewport::control& Viewport, const bool Visible, const k3d::point3& Position, const k3d::matrix4& Orientation, tool_selection::motion_t Motion, const k3d::point3& Scaling) = 0; virtual void select(viewport::control& Viewport, const k3d::point3& Position, const k3d::matrix4& Orientation) = 0; virtual std::string get_constraint_name() = 0; virtual Glib::RefPtr set_constraint(const std::string& Name) = 0; virtual std::string constraint_name(const k3d::selection::id ID) = 0; virtual void update_constraint(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) = 0; virtual void begin_mouse_move(const k3d::point2& Coordinates, const k3d::point3& Origin) = 0; virtual Type mouse_move(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::point3& Position, const k3d::matrix4& Orientation) = 0; }; double manipulators_scale(viewport::control& Viewport, const k3d::point3& Origin, const double Size); /// Returns whether given direction faces the screen bool is_front_facing(viewport::control& Viewport, const k3d::vector3& Normal, const k3d::point3& Origin, const k3d::matrix4& Orientation); } // namespace detail ///////////////////////////////////////////////////////////////////////////// // transform_tool class transform_tool : public tool, public tool_selection, public k3d::property_collection { typedef tool tool_base; typedef tool_selection tool_selection_base; public: transform_tool(k3d::idocument& Document, document_state& DocumentState, const std::string& Name) : tool_base(DocumentState, Name), tool_selection_base(Document, DocumentState), k3d::property_collection(), m_document(Document), m_document_state(DocumentState), m_navigation_model(DocumentState), m_current_target(0), m_node_selection_changed(false), m_coordinate_system(init_owner(*this) + init_name("coordinate_system") + init_label(_("Coordinate system")) + init_description(_("Coordinate system in which the transformation occurs")) + init_value(GLOBAL) + init_enumeration(coordinate_system_values())), m_visible_manipulators(init_owner(*this) + init_name("visible_manipulators") + init_label(_("Visible manipulators")) + init_description(_("Shows/hides manipulators")) + init_value(true)) { m_coordinate_system.changed_signal().connect(sigc::mem_fun(*this, &transform_tool::update_coordinate_system)); m_visible_manipulators.changed_signal().connect(sigc::mem_fun(*this, &tool_selection::redraw_all)); connect_navigation_input_model(); } virtual ~transform_tool(); // Interface required for data containers k3d::idocument& document() { return m_document; } navigation_input_model& navigation_model() { return m_navigation_model; } basic_viewport_input_model& input_model() { return m_input_model; } // Functions executed by transform_tool that rely on transform_tool's derived classes functions virtual std::string manipulator_name(const k3d::selection::id ID) = 0; typedef std::vector manipulators_t; virtual std::string get_manipulator(const manipulators_t& Manipulators) = 0; virtual void set_manipulator(const std::string ManipulatorName) = 0; virtual std::string get_constraint_name() = 0; virtual void begin_mouse_move(const k3d::point2& Coordinates) = 0; virtual void update_constraint(viewport::control& Viewport, const k3d::point2& Coordinates) = 0; virtual void reset() = 0; protected: typedef std::vector connections_t; sigc::connection m_mbutton_start_drag_signal; sigc::connection m_mbutton_drag_signal; sigc::connection m_mbutton_end_drag_signal; sigc::connection m_rbutton_start_drag_signal; sigc::connection m_rbutton_drag_signal; sigc::connection m_rbutton_end_drag_signal; sigc::connection m_scroll_signal; void connect_navigation_input_model() { m_mbutton_start_drag_signal = m_input_model.connect_mbutton_start_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button1_start_drag)); m_mbutton_drag_signal = m_input_model.connect_mbutton_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button1_drag)); m_mbutton_end_drag_signal = m_input_model.connect_mbutton_end_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button1_end_drag)); m_rbutton_start_drag_signal = m_input_model.connect_rbutton_start_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button2_start_drag)); m_rbutton_drag_signal = m_input_model.connect_rbutton_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button2_drag)); m_rbutton_end_drag_signal = m_input_model.connect_rbutton_end_drag(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_button2_end_drag)); m_scroll_signal = m_input_model.connect_scroll(sigc::mem_fun(m_navigation_model, &navigation_input_model::on_scroll)); } void disconnect_navigation_input_model() { m_mbutton_start_drag_signal.disconnect(); m_mbutton_drag_signal.disconnect(); m_mbutton_end_drag_signal.disconnect(); m_rbutton_start_drag_signal.disconnect(); m_rbutton_drag_signal.disconnect(); m_rbutton_end_drag_signal.disconnect(); m_scroll_signal.disconnect(); } /// Mouse handling functions void lbutton_down(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::key_modifiers& Modifiers); void lmb_down_add(); void lmb_down_subtract(); void lmb_down_manipulator(const std::string& ManipulatorName); void lmb_down_selected(); void lmb_down_deselected(); void lmb_down_nothing(); void lbutton_click(viewport::control& Viewport, const k3d::point2& Coordinates); void lmb_click_add(viewport::control& Viewport, const k3d::point2& Coordinates); void lmb_click_subtract(viewport::control& Viewport, const k3d::point2& Coordinates); void lmb_click_replace(viewport::control& Viewport, const k3d::point2& Coordinates); void lmb_click_start_motion(const k3d::point2& Coordinates); void lmb_click_stop_motion(); void lmb_click_deselect_all(); void lbutton_start_drag(viewport::control& Viewport, const k3d::point2& Coordinates); void lmb_start_drag_start_motion(const k3d::point2& Coordinates); void lmb_start_drag_box_select(viewport::control& Viewport, const k3d::point2& Coordinates); void lmb_drag_box_select(viewport::control& Viewport, const k3d::point2& Coordinates); void lbutton_end_drag(viewport::control& Viewport, const k3d::point2& Coordinates); void lmb_end_drag_stop_motion(); void lmb_end_drag_box_select(viewport::control& Viewport, const k3d::point2& Coordinates); void mbutton_click(viewport::control& Viewport, const k3d::point2& Coordinates, const k3d::key_modifiers& Modifiers); void mmb_click_toggle_manipulators_visibility(); void mmb_click_manipulators_next_selection(); void mmb_click_switch_coordinate_system(); void mmb_click_next_constraint(viewport::control& Viewport, const k3d::point2& Coordinates); void rbutton_click(const viewport::control& Viewport, const k3d::point2& Coordinates); void rmb_click_selection_tool(); void rmb_click_cancel_move(); void cancel_mouse_move(); std::string complete_mouse_move(); // Common functions /** \todo standardize set_motion in selection tool and transform tools */ void set_motion(const motion_t Motion); virtual k3d::point3 world_position(); k3d::matrix4 world_orientation(); /// Manipulators scale to adjust to viewport size double m_manipulators_scale; /// Updates manipulators scale to show at constant size after camera update void update_manipulators_scale(viewport::control& Viewport, const k3d::point3& Origin); /// Returns whether given direction faces the screen bool front_facing(viewport::control& Viewport, const k3d::vector3& Normal, const k3d::point3& Origin); /// Handles off-screen pointer warping during mouse drag void off_screen_warp(viewport::control& Viewport, k3d::point2& NewCoordinates); /// Keep an offset to compute mouse coordinates in an infinite virtual screen k3d::point2 m_off_screen_offset; /// Deletes all targets void clear_targets(); /// Stores whether target list was updated void target_list_changed() { m_node_selection_changed = true; } /// Retrieves the current document selection, refreshing the target list void get_current_selection(); /// Returns the number of selected targets (nodes or components depending on selection mode) unsigned long target_number(); /// Updates target list whenever necessary (e.g. : one of them was deleted) void update_targets(); /// Transform targets void start_move(); void start_rotation(); void start_scaling(); void move_targets(const k3d::vector3& Delta); void rotate_targets(const k3d::matrix4& Rotation); void scale_targets(const k3d::point3& Scaling); void end_drag_motion(); private: /// Stores an object to be moved interactively class itarget { public: itarget() : current_system_type(GLOBAL), modifier(0) { } virtual ~itarget(); // Returns selected target number virtual unsigned long target_number() = 0; // Resets move virtual void reset() = 0; // Update coordinate system void set_local() { current_system_type = LOCAL; reset(); } void set_global() { current_system_type = GLOBAL; reset(); } void set_parent() { current_system_type = PARENT; reset(); } // World parameters virtual k3d::point3 world_position() = 0; k3d::matrix4 world_orientation(); // Modifier void set_transform_modifier(k3d::inode* Modifier); void reset_transform_modifier(); // Actions virtual void start_move() = 0; virtual void start_rotation() = 0; virtual void start_scaling() = 0; virtual void move(const k3d::vector3& Delta) = 0; virtual void rotate(const k3d::matrix4& RotationMatrix, const k3d::point3& WorldCenter) = 0; virtual void scale(const k3d::point3& Delta, const k3d::point3& WorldCenter) = 0; virtual void end_drag_motion() = 0; protected: void set_coordinate_system_change_matrices(); typedef enum { GLOBAL, LOCAL, PARENT } system_t; /// Stores the transformation type system_t current_system_type; /// Stores the target node k3d::inode* node; /// Stores the transformation to be applied k3d::inode* modifier; /// Stores initial position k3d::point3 m_origin; /// Stores manipulators matrix k3d::matrix4 m_manipulator_orientation; /// Stores coordinate system change matrices k3d::matrix4 m_system_matrix; k3d::matrix4 m_system_matrix_inverse; /// Connections made that need cleaning up connections_t m_connections; }; class transform_target : public itarget { public: transform_target(k3d::inode* Node); virtual k3d::point3 world_position(); virtual unsigned long target_number(); virtual void reset(); virtual void start_move(); virtual void start_rotation(); virtual void start_scaling(); virtual void move(const k3d::vector3& Delta); virtual void rotate(const k3d::matrix4& RotationMatrix, const k3d::point3& WorldCenter); virtual void scale(const k3d::point3& Delta, const k3d::point3& WorldCenter); virtual void end_drag_motion(); /// Inserts a transform modifier bool create_transform_modifier(const k3d::uuid& Class, const std::string& Name); private: /// Stores modifier's original matrix k3d::matrix4 m_original_matrix; /// Sets the original matrix, using the current state of the pipeline void set_original_matrix(); }; class mesh_target : public itarget { public: mesh_target(document_state& DocumentState, k3d::inode* Node, k3d::iproperty& MeshSourceProperty); ~mesh_target() { m_mesh_change_signal.disconnect(); } virtual k3d::point3 world_position(); virtual unsigned long target_number(); virtual void reset(); virtual void start_move(); virtual void start_rotation(); virtual void start_scaling(); virtual void move(const k3d::vector3& Delta); virtual void rotate(const k3d::matrix4& RotationMatrix, const k3d::point3& WorldCenter); virtual void scale(const k3d::point3& Delta, const k3d::point3& WorldCenter); virtual void end_drag_motion(); private: void reset_selection(); /// Inserts a tweak modifier void create_mesh_modifier(const std::string& Name); /// Updates the mesh modifier with the new tweaks void update_mesh_modifier(); /// Initialize the transformation void init_transformation(); /// Stores the owning document_state document_state& m_document_state; /// Stores the mesh_source property instead of the mesh itself because the k3d::mesh pointer can change k3d::iproperty& mesh_source_property; /// Stores the average component position k3d::point3 component_center; /// Stores the list of selected points with their index detail::component_points_t selected_points; /// Stores the new point positions, for each selected point k3d::mesh::points_t point_positions; /// Initial positions k3d::mesh::points_t initial_positions; /// Mesh change signal sigc::connection m_mesh_change_signal; /// Stores whether the mesh changed bool m_mesh_changed; /// Called by m_mesh_change_signal void mesh_changed(k3d::iunknown*) { m_mesh_changed = true; } /// Mutex to prevent unnecessary updates during drag action bool m_drag_mutex; /// Stores modifier's original matrix k3d::matrix4 m_original_matrix; }; /// Defines a collection of objects to be manipulated interactively typedef std::vector targets_t; /// Stores the current set of objects to be manipulated interactively targets_t m_targets; /// Enumerates coordinate-system behaviors typedef enum { LOCAL, GLOBAL, PARENT } coordinate_system_t; void set_coordinate_system(const coordinate_system_t CoordinateSystem); void update_coordinate_system(k3d::iunknown*); protected: /// Stores the owning document k3d::idocument& m_document; document_state& m_document_state; /// Provides interactive navigation behavior navigation_input_model m_navigation_model; /// Dispatches incoming user input events basic_viewport_input_model m_input_model; /// Stores manipulators size double m_manipulators_size; /// Stores the target number used to provide local coordinates unsigned long m_current_target; /// Set to true when target list changes bool m_node_selection_changed; /// Defines coordinate system enumeration property friend std::ostream& operator << (std::ostream& Stream, const coordinate_system_t& Value) { switch(Value) { case LOCAL: Stream << "local"; break; case GLOBAL: Stream << "global"; break; case PARENT: Stream << "parent"; break; } return Stream; } friend std::istream& operator >> (std::istream& Stream, coordinate_system_t& Value) { std::string text; Stream >> text; if(text == "local") Value = LOCAL; else if(text == "global") Value = GLOBAL; else if(text == "parent") Value = PARENT; else k3d::log() << k3d_file_reference << ": unknown enumeration [" << text << "]" << std::endl; return Stream; } static const k3d::ienumeration_property::enumeration_values_t& coordinate_system_values() { static k3d::ienumeration_property::enumeration_values_t values; if(values.empty()) { values.push_back(k3d::ienumeration_property::enumeration_value_t("Local", "local", "Moves objects in local coordinate system")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Global", "global", "Moves objects in global coordinate system")); values.push_back(k3d::ienumeration_property::enumeration_value_t("Parent", "parent", "Moves objects in parent's coordinate system")); } return values; } /// Stores the current coordinate system behavior k3d_data(coordinate_system_t, immutable_name, change_signal, with_undo, local_storage, no_constraint, enumeration_property, no_serialization) m_coordinate_system; /// Stores the enabled/disabled state for the manipulators k3d_data(bool, immutable_name, change_signal, with_undo, local_storage, no_constraint, writable_property, no_serialization) m_visible_manipulators; connections_t m_connections; }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_TRANSFORM_TOOL_H ================================================ FILE: k3dsdk/ngui/undo_utility.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead */ #include #include namespace k3d { namespace ngui { const parent_nodes_t parent_nodes(const k3d::istate_recorder::node* const Node) { parent_nodes_t results; for(const k3d::istate_recorder::node* node = Node; node; node = node->parent) results.push_back(node); std::reverse(results.begin(), results.end()); return results; } const k3d::istate_recorder::node* next_redo(k3d::istate_recorder& StateRecorder) { const k3d::istate_recorder::node* const current_node = StateRecorder.current_node(); // First, see if the current node is located anywhere within the ancestry of the // most-recently-created node. If it is, head in that direction ... const parent_nodes_t recent_nodes = parent_nodes(StateRecorder.newest_node()); parent_nodes_t::const_iterator i = std::find(recent_nodes.begin(), recent_nodes.end(), current_node); if(i != recent_nodes.end() && ++i != recent_nodes.end()) return *i; // ... otherwise, if we're no longer on the path to the most-recently-created node, // "follow the local terrain" by following the most recent branches ... if(current_node) { if(current_node->children.size()) return current_node->children.back(); } else { if(StateRecorder.root_nodes().size()) return StateRecorder.root_nodes().back(); } return 0; } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/undo_utility.h ================================================ #ifndef K3DSDK_NGUI_UNDO_UTILITY_H #define K3DSDK_NGUI_UNDO_UTILITY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead */ #include #include namespace k3d { namespace ngui { /// Defines an ordered collection of undo/redo hierarchy nodes typedef std::vector parent_nodes_t; /// Returns the set of nodes that are parents of the given node, ordered from parent -> child (could return empty collection) const parent_nodes_t parent_nodes(const k3d::istate_recorder::node* const Node); /// Given the state recorder for a document, returns the child that should be used by default for the next redo (if any, could return NULL) const k3d::istate_recorder::node* next_redo(k3d::istate_recorder& StateRecorder); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_UNDO_UTILITY_H ================================================ FILE: k3dsdk/ngui/unknown.xpm ================================================ /* XPM */ static const char* unknown_xpm[] = { "16 16 1 1", " c None", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "}; ================================================ FILE: k3dsdk/ngui/unsaved_document.h ================================================ #ifndef K3DSDK_NGUI_UNSAVED_DOCUMENT_H #define K3DSDK_NGUI_UNSAVED_DOCUMENT_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace ngui { ////////////////////////////////////////////////////////////////////////////////////////// // unsaved_document /// Abstract interface class for UI components that may encapsulate an unsaved document class unsaved_document { public: /// Returns true iff there are unsaved changes to the underlying document. virtual const bool_t unsaved_changes() = 0; /// Return a human-readable title for the underlying document. virtual const string_t unsaved_document_title() = 0; /// Save the underlying document, returning true if it was saved successfully. Implementations may need to the prompt the user for a filename, and should return false if the user cancels file selection. virtual const bool_t save_unsaved_changes() = 0; protected: unsaved_document() {} unsaved_document(const unsaved_document&) {} unsaved_document& operator=(const unsaved_document&) { return *this; } virtual ~unsaved_document() {} }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_UNSAVED_DOCUMENT_H ================================================ FILE: k3dsdk/ngui/uri.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { namespace ngui { namespace uri { void open(const std::string& URI) { // Look for any plugins that could be used ... const plugin::factory::collection_t factories = plugin::factory::lookup(); if(factories.empty()) { k3d::ngui::error_message(k3d::string_cast(boost::format(_("Couldn't display %1%")) % URI), _("No plugin is available to open URIs.")); return; } for(plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { boost::scoped_ptr handler(k3d::plugin::create(**factory)); if(handler) { if(handler->open_uri(URI)) return; } } k3d::ngui::error_message(k3d::string_cast(boost::format(_("Couldn't display %1%")) % URI), _("No application is configured to handle the given URI.")); } } // namespace uri } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/uri.h ================================================ #ifndef K3DSDK_NGUI_URI_H #define K3DSDK_NGUI_URI_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { namespace uri { /// Asynchronously displays a URI in the user's choice of application, displays an error message otherwise void open(const std::string& URI); } // namespace uri } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_URI_H ================================================ FILE: k3dsdk/ngui/utility.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { bool sleep_callback(bool* Done) { *Done = true; return false; } const k3d::filesystem::path share_path() { return k3d::share_path() / k3d::filesystem::generic_path("ngui/pixmap"); } } // namespace detail void handle_pending_events() { while(Gtk::Main::events_pending()) Gtk::Main::iteration(); } void non_blocking_sleep(const double Seconds) { bool done = false; Glib::signal_timeout().connect( sigc::bind(sigc::ptr_fun(detail::sleep_callback), &done), static_cast(1000 * Seconds)); while(!done) handle_pending_events(); } Glib::RefPtr load_pixbuf(const k3d::filesystem::path& Path) { return load_pixbuf(detail::share_path(), Path); } Glib::RefPtr load_pixbuf(const k3d::filesystem::path& SharePath, const k3d::filesystem::path& Path) { Glib::RefPtr result; const k3d::filesystem::path path = SharePath / Path; try { result = Gdk::Pixbuf::create_from_file(path.native_filesystem_string()); } catch(Glib::Exception& e) { k3d::log() << error << e.what() << std::endl; } catch(std::exception& e) { k3d::log() << error << e.what() << std::endl; } catch(...) { k3d::log() << error << "Unknown exception loading [" << path.native_console_string() << "]" << std::endl; } return result; } /// Converts a k3d::color to a Gdk::Color const Gdk::Color convert(const k3d::color& RHS) { Gdk::Color result; result.set_rgb_p(RHS.red, RHS.green, RHS.blue); return result; } /// Converts a Gdk::Color to a k3d::color const k3d::color convert(const Gdk::Color& RHS) { return k3d::color(RHS.get_red_p(), RHS.get_green_p(), RHS.get_blue_p()); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/utility.h ================================================ #ifndef K3DSDK_NGUI_UTILITY_H #define K3DSDK_NGUI_UTILITY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your argument) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace Gdk { class Pixbuf; } namespace k3d { namespace filesystem { class path; } } namespace k3d { namespace ngui { /// Processes any pending user interface events void handle_pending_events(); /// Provides a portable sleep() that doesn't block processing of UI events void non_blocking_sleep(const double Seconds); /// Loads a pixbuf from disk, with error-handling Glib::RefPtr load_pixbuf(const k3d::filesystem::path& Path); /// Loads a pixbuf from disk, with error-handling Glib::RefPtr load_pixbuf(const k3d::filesystem::path& SharePath, const k3d::filesystem::path& Path); /// Converts a k3d::color to a Gdk::Color const Gdk::Color convert(const k3d::color& RHS); /// Converts a Gdk::Color to a k3d::color const k3d::color convert(const Gdk::Color& RHS); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_UTILITY_H ================================================ FILE: k3dsdk/ngui/viewport.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace k3d::selection; namespace k3d { namespace ngui { namespace viewport { namespace detail { /// Defines storage for a collection of OpenGL hit records typedef std::vector gl_selection_buffer_t; const k3d::gl::selection_state select_nodes() { k3d::gl::selection_state result; result.select_backfacing = true; result.select_component.insert(k3d::selection::CURVE); result.select_component.insert(k3d::selection::FACE); result.select_component.insert(k3d::selection::PATCH); result.select_component.insert(k3d::selection::POINT); result.select_component.insert(k3d::selection::EDGE); result.select_component.insert(k3d::selection::SURFACE); return result; } struct sort_by_zmin { bool operator()(const k3d::selection::record& LHS, const k3d::selection::record& RHS) { return LHS.zmin < RHS.zmin; } }; /// Wrapper class for OpenGL hit records - designed to resemble an STL container class hit_record { public: explicit hit_record(GLuint* const Storage) : m_storage(Storage) { assert(m_storage); } /// Returns the minimum Z depth of the hit GLuint zmin() const { return *(m_storage+1); } /// Returns the maximum Z depth of the hit GLuint zmax() const { return *(m_storage+2); } /// Returns true iff the hit was empty (i.e. doesn't contain any names) bool empty() const { return 0 == size(); } /// Returns the number of names contained in the hit unsigned int size() const { return *m_storage; } /// Defines an iterator type for accessing hit names typedef GLuint* const_name_iterator; /// Returns an iterator designating the beginning of the range of hit names const_name_iterator name_begin() const { return m_storage+3; } /// Returns an iterator designating one-past-the-end of the range of hit names const_name_iterator name_end() const { return m_storage+3+size(); } /// Defines a strict ordering for non-empty hit records based on minimum Z depth, since we typically want to find the "closest" hit friend bool operator<(const hit_record& LHS, const hit_record& RHS) { if(LHS.empty()) return false; return LHS.zmin() < RHS.zmin(); } private: GLuint* const m_storage; }; /// Input iterator that extracts objects of type hit_record from a flat buffer class hit_iterator { public: hit_iterator() : m_current(0), m_remaining(0) { } hit_iterator(gl_selection_buffer_t& Buffer, const unsigned int HitCount) : m_current(HitCount ? &Buffer[0] : 0), m_remaining(HitCount) { } hit_record operator*() const { return hit_record(m_current); } hit_record operator->() const { return hit_record(m_current); } hit_iterator& operator++() { if(m_remaining) { if(0 == --m_remaining) m_current = 0; else m_current += (3 + hit_record(m_current).size()); } return *this; } hit_iterator operator++(int) { hit_iterator temp(*this); this->operator++(); return temp; } friend bool operator == (const hit_iterator& LHS, const hit_iterator& RHS) { return LHS.m_current == RHS.m_current; } friend bool operator != (const hit_iterator& LHS, const hit_iterator& RHS) { return !(LHS == RHS); } private: GLuint* m_current; unsigned int m_remaining; }; /// Convenience function used to choose whichever point is closest to the given window coordinates void select_nearest_point(const k3d::mesh::points_t& Points, const k3d::selection::id Point, const k3d::point2& Coordinates, const k3d::double_t ScreenHeight, const GLdouble ModelViewMatrix[16], const GLdouble ProjectionMatrix[16], const GLint Viewport[4], k3d::selection::id& OutputPoint, k3d::double_t& OutputDistance) { k3d::point2 coords; k3d::double_t unused; gluProject( Points[Point][0], Points[Point][1], Points[Point][2], ModelViewMatrix, ProjectionMatrix, Viewport, &coords[0], &coords[1], &unused); coords[1] = ScreenHeight - coords[1]; const k3d::double_t distance = (coords - Coordinates).length2(); if(distance < OutputDistance) { OutputPoint = Point; OutputDistance = distance; } } /// Convenience function used to choose whichever edge is closest to the given window coordinates void select_nearest_edge(const k3d::mesh::indices_t& EdgePoints, const k3d::mesh::indices_t& ClockwiseEdges, const k3d::mesh::points_t& Points, const k3d::selection::id Edge, const k3d::point2& Coordinates, const k3d::double_t ScreenHeight, const GLdouble ModelViewMatrix[16], const GLdouble ProjectionMatrix[16], const GLint Viewport[4], k3d::selection::id& OutputEdge, k3d::double_t& OutputDistance) { k3d::double_t x1, y1, x2, y2; k3d::double_t unused; // First edge end : S1 gluProject( Points[EdgePoints[Edge]][0], Points[EdgePoints[Edge]][1], Points[EdgePoints[Edge]][2], ModelViewMatrix, ProjectionMatrix, Viewport, &x1, &y1, &unused); const k3d::point2 S1(x1, ScreenHeight - y1); // Second edge end : S2 gluProject( Points[EdgePoints[ClockwiseEdges[Edge]]][0], Points[EdgePoints[ClockwiseEdges[Edge]]][1], Points[EdgePoints[ClockwiseEdges[Edge]]][2], ModelViewMatrix, ProjectionMatrix, Viewport, &x2, &y2, &unused); const k3d::point2 S2(x2, ScreenHeight - y2); // Coordinates to segment distance k3d::double_t distance = 0; const k3d::vector2 edge = S2 - S1; const k3d::vector2 w = Coordinates - S1; const k3d::double_t c1 = w * edge; if(c1 <= 0) distance = k3d::distance(Coordinates, S1); else { const k3d::double_t c2 = edge * edge; if(c2 <= c1) distance = k3d::distance(Coordinates, S2); else { const k3d::double_t b = c1 / c2; const k3d::point2 middlepoint = S1 + b * edge; distance = k3d::distance(Coordinates, middlepoint); } } if(distance < OutputDistance) { OutputEdge = Edge; OutputDistance = distance; } } /// OpenGL context for use with a GDK viewport class context : public k3d::gl::context { public: context(GtkWidget* Widget) : m_drawable(gtk_widget_get_gl_drawable(Widget)), m_context(gtk_widget_get_gl_context(Widget)) { assert(m_drawable); assert(m_context); } void on_begin() { if(!gdk_gl_drawable_gl_begin(m_drawable, m_context)) k3d::log() << error << "Failed to call gl_begin" << std::endl; } void on_end() { if(gdk_gl_drawable_is_double_buffered(m_drawable)) gdk_gl_drawable_swap_buffers(m_drawable); gdk_gl_drawable_gl_end(m_drawable); } GdkGLDrawable* const m_drawable; GdkGLContext* const m_context; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // control::implementation class control::implementation { public: implementation(document_state& DocumentState) : m_document_state(DocumentState), m_camera(init_value(0)), m_gl_engine(init_value(0)), m_preview_engine(init_value(0)), m_still_engine(init_value(0)), m_animation_engine(init_value(0)), m_font_begin(0), m_font_end(0) { } /// Stores a reference to the owning document document_state& m_document_state; /// Stores a reference to the current camera k3d_data(k3d::icamera*, no_name, change_signal, no_undo, node_storage, no_constraint, no_property, no_serialization) m_camera; /// Stores a reference to the current OpenGL render engine k3d_data(k3d::gl::irender_viewport*, no_name, change_signal, no_undo, node_storage, no_constraint, no_property, no_serialization) m_gl_engine; /// Stores a reference to the current preview render engine k3d_data(k3d::irender_camera_preview*, no_name, change_signal, no_undo, node_storage, no_constraint, no_property, no_serialization) m_preview_engine; /// Stores a reference to the current still render engine k3d_data(k3d::irender_camera_frame*, no_name, change_signal, no_undo, node_storage, no_constraint, no_property, no_serialization) m_still_engine; /// Stores a reference to the current animation render engine k3d_data(k3d::irender_camera_animation*, no_name, change_signal, no_undo, node_storage, no_constraint, no_property, no_serialization) m_animation_engine; /// Stores the current set of OpenGL font glyphs (generated from Pango by gtkglext) unsigned long m_font_begin; /// Stores the current set of OpenGL font glyphs (generated from Pango by gtkglext) unsigned long m_font_end; /// Stores a connection to the attached OpenGL render engine redraw request signal sigc::connection m_gl_engine_redraw_request_connection; /// Buffers OpenGL hit records typedef std::vector gl_selection_buffer_t; gl_selection_buffer_t m_selection_buffer; // Buffers parameters from the most-recent render GLdouble m_gl_view_matrix[16]; GLdouble m_gl_projection_matrix[16]; GLint m_gl_viewport[4]; /// Signal that will be emitted whenever this control should grab the panel focus sigc::signal m_panel_grab_signal; /// Keep track of gl context boost::scoped_ptr m_gl_context; }; ///////////////////////////////////////////////////////////////////////////// // control control::control(document_state& DocumentState) : m_implementation(new implementation(DocumentState)) { m_implementation->m_camera.changed_signal().connect(sigc::mem_fun(*this, &control::on_camera_changed)); m_implementation->m_gl_engine.changed_signal().connect(sigc::mem_fun(*this, &control::on_gl_engine_changed)); set_flags(Gtk::CAN_FOCUS); add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::KEY_PRESS_MASK | Gdk::POINTER_MOTION_MASK | Gdk::SCROLL_MASK); signal_button_press_event().connect(sigc::bind_return(sigc::hide(m_implementation->m_panel_grab_signal.make_slot()), false), false); signal_expose_event().connect(sigc::hide(sigc::mem_fun(*this, &control::on_redraw))); set_double_buffered(false); GdkGLConfig* const config = gdk_gl_config_new_by_mode(static_cast(GDK_GL_MODE_RGBA | GDK_GL_MODE_DOUBLE | GDK_GL_MODE_DEPTH)); assert(config); if(!gtk_widget_set_gl_capability(GTK_WIDGET(gobj()), config, m_implementation->m_document_state.gdkgl_share_list(), true, GDK_GL_RGBA_TYPE)) { k3d::log() << warning << "Disabling OpenGL context sharing, since it appears to be unsupported" << std::endl; gtk_widget_set_gl_capability(GTK_WIDGET(gobj()), config, NULL, true, GDK_GL_RGBA_TYPE); } show_all(); } void control::initialize(document_state& DocumentState) { assert_not_implemented(); } const k3d::string_t control::panel_type() { return "NGUIViewportPanel"; } sigc::connection control::connect_focus_signal(const sigc::slot& Slot) { return m_implementation->m_panel_grab_signal.connect(Slot); } k3d::idocument& control::document() { return m_implementation->m_document_state.document(); } k3d::icamera* const control::camera() { return m_implementation->m_camera.internal_value(); } k3d::gl::irender_viewport* const control::gl_engine() { return m_implementation->m_gl_engine.internal_value(); } k3d::irender_camera_preview* const control::camera_preview_engine() { return m_implementation->m_preview_engine.internal_value(); } k3d::irender_camera_frame* const control::camera_still_engine() { return m_implementation->m_still_engine.internal_value(); } k3d::irender_camera_animation* const control::camera_animation_engine() { return m_implementation->m_animation_engine.internal_value(); } void control::set_camera(k3d::icamera* const Camera) { m_implementation->m_camera.set_value(Camera); } void control::set_gl_engine(k3d::gl::irender_viewport* const Engine) { m_implementation->m_gl_engine_redraw_request_connection.disconnect(); if(Engine) m_implementation->m_gl_engine_redraw_request_connection = Engine->redraw_request_signal().connect(sigc::mem_fun(*this, &control::on_redraw_request)); m_implementation->m_gl_engine.set_value(Engine); on_redraw_request(k3d::gl::irender_viewport::SYNCHRONOUS); } void control::set_camera_preview_engine(k3d::irender_camera_preview* const Engine) { m_implementation->m_preview_engine.set_value(Engine); } void control::set_camera_still_engine(k3d::irender_camera_frame* const Engine) { m_implementation->m_still_engine.set_value(Engine); } void control::set_camera_animation_engine(k3d::irender_camera_animation* const Engine) { m_implementation->m_animation_engine.set_value(Engine); } const k3d::matrix4 control::get_view_matrix() { return_val_if_fail(camera(), k3d::identity3()); return k3d::node_to_world_matrix(camera()->navigation_target()); } void control::set_view_matrix(const k3d::matrix4& Matrix) { return_if_fail(camera()); k3d::set_matrix(camera()->navigation_target(), Matrix); } const k3d::point3 control::get_target() { return boost::any_cast(camera()->world_target().property_internal_value()); } void control::set_target(const k3d::point3& Target) { k3d::property::set_internal_value(*camera(), "world_target", Target); } const k3d::vector3 control::get_up_axis() { return k3d::vector3(0, 0, 1); } void control::get_gl_viewport(GLdouble ViewMatrix[16], GLdouble ProjectionMatrix[16], GLint Viewport[4]) { std::copy(m_implementation->m_gl_view_matrix, m_implementation->m_gl_view_matrix + 16, ViewMatrix); std::copy(m_implementation->m_gl_projection_matrix, m_implementation->m_gl_projection_matrix + 16, ProjectionMatrix); std::copy(m_implementation->m_gl_viewport, m_implementation->m_gl_viewport + 4, Viewport); } gl::context& control::gl_context() { return *m_implementation->m_gl_context; } const k3d::point2 control::project(const k3d::point3& WorldCoords) { k3d::point2 coords; double unused; gluProject( WorldCoords[0], WorldCoords[1], WorldCoords[2], m_implementation->m_gl_view_matrix, m_implementation->m_gl_projection_matrix, m_implementation->m_gl_viewport, &coords[0], &coords[1], &unused); coords[1] = get_height() - coords[1]; return coords; } bool control::render_camera_frame(k3d::icamera& Camera, const k3d::filesystem::path& OutputImage, const bool ViewCompletedImage) { return save_frame(Camera, OutputImage, ViewCompletedImage); } bool control::render_camera_animation(k3d::icamera& Camera, k3d::iproperty& Time, const k3d::frames& Frames, const bool ViewCompletedImages) { // For each frame to be rendered ... for(k3d::frames::const_iterator frame = Frames.begin(); frame != Frames.end(); ++frame) { // Set the frame time ... k3d::property::set_internal_value(Time, frame->begin_time); // Save that baby ... return_val_if_fail(save_frame(Camera, frame->destination, ViewCompletedImages), false); } return true; } bool control::save_frame(k3d::icamera& Camera, const k3d::filesystem::path& OutputImage, const bool ViewCompletedImage) { // Draw the image as we normally would ... const unsigned long width = get_width(); const unsigned long height = get_height(); return_val_if_fail(width && height, false); m_implementation->m_gl_context->begin(); create_font(); glViewport(0, 0, width, height); if(m_implementation->m_gl_engine.internal_value()) { m_implementation->m_gl_engine.internal_value()->render_viewport(Camera, width, height, m_implementation->m_gl_view_matrix, m_implementation->m_gl_projection_matrix, m_implementation->m_gl_viewport); } else { glClearColor(0.6f, 0.6f, 0.6f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); } glFlush(); // Get the rendered image ... std::vector image_buffer(width * height * 3, 0); glReadBuffer(GL_BACK); glPixelStorei(GL_PACK_SWAP_BYTES, GL_FALSE); glPixelStorei(GL_PACK_LSB_FIRST, GL_FALSE); glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_SKIP_ROWS, 0); glPixelStorei(GL_PACK_SKIP_PIXELS, 0); glPixelStorei(GL_PACK_ALIGNMENT, 1); // glPixelStorei(GL_PACK_IMAGE_HEIGHT, 0); glPixelZoom(1.0, -1.0); glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, &image_buffer[0]); m_implementation->m_gl_context->end(); // Save that bad-boy ... k3d::filesystem::ofstream stream(OutputImage); stream << "P6" << std::endl; stream << width << " " << height << std::endl; stream << "255" << std::endl; // Write data ... for(unsigned long y = 0; y != height; ++y) std::copy(&image_buffer[(height - 1 - y) * width * 3], &image_buffer[(height - y) * width * 3], std::ostreambuf_iterator(stream)); return true; } void control::on_camera_changed(k3d::iunknown*) { on_redraw_request(k3d::gl::irender_viewport::SYNCHRONOUS); } void control::on_gl_engine_changed(k3d::iunknown*) { on_redraw_request(k3d::gl::irender_viewport::SYNCHRONOUS); } void control::on_redraw_request(k3d::gl::irender_viewport::redraw_type_t RedrawType) { if(k3d::gl::irender_viewport::ASYNCHRONOUS == RedrawType) { queue_draw(); return; } on_redraw(); } void control::on_style_changed(const Glib::RefPtr& previous_style) { base::on_style_changed(previous_style); if (m_implementation->m_font_begin != m_implementation->m_font_end) glDeleteLists(m_implementation->m_font_begin, m_implementation->m_font_end - m_implementation->m_font_begin); } void control::create_font() { if(m_implementation->m_font_begin != m_implementation->m_font_end) return; const unsigned long begin_glyph = 0; const unsigned long end_glyph = 256; m_implementation->m_font_begin = glGenLists(end_glyph - begin_glyph); return_if_fail(m_implementation->m_font_begin); m_implementation->m_font_end = m_implementation->m_font_begin + end_glyph - begin_glyph; // Initialize font return_if_fail(get_pango_context()); const Pango::FontDescription& font_description = get_pango_context()->get_font_description(); k3d::log() << debug << "attempting to use font family " << pango_font_description_get_family(font_description.gobj()) << std::endl; return_if_fail(get_pango_context()->get_font_description().gobj()); //Glib::RefPtr font = Glib::wrap(gdk_gl_font_use_pango_font(font_description.gobj(), begin_glyph, end_glyph, m_implementation->m_font_begin)); // if(font) // font->reference(); } bool control::on_button_press_event(GdkEventButton* Event) { m_implementation->m_document_state.set_focus_viewport(this); m_implementation->m_document_state.active_tool().input_model().button_press_event(*this, Event); return true; } bool control::on_button_release_event(GdkEventButton* Event) { m_implementation->m_document_state.active_tool().input_model().button_release_event(*this, Event); return true; } bool control::on_motion_notify_event(GdkEventMotion* Event) { m_implementation->m_document_state.active_tool().input_model().motion_notify_event(*this, Event); return true; } bool control::on_scroll_event(GdkEventScroll* Event) { m_implementation->m_document_state.active_tool().input_model().scroll_event(*this, Event); return true; } bool control::on_key_press_event(GdkEventKey* Event) { m_implementation->m_document_state.active_tool().input_model().key_press_event(*this, Event); return true; } bool control::on_key_release_event(GdkEventKey* Event) { m_implementation->m_document_state.active_tool().input_model().key_release_event(*this, Event); return true; } void control::on_realize() { m_implementation->m_gl_context.reset(NULL); Gtk::DrawingArea::on_realize(); } k3d::selection::records control::get_node_selectables(const k3d::rectangle& SelectionRegion) { return get_selection(detail::select_nodes(), SelectionRegion); } k3d::selection::records control::get_component_selectables(const k3d::selection::type Component, const k3d::rectangle& SelectionRegion, bool Backfacing) { k3d::gl::selection_state selection_state; selection_state.exclude_unselected_nodes = true; selection_state.select_backfacing = Backfacing; selection_state.select_component.insert(Component); return get_selection(selection_state, SelectionRegion); } k3d::selection::records control::get_object_selectables(const k3d::rectangle& SelectionRegion, bool Backfacing) { switch(selection::state(m_implementation->m_document_state.document()).current_mode()) { case selection::CURVE: return get_component_selectables(k3d::selection::CURVE, SelectionRegion, Backfacing); break; case selection::FACE: return get_component_selectables(k3d::selection::FACE, SelectionRegion, Backfacing); break; case selection::NODE: return get_node_selectables(SelectionRegion); break; case selection::PATCH: return get_component_selectables(k3d::selection::PATCH, SelectionRegion, Backfacing); break; case selection::POINT: return get_component_selectables(k3d::selection::POINT, SelectionRegion, Backfacing); break; case selection::EDGE: return get_component_selectables(k3d::selection::EDGE, SelectionRegion, Backfacing); break; case selection::SURFACE: return get_component_selectables(k3d::selection::SURFACE, SelectionRegion, Backfacing); break; } assert_not_reached(); return k3d::selection::records(); } k3d::selection::record control::pick_node(const k3d::point2& Coordinates) { k3d::selection::records records; return pick_node(Coordinates, records); } k3d::selection::record control::pick_point(const k3d::point2& Coordinates, bool Backfacing) { k3d::selection::records records; return pick_point(Coordinates, records, Backfacing); } k3d::selection::record control::pick_edge(const k3d::point2& Coordinates, bool Backfacing) { k3d::selection::records records; return pick_edge(Coordinates, records, Backfacing); } k3d::selection::record control::pick_component(const k3d::selection::type Component, const k3d::point2& Coordinates, bool Backfacing) { k3d::selection::records records; return pick_component(Component, Coordinates, records, Backfacing); } k3d::selection::record control::pick_object(const k3d::point2& Coordinates, bool Backfacing) { k3d::selection::records records; return pick_object(Coordinates, records, Backfacing); } k3d::selection::record control::pick_node(const k3d::point2& Coordinates, k3d::selection::records& Records) { const double sensitivity = 3; const k3d::rectangle selection_region( Coordinates[0] - sensitivity, Coordinates[0] + sensitivity, Coordinates[1] - sensitivity, Coordinates[1] + sensitivity); Records = get_selection(detail::select_nodes(), selection_region); std::sort(Records.begin(), Records.end(), detail::sort_by_zmin()); for(k3d::selection::records::iterator record = Records.begin(); record != Records.end(); ++record) { if(record->tokens.size() && record->tokens[0].type == k3d::selection::NODE) return *record; } return k3d::selection::record::empty_record(); } k3d::selection::record control::pick_point(const k3d::point2& Coordinates, k3d::selection::records& Records, k3d::bool_t Backfacing) { // Draw everything (will find nearest point if some other component is picked) k3d::gl::selection_state selection_state; selection_state.exclude_unselected_nodes = true; selection_state.select_backfacing = Backfacing; selection_state.select_component.insert(k3d::selection::POINT); selection_state.select_component.insert(k3d::selection::EDGE); selection_state.select_component.insert(k3d::selection::FACE); selection_state.select_component.insert(k3d::selection::PATCH); selection_state.select_component.insert(k3d::selection::CURVE); const k3d::double_t sensitivity = 5; const k3d::rectangle selection_region( Coordinates[0] - sensitivity, Coordinates[0] + sensitivity, Coordinates[1] - sensitivity, Coordinates[1] + sensitivity); GLdouble view_matrix[16]; GLdouble projection_matrix[16]; GLint viewport[4]; Records = get_selection(selection_state, selection_region, view_matrix, projection_matrix, viewport); std::sort(Records.begin(), Records.end(), detail::sort_by_zmin()); if(Records.empty()) return k3d::selection::record::empty_record(); const k3d::selection::record& record = Records.front(); k3d::selection::id node_id = k3d::selection::null_id(); k3d::inode* node = 0; GLdouble model_view_matrix[16]; k3d::selection::id mesh_id = k3d::selection::null_id(); k3d::mesh* mesh = 0; k3d::selection::id primitive_id = k3d::selection::null_id(); const k3d::mesh::primitive* primitive = 0; k3d::selection::id point_id = k3d::selection::null_id(); k3d::double_t point_distance = std::numeric_limits::max(); for(k3d::selection::record::tokens_t::const_iterator token = record.tokens.begin(); token != record.tokens.end(); ++token) { switch(token->type) { case k3d::selection::NODE: { node_id = token->id; node = k3d::selection::get_node(record); return_val_if_fail(node, k3d::selection::record::empty_record()); k3d::transpose(k3d::gl::matrix(view_matrix) * k3d::node_to_world_matrix(*node)).CopyArray(model_view_matrix); break; } case k3d::selection::MESH: { mesh_id = token->id; mesh = selection::get_mesh(node, mesh_id); return_val_if_fail(mesh, k3d::selection::record::empty_record()); return_val_if_fail(mesh->points, k3d::selection::record::empty_record()); break; } case k3d::selection::POINT: { return record; } case k3d::selection::PRIMITIVE: { primitive_id = token->id; return_val_if_fail(mesh, k3d::selection::record::empty_record()); return_val_if_fail(primitive_id < mesh->primitives.size(), k3d::selection::record::empty_record()); primitive = mesh->primitives[primitive_id].get(); break; } case k3d::selection::EDGE: { return_val_if_fail(mesh, k3d::selection::record::empty_record()); return_val_if_fail(primitive, k3d::selection::record::empty_record()); boost::scoped_ptr polyhedron(k3d::polyhedron::validate(*mesh, *primitive)); return_val_if_fail(polyhedron, k3d::selection::record::empty_record()); const k3d::selection::id edge = token->id; detail::select_nearest_point( *mesh->points, polyhedron->vertex_points[edge], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); detail::select_nearest_point( *mesh->points, polyhedron->vertex_points[polyhedron->clockwise_edges[edge]], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); break; } case k3d::selection::FACE: { return_val_if_fail(mesh, k3d::selection::record::empty_record()); return_val_if_fail(primitive, k3d::selection::record::empty_record()); boost::scoped_ptr polyhedron(k3d::polyhedron::validate(*mesh, *primitive)); return_val_if_fail(polyhedron, k3d::selection::record::empty_record()); const k3d::selection::id face = token->id; const k3d::uint_t face_loop_begin = polyhedron->face_first_loops[face]; const k3d::uint_t face_loop_end = face_loop_begin + polyhedron->face_loop_counts[face]; for(k3d::uint_t face_loop = face_loop_begin; face_loop != face_loop_end; ++face_loop) { const k3d::uint_t first_edge = polyhedron->loop_first_edges[face_loop]; for(k3d::uint_t edge = first_edge; ; ) { detail::select_nearest_point( *mesh->points, polyhedron->vertex_points[edge], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); edge = polyhedron->clockwise_edges[edge]; if(edge == first_edge) break; } } break; } case k3d::selection::PATCH: { return_val_if_fail(mesh, k3d::selection::record::empty_record()); return_val_if_fail(primitive, k3d::selection::record::empty_record()); const k3d::selection::id patch = token->id; boost::scoped_ptr bilinear_patch(k3d::bilinear_patch::validate(*mesh, *primitive)); if(bilinear_patch) { const k3d::uint_t point_begin = patch * 4; const k3d::uint_t point_end = point_begin + 4; for(k3d::uint_t patch_point = point_begin; patch_point != point_end; ++patch_point) { detail::select_nearest_point( *mesh->points, bilinear_patch->patch_points[patch_point], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); } break; } boost::scoped_ptr bicubic_patch(k3d::bicubic_patch::validate(*mesh, *primitive)); if(bicubic_patch) { k3d::uint_t point_begin = patch * 16; k3d::uint_t point_end = point_begin + 16; for(k3d::uint_t patch_point = point_begin; patch_point != point_end; ++patch_point) { detail::select_nearest_point( *mesh->points, bicubic_patch->patch_points[patch_point], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); } break; } boost::scoped_ptr nurbs_patch(k3d::nurbs_patch::validate(*mesh, *primitive)); if(nurbs_patch) { k3d::uint_t point_begin = nurbs_patch->patch_first_points.at(patch); k3d::uint_t point_end = point_begin + (nurbs_patch->patch_u_point_counts[patch] * nurbs_patch->patch_v_point_counts[patch]); for(k3d::uint_t patch_point = point_begin; patch_point != point_end; ++patch_point) { detail::select_nearest_point( *mesh->points, nurbs_patch->patch_points[patch_point], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); } break; } } case k3d::selection::CURVE: { const k3d::selection::id curve = token->id; boost::scoped_ptr linear_curve(k3d::linear_curve::validate(*mesh, *primitive)); if(linear_curve) { const k3d::uint_t curve_points_begin = linear_curve->curve_first_points[curve]; const k3d::uint_t curve_points_end = curve_points_begin + linear_curve->curve_point_counts[curve]; for(k3d::uint_t curve_point = curve_points_begin; curve_point != curve_points_end; ++curve_point) { detail::select_nearest_point( *mesh->points, linear_curve->curve_points[curve_point], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); } break; } boost::scoped_ptr cubic_curve(k3d::cubic_curve::validate(*mesh, *primitive)); if(cubic_curve) { const k3d::uint_t curve_points_begin = cubic_curve->curve_first_points[curve]; const k3d::uint_t curve_points_end = curve_points_begin + cubic_curve->curve_point_counts[curve]; for(k3d::uint_t curve_point = curve_points_begin; curve_point != curve_points_end; ++curve_point) { detail::select_nearest_point( *mesh->points, cubic_curve->curve_points[curve_point], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); } break; } boost::scoped_ptr nurbs_curve(k3d::nurbs_curve::validate(*mesh, *primitive)); if(nurbs_curve) { const k3d::uint_t curve_points_begin = nurbs_curve->curve_first_points[curve]; const k3d::uint_t curve_points_end = curve_points_begin + nurbs_curve->curve_point_counts[curve]; for(k3d::uint_t curve_point = curve_points_begin; curve_point != curve_points_end; ++curve_point) { detail::select_nearest_point( *mesh->points, nurbs_curve->curve_points[curve_point], Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, point_id, point_distance); } break; } } } } if(point_distance < std::numeric_limits::max()) { k3d::selection::record record = k3d::selection::record::empty_record(); record.tokens.push_back(k3d::selection::token(NODE, node_id)); record.tokens.push_back(k3d::selection::token(MESH, mesh_id)); record.tokens.push_back(k3d::selection::token(k3d::selection::POINT, point_id)); return record; } return k3d::selection::record::empty_record(); } k3d::selection::record control::pick_edge(const k3d::point2& Coordinates, k3d::selection::records& Records, bool Backfacing) { // Draw everything (will find nearest line if some other component type is picked) k3d::gl::selection_state selection_state; selection_state.exclude_unselected_nodes = true; selection_state.select_backfacing = Backfacing; selection_state.select_component.insert(k3d::selection::EDGE); selection_state.select_component.insert(k3d::selection::FACE); const k3d::double_t sensitivity = 5; const k3d::rectangle selection_region( Coordinates[0] - sensitivity, Coordinates[0] + sensitivity, Coordinates[1] - sensitivity, Coordinates[1] + sensitivity); GLdouble view_matrix[16]; GLdouble projection_matrix[16]; GLint viewport[4]; Records = get_selection(selection_state, selection_region, view_matrix, projection_matrix, viewport); std::sort(Records.begin(), Records.end(), detail::sort_by_zmin()); if(Records.empty()) return k3d::selection::record::empty_record(); const k3d::selection::record& record = Records.front(); k3d::selection::id node_id = k3d::selection::null_id(); k3d::inode* node = 0; GLdouble model_view_matrix[16]; k3d::selection::id mesh_id = k3d::selection::null_id(); k3d::mesh* mesh = 0; k3d::selection::id primitive_id = k3d::selection::null_id(); const k3d::mesh::primitive* primitive = 0; k3d::selection::id edge_id = k3d::selection::null_id(); k3d::double_t edge_distance = std::numeric_limits::max(); for(k3d::selection::record::tokens_t::const_iterator token = record.tokens.begin(); token != record.tokens.end(); ++token) { switch(token->type) { case k3d::selection::NODE: { node_id = token->id; node = k3d::selection::get_node(record); return_val_if_fail(node, k3d::selection::record::empty_record()); k3d::transpose(k3d::gl::matrix(view_matrix) * k3d::node_to_world_matrix(*node)).CopyArray(model_view_matrix); break; } case k3d::selection::MESH: { mesh_id = token->id; mesh = selection::get_mesh(node, mesh_id); return_val_if_fail(mesh, k3d::selection::record::empty_record()); return_val_if_fail(mesh->points, k3d::selection::record::empty_record()); break; } case k3d::selection::PRIMITIVE: { primitive_id = token->id; return_val_if_fail(mesh, k3d::selection::record::empty_record()); return_val_if_fail(primitive_id < mesh->primitives.size(), k3d::selection::record::empty_record()); primitive = mesh->primitives[primitive_id].get(); break; } case k3d::selection::EDGE: { return record; } case k3d::selection::FACE: { return_val_if_fail(mesh, k3d::selection::record::empty_record()); return_val_if_fail(primitive, k3d::selection::record::empty_record()); boost::scoped_ptr polyhedron(k3d::polyhedron::validate(*mesh, *primitive)); return_val_if_fail(polyhedron, k3d::selection::record::empty_record()); const k3d::selection::id face = token->id; const k3d::uint_t face_loop_begin = polyhedron->face_first_loops[face]; const k3d::uint_t face_loop_end = face_loop_begin + polyhedron->face_loop_counts[face]; for(k3d::uint_t face_loop = face_loop_begin; face_loop != face_loop_end; ++face_loop) { const k3d::uint_t first_edge = polyhedron->loop_first_edges[face_loop]; for(k3d::uint_t edge = first_edge; ; ) { detail::select_nearest_edge( polyhedron->vertex_points, polyhedron->clockwise_edges, *mesh->points, edge, Coordinates, get_height(), model_view_matrix, projection_matrix, viewport, edge_id, edge_distance); edge = polyhedron->clockwise_edges[edge]; if(edge == first_edge) break; } } break; } } } if(edge_distance < std::numeric_limits::max()) { k3d::selection::record record = k3d::selection::record::empty_record(); record.tokens.push_back(k3d::selection::token(k3d::selection::NODE, node_id)); record.tokens.push_back(k3d::selection::token(k3d::selection::MESH, mesh_id)); record.tokens.push_back(k3d::selection::token(k3d::selection::PRIMITIVE, primitive_id)); record.tokens.push_back(k3d::selection::token(k3d::selection::EDGE, edge_id)); return record; } return k3d::selection::record::empty_record(); } k3d::selection::record control::pick_component(const k3d::selection::type Component, const k3d::point2& Coordinates, k3d::selection::records& Records, bool Backfacing) { const double sensitivity = 3; const k3d::rectangle selection_region( Coordinates[0] - sensitivity, Coordinates[0] + sensitivity, Coordinates[1] - sensitivity, Coordinates[1] + sensitivity); k3d::gl::selection_state selection_state; selection_state.exclude_unselected_nodes = true; selection_state.select_backfacing = Backfacing; selection_state.select_component.insert(Component); Records = get_selection(selection_state, selection_region); std::sort(Records.begin(), Records.end(), detail::sort_by_zmin()); for(k3d::selection::records::const_iterator record = Records.begin(); record != Records.end(); ++record) { for(k3d::selection::record::tokens_t::const_iterator token = record->tokens.begin(); token != record->tokens.end(); ++token) { if(token->type == Component) return *record; } } return k3d::selection::record::empty_record(); } k3d::selection::record control::pick_object(const k3d::point2& Coordinates, k3d::selection::records& Records, bool Backfacing) { switch(selection::state(m_implementation->m_document_state.document()).current_mode()) { case selection::CURVE: return pick_component(k3d::selection::CURVE, Coordinates, Records, Backfacing); break; case selection::FACE: return pick_component(k3d::selection::FACE, Coordinates, Records, Backfacing); break; case selection::NODE: return pick_node(Coordinates, Records); break; case selection::PATCH: return pick_component(k3d::selection::PATCH, Coordinates, Records, Backfacing); break; case selection::POINT: return pick_point(Coordinates, Records, Backfacing); break; case selection::EDGE: return pick_edge(Coordinates, Records, Backfacing); break; case selection::SURFACE: return pick_component(k3d::selection::SURFACE, Coordinates, Records, Backfacing); break; } return k3d::selection::record::empty_record(); } const k3d::selection::records control::get_selection(const k3d::gl::selection_state& SelectionState, const k3d::rectangle& SelectionRegion) { GLdouble view_matrix[16]; GLdouble projection_matrix[16]; GLint viewport[4]; return get_selection(SelectionState, SelectionRegion, view_matrix, projection_matrix, viewport); } const k3d::selection::records control::get_selection(const k3d::gl::selection_state& SelectionState, const k3d::rectangle& SelectionRegion, GLdouble ViewMatrix[16], GLdouble ProjectionMatrix[16], GLint Viewport[4]) { k3d::selection::records selection; const unsigned int hit_count = select(SelectionState, SelectionRegion, ViewMatrix, ProjectionMatrix, Viewport); for(detail::hit_iterator hit(m_implementation->m_selection_buffer, hit_count); hit != detail::hit_iterator(); ++hit) { k3d::selection::record record; record.zmin = (*hit).zmin(); record.zmax = (*hit).zmax(); for(detail::hit_record::const_name_iterator name = (*hit).name_begin(); name != (*hit).name_end(); ) { k3d::selection::type type = k3d::selection::type(*name++); k3d::selection::id id = k3d::selection::id(*name++); record.tokens.push_back(k3d::selection::token(type, id)); } selection.push_back(record); } return selection; } bool control::on_redraw() { // If we're minimized, we're done ... const unsigned long width = get_width(); const unsigned long height = get_height(); if(!width || !height) return true; if(!is_realized()) return true; if(!m_implementation->m_gl_context) { m_implementation->m_gl_context.reset(new detail::context(GTK_WIDGET(gobj()))); m_implementation->m_gl_context->begin(); // Create opengl-start plugins ... const k3d::plugin::factory::collection_t factories = k3d::plugin::factory::lookup(); for(k3d::plugin::factory::collection_t::const_iterator factory = factories.begin(); factory != factories.end(); ++factory) { k3d::iplugin_factory::metadata_t metadata = (**factory).metadata(); if(!metadata.count("ngui:opengl-start")) continue; k3d::log() << info << "Creating plugin [" << (**factory).name() << "] via ngui:opengl-start" << std::endl; boost::scoped_ptr plugin(k3d::plugin::create(**factory)); if(!plugin) { k3d::log() << error << "Error creating plugin [" << (**factory).name() << "] via ngui:opengl-start" << std::endl; continue; } if(k3d::iscripted_action* const scripted_action = dynamic_cast(plugin.get())) { k3d::iscript_engine::context context; context["command"] = k3d::string_t("ngui:opengl-start"); scripted_action->execute(context); } } m_implementation->m_gl_context->end(); } m_implementation->m_gl_context->begin(); create_font(); glViewport(0, 0, width, height); if(m_implementation->m_gl_engine.internal_value() && m_implementation->m_camera.internal_value()) { k3d::timer timer; m_implementation->m_gl_engine.internal_value()->render_viewport(*m_implementation->m_camera.internal_value(), width, height, m_implementation->m_gl_view_matrix, m_implementation->m_gl_projection_matrix, m_implementation->m_gl_viewport); m_implementation->m_document_state.active_tool().redraw(*this); const double elapsed = timer.elapsed(); if(elapsed) { std::stringstream buffer; buffer << std::fixed << std::setprecision(1) << 1.0 / elapsed << "fps"; glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1, 1, -1, 1, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_1D); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); glColor3d(0, 0, 0); glRasterPos3d(-0.95, -0.95, 0); glListBase(m_implementation->m_font_begin); glCallLists(buffer.str().size(), GL_UNSIGNED_BYTE, buffer.str().data()); } } else { glClearColor(0.6f, 0.6f, 0.6f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1, 1, -1, 1, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_LIGHTING); glDisable(GL_TEXTURE_1D); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); glColor3d(0, 0, 0); glRasterPos3d(-0.95, -0.95, 0); const std::string buffer(_("Unattached")); glListBase(m_implementation->m_font_begin); glCallLists(buffer.size(), GL_UNSIGNED_BYTE, buffer.data()); } glFlush(); m_implementation->m_gl_context->end(); return true; } const GLint control::select(const k3d::gl::selection_state& SelectState, const k3d::rectangle& SelectionRegion) { GLdouble view_matrix[16]; GLdouble projection_matrix[16]; GLint viewport[4]; return select(SelectState, SelectionRegion, view_matrix, projection_matrix, viewport); } const GLint control::select(const k3d::gl::selection_state& SelectState, const k3d::rectangle& SelectionRegion, GLdouble ViewMatrix[16], GLdouble ProjectionMatrix[16], GLint Viewport[4]) { // If we don't have a camera, we're done ... if(!m_implementation->m_camera.internal_value()) return 0; if(!is_realized()) return 0; // If we're minimized, we're done ... const unsigned long width = get_width(); const unsigned long height = get_height(); if(!width || !height) return 0; // Set our selection buffer to a sensible minimum size ... if(m_implementation->m_selection_buffer.size() < 8096) m_implementation->m_selection_buffer.resize(8096); // Set an (arbitrary) upper-limit on how large we let the buffer grow ... while(m_implementation->m_selection_buffer.size() < 10000000) { m_implementation->m_gl_context->begin(); create_font(); glViewport(0, 0, width, height); glSelectBuffer(m_implementation->m_selection_buffer.size(), &m_implementation->m_selection_buffer[0]); glRenderMode(GL_SELECT); glInitNames(); GLdouble projection_matrix[16]; m_implementation->m_gl_engine.internal_value()->render_viewport_selection(SelectState, *m_implementation->m_camera.internal_value(), width, height, k3d::rectangle::normalize(SelectionRegion), m_implementation->m_gl_view_matrix, projection_matrix, m_implementation->m_gl_viewport); std::copy(m_implementation->m_gl_view_matrix, m_implementation->m_gl_view_matrix + 16, ViewMatrix); std::copy(projection_matrix, projection_matrix + 16, ProjectionMatrix); std::copy(m_implementation->m_gl_viewport, m_implementation->m_gl_viewport + 4, Viewport); m_implementation->m_document_state.active_tool().select(*this); const GLint hits = glRenderMode(GL_RENDER); glFlush(); m_implementation->m_gl_context->end(); // If we got a positive number of hits, we're done ... if(hits >= 0) return hits; // A negative number means there was buffer overflow, so try again ... m_implementation->m_selection_buffer.resize(m_implementation->m_selection_buffer.size() * 2); } // Ran out of buffer space! k3d::log() << error << "Ran out of selection-buffer space" << std::endl; return 0; } } // namespace viewport ///////////////////////////////////////////////////////////////////////////// // widget_to_ndc const k3d::point2 widget_to_ndc(viewport::control& Viewport, const k3d::point2& WidgetCoords) { return_val_if_fail(Viewport.gl_engine(), k3d::point2()); return_val_if_fail(Viewport.camera(), k3d::point2()); const unsigned long width = Viewport.get_width(); const unsigned long height = Viewport.get_height(); k3d::rectangle host_rect(0, 0, 0, 0); k3d::rectangle window_rect(0, 0, 0, 0); Viewport.gl_engine()->get_ndc(*Viewport.camera(), width, height, host_rect, window_rect); const double window_x = k3d::mix(window_rect.x1, window_rect.x2, WidgetCoords[0] / width); const double window_y = k3d::mix(window_rect.y1, window_rect.y2, WidgetCoords[1] / height); const double x = (window_x - host_rect.x1) / (host_rect.x2 - host_rect.x1); const double y = (window_y - host_rect.y1) / (host_rect.y2 - host_rect.y1); return k3d::point2(x, y); } ///////////////////////////////////////////////////////////////////////////// // ndc_to_widget const k3d::point2 ndc_to_widget(viewport::control& Viewport, const k3d::point2& NDC) { return_val_if_fail(Viewport.gl_engine(), k3d::point2()); return_val_if_fail(Viewport.camera(), k3d::point2()); const unsigned long width = Viewport.get_width(); const unsigned long height = Viewport.get_height(); k3d::rectangle host_rect(0, 0, 0, 0); k3d::rectangle window_rect(0, 0, 0, 0); Viewport.gl_engine()->get_ndc(*Viewport.camera(), width, height, host_rect, window_rect); const double host_x = k3d::mix(host_rect.x1, host_rect.x2, NDC[0]); const double host_y = k3d::mix(host_rect.y1, host_rect.y2, NDC[1]); const double x = (host_x - window_rect.x1) / (window_rect.x2 - window_rect.x1); const double y = (host_y - window_rect.y1) / (window_rect.y2 - window_rect.y1); return k3d::point2(width * x, height * y); } ///////////////////////////////////////////////////////////////////////////// // mouse_to_world const k3d::line3 mouse_to_world(viewport::control& Viewport, const k3d::point2& WidgetCoords) { return_val_if_fail(Viewport.gl_engine(), k3d::line3(k3d::vector3(), k3d::point3())); GLdouble gl_view_matrix[16]; GLdouble gl_projection_matrix[16]; GLint gl_viewport[4]; Viewport.get_gl_viewport(gl_view_matrix, gl_projection_matrix, gl_viewport); k3d::point3 near_plane; gluUnProject(WidgetCoords[0], Viewport.get_height() - WidgetCoords[1], 0.0, gl_view_matrix, gl_projection_matrix, gl_viewport, &near_plane[0], &near_plane[1], &near_plane[2]); k3d::point3 far_plane; gluUnProject(WidgetCoords[0], Viewport.get_height() - WidgetCoords[1], 1.0, gl_view_matrix, gl_projection_matrix, gl_viewport, &far_plane[0], &far_plane[1], &far_plane[2]); return k3d::line3(far_plane - near_plane, near_plane); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/viewport.h ================================================ #ifndef K3DSDK_NGUI_VIEWPORT_H #define K3DSDK_NGUI_VIEWPORT_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace gl { class selection_state; class context; } } namespace k3d { namespace ngui { class document_state; namespace viewport { ///////////////////////////////////////////////////////////////////////////// // control class control : public Gtk::DrawingArea, public k3d::property_collection, public k3d::irender_camera_frame, public k3d::irender_camera_animation, public panel::control { typedef Gtk::DrawingArea base; public: control(document_state& DocumentState); void initialize(document_state& DocumentState); const k3d::string_t panel_type(); sigc::connection connect_focus_signal(const sigc::slot& Slot); /// Returns the owning document k3d::idocument& document(); /// Returns the camera for this viewport k3d::icamera* const camera(); /// Returns the OpenGL render engine for this viewport k3d::gl::irender_viewport* const gl_engine(); /// Returns the preview render engine for this viewport k3d::irender_camera_preview* const camera_preview_engine(); /// Returns the still render engine for this viewport k3d::irender_camera_frame* const camera_still_engine(); /// Returns the animation render engine for this viewport k3d::irender_camera_animation* const camera_animation_engine(); /// Sets the camera for this viewport void set_camera(k3d::icamera* const Camera); /// Sets the OpenGL render engine for this viewport void set_gl_engine(k3d::gl::irender_viewport* const Engine); /// Sets the current preview render engine for this viewport void set_camera_preview_engine(k3d::irender_camera_preview* const Engine); /// Sets the current still render engine for this viewport void set_camera_still_engine(k3d::irender_camera_frame* const Engine); /// Sets the current animation render engine for this viewport void set_camera_animation_engine(k3d::irender_camera_animation* const Engine); /// Returns the viewport view matrix const k3d::matrix4 get_view_matrix(); /// Sets the viewport view matrix void set_view_matrix(const k3d::matrix4& Matrix); /// Returns the viewport "target", the point (in world coordinates) around which the viewport orbits const k3d::point3 get_target(); /// Sets the viewport "target", the point (in world coordinates) around which the viewport orbits void set_target(const k3d::point3& Target); /// Returns the viewport "up" axis, the axis (in world coordinates) that defines "up" for modeling purposes const k3d::vector3 get_up_axis(); /// Returns the most recent OpenGL viewport parameters void get_gl_viewport(GLdouble ViewMatrix[16], GLdouble ProjectionMatrix[16], GLint Viewport[4]); /// The OpenGL context for this viewport k3d::gl::context& gl_context(); /// Projects a point in world coordinates into screen space, returning the 2D widget coordinates const k3d::point2 project(const k3d::point3& WorldCoords); k3d::bool_t render_camera_frame(k3d::icamera& Camera, const k3d::filesystem::path& OutputImage, const k3d::bool_t ViewCompletedImage); k3d::bool_t render_camera_animation(k3d::icamera& Camera, k3d::iproperty& Time, const k3d::frames& Frames, const k3d::bool_t ViewCompletedImages); /// Returns all nodes that intersect the given rectangle in widget coordinates k3d::selection::records get_node_selectables(const k3d::rectangle& SelectionRegion); /// Returns all points contained in the given rectangle in widget coordinates k3d::selection::records get_point_selectables(const k3d::rectangle& SelectionRegion, k3d::bool_t Backfacing); /// Returns all components that intersect the given rectangle in widget coordinates k3d::selection::records get_component_selectables(const k3d::selection::type Component, const k3d::rectangle& SelectionRegion, k3d::bool_t Backfacing); /// Returns all objects (point, split-edge, uniform components, or nodes, depending on selection mode) that intersect the given rectangle in widget coordinates k3d::selection::records get_object_selectables(const k3d::rectangle& SelectionRegion, k3d::bool_t Backfacing); /// Returns the closest node at the given widget coordinates (may return an empty record) k3d::selection::record pick_node(const k3d::point2& Coordinates); /// Returns the closest point at the given widget coordinates (may return an empty record) k3d::selection::record pick_point(const k3d::point2& Coordinates, k3d::bool_t Backfacing); /// Returns the closest polyhedron edge at the given widget coordinates (may return an empty record) k3d::selection::record pick_edge(const k3d::point2& Coordinates, k3d::bool_t Backfacing); /// Returns the closest component at the given widget coordinates (may return an empty record) k3d::selection::record pick_component(const k3d::selection::type Component, const k3d::point2& Coordinates, k3d::bool_t Backfacing); /// Returns the closest object (point, split-edge, uniform component, or node, depending on selection mode) at the given coordinates (may return an empty record) k3d::selection::record pick_object(const k3d::point2& Coordinates, k3d::bool_t Backfacing); /// Returns the closest node at the given widget coordinates (may return an empty record) k3d::selection::record pick_node(const k3d::point2& Coordinates, k3d::selection::records& Records); /// Returns the closest point at the given widget coordinates (may return an empty record) k3d::selection::record pick_point(const k3d::point2& Coordinates, k3d::selection::records& Records, k3d::bool_t Backfacing); /// Returns the closest polyhedron edge at the given widget coordinates (may return an empty record) k3d::selection::record pick_edge(const k3d::point2& Coordinates, k3d::selection::records& Records, k3d::bool_t Backfacing); /// Returns the closest uniform component at the given widget coordinates (may return an empty record) k3d::selection::record pick_component(const k3d::selection::type Component, const k3d::point2& Coordinates, k3d::selection::records& Records, k3d::bool_t Backfacing); /// Returns the closest object (point, split-edge, uniform component, or node, depending on selection mode) at the given coordinates (may return an empty record) k3d::selection::record pick_object(const k3d::point2& Coordinates, k3d::selection::records& Records, k3d::bool_t Backfacing); private: void on_camera_changed(k3d::iunknown*); void on_gl_engine_changed(k3d::iunknown*); void on_redraw_request(k3d::gl::irender_viewport::redraw_type_t RedrawType); void on_style_changed(const Glib::RefPtr& previous_style); k3d::bool_t on_redraw(); const GLint select(const k3d::gl::selection_state& SelectState, const k3d::rectangle& SelectionRegion); const GLint select(const k3d::gl::selection_state& SelectState, const k3d::rectangle& SelectionRegion, GLdouble ViewMatrix[16], GLdouble ProjectionMatrix[16], GLint Viewport[4]); /// Returns an OpenGL selection as a collection of records const k3d::selection::records get_selection(const k3d::gl::selection_state& SelectionState, const k3d::rectangle& SelectionRegion); /// Returns an OpenGL selection as a collection of records const k3d::selection::records get_selection(const k3d::gl::selection_state& SelectionState, const k3d::rectangle& SelectionRegion, GLdouble ViewMatrix[16], GLdouble ProjectionMatrix[16], GLint Viewport[4]); /// Renders the current view to disk k3d::bool_t save_frame(k3d::icamera& Camera, const k3d::filesystem::path& OutputImage, const k3d::bool_t ViewCompletedImage); /// Caches the current font as an OpenGL display list void create_font(); /// Called when a mouse button is pressed k3d::bool_t on_button_press_event(GdkEventButton* Event); /// Called when a mouse button is released k3d::bool_t on_button_release_event(GdkEventButton* Event); /// Called when the mouse wheel is scrolled k3d::bool_t on_scroll_event(GdkEventScroll* Event); /// Called when the mouse is moved k3d::bool_t on_motion_notify_event(GdkEventMotion* Event); /// Called when a key is pressed k3d::bool_t on_key_press_event(GdkEventKey* Event); /// Called when a key is released k3d::bool_t on_key_release_event(GdkEventKey* Event); void on_realize(); class implementation; implementation* const m_implementation; }; } // namespace viewport ///////////////////////////////////////////////////////////////////////////// // widget_to_ndc /// Converts widget coordinates to normalized camera coordinates - note: results may be outside the range [0, 1] because the viewport and camera aspect ratios may not match const k3d::point2 widget_to_ndc(viewport::control& Viewport, const k3d::point2& WidgetCoords); ///////////////////////////////////////////////////////////////////////////// // ndc_to_widget /// Converts normalized camera coordinates to widget coordinates const k3d::point2 ndc_to_widget(viewport::control& Viewport, const k3d::point2& NDC); ///////////////////////////////////////////////////////////////////////////// // mouse_to_world /// Converts widget coordinates to a line in world coordinates const k3d::line3 mouse_to_world(viewport::control& Viewport, const k3d::point2& WidgetCoords); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_VIEWPORT_H ================================================ FILE: k3dsdk/ngui/viewport_input_model.h ================================================ #ifndef K3DSDK_NGUI_VIEWPORT_INPUT_MODEL_H #define K3DSDK_NGUI_VIEWPORT_INPUT_MODEL_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace ngui { namespace viewport { class control; } ///////////////////////////////////////////////////////////////////////////// // viewport_input_model /// Abstract interface for objects that can process user input class viewport_input_model { public: /// Called when a mouse button is pressed virtual void button_press_event(viewport::control& Viewport, GdkEventButton* Event) = 0; /// Called when a mouse button is released virtual void button_release_event(viewport::control& Viewport, GdkEventButton* Event) = 0; /// Called during mouse movement virtual void motion_notify_event(viewport::control& Viewport, GdkEventMotion* Event) = 0; /// Called when the mouse wheel is scrolled virtual void scroll_event(viewport::control& Viewport, GdkEventScroll* Event) = 0; /// Called when a key is pressed virtual void key_press_event(viewport::control& Viewport, GdkEventKey* Event) = 0; /// Called when a key is released virtual void key_release_event(viewport::control& Viewport, GdkEventKey* Event) = 0; protected: viewport_input_model() {} viewport_input_model(const viewport_input_model&) {} viewport_input_model& operator=(const viewport_input_model&) { return *this; } virtual ~viewport_input_model() {} }; } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_VIEWPORT_INPUT_MODEL_H ================================================ FILE: k3dsdk/ngui/widget_manip.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { namespace ngui { namespace detail { /// Duplicated from GTK sources because there's no gtk_widget_get_accel_path() typedef struct { GQuark path_quark; GtkWidget *widget; GtkAccelGroup *accel_group; GClosure *closure; } AccelPath; const std::string get_accel_path(Gtk::Widget* Widget) { return_val_if_fail(Widget, std::string()); static GQuark quark_accel_path = g_quark_from_static_string("gtk-accel-path"); AccelPath* const apath = reinterpret_cast(g_object_get_qdata(G_OBJECT(Widget->gobj()), quark_accel_path)); return apath ? g_quark_to_string(apath->path_quark) : ""; } bool dynamic_accelerator_on_enter_notify_event(GdkEventCrossing*, Gtk::Widget* Widget) { return_val_if_fail(Widget, false); // Unless assign hotkeys mode is enabled, we're done ... if(!application_state::instance().assign_hotkeys()) return false; // If the widget doesn't have an accelerator path, we're done ... if(get_accel_path(Widget).empty()) return false; Widget->grab_focus(); return false; } bool dynamic_accelerator_on_key_press_event(GdkEventKey*, Gtk::Widget* Widget) { return_val_if_fail(Widget, false); // Unless assign hotkeys mode is enabled, we're done ... if(!application_state::instance().assign_hotkeys()) return false; // If the widget doesn't have an accelerator path, we're done ... const std::string accel_path = get_accel_path(Widget); if(accel_path.empty()) return false; Gtk::AccelMap::add_entry(accel_path, Gtk::AccelKey("q").get_key(), Gdk::ModifierType(0)); return false; } } // namespace detail void enable_dynamic_accelerators_impl(Gtk::Widget* const Widget) { return_if_fail(Widget); // Menu items already support dynamic hotkey assignment, so we're done ... Gtk::MenuItem* const menu_item = dynamic_cast(Widget); if(menu_item) return; Widget->signal_enter_notify_event().connect(sigc::bind(sigc::ptr_fun(detail::dynamic_accelerator_on_enter_notify_event), Widget)); Widget->signal_key_press_event().connect(sigc::bind(sigc::ptr_fun(detail::dynamic_accelerator_on_key_press_event), Widget)); } Gtk::Label* get_label(Gtk::ImageMenuItem& widget) { return dynamic_cast(widget.get_child()); } } // namespace ngui } // namespace k3d ================================================ FILE: k3dsdk/ngui/widget_manip.h ================================================ #ifndef K3DSDK_NGUI_WIDGET_MANIP_H #define K3DSDK_NGUI_WIDGET_MANIP_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace Gtk { class ImageMenuItem; } namespace k3d { namespace ngui { ///////////////////////////////////////////////////////////////////////////// // set_tooltip /// Convenience object for setting the tooltip on a component inline struct set_tooltip { set_tooltip(const Glib::ustring& Tooltip) : tooltip(Tooltip) { } const Glib::ustring tooltip; }; template T* operator<<(T* LHS, const set_tooltip& RHS) { return_val_if_fail(LHS, LHS); LHS->set_tooltip_text(RHS.tooltip); return LHS; } ///////////////////////////////////////////////////////////////////////////// // set_insensitive /// Convenience object for disabling a widget inline struct set_insensitive { }; template T* operator<<(T* LHS, const set_insensitive& RHS) { return_val_if_fail(LHS, LHS); LHS->set_sensitive(false); return LHS; } ///////////////////////////////////////////////////////////////////////////// // connect_button /// Convenience object for connecting a button to a slot inline struct connect_button { typedef sigc::slot slot_t; connect_button(const slot_t& Slot) : slot(Slot) { } slot_t slot; }; template T* operator<<(T* LHS, const connect_button& RHS) { return_val_if_fail(LHS, LHS); LHS->signal_clicked().connect(RHS.slot); return LHS; } ///////////////////////////////////////////////////////////////////////////// // connect_menu_item /// Convenience object for connecting a menu item to a slot inline struct connect_menu_item { typedef sigc::slot slot_t; connect_menu_item(const slot_t& Slot) : slot(Slot) { } slot_t slot; }; template T* operator<<(T* LHS, const connect_menu_item& RHS) { return_val_if_fail(LHS, LHS); LHS->signal_activate().connect(RHS.slot); return LHS; } ///////////////////////////////////////////////////////////////////////////// // connect_signal_changed /// Convenience object for connecting a menu item to a slot inline struct connect_signal_changed { typedef sigc::slot slot_t; connect_signal_changed(const slot_t& Slot) : slot(Slot) { } slot_t slot; }; template T* operator<<(T* LHS, const connect_signal_changed& RHS) { return_val_if_fail(LHS, LHS); LHS->signal_changed().connect(RHS.slot); return LHS; } ///////////////////////////////////////////////////////////////////////////// // line_wrap struct line_wrap { }; template T* operator<<(T* LHS, const line_wrap& RHS) { return_val_if_fail(LHS, LHS); LHS->set_line_wrap(true); return LHS; } ///////////////////////////////////////////////////////////////////////////// // center_justify struct center_justify { }; template T* operator<<(T* LHS, const center_justify& RHS) { return_val_if_fail(LHS, LHS); LHS->set_justify(Gtk::JUSTIFY_CENTER); return LHS; } ///////////////////////////////////////////////////////////////////////////// // right_justify struct right_justify { }; template T* operator<<(T* LHS, const right_justify& RHS) { return_val_if_fail(LHS, LHS); LHS->set_justify(Gtk::JUSTIFY_RIGHT); return LHS; } ///////////////////////////////////////////////////////////////////////////// // alignment struct alignment { alignment(const float XAlign, const float YAlign) : xalign(XAlign), yalign (YAlign) { } const float xalign; const float yalign; }; template T* operator<<(T* LHS, const alignment& RHS) { return_val_if_fail(LHS, LHS); LHS->set_alignment(RHS.xalign, RHS.yalign); return LHS; } ///////////////////////////////////////////////////////////////////////////// // set_markup struct set_markup { set_markup(const Glib::ustring& Markup) : markup(Markup) { } const Glib::ustring markup; }; template T* operator<<(T* LHS, const set_markup& RHS) { return_val_if_fail(LHS, LHS); LHS->set_markup(RHS.markup); return LHS; } ///////////////////////////////////////////////////////////////////////////// // make_toolbar_button struct make_toolbar_button { }; template T* operator<<(T* LHS, const make_toolbar_button& RHS) { return_val_if_fail(LHS, LHS); LHS->set_name("k3d-toolbar-button"); LHS->set_relief(Gtk::RELIEF_NONE); return LHS; } ///////////////////////////////////////////////////////////////////////////// // set_accelerator_path struct set_accelerator_path { set_accelerator_path(const Glib::ustring& Path, const Glib::RefPtr& Group) : path(Path), group(Group) { } const Glib::ustring path; const Glib::RefPtr group; }; template T* operator<<(T* LHS, const set_accelerator_path& RHS) { return_val_if_fail(LHS, LHS); static_cast(LHS)->set_accel_path(RHS.path, RHS.group); return LHS; } ///////////////////////////////////////////////////////////////////////////// // enable_dynamic_accelerators struct enable_dynamic_accelerators { }; void enable_dynamic_accelerators_impl(Gtk::Widget*); template T* operator<<(T* LHS, const enable_dynamic_accelerators& RHS) { return_val_if_fail(LHS, LHS); enable_dynamic_accelerators_impl(LHS); return LHS; } ///////////////////////////////////////////////////////////////////////////// // get_label /// Returns the text label associated with an image label widget Gtk::Label* get_label(Gtk::ImageMenuItem& widget); } // namespace ngui } // namespace k3d #endif // !K3DSDK_NGUI_WIDGET_MANIP_H ================================================ FILE: k3dsdk/node.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // node node::node(iplugin_factory& Factory, idocument& Document) : property_collection(), m_factory(Factory), m_document(Document), m_name(init_owner(*this) + init_name("name") + init_label(_("Name")) + init_description(_("Assign a human-readable name to identify this node.")) + init_value("")) { m_deleted_signal.connect(sigc::mem_fun(*this, &node::on_deleted)); m_name.changed_signal().connect(sigc::hide(m_name_changed_signal.make_slot())); } node::~node() { } void node::set_name(const std::string Name) { m_name.set_value(Name); } const std::string node::name() { return m_name.internal_value(); } void node::on_deleted() { // Signal that our properties are going away ... const property_collection::properties_t props = properties(); for(property_collection::properties_t::const_iterator property = props.begin(); property != props.end(); ++property) (**property).property_deleted_signal().emit(); } iplugin_factory& node::factory() { return m_factory; } idocument& node::document() { return m_document; } inode::deleted_signal_t& node::deleted_signal() { return m_deleted_signal; } inode::name_changed_signal_t& node::name_changed_signal() { return m_name_changed_signal; } void node::save(xml::element& Element, const ipersistent::save_context& Context) { persistent_property_collection::save(Element, Context); } void node::load(xml::element& Element, const ipersistent::load_context& Context) { // Load object name ... set_name(xml::attribute_text(Element, "name")); // Load Variables persistent_property_collection::load(Element, Context); } const std::vector node::lookup(idocument& Document) { return Document.nodes().collection(); } const std::vector node::lookup(idocument& Document, const uuid FactoryID) { std::vector result; const std::vector::const_iterator end = Document.nodes().collection().end(); for(std::vector::const_iterator node = Document.nodes().collection().begin(); node != end; ++node) { if((**node).factory().factory_id() == FactoryID) result.push_back(*node); } return result; } const std::vector node::lookup(idocument& Document, const string_t& NodeName) { std::vector result; const std::vector::const_iterator end = Document.nodes().collection().end(); for(std::vector::const_iterator node = Document.nodes().collection().begin(); node != end; ++node) { if((**node).name() == NodeName) result.push_back(*node); } return result; } const std::vector node::lookup(idocument& Document, const string_t& MetaName, const string_t& MetaValue) { std::vector result; const std::vector::const_iterator end = Document.nodes().collection().end(); for(std::vector::const_iterator node = Document.nodes().collection().begin(); node != end; ++node) { if(imetadata* const metadata = dynamic_cast(*node)) { imetadata::metadata_t pairs = metadata->get_metadata(); imetadata::metadata_t::iterator pair = pairs.find(MetaName); if(pair != pairs.end() && pair->second == MetaValue) result.push_back(*node); } } return result; } inode* node::lookup_one(idocument& Document, const string_t& NodeName) { std::vector nodes = lookup(Document, NodeName); return nodes.size() == 1 ? nodes[0] : 0; } void node::show(idocument& Document, inode& Node) { show(Document, std::vector(1, &Node)); } void node::show(idocument& Document, const std::vector& Nodes) { const std::vector sinks = lookup(Document); for(uint_t i = 0; i != sinks.size(); ++i) { const inode_collection_sink::properties_t properties = sinks[i]->node_collection_properties(); for(inode_collection_sink::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { if(inode_collection_property* const node_collection_property = dynamic_cast(*property)) { inode_collection_property::nodes_t nodes = property::internal_value(**property); for(uint_t i = 0; i != Nodes.size(); ++i) { if(node_collection_property->property_allow(*Nodes[i])) { nodes.erase(std::remove(nodes.begin(), nodes.end(), Nodes[i]), nodes.end()); nodes.push_back(Nodes[i]); } } property::set_internal_value(**property, nodes); } } } } void node::hide(idocument& Document, inode& Node) { hide(Document, std::vector(1, &Node)); } void node::hide(idocument& Document, const std::vector& Nodes) { const std::vector sinks = lookup(Document); for(uint_t i = 0; i != sinks.size(); ++i) { const inode_collection_sink::properties_t properties = sinks[i]->node_collection_properties(); for(inode_collection_sink::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { if(inode_collection_property* const node_collection_property = dynamic_cast(*property)) { inode_collection_property::nodes_t nodes = property::internal_value(**property); for(uint_t i = 0; i != Nodes.size(); ++i) { nodes.erase(std::remove(nodes.begin(), nodes.end(), Nodes[i]), nodes.end()); } property::set_internal_value(**property, nodes); } } } } } // namespace k3d ================================================ FILE: k3dsdk/node.h ================================================ #ifndef K3DSDK_NODE_H #define K3DSDK_NODE_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include namespace k3d { class iplugin_factory; /// Implements the minimum functionality required of any K-3D node. You should derive document plugins from node and override /// the default method implementations and/or implement additional interfaces as-needed. class node : public inode, public ipersistent, public property_collection, public persistent_property_collection, public metadata::storage, public sigc::trackable { public: node(iplugin_factory& Factory, idocument& Document); virtual ~node(); void set_name(const std::string Name); const std::string name(); idocument& document(); iplugin_factory& factory(); deleted_signal_t& deleted_signal(); name_changed_signal_t& name_changed_signal(); void save(xml::element& Element, const ipersistent::save_context& Context); void load(xml::element& Element, const ipersistent::load_context& Context); /// Returns the set of all nodes for the given document static const std::vector lookup(idocument& Document); /// Returns the set of nodes that match a specific factory ID (could return empty set!) static const std::vector lookup(idocument& Document, const uuid FactoryID); /// Returns the set of nodes that match the given name (be prepared to handle zero, one, or many results) static const std::vector lookup(idocument& Document, const string_t& NodeName); /// Returns the set of nodes that match the given metadata name and value static const std::vector lookup(idocument& Document, const string_t& MetaName, const string_t& MetaValue); /// Returns the set of nodes that implement the requested interface type (could return an empty set). template static const std::vector lookup(idocument& Document) { std::vector result; const std::vector nodes = lookup(Document); const std::vector::const_iterator end(nodes.end()); for(std::vector::const_iterator node = nodes.begin(); node != end; ++node) { if(interface_t* const requested = dynamic_cast(*node)) result.push_back(requested); } return result; } /// Returns the set of nodes that implement the requested interface type and match the given factory ID. template static const std::vector lookup(idocument& Document, const uuid FactoryID) { std::vector result; const std::vector nodes = lookup(Document, FactoryID); const std::vector::const_iterator end(nodes.end()); for(std::vector::const_iterator node = nodes.begin(); node != end; ++node) { if(interface_t* const requested = dynamic_cast(*node)) result.push_back(requested); } return result; } /// Returns the set of nodes that implement the requested interface type and match the given metadata name and value. template static const std::vector lookup(idocument& Document, const string_t& MetaName, const string_t& MetaValue) { std::vector result; const std::vector nodes = lookup(Document, MetaName, MetaValue); const std::vector::const_iterator end(nodes.end()); for(std::vector::const_iterator node = nodes.begin(); node != end; ++node) { if(interface_t* const requested = dynamic_cast(*node)) result.push_back(requested); } return result; } /// Returns the one node that matches the given name, or NULL. static inode* lookup_one(idocument& Document, const string_t& NodeName); /// Makes a node visible (adds it to visibility properties for all node collection sinks) static void show(idocument& Document, inode& Node); /// Makes a collection of nodes visible (adds them to visibility properties for all node collection sinks) static void show(idocument& Document, const std::vector& Node); /// Makes a node invisible (removes it from visibility properties for all node collection sinks) static void hide(idocument& Document, inode& Node); /// Makes a collection of nodes invisible (removes them from visibility properties for all node collection sinks) static void hide(idocument& Document, const std::vector& Node); private: void on_deleted(); /// Stores the factory that created this node iplugin_factory& m_factory; /// Stores the Document that owns this node idocument& m_document; /// Stores the name for this node k3d_data(std::string, data::immutable_name, data::change_signal, data::with_undo, data::local_storage, data::no_constraint, data::writable_property, data::no_serialization) m_name; /// Used to signal observers when this node is deleted deleted_signal_t m_deleted_signal; /// Used to signal observers when this node's name changes name_changed_signal_t m_name_changed_signal; }; } // namespace k3d #endif // !K3DSDK_NODE_H ================================================ FILE: k3dsdk/node_change_signal.h ================================================ #ifndef K3DSDK_NODE_CHANGE_SIGNAL_H #define K3DSDK_NODE_CHANGE_SIGNAL_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Provides a mixin-class implementation of k3d::inode_change_signal template class node_change_signal : public inode_change_signal { public: sigc::connection connect_node_changed_signal(const sigc::slot& Slot) { return m_node_changed_signal.connect(Slot); } protected: signal::loop_safe_slot > make_node_change_slot() { return signal::make_loop_safe_slot(m_node_changed_signal); } private: sigc::signal m_node_changed_signal; }; } // namespace k3d #endif // !K3DSDK_NODE_CHANGE_SIGNAL_H ================================================ FILE: k3dsdk/node_name_map.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { /////////////////////////////////////////////////////////////////////////////////// // node_name_map::implementation class node_name_map::implementation { public: typedef std::vector nodes_t; nodes_t m_nodes; }; /////////////////////////////////////////////////////////////////////////////////// // node_name_map node_name_map::node_name_map() : m_implementation(new implementation()) { } node_name_map::~node_name_map() { delete m_implementation; } void node_name_map::add_nodes(const inode_collection::nodes_t& Nodes) { m_implementation->m_nodes.insert(m_implementation->m_nodes.end(), Nodes.begin(), Nodes.end()); } const std::string node_name_map::name(inode& Node) { const uuid node_factory_id = Node.factory().factory_id(); size_t node_number = 1; const size_t begin = 0; const size_t end = begin + m_implementation->m_nodes.size(); for(size_t i = begin; i != end; ++i) { if(m_implementation->m_nodes[i] == &Node) { std::ostringstream buffer; buffer << node_factory_id << " " << node_number; return buffer.str(); } if(m_implementation->m_nodes[i]->factory().factory_id() != node_factory_id) continue; ++node_number; } log() << error << k3d_file_reference << "internal error: can't find node [" << Node.name() << "]" << std::endl; return std::string(); } inode* node_name_map::node(const std::string& Name) { uuid lookup_node_factory_id = uuid::null(); size_t lookup_node_number = 0; std::istringstream buffer(Name); buffer >> lookup_node_factory_id >> lookup_node_number; return_val_if_fail(lookup_node_factory_id != uuid::null(), 0); return_val_if_fail(lookup_node_number != 0, 0); size_t node_number = 1; const size_t begin = 0; const size_t end = begin + m_implementation->m_nodes.size(); for(size_t i = begin; i != end; ++i) { if(m_implementation->m_nodes[i]->factory().factory_id() != lookup_node_factory_id) continue; if(node_number == lookup_node_number) return m_implementation->m_nodes[i]; ++node_number; } log() << error << k3d_file_reference << "can't find node [" << lookup_node_factory_id << "] number [" << lookup_node_number << "]" << std::endl; return 0; } } // namespace k3d ================================================ FILE: k3dsdk/node_name_map.h ================================================ #ifndef K3DSDK_NODE_NAME_MAP_H #define K3DSDK_NODE_NAME_MAP_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Concrete implementation of inode_name_map that generates repeatable unique node names for use by e.g: tutorial recording and playback class node_name_map : public inode_name_map { public: node_name_map(); ~node_name_map(); /// Adds nodes to the collection void add_nodes(const inode_collection::nodes_t& Nodes); virtual const std::string name(inode& Node); virtual inode* node(const std::string& Name); private: class implementation; implementation* const m_implementation; }; } // namespace k3d #endif // !K3DSDK_NODE_NAME_MAP_H ================================================ FILE: k3dsdk/nodes.cpp ================================================ // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include // The following includes are needed to compare typeinfo of properties in skip_nodes #include namespace k3d { namespace detail { template struct factory_id_filter_t { explicit factory_id_filter_t(const uuid FactoryID, functor_t Functor) : factory_id(FactoryID), functor(Functor) {} void operator()(k3d::inode* Object) { if(Object->factory().factory_id() == factory_id) functor(Object); } const uuid factory_id; functor_t functor; }; template factory_id_filter_t factory_id_filter(const uuid ID, functor_t Functor) { return factory_id_filter_t(ID, Functor); } void skip_node(inode& Node, ipipeline::dependencies_t& NewDependencies) { idocument& document = Node.document(); ipipeline& pipeline = document.pipeline(); try { iproperty_collection& property_collection = dynamic_cast(Node); iproperty_collection::properties_t properties = property_collection.properties(); for(iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { iproperty* connected_property = pipeline.dependency(**property); if(!connected_property) continue; for(ipipeline::dependencies_t::const_iterator dependency = pipeline.dependencies().begin(); dependency != pipeline.dependencies().end(); ++dependency) { iproperty* output_property = dependency->second; if(output_property && output_property->property_node() == &Node && output_property->property_name() == connected_property->property_name() && output_property->property_type() == connected_property->property_type()) { NewDependencies[dependency->first] = connected_property; } } } } catch(std::bad_cast& E) // Catch the exception when the dynamic cast to ioperty_collection fails { return; } } void skip_nodes(nodes_t Nodes, ipipeline::dependencies_t& NewDependencies) { for(nodes_t::iterator node = Nodes.begin(); node != Nodes.end(); ++node) skip_node(**node, NewDependencies); } } // namespace detail inode* find_node(inode_collection& Nodes, iproperty& Property) { const nodes_t::const_iterator end = Nodes.collection().end(); for(nodes_t::const_iterator node = Nodes.collection().begin(); node != end; ++node) { iproperty_collection* const property_collection = dynamic_cast(*node); if(!property_collection) continue; const iproperty_collection::properties_t& properties = property_collection->properties(); if(std::find(properties.begin(), properties.end(), &Property) != properties.end()) return *node; } return 0; } const std::string unique_name(inode_collection& Nodes, const std::string& Name) { // For each node in the collection ... for(k3d::inode_collection::nodes_t::const_iterator handle = Nodes.collection().begin(); handle != Nodes.collection().end(); ++handle) { inode* const node = *handle; // Name doesn't match, so keep going ... if(Name != node->name()) continue; // Got a duplicate name, so recursively try something else ... std::string base(k3d::trim(Name)); unsigned int copy = 1; //parse(Name.c_str(), lexeme_d[*(anychar_p - space_p)][assign(base)] >> !(int_p[assign(copy)]), space_p); // Find trailing space followed by a number and increment ('k3d 5' -> 'k3d 6', 'k3d3' -> 'k3d3 2') std::string::iterator c = base.end(); while(--c != base.begin() && *c >= '0' && *c <= '9') { } if(*c == ' ') { // Get trailing number std::string number(c + 1, base.end()); copy = k3d::from_string(number, 1); // Cut trailing space + number base = std::string(base.begin(), c); } return unique_name(Nodes, base + ' ' + k3d::string_cast(copy+1)); } return Name; } void delete_nodes(idocument& Document, const nodes_t& Nodes) { ipipeline::dependencies_t skip_dependencies; // Get the dependencies needed to skip the deleted node detail::skip_nodes(Nodes, skip_dependencies); // Let the nodes know that they're about to be deleted ... for(nodes_t::const_iterator node = Nodes.begin(); node != Nodes.end(); ++node) (*node)->deleted_signal().emit(); // Remove them from the document node collection ... Document.nodes().remove_nodes(Nodes); // Remove them from node collection sinks const k3d::inode_collection::nodes_t::const_iterator doc_node_end = Document.nodes().collection().end(); for(k3d::inode_collection::nodes_t::const_iterator doc_node = Document.nodes().collection().begin(); doc_node != doc_node_end; ++doc_node) { if(k3d::inode_collection_sink* const node_collection_sink = dynamic_cast(*doc_node)) { const k3d::inode_collection_sink::properties_t properties = node_collection_sink->node_collection_properties(); for(k3d::inode_collection_sink::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { if(k3d::inode_collection_property* const node_collection_property = dynamic_cast(*property)) { k3d::inode_collection_property::nodes_t nodes = k3d::property::internal_value(**property); for(nodes_t::const_iterator node = Nodes.begin(); node != Nodes.end(); ++node) { for (k3d::inode_collection_property::nodes_t::iterator visible_node = nodes.begin(); visible_node != nodes.end(); ) { if (*visible_node == *node) visible_node = nodes.erase(visible_node); else ++visible_node; } } k3d::property::set_internal_value(**property, nodes); } } } } // Make sure the node gets cleaned-up properly after a redo ... for(nodes_t::const_iterator node = Nodes.begin(); node != Nodes.end(); ++node) k3d::undoable_delete(*node, Document); Document.pipeline().set_dependencies(skip_dependencies); } void make_visible(const nodes_t& Nodes, inode_collection_sink& NodeCollectionSink) { const k3d::inode_collection_sink::properties_t properties = NodeCollectionSink.node_collection_properties(); for(k3d::inode_collection_sink::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { if(k3d::inode_collection_property* const node_collection_property = dynamic_cast(*property)) { k3d::inode_collection_property::nodes_t nodes = k3d::property::internal_value(**property); nodes.insert(nodes.end(), Nodes.begin(), Nodes.end()); } } } } // namespace k3d ================================================ FILE: k3dsdk/nodes.h ================================================ #ifndef K3DSDK_NODES_H #define K3DSDK_NODES_H // K-3D // Copyright (c) 1995-2005, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #ifdef interface #undef interface #endif // interface namespace k3d { // Forward declarations class idocument; class iproperty; class inode_collection_sink; /// Defines a collection of nodes typedef inode_collection::nodes_t nodes_t; /// Returns the node that owns the given property (could return NULL) /** \deprecated Use methods in k3d::node instead */ inode* find_node(inode_collection& Nodes, iproperty& Property); /// Returns a unique node name based on the one supplied const std::string unique_name(inode_collection& Nodes, const std::string& Name); /// Deletes a collection of nodes, cleaning-up all references and resources (this operation is undo-able, if state change recording is in effect) void delete_nodes(idocument& Document, const nodes_t& Nodes); /// Marks the given nodes as visible in the given node collection sink void make_visible(const nodes_t& Nodes, inode_collection_sink& NodeCollectionSink); } // namespace k3d #endif // !K3DSDK_NODES_H ================================================ FILE: k3dsdk/noise.cpp ================================================ // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace noise { ////////////////////////////////////////////////////////////////////////////// // classic3 inline int32_t fastfloor(double_t x) { return x > 0 ? static_cast(x) : static_cast(x - 1); } inline double_t dot(int32_t g[], double_t x, double_t y, double_t z) { return g[0]*x + g[1]*y + g[2]*z; } inline double_t mix(double_t a, double_t b, double_t t) { return (1-t)*a + t*b; } inline double_t fade(double_t t) { return t*t*t*(t*(t*6-15)+10); } int32_t classic3::grad3[][3] = { {1,1,0}, {-1,1,0}, {1,-1,0}, {-1,-1,0}, {1,0,1}, {-1,0,1}, {1,0,-1}, {-1,0,-1}, {0,1,1}, {0,-1,1}, {0,1,-1}, {0,-1,-1} }; int32_t classic3::p[] = { 151,160,137,91,90,15, 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 }; int32_t classic3::perm[512]; classic3::classic3() { static bool_t initialized = false; if(!initialized) { initialized = true; for(int32_t i = 0; i < 512; ++i) perm[i] = p[i & 255]; } } double_t classic3::operator()(double_t x, double_t y, double_t z) const { // Find unit grid cell containing point int32_t X = fastfloor(x); int32_t Y = fastfloor(y); int32_t Z = fastfloor(z); // Get relative xyz coordinates of point within that cell x = x - X; y = y - Y; z = z - Z; // Wrap the integer cells at 255 (smaller integer period can be introduced here) X = X & 255; Y = Y & 255; Z = Z & 255; // Calculate a set of eight hashed gradient indices int32_t gi000 = perm[X+perm[Y+perm[Z]]] % 12; int32_t gi001 = perm[X+perm[Y+perm[Z+1]]] % 12; int32_t gi010 = perm[X+perm[Y+1+perm[Z]]] % 12; int32_t gi011 = perm[X+perm[Y+1+perm[Z+1]]] % 12; int32_t gi100 = perm[X+1+perm[Y+perm[Z]]] % 12; int32_t gi101 = perm[X+1+perm[Y+perm[Z+1]]] % 12; int32_t gi110 = perm[X+1+perm[Y+1+perm[Z]]] % 12; int32_t gi111 = perm[X+1+perm[Y+1+perm[Z+1]]] % 12; // The gradients of each corner are now: // g000 = grad3[gi000]; // g001 = grad3[gi001]; // g010 = grad3[gi010]; // g011 = grad3[gi011]; // g100 = grad3[gi100]; // g101 = grad3[gi101]; // g110 = grad3[gi110]; // g111 = grad3[gi111]; // Calculate noise contributions from each of the eight corners double_t n000= dot(grad3[gi000], x, y, z); double_t n100= dot(grad3[gi100], x-1, y, z); double_t n010= dot(grad3[gi010], x, y-1, z); double_t n110= dot(grad3[gi110], x-1, y-1, z); double_t n001= dot(grad3[gi001], x, y, z-1); double_t n101= dot(grad3[gi101], x-1, y, z-1); double_t n011= dot(grad3[gi011], x, y-1, z-1); double_t n111= dot(grad3[gi111], x-1, y-1, z-1); // Compute the fade curve value for each of x, y, z double_t u = fade(x); double_t v = fade(y); double_t w = fade(z); // Interpolate along x the contributions from each of the corners double_t nx00 = mix(n000, n100, u); double_t nx01 = mix(n001, n101, u); double_t nx10 = mix(n010, n110, u); double_t nx11 = mix(n011, n111, u); // Interpolate the four results along y double_t nxy0 = mix(nx00, nx10, v); double_t nxy1 = mix(nx01, nx11, v); // Interpolate the two last results along z double_t nxyz = mix(nxy0, nxy1, w); return nxyz; } } // namespace noise } // namespace k3d ================================================ FILE: k3dsdk/noise.h ================================================ #ifndef K3DSDK_NOISE_H #define K3DSDK_NOISE_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Functions by Ken Perlin, from "Texturing and Modeling - A Procedural Approach" \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace noise { /// Noise generator that returns "classic" Perlin 3D noise in the range (-1, 1). class classic3 { public: classic3(); /// Returns a noise value in the range (-1, 1) for the given point in 3-space. double_t operator()(double_t X, double_t Y, double_t Z) const; private: static int32_t grad3[][3]; static int32_t p[]; static int32_t perm[512]; }; /// Helper function that maps 3D noise to 3D objects including point3, vector3, normal3, and texture3. template const ValueT map3(const GeneratorT& Generator, double_t X, double_t Y, double_t Z) { return ValueT( Generator(X + 0.34, Y + 0.66, Z + 0.237), Generator(X + 0.011, Y + 0.845, Z + 0.037), Generator(X + 0.34, Y + 0.12, Z + 0.9) ); } } // namespace noise } // namespace k3d #endif // !K3DSDK_NOISE_H ================================================ FILE: k3dsdk/normal3.h ================================================ #ifndef K3DSDK_NORMAL3_H #define K3DSDK_NORMAL3_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Vector (points, vectors and normals) routines \author Timothy M. Shead (tshead@k-3d.com) */ /**************************************************************** * * C++ Vector and Matrix Algebra routines * Author: Jean-Francois DOUE * Version 3.1 --- October 1993 * ****************************************************************/ // // From "Graphics Gems IV / Edited by Paul S. Heckbert // Academic Press, 1994, ISBN 0-12-336156-9 // "You are free to use and modify this code in any way // you like." (p. xv) // // Modified by J. Nagle, March 1997 // - All functions are inline. // - All functions are const-correct. // - All checking is via the standard "assert" macro. // // Modified by Tim Shead for use with K-3D, January 1998 #include #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // normal3 /// Encapsulates a 3D surface normal class normal3 { public: /// Stores the normal values double n[3]; normal3() { n[0] = n[1] = n[2] = 0.0; } normal3(const double x, const double y, const double z) { n[0] = x; n[1] = y; n[2] = z; } normal3& operator+=(const normal3& v) { n[0] += v.n[0]; n[1] += v.n[1]; n[2] += v.n[2]; return *this; } normal3& operator-=(const normal3& v) { n[0] += v.n[0]; n[1] += v.n[1]; n[2] += v.n[2]; return *this; } normal3& operator*=(const double d) { n[0] *= d; n[1] *= d; n[2] *= d; return *this; } normal3& operator/=(const double d) { return_val_if_fail(d, *this); const double d_inv = 1./d; n[0] *= d_inv; n[1] *= d_inv; n[2] *= d_inv; return *this; } double& operator[](const unsigned int i) { return n[i]; } double operator[](const unsigned int i) const { return n[i]; } /// Returns the normal length double length() const { return std::sqrt(length2()); } /// Returns the squared normal length double length2() const { return n[0] * n[0] + n[1] * n[1] + n[2] * n[2]; } friend std::ostream& operator<<(std::ostream& Stream, const normal3& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.n[0] << " " << RHS.n[1] << " " << RHS.n[2]; return Stream; } friend std::istream& operator>>(std::istream& Stream, normal3& RHS) { Stream >> RHS.n[0] >> RHS.n[1] >> RHS.n[2]; return Stream; } }; /// Multiplication by a constant inline const normal3 operator*(const normal3& a, const double d) { return normal3(a.n[0] * d, a.n[1] * d, a.n[2] * d); } /// Multiplication by a constant inline const normal3 operator*(const double d, const normal3& a) { return normal3(a.n[0] * d, a.n[1] * d, a.n[2] * d); } /// Division by a constant inline const normal3 operator/(const normal3& a, const double d) { return_val_if_fail(d, normal3()); return normal3(a.n[0] / d, a.n[1] / d, a.n[2] / d); } /// Returns the dot product of two normals inline double operator*(const normal3& a, const normal3& b) { return a.n[0] * b.n[0] + a.n[1] * b.n[1] + a.n[2] * b.n[2]; } /// Returns the cross product of two normals inline const normal3 operator^(const normal3& a, const normal3& b) { return normal3(a.n[1] * b.n[2] - a.n[2] * b.n[1], a.n[2] * b.n[0] - a.n[0] * b.n[2], a.n[0] * b.n[1] - a.n[1] * b.n[0]); } /// Equality inline bool operator==(const normal3& a, const normal3& b) { return a.n[0] == b.n[0] && a.n[1] == b.n[1] && a.n[2] == b.n[2]; } /// Inequality inline bool operator!=(const normal3& a, const normal3& b) { return a.n[0] != b.n[0] || a.n[1] != b.n[1] || a.n[2] != b.n[2]; } /// Returns the length of a normal inline double length(const normal3& Normal) { return Normal.length(); } /// Returns the normalized form of a normal inline const normal3 normalize(const normal3& Normal) { const double length = Normal.length(); return_val_if_fail(length, Normal); return Normal / length; } namespace difference { /// Specialization of difference::test for normal3 inline void test(const normal3& A, const normal3& B, accumulator& Result) { range_test(A.n, A.n + 3, B.n, B.n + 3, Result); } } // difference } // namespace k3d #endif // !K3DSDK_NORMAL3_H ================================================ FILE: k3dsdk/nurbs_curve.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include namespace k3d { namespace nurbs_curve { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::materials_t& Material, const mesh::indices_t& CurveFirstPoints, const mesh::counts_t& CurvePointCounts, const mesh::orders_t& CurveOrders, const mesh::indices_t& CurveFirstKnots, const mesh::selection_t& CurveSelections, const mesh::indices_t& CurvePoints, const mesh::weights_t& CurvePointWeights, const mesh::knots_t& CurveKnots, const mesh::table_t& ConstantAttributes, const mesh::table_t& CurveAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ) : material(Material), curve_first_points(CurveFirstPoints), curve_point_counts(CurvePointCounts), curve_orders(CurveOrders), curve_first_knots(CurveFirstKnots), curve_selections(CurveSelections), curve_points(CurvePoints), curve_point_weights(CurvePointWeights), curve_knots(CurveKnots), constant_attributes(ConstantAttributes), curve_attributes(CurveAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } const_primitive::const_primitive(const primitive& Primitive) : material(Primitive.material), curve_first_points(Primitive.curve_first_points), curve_point_counts(Primitive.curve_point_counts), curve_orders(Primitive.curve_orders), curve_first_knots(Primitive.curve_first_knots), curve_selections(Primitive.curve_selections), curve_points(Primitive.curve_points), curve_point_weights(Primitive.curve_point_weights), curve_knots(Primitive.curve_knots), constant_attributes(Primitive.constant_attributes), curve_attributes(Primitive.curve_attributes), parameter_attributes(Primitive.parameter_attributes), vertex_attributes(Primitive.vertex_attributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::materials_t& Material, mesh::indices_t& CurveFirstPoints, mesh::counts_t& CurvePointCounts, mesh::orders_t& CurveOrders, mesh::indices_t& CurveFirstKnots, mesh::selection_t& CurveSelections, mesh::indices_t& CurvePoints, mesh::weights_t& CurvePointWeights, mesh::knots_t& CurveKnots, mesh::table_t& ConstantAttributes, mesh::table_t& CurveAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ) : material(Material), curve_first_points(CurveFirstPoints), curve_point_counts(CurvePointCounts), curve_orders(CurveOrders), curve_first_knots(CurveFirstKnots), curve_selections(CurveSelections), curve_points(CurvePoints), curve_point_weights(CurvePointWeights), curve_knots(CurveKnots), constant_attributes(ConstantAttributes), curve_attributes(CurveAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { return create(Mesh.primitives.create("nurbs_curve")); } primitive* create(mesh::primitive& Primitive) { return_val_if_fail(Primitive.type == "nurbs_curve", 0); primitive* const result = new primitive( Primitive.structure["constant"].create("material"), Primitive.structure["curve"].create("curve_first_points"), Primitive.structure["curve"].create("curve_point_counts"), Primitive.structure["curve"].create("curve_orders"), Primitive.structure["curve"].create("curve_first_knots"), Primitive.structure["curve"].create("curve_selections"), Primitive.structure["vertex"].create("curve_points"), Primitive.structure["vertex"].create("curve_point_weights"), Primitive.structure["knot"].create("curve_knots"), Primitive.attributes["constant"], Primitive.attributes["curve"], Primitive.attributes["parameter"], Primitive.attributes["vertex"] ); result->curve_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->curve_points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "nurbs_curve") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& constant_structure = require_structure(Primitive, "constant"); const mesh::table_t& curve_structure = require_structure(Primitive, "curve"); const mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); const mesh::table_t& knot_structure = require_structure(Primitive, "knot"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& curve_attributes = require_attributes(Primitive, "curve"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); const mesh::materials_t& material = require_array(Primitive, constant_structure, "material"); const mesh::indices_t& curve_first_points = require_array(Primitive, curve_structure, "curve_first_points"); const mesh::counts_t& curve_point_counts = require_array(Primitive, curve_structure, "curve_point_counts"); const mesh::orders_t& curve_orders = require_array(Primitive, curve_structure, "curve_orders"); const mesh::indices_t& curve_first_knots = require_array(Primitive, curve_structure, "curve_first_knots"); const mesh::selection_t& curve_selections = require_array(Primitive, curve_structure, "curve_selections"); const mesh::indices_t& curve_points = require_array(Primitive, vertex_structure, "curve_points"); const mesh::weights_t& curve_point_weights = require_array(Primitive, vertex_structure, "curve_point_weights"); const mesh::knots_t& curve_knots = require_array(Primitive, knot_structure, "curve_knots"); require_metadata(Primitive, curve_selections, "curve_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, curve_points, "curve_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", std::accumulate(curve_point_counts.begin(), curve_point_counts.end(), 0)); require_table_row_count(Primitive, knot_structure, "knots", std::accumulate(curve_point_counts.begin(), curve_point_counts.end(), 0) + std::accumulate(curve_orders.begin(), curve_orders.end(), 0)); require_table_row_count(Primitive, parameter_attributes, "parameter", curve_structure.row_count() * 2); return new const_primitive(material, curve_first_points, curve_point_counts, curve_orders, curve_first_knots, curve_selections, curve_points,curve_point_weights, curve_knots, constant_attributes, curve_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "nurbs_curve") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& constant_structure = require_structure(Primitive, "constant"); mesh::table_t& curve_structure = require_structure(Primitive, "curve"); mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); mesh::table_t& knot_structure = require_structure(Primitive, "knot"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& curve_attributes = require_attributes(Primitive, "curve"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); mesh::materials_t& material = require_array(Primitive, constant_structure, "material"); mesh::indices_t& curve_first_points = require_array(Primitive, curve_structure, "curve_first_points"); mesh::counts_t& curve_point_counts = require_array(Primitive, curve_structure, "curve_point_counts"); mesh::orders_t& curve_orders = require_array(Primitive, curve_structure, "curve_orders"); mesh::indices_t& curve_first_knots = require_array(Primitive, curve_structure, "curve_first_knots"); mesh::selection_t& curve_selections = require_array(Primitive, curve_structure, "curve_selections"); mesh::indices_t& curve_points = require_array(Primitive, vertex_structure, "curve_points"); mesh::weights_t& curve_point_weights = require_array(Primitive, vertex_structure, "curve_point_weights"); mesh::knots_t& curve_knots = require_array(Primitive, knot_structure, "curve_knots"); require_metadata(Primitive, curve_selections, "curve_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, curve_points, "curve_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_structure, "vertex", std::accumulate(curve_point_counts.begin(), curve_point_counts.end(), 0)); require_table_row_count(Primitive, knot_structure, "knots", std::accumulate(curve_point_counts.begin(), curve_point_counts.end(), 0) + std::accumulate(curve_orders.begin(), curve_orders.end(), 0)); require_table_row_count(Primitive, parameter_attributes, "parameter", curve_structure.row_count() * 2); return new primitive(material, curve_first_points, curve_point_counts, curve_orders, curve_first_knots, curve_selections, curve_points,curve_point_weights, curve_knots, constant_attributes, curve_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "nurbs_curve") return 0; return validate(Mesh, Primitive.writable()); } void add_curve(mesh& Mesh, primitive& Primitive, const uint_t Order, const mesh::points_t& ControlPoints, const uint_t RepeatPoints) { add_curve(Mesh, Primitive, Order, ControlPoints, mesh::weights_t(ControlPoints.size(), 1), RepeatPoints); } void add_curve(mesh& Mesh, primitive& Primitive, const uint_t Order, const mesh::points_t& ControlPoints, const mesh::weights_t& Weights, const uint_t RepeatPoints) { mesh::knots_t knots; add_open_uniform_knots(Order, ControlPoints.size() + RepeatPoints, knots); add_curve(Mesh, Primitive, Order, ControlPoints, Weights, knots, RepeatPoints); } void add_curve(mesh& Mesh, primitive& Primitive, const uint_t Order, const mesh::points_t& ControlPoints, const mesh::weights_t& Weights, const mesh::knots_t& Knots, const uint_t RepeatPoints) { return_if_fail(Mesh.points); return_if_fail(Mesh.point_selection); return_if_fail(Order >= 2); return_if_fail(ControlPoints.size() + RepeatPoints >= Order); return_if_fail(ControlPoints.size() == Weights.size()); return_if_fail(Knots.size() == ControlPoints.size() + RepeatPoints + Order); mesh::points_t& points = Mesh.points.writable(); mesh::selection_t& point_selection = Mesh.point_selection.writable(); Primitive.curve_first_points.push_back(Primitive.curve_points.size()); Primitive.curve_point_counts.push_back(ControlPoints.size() + RepeatPoints); Primitive.curve_orders.push_back(Order); Primitive.curve_first_knots.push_back(Primitive.curve_knots.size()); Primitive.curve_selections.push_back(0); const uint_t start_index = Primitive.curve_points.size(); for(uint_t i = 0; i != ControlPoints.size(); ++i) { Primitive.curve_points.push_back(points.size()); Primitive.curve_point_weights.push_back(Weights[i]); points.push_back(ControlPoints[i]); point_selection.push_back(0); } for(uint_t i = 0; i != RepeatPoints; ++i) { const uint_t repeat_index = start_index + (i % ControlPoints.size()); Primitive.curve_points.push_back(Primitive.curve_points[repeat_index]); Primitive.curve_point_weights.push_back(Primitive.curve_point_weights[repeat_index]); } Primitive.curve_knots.insert(Primitive.curve_knots.end(), Knots.begin(), Knots.end()); } void add_curves(mesh& Mesh, primitive& Primitive, const mesh::points_t& Points, const mesh::orders_t& Orders, const mesh::counts_t& ControlPointCounts, const mesh::indices_t& ControlPoints) { add_curves(Mesh, Primitive, Points, Orders, ControlPointCounts, ControlPoints, mesh::weights_t(ControlPoints.size(), 1)); } void add_curves(mesh& Mesh, primitive& Primitive, const mesh::points_t& Points, const mesh::orders_t& Orders, const mesh::counts_t& ControlPointCounts, const mesh::indices_t& ControlPoints, const mesh::weights_t& ControlPointWeights) { return_if_fail(Orders.size() == ControlPointCounts.size()); mesh::knots_t knots; for(uint_t i = 0; i != Orders.size(); ++i) add_open_uniform_knots(Orders[i], ControlPointCounts[i], knots); add_curves(Mesh, Primitive, Points, Orders, ControlPointCounts, ControlPoints, ControlPointWeights, knots); } void add_curves(mesh& Mesh, primitive& Primitive, const mesh::points_t& Points, const mesh::orders_t& Orders, const mesh::counts_t& ControlPointCounts, const mesh::indices_t& ControlPoints, const mesh::weights_t& ControlPointWeights, const mesh::knots_t& Knots) { // Sanity checking ... return_if_fail(Mesh.points); return_if_fail(Mesh.point_selection); return_if_fail(Orders.size() == ControlPointCounts.size()); for(uint_t i = 0; i != Orders.size(); ++i) { return_if_fail(Orders[i] >= 2); return_if_fail(ControlPointCounts[i] >= Orders[i]); } return_if_fail(ControlPoints.size() == std::accumulate(ControlPointCounts.begin(), ControlPointCounts.end(), 0)); for(uint_t i = 0; i != ControlPoints.size(); ++i) return_if_fail(ControlPoints[i] < Points.size()); return_if_fail(ControlPointWeights.size() == ControlPoints.size()); return_if_fail(Knots.size() == std::accumulate(Orders.begin(), Orders.end(), 0) + ControlPoints.size()); // Update the primitive ... mesh::points_t& points = Mesh.points.writable(); mesh::selection_t& point_selection = Mesh.point_selection.writable(); const uint_t point_offset = points.size(); points.insert(points.end(), Points.begin(), Points.end()); point_selection.insert(point_selection.end(), Points.size(), 0); uint_t first_point_offset = Primitive.curve_points.size(); for(uint_t i = 0; i != ControlPoints.size(); ++i) { Primitive.curve_points.push_back(ControlPoints[i] + point_offset); } Primitive.curve_point_weights.insert(Primitive.curve_point_weights.end(), ControlPointWeights.begin(), ControlPointWeights.end()); uint_t first_knot_offset = Primitive.curve_knots.size(); Primitive.curve_knots.insert(Primitive.curve_knots.end(), Knots.begin(), Knots.end()); for(uint_t i = 0; i != Orders.size(); ++i) { Primitive.curve_first_points.push_back(first_point_offset); Primitive.curve_point_counts.push_back(ControlPointCounts[i]); Primitive.curve_orders.push_back(Orders[i]); Primitive.curve_first_knots.push_back(first_knot_offset); Primitive.curve_selections.push_back(0); first_point_offset += ControlPointCounts[i]; first_knot_offset += Orders[i] + ControlPointCounts[i]; } } void add_open_uniform_knots(const uint_t Order, const uint_t ControlPointCount, mesh::knots_t& Knots) { Knots.insert(Knots.end(), Order, 0); for(uint_t i = 1; i <= ControlPointCount - Order; ++i) Knots.insert(Knots.end(), 1, i); Knots.insert(Knots.end(), Order, ControlPointCount - Order + 1); } void circular_arc(const vector3& X, const vector3& Y, const double_t StartAngle, const double_t EndAngle, const uint_t Segments, mesh::knots_t& Knots, mesh::weights_t& Weights, mesh::points_t& ControlPoints) { return_if_fail(Segments); const double_t theta = (EndAngle - StartAngle) / static_cast(Segments); const double_t weight = std::cos(std::fabs(theta) * 0.5); Knots.clear(); Knots.insert(Knots.end(), 3, 0); for(uint_t i = 1; i != Segments; ++i) Knots.insert(Knots.end(), 2, i); Knots.insert(Knots.end(), 3, Segments); Weights.clear(); Weights.push_back(1.0); for(uint_t i = 0; i != Segments; ++i) { Weights.push_back(weight); Weights.push_back(1); } ControlPoints.clear(); ControlPoints.push_back(k3d::to_point(std::cos(StartAngle) * X + std::sin(StartAngle) * Y)); for(uint_t i = 0; i != Segments; ++i) { const double_t a0 = mix(StartAngle, EndAngle, static_cast(i) / static_cast(Segments)); const double_t a2 = mix(StartAngle, EndAngle, static_cast(i+1) / static_cast(Segments)); const point3 p0(k3d::to_point(std::cos(a0) * X + std::sin(a0) * Y)); const point3 p2(k3d::to_point(std::cos(a2) * X + std::sin(a2) * Y)); const point3 t0(k3d::to_point(-std::sin(a0) * X + std::cos(a0) * Y)); const point3 t2(k3d::to_point(-std::sin(a2) * X + std::cos(a2) * Y)); point3 p1; intersect_lines(p0, to_vector(t0), p2, to_vector(t2), p1); ControlPoints.push_back(p1); ControlPoints.push_back(p2); } } } // namespace nurbs_curve } // namespace k3d ================================================ FILE: k3dsdk/nurbs_curve.h ================================================ #ifndef K3DSDK_NURBS_CURVE_H #define K3DSDK_NURBS_CURVE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace nurbs_curve { class primitive; /// Gathers the member arrays of a nurbs_curve primitive into a convenient package class const_primitive { public: const_primitive( const mesh::materials_t& Material, const mesh::indices_t& CurveFirstPoints, const mesh::counts_t& CurvePointCounts, const mesh::orders_t& CurveOrders, const mesh::indices_t& CurveFirstKnots, const mesh::selection_t& CurveSelections, const mesh::indices_t& CurvePoints, const mesh::weights_t& CurvePointWeights, const mesh::knots_t& CurveKnots, const mesh::table_t& ConstantAttributes, const mesh::table_t& CurveAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ); const_primitive(const primitive& Primitive); const mesh::materials_t& material; const mesh::indices_t& curve_first_points; const mesh::counts_t& curve_point_counts; const mesh::orders_t& curve_orders; const mesh::indices_t& curve_first_knots; const mesh::selection_t& curve_selections; const mesh::indices_t& curve_points; const mesh::weights_t& curve_point_weights; const mesh::knots_t& curve_knots; const mesh::table_t& constant_attributes; const mesh::table_t& curve_attributes; const mesh::table_t& parameter_attributes; const mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a nurbs_curve primitive into a convenient package class primitive { public: primitive( mesh::materials_t& Material, mesh::indices_t& CurveFirstPoints, mesh::counts_t& CurvePointCounts, mesh::orders_t& CurveOrders, mesh::indices_t& CurveFirstKnots, mesh::selection_t& CurveSelections, mesh::indices_t& CurvePoints, mesh::weights_t& CurvePointWeights, mesh::knots_t& CurveKnots, mesh::table_t& ConstantAttributes, mesh::table_t& CurveAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ); mesh::materials_t& material; mesh::indices_t& curve_first_points; mesh::counts_t& curve_point_counts; mesh::orders_t& curve_orders; mesh::indices_t& curve_first_knots; mesh::selection_t& curve_selections; mesh::indices_t& curve_points; mesh::weights_t& curve_point_weights; mesh::knots_t& curve_knots; mesh::table_t& constant_attributes; mesh::table_t& curve_attributes; mesh::table_t& parameter_attributes; mesh::table_t& vertex_attributes; }; /// Creates a new nurbs_curve mesh primitive inside the given mesh, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Creates a new nurbs_curve mesh primitive inside the given primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh::primitive& Primitive); /// Tests the given mesh primitive to see if it is a valid nurbs_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid nurbs_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid nurbs_curve primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); /// Adds a curve to an existing primitive, specified using the order of the curve and a set of control points. /// Control points will be assigned unity weights and an open uniform knot vector is automatically supplied. void add_curve(mesh& Mesh, primitive& Primitive, const uint_t Order, const mesh::points_t& ControlPoints, const uint_t RepeatPoints = 0); /// Adds a curve to an existing primitive, specified using the order of the curve and a set of control points and control point weights. /// An open uniform knot vector is automatically supplied. void add_curve(mesh& Mesh, primitive& Primitive, const uint_t Order, const mesh::points_t& ControlPoints, const mesh::weights_t& Weights, const uint_t RepeatPoints = 0); /// Adds a curve to an existing primitive, specified using the order of the curve and a set of control points, control point weights, and knot vector. void add_curve(mesh& Mesh, primitive& Primitive, const uint_t Order, const mesh::points_t& ControlPoints, const mesh::weights_t& Weights, const mesh::knots_t& Knots, const uint_t RepeatPoints = 0); /// Adds multiple curves to an existing primitive, specified by a set of points, curve orders, control point counts, and control point indices. /// Control points will be assigned unity weights, and curves will be assigned open uniform knot vectors. void add_curves(mesh& Mesh, primitive& Primitive, const mesh::points_t& Points, const mesh::orders_t& Orders, const mesh::counts_t& ControlPointCounts, const mesh::indices_t& ControlPoints); /// Adds multiple curves to an existing primitive, specified by a set of points, curve orders, control point counts, control point indices, and control point weights. /// Curves will be assigned open uniform knot vectors. void add_curves(mesh& Mesh, primitive& Primitive, const mesh::points_t& Points, const mesh::orders_t& Orders, const mesh::counts_t& ControlPointCounts, const mesh::indices_t& ControlPoints, const mesh::weights_t& ControlPointWeights); /// Adds multiple curves to an existing primitive, specified by a set of points, curve orders, control point counts, control point indices, control point weights, and knots. void add_curves(mesh& Mesh, primitive& Primitive, const mesh::points_t& Points, const mesh::orders_t& Orders, const mesh::counts_t& ControlPointCounts, const mesh::indices_t& ControlPoints, const mesh::weights_t& ControlPointWeights, const mesh::knots_t& Knots); /// Appends an open uniform knot vector to the given collection of knots. void add_open_uniform_knots(const uint_t Order, const uint_t ControlPointCount, mesh::knots_t& Knots); /** Computes a set of control points, weights, and knots that define an order-3 circular arc centered at the origin \param X Defines the X axis of the plane containing the arc \param Y Defines the Y axis of the plane containing the arc \param StartAngle Start angle of the arc in radians \param EndAngle End angle of the arc in radians \param Segments The number of NURBS segments in the resulting arc \param Knots Output container for the resulting arc knot vector \param Weights Output container for the resulting arc control point weights \param ControlPoints Output container for the resulting arc control point positions */ void circular_arc(const vector3& X, const vector3& Y, const double_t StartAngle, const double_t EndAngle, const uint_t Segments, mesh::knots_t& Knots, mesh::weights_t& Weights, mesh::points_t& ControlPoints); } // namespace nurbs_curve } // namespace k3d #endif // !K3DSDK_NURBS_CURVE_H ================================================ FILE: k3dsdk/nurbs_patch.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include namespace k3d { namespace nurbs_patch { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::indices_t& PatchFirstPoints, const mesh::counts_t& PatchUPointCounts, const mesh::counts_t& PatchVPointCounts, const mesh::orders_t& PatchUOrders, const mesh::orders_t& PatchVOrders, const mesh::indices_t& PatchUFirstKnots, const mesh::indices_t& PatchVFirstKnots, const mesh::selection_t& PatchSelections, const mesh::materials_t& PatchMaterials, const mesh::indices_t& PatchPoints, const mesh::weights_t& PatchPointWeights, const mesh::knots_t& PatchUKnots, const mesh::knots_t& PatchVKnots, const mesh::indices_t& PatchFirstTrimLoops, const mesh::counts_t& PatchTrimLoopCounts, const mesh::indices_t& TrimLoopFirstCurves, const mesh::counts_t& TrimLoopCurveCounts, const mesh::selection_t& TrimLoopSelections, const mesh::indices_t& CurveFirstPoints, const mesh::counts_t& CurvePointCounts, const mesh::orders_t& CurveOrders, const mesh::indices_t& CurveFirstKnots, const mesh::selection_t& CurveSelections, const mesh::indices_t& CurvePoints, const mesh::weights_t& CurvePointWeights, const mesh::knots_t& CurveKnots, const mesh::points_2d_t& Points, const mesh::selection_t& PointSelections, const mesh::table_t& ConstantAttributes, const mesh::table_t& PatchAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ) : patch_first_points(PatchFirstPoints), patch_u_point_counts(PatchUPointCounts), patch_v_point_counts(PatchVPointCounts), patch_u_orders(PatchUOrders), patch_v_orders(PatchVOrders), patch_u_first_knots(PatchUFirstKnots), patch_v_first_knots(PatchVFirstKnots), patch_selections(PatchSelections), patch_materials(PatchMaterials), patch_points(PatchPoints), patch_point_weights(PatchPointWeights), patch_u_knots(PatchUKnots), patch_v_knots(PatchVKnots), patch_first_trim_loops(PatchFirstTrimLoops), patch_trim_loop_counts(PatchTrimLoopCounts), trim_loop_first_curves(TrimLoopFirstCurves), trim_loop_curve_counts(TrimLoopCurveCounts), trim_loop_selections(TrimLoopSelections), curve_first_points(CurveFirstPoints), curve_point_counts(CurvePointCounts), curve_orders(CurveOrders), curve_first_knots(CurveFirstKnots), curve_selections(CurveSelections), curve_points(CurvePoints), curve_point_weights(CurvePointWeights), curve_knots(CurveKnots), points(Points), point_selections(PointSelections), constant_attributes(ConstantAttributes), patch_attributes(PatchAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } const_primitive::const_primitive(primitive& Primitive) : patch_first_points(Primitive.patch_first_points), patch_u_point_counts(Primitive.patch_u_point_counts), patch_v_point_counts(Primitive.patch_v_point_counts), patch_u_orders(Primitive.patch_u_orders), patch_v_orders(Primitive.patch_v_orders), patch_u_first_knots(Primitive.patch_u_first_knots), patch_v_first_knots(Primitive.patch_v_first_knots), patch_selections(Primitive.patch_selections), patch_materials(Primitive.patch_materials), patch_points(Primitive.patch_points), patch_point_weights(Primitive.patch_point_weights), patch_u_knots(Primitive.patch_u_knots), patch_v_knots(Primitive.patch_v_knots), patch_first_trim_loops(Primitive.patch_first_trim_loops), patch_trim_loop_counts(Primitive.patch_trim_loop_counts), trim_loop_first_curves(Primitive.trim_loop_first_curves), trim_loop_curve_counts(Primitive.trim_loop_curve_counts), trim_loop_selections(Primitive.trim_loop_selections), curve_first_points(Primitive.curve_first_points), curve_point_counts(Primitive.curve_point_counts), curve_orders(Primitive.curve_orders), curve_first_knots(Primitive.curve_first_knots), curve_selections(Primitive.curve_selections), curve_points(Primitive.curve_points), curve_point_weights(Primitive.curve_point_weights), curve_knots(Primitive.curve_knots), points(Primitive.points), point_selections(Primitive.point_selections), constant_attributes(Primitive.constant_attributes), patch_attributes(Primitive.patch_attributes), parameter_attributes(Primitive.parameter_attributes), vertex_attributes(Primitive.vertex_attributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::indices_t& PatchFirstPoints, mesh::counts_t& PatchUPointCounts, mesh::counts_t& PatchVPointCounts, mesh::orders_t& PatchUOrders, mesh::orders_t& PatchVOrders, mesh::indices_t& PatchUFirstKnots, mesh::indices_t& PatchVFirstKnots, mesh::selection_t& PatchSelections, mesh::materials_t& PatchMaterials, mesh::indices_t& PatchPoints, mesh::weights_t& PatchPointWeights, mesh::knots_t& PatchUKnots, mesh::knots_t& PatchVKnots, mesh::indices_t& PatchFirstTrimLoops, mesh::counts_t& PatchTrimLoopCounts, mesh::indices_t& TrimLoopFirstCurves, mesh::counts_t& TrimLoopCurveCounts, mesh::selection_t& TrimLoopSelections, mesh::indices_t& CurveFirstPoints, mesh::counts_t& CurvePointCounts, mesh::orders_t& CurveOrders, mesh::indices_t& CurveFirstKnots, mesh::selection_t& CurveSelections, mesh::indices_t& CurvePoints, mesh::weights_t& CurvePointWeights, mesh::knots_t& CurveKnots, mesh::points_2d_t& Points, mesh::selection_t& PointSelections, mesh::table_t& ConstantAttributes, mesh::table_t& PatchAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ) : patch_first_points(PatchFirstPoints), patch_u_point_counts(PatchUPointCounts), patch_v_point_counts(PatchVPointCounts), patch_u_orders(PatchUOrders), patch_v_orders(PatchVOrders), patch_u_first_knots(PatchUFirstKnots), patch_v_first_knots(PatchVFirstKnots), patch_selections(PatchSelections), patch_materials(PatchMaterials), patch_points(PatchPoints), patch_point_weights(PatchPointWeights), patch_u_knots(PatchUKnots), patch_v_knots(PatchVKnots), patch_first_trim_loops(PatchFirstTrimLoops), patch_trim_loop_counts(PatchTrimLoopCounts), trim_loop_first_curves(TrimLoopFirstCurves), trim_loop_curve_counts(TrimLoopCurveCounts), trim_loop_selections(TrimLoopSelections), curve_first_points(CurveFirstPoints), curve_point_counts(CurvePointCounts), curve_orders(CurveOrders), curve_first_knots(CurveFirstKnots), curve_selections(CurveSelections), curve_points(CurvePoints), curve_point_weights(CurvePointWeights), curve_knots(CurveKnots), points(Points), point_selections(PointSelections), constant_attributes(ConstantAttributes), patch_attributes(PatchAttributes), parameter_attributes(ParameterAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("nurbs_patch"); return create(generic_primitive); } primitive* create(mesh::primitive& Primitive) { return_val_if_fail(Primitive.type == "nurbs_patch", 0); primitive* const result = new primitive( Primitive.structure["patch"].create("patch_first_points"), Primitive.structure["patch"].create("patch_u_point_counts"), Primitive.structure["patch"].create("patch_v_point_counts"), Primitive.structure["patch"].create("patch_u_orders"), Primitive.structure["patch"].create("patch_v_orders"), Primitive.structure["patch"].create("patch_u_first_knots"), Primitive.structure["patch"].create("patch_v_first_knots"), Primitive.structure["patch"].create("patch_selections"), Primitive.structure["patch"].create("patch_materials"), Primitive.structure["vertex"].create("patch_points"), Primitive.structure["vertex"].create("patch_point_weights"), Primitive.structure["u_knot"].create("patch_u_knots"), Primitive.structure["v_knot"].create("patch_v_knots"), Primitive.structure["patch"].create("patch_first_trim_loops"), Primitive.structure["patch"].create("patch_trim_loop_counts"), Primitive.structure["trim_loop"].create("trim_loop_first_curves"), Primitive.structure["trim_loop"].create("trim_loop_curve_counts"), Primitive.structure["trim_loop"].create("trim_loop_selections"), Primitive.structure["trim_uniform"].create("curve_first_points"), Primitive.structure["trim_uniform"].create("curve_point_counts"), Primitive.structure["trim_uniform"].create("curve_orders"), Primitive.structure["trim_uniform"].create("curve_first_knots"), Primitive.structure["trim_uniform"].create("curve_selections"), Primitive.structure["trim_vertex"].create("curve_points"), Primitive.structure["trim_vertex"].create("curve_point_weights"), Primitive.structure["trim_knot"].create("curve_knots"), Primitive.structure["trim_point"].create("points"), Primitive.structure["trim_point"].create("point_selections"), Primitive.attributes["constant"], Primitive.attributes["patch"], Primitive.attributes["parameter"], Primitive.attributes["vertex"] ); result->patch_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->patch_points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "nurbs_patch") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& patch_structure = require_structure(Primitive, "patch"); const mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); const mesh::table_t& u_knot_structure = require_structure(Primitive, "u_knot"); const mesh::table_t& v_knot_structure = require_structure(Primitive, "v_knot"); const mesh::table_t& trim_loop_structure = require_structure(Primitive, "trim_loop"); const mesh::table_t& trim_uniform_structure = require_structure(Primitive, "trim_uniform"); const mesh::table_t& trim_vertex_structure = require_structure(Primitive, "trim_vertex"); const mesh::table_t& trim_knot_structure = require_structure(Primitive, "trim_knot"); const mesh::table_t& trim_point_structure = require_structure(Primitive, "trim_point"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& patch_attributes = require_attributes(Primitive, "patch"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); const mesh::indices_t& patch_first_points = require_array(Primitive, patch_structure, "patch_first_points"); const mesh::counts_t& patch_u_point_counts = require_array(Primitive, patch_structure, "patch_u_point_counts"); const mesh::counts_t& patch_v_point_counts = require_array(Primitive, patch_structure, "patch_v_point_counts"); const mesh::orders_t& patch_u_orders = require_array(Primitive, patch_structure, "patch_u_orders"); const mesh::orders_t& patch_v_orders = require_array(Primitive, patch_structure, "patch_v_orders"); const mesh::indices_t& patch_u_first_knots = require_array(Primitive, patch_structure, "patch_u_first_knots"); const mesh::indices_t& patch_v_first_knots = require_array(Primitive, patch_structure, "patch_v_first_knots"); const mesh::selection_t& patch_selections = require_array(Primitive, patch_structure, "patch_selections"); const mesh::materials_t& patch_materials = require_array(Primitive, patch_structure, "patch_materials"); const mesh::indices_t& patch_points = require_array(Primitive, vertex_structure, "patch_points"); const mesh::weights_t& patch_point_weights = require_array(Primitive, vertex_structure, "patch_point_weights"); const mesh::knots_t& patch_u_knots = require_array(Primitive, u_knot_structure, "patch_u_knots"); const mesh::knots_t& patch_v_knots = require_array(Primitive, v_knot_structure, "patch_v_knots"); const mesh::indices_t& patch_first_trim_loops = require_array(Primitive, patch_structure, "patch_first_trim_loops"); const mesh::counts_t& patch_trim_loop_counts = require_array(Primitive, patch_structure, "patch_trim_loop_counts"); const mesh::indices_t& trim_loop_first_curves = require_array(Primitive, trim_loop_structure, "trim_loop_first_curves"); const mesh::counts_t& trim_loop_curve_counts = require_array(Primitive, trim_loop_structure, "trim_loop_curve_counts"); const mesh::selection_t& trim_loop_selections = require_array(Primitive, trim_loop_structure, "trim_loop_selections"); const mesh::indices_t& curve_first_points = require_array(Primitive, trim_uniform_structure, "curve_first_points"); const mesh::counts_t& curve_point_counts = require_array(Primitive, trim_uniform_structure, "curve_point_counts"); const mesh::orders_t& curve_orders = require_array(Primitive, trim_uniform_structure, "curve_orders"); const mesh::indices_t& curve_first_knots = require_array(Primitive, trim_uniform_structure, "curve_first_knots"); const mesh::selection_t& curve_selections = require_array(Primitive, trim_uniform_structure, "curve_selections"); const mesh::indices_t& curve_points = require_array(Primitive, trim_vertex_structure, "curve_points"); const mesh::weights_t& curve_point_weights = require_array(Primitive, trim_vertex_structure, "curve_point_weights"); const mesh::knots_t& curve_knots = require_array(Primitive, trim_knot_structure, "curve_knots"); const mesh::points_2d_t& points = require_array(Primitive, trim_point_structure, "points"); const mesh::selection_t& point_selections = require_array(Primitive, trim_point_structure, "point_selections"); require_metadata(Primitive, patch_selections, "patch_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, patch_points, "patch_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, u_knot_structure, "u_knot", std::accumulate(patch_u_point_counts.begin(), patch_u_point_counts.end(), 0) + std::accumulate(patch_u_orders.begin(), patch_u_orders.end(), 0)); require_table_row_count(Primitive, v_knot_structure, "v_knot", std::accumulate(patch_v_point_counts.begin(), patch_v_point_counts.end(), 0) + std::accumulate(patch_v_orders.begin(), patch_v_orders.end(), 0)); require_table_row_count(Primitive, parameter_attributes, "parameter", patch_structure.row_count() * 4); return new const_primitive( patch_first_points, patch_u_point_counts, patch_v_point_counts, patch_u_orders, patch_v_orders, patch_u_first_knots, patch_v_first_knots, patch_selections, patch_materials, patch_points, patch_point_weights, patch_u_knots, patch_v_knots, patch_first_trim_loops, patch_trim_loop_counts, trim_loop_first_curves, trim_loop_curve_counts, trim_loop_selections, curve_first_points, curve_point_counts, curve_orders, curve_first_knots, curve_selections, curve_points, curve_point_weights, curve_knots, points, point_selections, constant_attributes, patch_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "nurbs_patch") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& patch_structure = require_structure(Primitive, "patch"); mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); mesh::table_t& u_knot_structure = require_structure(Primitive, "u_knot"); mesh::table_t& v_knot_structure = require_structure(Primitive, "v_knot"); mesh::table_t& trim_loop_structure = require_structure(Primitive, "trim_loop"); mesh::table_t& trim_uniform_structure = require_structure(Primitive, "trim_uniform"); mesh::table_t& trim_vertex_structure = require_structure(Primitive, "trim_vertex"); mesh::table_t& trim_knot_structure = require_structure(Primitive, "trim_knot"); mesh::table_t& trim_point_structure = require_structure(Primitive, "trim_point"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& patch_attributes = require_attributes(Primitive, "patch"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); mesh::indices_t& patch_first_points = require_array(Primitive, patch_structure, "patch_first_points"); mesh::counts_t& patch_u_point_counts = require_array(Primitive, patch_structure, "patch_u_point_counts"); mesh::counts_t& patch_v_point_counts = require_array(Primitive, patch_structure, "patch_v_point_counts"); mesh::orders_t& patch_u_orders = require_array(Primitive, patch_structure, "patch_u_orders"); mesh::orders_t& patch_v_orders = require_array(Primitive, patch_structure, "patch_v_orders"); mesh::indices_t& patch_u_first_knots = require_array(Primitive, patch_structure, "patch_u_first_knots"); mesh::indices_t& patch_v_first_knots = require_array(Primitive, patch_structure, "patch_v_first_knots"); mesh::selection_t& patch_selections = require_array(Primitive, patch_structure, "patch_selections"); mesh::materials_t& patch_materials = require_array(Primitive, patch_structure, "patch_materials"); mesh::indices_t& patch_points = require_array(Primitive, vertex_structure, "patch_points"); mesh::weights_t& patch_point_weights = require_array(Primitive, vertex_structure, "patch_point_weights"); mesh::knots_t& patch_u_knots = require_array(Primitive, u_knot_structure, "patch_u_knots"); mesh::knots_t& patch_v_knots = require_array(Primitive, v_knot_structure, "patch_v_knots"); mesh::indices_t& patch_first_trim_loops = require_array(Primitive, patch_structure, "patch_first_trim_loops"); mesh::counts_t& patch_trim_loop_counts = require_array(Primitive, patch_structure, "patch_trim_loop_counts"); mesh::indices_t& trim_loop_first_curves = require_array(Primitive, trim_loop_structure, "trim_loop_first_curves"); mesh::counts_t& trim_loop_curve_counts = require_array(Primitive, trim_loop_structure, "trim_loop_curve_counts"); mesh::selection_t& trim_loop_selections = require_array(Primitive, trim_loop_structure, "trim_loop_selections"); mesh::indices_t& curve_first_points = require_array(Primitive, trim_uniform_structure, "curve_first_points"); mesh::counts_t& curve_point_counts = require_array(Primitive, trim_uniform_structure, "curve_point_counts"); mesh::orders_t& curve_orders = require_array(Primitive, trim_uniform_structure, "curve_orders"); mesh::indices_t& curve_first_knots = require_array(Primitive, trim_uniform_structure, "curve_first_knots"); mesh::selection_t& curve_selections = require_array(Primitive, trim_uniform_structure, "curve_selections"); mesh::indices_t& curve_points = require_array(Primitive, trim_vertex_structure, "curve_points"); mesh::weights_t& curve_point_weights = require_array(Primitive, trim_vertex_structure, "curve_point_weights"); mesh::knots_t& curve_knots = require_array(Primitive, trim_knot_structure, "curve_knots"); mesh::points_2d_t& points = require_array(Primitive, trim_point_structure, "points"); mesh::selection_t& point_selections = require_array(Primitive, trim_point_structure, "point_selections"); require_metadata(Primitive, patch_selections, "patch_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, patch_points, "patch_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, u_knot_structure, "u_knot", std::accumulate(patch_u_point_counts.begin(), patch_u_point_counts.end(), 0) + std::accumulate(patch_u_orders.begin(), patch_u_orders.end(), 0)); require_table_row_count(Primitive, v_knot_structure, "v_knot", std::accumulate(patch_v_point_counts.begin(), patch_v_point_counts.end(), 0) + std::accumulate(patch_v_orders.begin(), patch_v_orders.end(), 0)); require_table_row_count(Primitive, parameter_attributes, "parameter", patch_structure.row_count() * 4); return new primitive( patch_first_points, patch_u_point_counts, patch_v_point_counts, patch_u_orders, patch_v_orders, patch_u_first_knots, patch_v_first_knots, patch_selections, patch_materials, patch_points, patch_point_weights, patch_u_knots, patch_v_knots, patch_first_trim_loops, patch_trim_loop_counts, trim_loop_first_curves, trim_loop_curve_counts, trim_loop_selections, curve_first_points, curve_point_counts, curve_orders, curve_first_knots, curve_selections, curve_points, curve_point_weights, curve_knots, points, point_selections, constant_attributes, patch_attributes, parameter_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "nurbs_patch") return 0; return validate(Mesh, Primitive.writable()); } } // namespace nurbs_patch } // namespace k3d ================================================ FILE: k3dsdk/nurbs_patch.h ================================================ #ifndef K3DSDK_NURBS_PATCH_H #define K3DSDK_NURBS_PATCH_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace nurbs_patch { /// Gathers the member arrays of a nurbs_patch primitive into a convenient package class primitive { public: primitive( mesh::indices_t& PatchFirstPoints, mesh::counts_t& PatchUPointCounts, mesh::counts_t& PatchVPointCounts, mesh::orders_t& PatchUOrders, mesh::orders_t& PatchVOrders, mesh::indices_t& PatchUFirstKnots, mesh::indices_t& PatchVFirstKnots, mesh::selection_t& PatchSelections, mesh::materials_t& PatchMaterials, mesh::indices_t& PatchPoints, mesh::weights_t& PatchPointWeights, mesh::knots_t& PatchUKnots, mesh::knots_t& PatchVKnots, mesh::indices_t& PatchFirstTrimLoops, mesh::counts_t& PatchTrimLoopCounts, mesh::indices_t& TrimLoopFirstCurves, mesh::counts_t& TrimLoopCurveCounts, mesh::selection_t& TrimLoopSelections, mesh::indices_t& CurveFirstPoints, mesh::counts_t& CurvePointCounts, mesh::orders_t& CurveOrders, mesh::indices_t& CurveFirstKnots, mesh::selection_t& CurveSelections, mesh::indices_t& CurvePoints, mesh::weights_t& CurvePointWeights, mesh::knots_t& CurveKnots, mesh::points_2d_t& Points, mesh::selection_t& PointSelections, mesh::table_t& ConstantAttributes, mesh::table_t& PatchAttributes, mesh::table_t& ParameterAttributes, mesh::table_t& VertexAttributes ); mesh::indices_t& patch_first_points; mesh::counts_t& patch_u_point_counts; mesh::counts_t& patch_v_point_counts; mesh::orders_t& patch_u_orders; mesh::orders_t& patch_v_orders; mesh::indices_t& patch_u_first_knots; mesh::indices_t& patch_v_first_knots; mesh::selection_t& patch_selections; mesh::materials_t& patch_materials; mesh::indices_t& patch_points; mesh::weights_t& patch_point_weights; mesh::knots_t& patch_u_knots; mesh::knots_t& patch_v_knots; mesh::indices_t& patch_first_trim_loops; mesh::counts_t& patch_trim_loop_counts; mesh::indices_t& trim_loop_first_curves; mesh::counts_t& trim_loop_curve_counts; mesh::selection_t& trim_loop_selections; mesh::indices_t& curve_first_points; mesh::counts_t& curve_point_counts; mesh::orders_t& curve_orders; mesh::indices_t& curve_first_knots; mesh::selection_t& curve_selections; mesh::indices_t& curve_points; mesh::weights_t& curve_point_weights; mesh::knots_t& curve_knots; mesh::points_2d_t& points; mesh::selection_t& point_selections; mesh::table_t& constant_attributes; mesh::table_t& patch_attributes; mesh::table_t& parameter_attributes; mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a nurbs_patch primitive into a convenient package class const_primitive { public: const_primitive( const mesh::indices_t& PatchFirstPoints, const mesh::counts_t& PatchUPointCounts, const mesh::counts_t& PatchVPointCounts, const mesh::orders_t& PatchUOrders, const mesh::orders_t& PatchVOrders, const mesh::indices_t& PatchUFirstKnots, const mesh::indices_t& PatchVFirstKnots, const mesh::selection_t& PatchSelections, const mesh::materials_t& PatchMaterials, const mesh::indices_t& PatchPoints, const mesh::weights_t& PatchPointWeights, const mesh::knots_t& PatchUKnots, const mesh::knots_t& PatchVKnots, const mesh::indices_t& PatchFirstTrimLoops, const mesh::counts_t& PatchTrimLoopCounts, const mesh::indices_t& TrimLoopFirstCurves, const mesh::counts_t& TrimLoopCurveCounts, const mesh::selection_t& TrimLoopSelections, const mesh::indices_t& CurveFirstPoints, const mesh::counts_t& CurvePointCounts, const mesh::orders_t& CurveOrders, const mesh::indices_t& CurveFirstKnots, const mesh::selection_t& CurveSelections, const mesh::indices_t& CurvePoints, const mesh::weights_t& CurvePointWeights, const mesh::knots_t& CurveKnots, const mesh::points_2d_t& Points, const mesh::selection_t& PointSelections, const mesh::table_t& ConstantAttributes, const mesh::table_t& PatchAttributes, const mesh::table_t& ParameterAttributes, const mesh::table_t& VertexAttributes ); const_primitive(primitive& Primitive); const mesh::indices_t& patch_first_points; const mesh::counts_t& patch_u_point_counts; const mesh::counts_t& patch_v_point_counts; const mesh::orders_t& patch_u_orders; const mesh::orders_t& patch_v_orders; const mesh::indices_t& patch_u_first_knots; const mesh::indices_t& patch_v_first_knots; const mesh::selection_t& patch_selections; const mesh::materials_t& patch_materials; const mesh::indices_t& patch_points; const mesh::weights_t& patch_point_weights; const mesh::knots_t& patch_u_knots; const mesh::knots_t& patch_v_knots; const mesh::indices_t& patch_first_trim_loops; const mesh::counts_t& patch_trim_loop_counts; const mesh::indices_t& trim_loop_first_curves; const mesh::counts_t& trim_loop_curve_counts; const mesh::selection_t& trim_loop_selections; const mesh::indices_t& curve_first_points; const mesh::counts_t& curve_point_counts; const mesh::orders_t& curve_orders; const mesh::indices_t& curve_first_knots; const mesh::selection_t& curve_selections; const mesh::indices_t& curve_points; const mesh::weights_t& curve_point_weights; const mesh::knots_t& curve_knots; const mesh::points_2d_t& points; const mesh::selection_t& point_selections; const mesh::table_t& constant_attributes; const mesh::table_t& patch_attributes; const mesh::table_t& parameter_attributes; const mesh::table_t& vertex_attributes; }; /// Creates a new nurbs_patch mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Creates a new nurbs_patch mesh primitive using the given primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh::primitive& Primitive); /// Tests the given mesh primitive to see if it is a valid nurbs_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid nurbs_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid nurbs_patch primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace nurbs_patch } // namespace k3d #endif // !K3DSDK_NURBS_PATCH_H ================================================ FILE: k3dsdk/options.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #ifdef K3D_API_WIN32 #define DEFAULT_BITMAP_VIEWER "mspaint \"%1%\"" #else // K3D_API_WIN32 #define DEFAULT_BITMAP_VIEWER "display \"%1%\"" #endif // !K3D_API_WIN32 namespace k3d { namespace options { namespace detail { xml::element& version_element() { return tree().safe_element("version"); } xml::element& paths_element() { return tree().safe_element("paths"); } xml::element& path_element(const string_t PathType) { const xml::element match("path", xml::attribute("type", PathType)); const xml::element prototype("path", xml::attribute("type", PathType)); return paths_element().safe_element(match, prototype); } xml::element& commands_element() { return tree().safe_element("commands"); } xml::element& command_element(const string_t CommandType) { const xml::element match("command", xml::attribute("type", CommandType)); const xml::element prototype("command", xml::attribute("type", CommandType)); return commands_element().safe_element(match, prototype); } } // namespace detail ////////////////////////////////////////////////////////////////////////////////////////// // file_storage::implementation class file_storage::implementation { public: implementation(const filesystem::path& File) : m_file(File) { try { log() << info << "Loading options from " << m_file.native_console_string() << std::endl; filesystem::ifstream stream(m_file); stream >> m_tree; return; } catch(std::exception& e) { log() << error << "Exception loading options: " << e.what() << std::endl; } catch(...) { log() << error << "Unknown exception loading options" << std::endl; } // Create a new, empty tree ... m_tree = xml::element("k3dml"); } ~implementation() { commit(); } xml::element& tree() { return m_tree; } void commit() { try { log() << info << "Saving options to " << m_file.native_console_string() << std::endl; filesystem::ofstream stream(m_file); stream << xml::declaration() << m_tree; } catch(std::exception& e) { log() << error << "Exception saving options: " << e.what() << std::endl; } catch(...) { log() << error << "Unknown exception saving options" << std::endl; } } private: filesystem::path m_file; xml::element m_tree; }; ////////////////////////////////////////////////////////////////////////////////////////// // file_storage file_storage::file_storage(const filesystem::path& File) : m_implementation(new implementation(File)) { } file_storage::~file_storage() { delete m_implementation; } xml::element& file_storage::tree() { return m_implementation->tree(); } void file_storage::commit() { m_implementation->commit(); } ////////////////////////////////////////////////////////////////////////////////////////// // set_storage /// Storage for global user options istorage* g_option_storage = 0; void set_storage(istorage& Storage) { g_option_storage = &Storage; // Defines the version of the data stored in the options tree ... incrementing it will force user options to be reset const unsigned long current_version = 4; if(detail::version_element().text.empty() || (boost::lexical_cast(detail::version_element().text) < current_version)) { log() << warning << "Resetting options data to version " << current_version << std::endl; tree().children.clear(); detail::version_element().text = k3d::string_cast(current_version); } // Default external paths if(detail::path_element(path::render_farm()).text.empty()) detail::path_element(path::render_farm()).text = system::get_temp_directory().native_utf8_string().raw(); if(detail::path_element(path::scripts()).text.empty()) detail::path_element(path::scripts()).text = (share_path() / filesystem::generic_path("scripts")).native_utf8_string().raw(); if(detail::path_element(path::documents()).text.empty()) detail::path_element(path::documents()).text = system::get_home_directory().native_utf8_string().raw(); if(detail::path_element(path::bitmaps()).text.empty()) detail::path_element(path::bitmaps()).text = system::get_home_directory().native_utf8_string().raw(); if(detail::path_element(path::tutorials()).text.empty()) detail::path_element(path::tutorials()).text = system::get_home_directory().native_utf8_string().raw(); if(detail::path_element(path::render_frame()).text.empty()) detail::path_element(path::render_frame()).text = system::get_home_directory().native_utf8_string().raw(); if(detail::path_element(path::render_animation()).text.empty()) detail::path_element(path::render_animation()).text = system::get_home_directory().native_utf8_string().raw(); if(detail::path_element(path::displacement_shaders()).text.empty()) detail::path_element(path::displacement_shaders()).text = (share_path() / filesystem::generic_path("shaders/displacement")).native_utf8_string().raw(); if(detail::path_element(path::imager_shaders()).text.empty()) detail::path_element(path::imager_shaders()).text = (share_path() / filesystem::generic_path("shaders/imager")).native_utf8_string().raw(); if(detail::path_element(path::light_shaders()).text.empty()) detail::path_element(path::light_shaders()).text = (share_path() / filesystem::generic_path("shaders/light")).native_utf8_string().raw(); if(detail::path_element(path::surface_shaders()).text.empty()) detail::path_element(path::surface_shaders()).text = (share_path() / filesystem::generic_path("shaders/surface")).native_utf8_string().raw(); if(detail::path_element(path::transformation_shaders()).text.empty()) detail::path_element(path::transformation_shaders()).text = (share_path() / filesystem::generic_path("shaders/transformation")).native_utf8_string().raw(); if(detail::path_element(path::volume_shaders()).text.empty()) detail::path_element(path::volume_shaders()).text = (share_path() / filesystem::generic_path("shaders/volume")).native_utf8_string().raw(); // Default external commands if(get_command(command::bitmap_viewer()).empty()) set_command(command::bitmap_viewer(), DEFAULT_BITMAP_VIEWER); } const filesystem::path get_path(const string_t& PathType) { return filesystem::native_path(ustring::from_utf8(detail::path_element(PathType).text)); } void set_path(const string_t& PathType, const filesystem::path& Path) { detail::path_element(PathType).text = Path.native_utf8_string().raw(); } const string_t get_command(const string_t& CommandType) { return detail::command_element(CommandType).text; } void set_command(const string_t& CommandType, const string_t& Command) { detail::command_element(CommandType).text = Command; } xml::element& tree() { // If this fires, you forgot to call set_storage() at program startup!!! assert(g_option_storage); return g_option_storage->tree(); } void commit() { // If this fires, you forgot to call set_storage() at program startup!!! assert(g_option_storage); g_option_storage->commit(); } } // namespace options } // namespace k3d ================================================ FILE: k3dsdk/options.h ================================================ #ifndef K3DSDK_OPTIONS_H #define K3DSDK_OPTIONS_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace filesystem { class path; } namespace xml { class element; } namespace options { /// Returns the default file path for the given data type (e.g. bitmap, document, script, etc) const filesystem::path get_path(const string_t& PathType); /// Sets the default file path for the given data type (e.g. bitmap, document, script, etc) void set_path(const string_t& PathType, const filesystem::path& Path); /// Predefined path types for use with get_path() and set_path() namespace path { inline const string_t render_farm() { return "render_farm"; } inline const string_t scripts() { return "scripts"; } inline const string_t documents() { return "documents"; } inline const string_t bitmaps() { return "bitmaps"; } inline const string_t tutorials() { return "tutorials"; } inline const string_t test_cases() { return "test_cases"; } inline const string_t render_frame() { return "render_frame"; } inline const string_t render_animation() { return "render_animation"; } inline const string_t fonts() { return "fonts"; } inline const string_t displacement_shaders() { return "displacement_shaders"; } inline const string_t imager_shaders() { return "imager_shaders"; } inline const string_t light_shaders() { return "light_shaders"; } inline const string_t surface_shaders() { return "surface_shaders"; } inline const string_t transformation_shaders() { return "transformation_shaders"; } inline const string_t volume_shaders() { return "volume_shaders"; } } // namespace path /// Returns the external command-line for the given action (e.g. bitmap, document, script, etc) const string_t get_command(const string_t& CommandType); /// Sets the default file path for the given data type (e.g. bitmap, document, script, etc) void set_command(const string_t& CommandType, const string_t& Command); /// Predefined command types for use with get_command() and set_command() namespace command { inline const string_t bitmap_viewer() { return "bitmap_viewer"; } } // namespace command /// Returns the hierarchical tree of user options (so you can store your own data) xml::element& tree(); /// Stores any modifications to the tree to persistent storage void commit(); } // namespace options } // namespace k3d #endif // !K3DSDK_OPTIONS_H ================================================ FILE: k3dsdk/options_policy.h ================================================ #ifndef K3DSDK_OPTIONS_POLICY_H #define K3DSDK_OPTIONS_POLICY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares k3d::istorage, an abstract interface for global user option storage (could be a file, could be gconf, could be the Windoze registry, etc) \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { // Forward declarations namespace xml { class element; } namespace options { /// Abstract interface for global user option storage class istorage : public virtual iunknown { public: /// Returns the stored user option data virtual xml::element& tree() = 0; /// Commits any modifications to the stored user option data to persistent storage virtual void commit() = 0; protected: istorage() {} istorage(const istorage&) {} istorage& operator = (const istorage&) { return *this; } virtual ~istorage() {} }; /// Trivial implementation of k3d::istorage that serializes data to an XML file class file_storage : public istorage { public: file_storage(const filesystem::path& File); ~file_storage(); xml::element& tree(); void commit(); private: class implementation; implementation* const m_implementation; }; /// Sets the istorage implementation to be used for storing user options ... this must be called once at startup before any other sdk calls are made void set_storage(istorage& OptionStorage); } // namespace options } // namespace k3d #endif // !K3DSDK_OPTIONS_POLICY_H ================================================ FILE: k3dsdk/os_load_module.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { ////////////////////////////////////////////////////////////////////////////// // os_load_module #if defined K3D_API_WIN32 #include void os_load_module(const filesystem::path& FilePath, register_plugins_entry_point& RegisterPlugins) { const UINT old_error_mode = SetErrorMode(SetErrorMode(SEM_FAILCRITICALERRORS)); // Disable error dialogs when loading DLLs HINSTANCE module = LoadLibrary(FilePath.native_filesystem_string().c_str()); SetErrorMode(old_error_mode); if(!module) { log() << error << "Module [" << FilePath.native_console_string() << "] could not be loaded: error " << GetLastError() << std::endl; return; } RegisterPlugins = register_plugins_entry_point(GetProcAddress(module, "register_k3d_plugins")); if(!RegisterPlugins) RegisterPlugins = register_plugins_entry_point(GetProcAddress(module, "_register_k3d_plugins")); if(!RegisterPlugins) { log() << error << "Module " << FilePath.leaf().raw() << " does not contain required register_k3d_plugins() entry point" << std::endl; return; } } #else // !K3D_API_WIN32 #include void os_load_module(const filesystem::path& FilePath, register_plugins_entry_point& RegisterPlugins) { void* module = dlopen(FilePath.native_filesystem_string().c_str(), RTLD_GLOBAL | RTLD_LAZY); if(!module) { log() << error << "Module " << FilePath.leaf().raw() << ": " << dlerror() << std::endl; return; } RegisterPlugins = register_plugins_entry_point(dlsym(module, "register_k3d_plugins")); if(!RegisterPlugins) { log() << error << "Module " << FilePath.leaf().raw() << " does not contain required register_k3d_plugins() entry point" << std::endl; return; } } #endif // !K3D_API_WIN32 } // namespace k3d ================================================ FILE: k3dsdk/os_load_module.h ================================================ #ifndef K3DSDK_OS_LOAD_MODULE_H #define K3DSDK_OS_LOAD_MODULE_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace filesystem { class path; } ////////////////////////////////////////////////////////////////////////////// // os_load_module /// Handles the platform-specific details of loading a module void os_load_module(const filesystem::path& FilePath, register_plugins_entry_point& RegisterPlugins); } // namespace k3d #endif // !K3DSDK_OS_LOAD_MODULE_H ================================================ FILE: k3dsdk/painter_render_state_gl.h ================================================ #ifndef K3DSDK_PAINTER_RENDER_STATE_GL_H #define K3DSDK_PAINTER_RENDER_STATE_GL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace gl { /// Used to pass rendering state from a node to a mesh painter class painter_render_state : public render_state { public: painter_render_state(const render_state& State, const matrix4& Matrix, const bool ShowComponentSelection) : render_state(State), matrix(Matrix), inside_out(k3d::inside_out(Matrix)), show_component_selection(ShowComponentSelection) { } /// Stores the complete world-to-object transform matrix for the mesh to be rendered matrix4 matrix; /// Set to true if the mesh transform matrix will turn it inside-out bool inside_out; /// Set to true if painters should highlight selected gprims bool show_component_selection; }; } // namespace gl } // namespace k3d #endif // !K3DSDK_PAINTER_RENDER_STATE_GL_H ================================================ FILE: k3dsdk/painter_selection_state_gl.h ================================================ #ifndef K3DSDK_PAINTER_SELECTION_STATE_GL_H #define K3DSDK_PAINTER_SELECTION_STATE_GL_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace gl { /// Used to pass selection state from a node to a mesh painter class painter_selection_state : public selection_state { public: painter_selection_state(const selection_state& State) : selection_state(State) { } }; } // namespace gl } // namespace k3d #endif // !K3DSDK_PAINTER_SELECTION_STATE_GL_H ================================================ FILE: k3dsdk/paraboloid.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { namespace paraboloid { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::doubles_t& Radii, const mesh::doubles_t& ZMin, const mesh::doubles_t& ZMax, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), radii(Radii), z_min(ZMin), z_max(ZMax), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::doubles_t& Radii, mesh::doubles_t& ZMin, mesh::doubles_t& ZMax, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes ) : matrices(Matrices), materials(Materials), radii(Radii), z_min(ZMin), z_max(ZMax), sweep_angles(SweepAngles), selections(Selections), constant_attributes(ConstantAttributes), surface_attributes(SurfaceAttributes), parameter_attributes(ParameterAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("paraboloid"); primitive* const result = new primitive( generic_primitive.structure["surface"].create("matrices"), generic_primitive.structure["surface"].create("materials"), generic_primitive.structure["surface"].create("radii"), generic_primitive.structure["surface"].create("z_min"), generic_primitive.structure["surface"].create("z_max"), generic_primitive.structure["surface"].create("sweep_angles"), generic_primitive.structure["surface"].create("selections"), generic_primitive.attributes["constant"], generic_primitive.attributes["surface"], generic_primitive.attributes["parameter"] ); result->selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "paraboloid") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& surface_structure = require_structure(Primitive, "surface"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); const mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); const mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); const mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); const mesh::doubles_t& radii = require_array(Primitive, surface_structure, "radii"); const mesh::doubles_t& z_min = require_array(Primitive, surface_structure, "z_min"); const mesh::doubles_t& z_max = require_array(Primitive, surface_structure, "z_max"); const mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); const mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new const_primitive(matrices, materials, radii, z_min, z_max, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "paraboloid") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& surface_structure = require_structure(Primitive, "surface"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& surface_attributes = require_attributes(Primitive, "surface"); mesh::table_t& parameter_attributes = require_attributes(Primitive, "parameter"); mesh::matrices_t& matrices = require_array(Primitive, surface_structure, "matrices"); mesh::materials_t& materials = require_array(Primitive, surface_structure, "materials"); mesh::doubles_t& radii = require_array(Primitive, surface_structure, "radii"); mesh::doubles_t& z_min = require_array(Primitive, surface_structure, "z_min"); mesh::doubles_t& z_max = require_array(Primitive, surface_structure, "z_max"); mesh::doubles_t& sweep_angles = require_array(Primitive, surface_structure, "sweep_angles"); mesh::selection_t& selections = require_array(Primitive, surface_structure, "selections"); require_metadata(Primitive, selections, "selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, parameter_attributes, "parameter", surface_structure.row_count() * 4); return new primitive(matrices, materials, radii, z_min, z_max, sweep_angles, selections, constant_attributes, surface_attributes, parameter_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "paraboloid") return 0; return validate(Mesh, Primitive.writable()); } } // namespace paraboloid } // namespace k3d ================================================ FILE: k3dsdk/paraboloid.h ================================================ #ifndef K3DSDK_PARABOLOID_H #define K3DSDK_PARABOLOID_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace paraboloid { /// Gathers the member arrays of a paraboloid primitive into a convenient package class const_primitive { public: const_primitive( const mesh::matrices_t& Matrices, const mesh::materials_t& Materials, const mesh::doubles_t& Radii, const mesh::doubles_t& ZMin, const mesh::doubles_t& ZMax, const mesh::doubles_t& SweepAngles, const mesh::selection_t& Selections, const mesh::table_t& ConstantAttributes, const mesh::table_t& SurfaceAttributes, const mesh::table_t& ParameterAttributes); const mesh::matrices_t& matrices; const mesh::materials_t& materials; const mesh::doubles_t& radii; const mesh::doubles_t& z_min; const mesh::doubles_t& z_max; const mesh::doubles_t& sweep_angles; const mesh::selection_t& selections; const mesh::table_t& constant_attributes; const mesh::table_t& surface_attributes; const mesh::table_t& parameter_attributes; }; /// Gathers the member arrays of a paraboloid primitive into a convenient package class primitive { public: primitive( mesh::matrices_t& Matrices, mesh::materials_t& Materials, mesh::doubles_t& Radii, mesh::doubles_t& ZMin, mesh::doubles_t& ZMax, mesh::doubles_t& SweepAngles, mesh::selection_t& Selections, mesh::table_t& ConstantAttributes, mesh::table_t& SurfaceAttributes, mesh::table_t& ParameterAttributes); mesh::matrices_t& matrices; mesh::materials_t& materials; mesh::doubles_t& radii; mesh::doubles_t& z_min; mesh::doubles_t& z_max; mesh::doubles_t& sweep_angles; mesh::selection_t& selections; mesh::table_t& constant_attributes; mesh::table_t& surface_attributes; mesh::table_t& parameter_attributes; }; /// Creates a new paraboloid mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid paraboloid primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid paraboloid primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid paraboloid primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace paraboloid } // namespace k3d #endif // !K3DSDK_PARABOLOID_H ================================================ FILE: k3dsdk/parallel/CMakeLists.txt ================================================ PROJECT(k3dsdk-parallel) FILE(GLOB HEADERS *.h) FILE(GLOB SOURCES *.cpp) LIST(SORT HEADERS) LIST(SORT SOURCES) K3D_ADD_LIBRARY(k3dsdk-parallel SHARED ${HEADERS} ${SOURCES}) K3D_GENERATE_DEF_FILE(k3dsdk-parallel) IF(K3D_ENABLE_PARALLEL) INCLUDE_DIRECTORIES(${K3D_TBB_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(k3dsdk-parallel ${K3D_TBB_LIBRARY}) ENDIF(K3D_ENABLE_PARALLEL) INSTALL(TARGETS k3dsdk-parallel RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(FILES ${HEADERS} DESTINATION include/k3d/k3dsdk/parallel) ================================================ FILE: k3dsdk/parallel/blocked_range.h ================================================ #ifndef K3DSDK_PARALLEL_BLOCKED_RANGE_H #define K3DSDK_PARALLEL_BLOCKED_RANGE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace parallel { template class blocked_range { public: //! Type of a value /** Called a const_iterator for sake of algorithms that need to treat a blocked_range as an STL container. */ typedef ValueT const_iterator; //! Type for size of a range typedef uint_t size_type; //! Construct range with default-constructed values for begin and end. /** Requires that Value have a default constructor. */ blocked_range() : m_begin(), m_end() { } //! Construct range over half-open interval [begin,end), with the given grainsize. blocked_range(ValueT Begin, ValueT End, size_type Grainsize = 1) : m_end(End), m_begin(Begin), m_grainsize(Grainsize) { // __TBB_ASSERT( m_grainsize>0, "grainsize must be positive" ); } //! Beginning of range. const_iterator begin() const { return m_begin; } //! One past last value in range. const_iterator end() const { return m_end; } //! Size of the range /** Unspecified if end() blocked_range(blocked_range& r, SplitT split) : m_end(r.m_end), m_begin(do_split(r)), m_grainsize(r.m_grainsize) { } private: /** NOTE: m_end MUST be declared before m_begin, otherwise the forking constructor will break. */ ValueT m_end; ValueT m_begin; size_type m_grainsize; //! Auxilary function used by forking constructor. /** Using this function lets us not require that Value support assignment or default construction. */ static ValueT do_split(blocked_range& r) { // __TBB_ASSERT( r.is_divisible(), "cannot split blocked_range that is not divisible" ); ValueT middle = r.m_begin + (r.m_end - r.m_begin) / 2u; r.m_end = middle; return middle; } }; } // namespace parallel } // namespace k3d #endif // !K3DSDK_PARALLEL_BLOCKED_RANGE_H ================================================ FILE: k3dsdk/parallel/parallel_for.h ================================================ #ifndef K3DSDK_PARALLEL_PARALLEL_FOR_H #define K3DSDK_PARALLEL_PARALLEL_FOR_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #ifdef K3D_ENABLE_PARALLEL #include #endif // K3D_ENABLE_PARALLEL namespace k3d { namespace parallel { template void parallel_for(const RangeT& Range, const BodyT& Body); #ifdef K3D_ENABLE_PARALLEL template void parallel_for(const RangeT& Range, const BodyT& Body) { ::tbb::parallel_for(Range, Body); } #else // K3D_ENABLE_PARALLEL template void parallel_for(const RangeT& Range, const BodyT& Body) { Body(Range); } #endif // !K3D_ENABLE_PARALLEL } // namespace parallel } // namespace k3d #endif // !K3DSDK_PARALLEL_PARALLEL_FOR_H ================================================ FILE: k3dsdk/parallel/threads.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #ifdef K3D_ENABLE_PARALLEL #include #endif // K3D_ENABLE_PARALLEL namespace k3d { namespace parallel { static uint_t g_grain_size = 10000; #ifdef K3D_ENABLE_PARALLEL void set_thread_count(const int32_t Count) { static ::tbb::task_scheduler_init scheduler(::tbb::task_scheduler_init::automatic); scheduler.terminate(); if(Count == automatic) scheduler.initialize(::tbb::task_scheduler_init::automatic); else scheduler.initialize(Count); } #else // K3D_ENABLE_PARALLEL void set_thread_count(const int32_t) { } #endif // !K3D_ENABLE_PARALLEL void set_grain_size(const uint_t GrainSize) { g_grain_size = GrainSize; } uint_t grain_size() { return g_grain_size; } } // namespace parallel } // namespace k3d ================================================ FILE: k3dsdk/parallel/threads.h ================================================ #ifndef K3DSDK_PARALLEL_THREADS_H #define K3DSDK_PARALLEL_THREADS_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { namespace parallel { enum { /// Set the number of threads to be used for parallel operations automatically (e.g: based on the number of hardware threads) automatic = -1 }; /// Set the number of threads to be used for parallel operations void set_thread_count(const int32_t Count); /// Set the preferred grainsize to be used for parallel operations void set_grain_size(const uint_t GrainSize); /// Get the preferred grainsize to be used for parallel operations uint_t grain_size(); } // namespace parallel } // namespace k3d #endif // !K3DSDK_PARALLEL_THREADS_H ================================================ FILE: k3dsdk/parentable.h ================================================ #ifndef K3DSDK_PARENTABLE_H #define K3DSDK_PARENTABLE_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { class idocument; class iplugin_factory; /// Provides a boilerplate implementation of an object that can be parented to another template class parentable : public base_t, public iparentable { public: parentable(iplugin_factory& Factory, idocument& Document) : base_t(Factory, Document), m_parent(init_owner(*this) + init_name("parent") + init_label(_("Parent")) + init_description(_("Parent")) + init_value(0)) { } iproperty& parent() { return m_parent; } private: k3d_data(inode*, data::immutable_name, data::change_signal, data::with_undo, data::node_storage, data::no_constraint, data::node_property, data::node_serialization) m_parent; }; } // namespace k3d #endif // !K3DSDK_PARENTABLE_H ================================================ FILE: k3dsdk/particle.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { namespace particle { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const typed_array& Material, const uint_t_array& Points, const table& ConstantAttributes, const table& VertexAttributes ) : material(Material), points(Points), constant_attributes(ConstantAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( typed_array& Material, uint_t_array& Points, table& ConstantAttributes, table& VertexAttributes ) : material(Material), points(Points), constant_attributes(ConstantAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("particle"); primitive* const result = new primitive( generic_primitive.structure["constant"].create >("material"), generic_primitive.structure["vertex"].create("points"), generic_primitive.attributes["constant"], generic_primitive.attributes["vertex"] ); result->points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); return result; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "particle") return 0; try { require_valid_primitive(Mesh, Primitive); const table& constant_structure = require_structure(Primitive, "constant"); const table& vertex_structure = require_structure(Primitive, "vertex"); const typed_array& material = require_array >(Primitive, constant_structure, "material"); const uint_t_array& points = require_array(Primitive, vertex_structure, "points"); const table& constant_attributes = require_attributes(Primitive, "constant"); const table& vertex_attributes = require_attributes(Primitive, "vertex"); require_metadata(Primitive, points, "points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_attributes, "vertex", vertex_structure.row_count()); return new const_primitive(material, points, constant_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "particle") return 0; try { require_valid_primitive(Mesh, Primitive); table& constant_structure = require_structure(Primitive, "constant"); table& vertex_structure = require_structure(Primitive, "vertex"); typed_array& material = require_array >(Primitive, constant_structure, "material"); uint_t_array& points = require_array(Primitive, vertex_structure, "points"); table& constant_attributes = require_attributes(Primitive, "constant"); table& vertex_attributes = require_attributes(Primitive, "vertex"); require_metadata(Primitive, points, "points", metadata::key::domain(), metadata::value::point_indices_domain()); require_table_row_count(Primitive, vertex_attributes, "vertex", vertex_structure.row_count()); return new primitive(material, points, constant_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "particle") return 0; return validate(Mesh, Primitive.writable()); } } // namespace particle } // namespace k3d ================================================ FILE: k3dsdk/particle.h ================================================ #ifndef K3DSDK_PARTICLE_H #define K3DSDK_PARTICLE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include namespace k3d { namespace particle { /// Gathers the member arrays of a particle primitive into a convenient package class const_primitive { public: const_primitive( const typed_array& Material, const uint_t_array& Points, const table& ConstantAttributes, const table& VertexAttributes ); const typed_array& material; const uint_t_array& points; const table& constant_attributes; const table& vertex_attributes; }; /// Gathers the member arrays of a particle primitive into a convenient package class primitive { public: primitive( typed_array& Material, uint_t_array& Points, table& ConstantAttributes, table& VertexAttributes ); typed_array& material; uint_t_array& points; table& constant_attributes; table& vertex_attributes; }; /// Creates a new particle mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Tests the given mesh primitive to see if it is a valid particle primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid particle primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid particle primitive, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); } // namespace particle } // namespace k3d #endif // !K3DSDK_PARTICLE_H ================================================ FILE: k3dsdk/path.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // This code leans heavily on boost::filesystem::path, most changes are to support ustring UTF-8 storage #include #include #include #include #include #include #ifdef K3D_API_WIN32 #include #else // K3D_API_WIN32 #include #include #include #include #include #endif // !K3D_API_WIN32 #include namespace k3d { namespace filesystem { namespace detail { // Define some platform-specific odds-and-ends #ifdef K3D_API_WIN32 const char NATIVE_SEARCHPATH_SEPARATOR = ';'; const char NATIVE_PATH_SEPARATOR = '\\'; #else // K3D_API_WIN32 const char NATIVE_SEARCHPATH_SEPARATOR = ':'; const char NATIVE_PATH_SEPARATOR = '/'; #endif // !K3D_API_WIN32 const char GENERIC_PATH_SEPARATOR = '/'; // end_pos is past-the-end position // return 0 if str itself is leaf (or empty) ustring::size_type leaf_pos( const ustring& str, ustring::size_type end_pos ) { if ( end_pos && str[end_pos-1] == '/' ) return end_pos-1; ustring::size_type pos( str.find_last_of( '/', end_pos-1 ) ); if ( pos == ustring::npos ) pos = str.find_last_of( ':', end_pos-2 ); return ( pos == ustring::npos // path itself must be a leaf (or empty) || (pos == 1 && str[0] == '/') // or share ) ? 0 // so leaf is entire string : pos + 1; // or starts after delimiter } bool_t is_absolute_root(const ustring& s, ustring::size_type len) { return len && s[len-1] == '/' && ( len == 1 // "/" || ( len > 1 && ( s[len-2] == ':' // drive or device || ( s[0] == '/' // share && s[1] == '/' && s.find( '/', 2 ) == len-1 ) ) ) ); } } // namespace detail ////////////////////////////////////////////////////////////////////////////////// // path::iterator::implementation class path::iterator::implementation { public: implementation() : storage(0), index(0) { } implementation(const ustring& Storage) : storage(&Storage), index(0) { if(Storage.size() > 2 && Storage[0] == '/' && Storage[1] == '/') // "//foo" { begin.push_back(0); end.push_back(std::min(Storage.size(), Storage.find('/', 2))); if(end.back() < Storage.size()) // "//foo/" { begin.push_back(end.back()); end.push_back(end.back() + 1); if(end.back() < Storage.size()) // "//foo/bar" { begin.push_back(end.back()); end.push_back(std::min(Storage.size(), Storage.find('/', end.back()))); } } } else if(Storage.size() > 1 && Storage[1] == ':') // "c:" { begin.push_back(0); end.push_back(2); if(Storage.size() > 2) { if(Storage[2] == '/') // "c:/foo/bar" { begin.push_back(2); end.push_back(3); if(Storage.size() > 3) { begin.push_back(3); end.push_back(std::min(Storage.size(), Storage.find('/', 3))); } } else // "c:foo" { begin.push_back(2); end.push_back(std::min(Storage.size(), Storage.find('/', 2))); } } } else if(Storage.size() && Storage[0] == '/') // "/foo/bar" { begin.push_back(0); end.push_back(1); if(Storage.size() > 1) { begin.push_back(1); end.push_back(std::min(Storage.size(), Storage.find('/', 1))); } } else // "foo/bar" { begin.push_back(0); end.push_back(std::min(Storage.size(), Storage.find('/'))); } while(end.size() && end.back() < Storage.size()) { begin.push_back(end.back() + 1); end.push_back(std::min(Storage.size(), Storage.find('/', end.back() + 1))); } } ustring dereference() const { return storage->substr(begin[index], end[index] - begin[index]); } bool_t equal(const implementation& rhs) const { return storage == rhs.storage && index == rhs.index; } void increment() { ++index; if(index >= begin.size()) { storage = 0; begin.clear(); end.clear(); index = 0; } } const ustring* storage; std::vector begin; std::vector end; size_t index; }; ////////////////////////////////////////////////////////////////////////////////// // path::iterator path::iterator::iterator() : m_implementation(new implementation()) { } path::iterator::iterator(const ustring& Storage) : m_implementation(new implementation(Storage)) { } path::iterator::~iterator() { delete m_implementation; } ustring path::iterator::operator*() { return m_implementation->dereference(); } bool_t path::iterator::operator==(const iterator& rhs) { return m_implementation->equal(*rhs.m_implementation); } bool_t path::iterator::operator!=(const iterator& rhs) { return !m_implementation->equal(*rhs.m_implementation); } path::iterator& path::iterator::operator++() { m_implementation->increment(); return *this; } ///////////////////////////////////////////////////////////////////////////////////////////// // path path::path() { } path::path(const ustring& GenericPath) : storage(GenericPath) { } path generic_path(const ustring& GenericPath) { return path(GenericPath); } path generic_path(const string_t& GenericPath) { return path(ustring::from_utf8(GenericPath)); } path native_path(const ustring& NativePath) { ustring generic_path(NativePath); for(ustring::size_type i = generic_path.find('\\'); i != ustring::npos; i = generic_path.find('\\')) generic_path.replace(i, 1, 1, detail::GENERIC_PATH_SEPARATOR); return path(generic_path); } path& path::operator/=(const path& rhs) { if(storage.empty()) { storage = rhs.storage; } else { if((storage[storage.size()-1] == '/') || (rhs.storage.size() && rhs.storage[0] == '/')) { storage += rhs.storage; } else { storage += detail::GENERIC_PATH_SEPARATOR; storage += rhs.storage; } } return *this; } path path::operator/(const path& rhs) const { path result(*this); result /= rhs; return result; } path path::operator+(const ustring& rhs) const { return path(storage + rhs); } path path::operator+(const string_t& rhs) const { return path(storage + ustring::from_utf8(rhs)); } ustring path::generic_utf8_string() const { return storage; } ustring path::native_utf8_string() const { ustring native_string(storage); for(ustring::size_type i = native_string.find(detail::GENERIC_PATH_SEPARATOR); i != ustring::npos; i = native_string.find(detail::GENERIC_PATH_SEPARATOR, i+1)) native_string.replace(i, 1, 1, detail::NATIVE_PATH_SEPARATOR); return native_string; } string_t path::native_console_string() const { return native_utf8_string().raw(); } string_t path::native_filesystem_string() const { #ifdef K3D_API_WIN32 return Glib::locale_from_utf8(native_utf8_string().raw()); #else // K3D_API_WIN32 return Glib::filename_from_utf8(native_utf8_string().raw()); #endif // !K3D_API_WIN32 } path path::root_path() const { return generic_path(root_name()) / generic_path(root_directory()); } ustring path::root_name() const { // Win32 cases ... ustring::size_type pos = storage.find(':'); if(pos != ustring::npos) return storage.substr(0, pos + 1); if(storage.size() > 2 && storage[0] == '/' && storage[1] == '/') { pos = storage.find('/', 2); return storage.substr(0, pos); } // Posix case ... return ustring(); } ustring path::root_directory() const { if(storage.size() > 2 && storage[1] == ':' && storage[2] == '/') return ustring::from_utf8("/"); if(storage.size() > 2 && storage[0] == '/' && storage[1] == '/') return ustring::from_utf8(storage.find('/', 2) != ustring::npos ? "/" : ""); if(storage.size() && storage[0] == '/') return ustring::from_utf8("/"); return ustring::from_utf8(""); } ustring path::leaf() const { return storage.substr(detail::leaf_pos(storage, storage.size())); } path path::branch_path() const { ustring::size_type end_pos = detail::leaf_pos(storage, storage.size()); // skip a '/' unless it is a root directory if(end_pos && storage[end_pos - 1] == '/' && !detail::is_absolute_root(storage, end_pos)) --end_pos; return path(storage.substr(0, end_pos)); } bool_t path::empty() const { return storage.empty(); } bool_t path::is_complete() const { // Win32 cases ... if(storage.size() > 2 && storage[1] == ':' && storage[2] == '/') // "c:/" return true; if(storage.size() > 2 && storage[0] == '/' && storage[1] == '/') // "//share" return true; if(storage.size() > 2 && storage[storage.size()-1] == ':') // "prn:" return true; // Posix cases ... if(storage.size() && storage[0] == '/') // "/foo" return true; return false; } path::iterator path::begin() const { return iterator(storage); } path::iterator path::end() const { return iterator(); } bool_t path::operator==(const path& that) const { return !(*this < that) && !(that < *this); } bool_t path::operator!=(const path& that) const { return !(*this == that); } bool_t path::operator<(const path& that) const { return storage < that.storage; } bool_t path::operator<=(const path& that) const { return !(that < *this); } bool_t path::operator>(const path& that) const { return that < *this; } bool_t path::operator>=(const path& that) const { return !(*this < that); } ////////////////////////////////////////////////////////////////////////////////// // exists bool_t exists(const path& Path) { #ifdef K3D_API_WIN32 return ::GetFileAttributesA(Path.native_filesystem_string().c_str()) != 0xFFFFFFFF; #else // K3D_API_WIN32 struct stat path_stat; return ::stat(Path.native_filesystem_string().c_str(), &path_stat) == 0; #endif // !K3D_API_WIN32 } const ustring extension(const path& Path); bool_t create_directory(const path& Path); bool_t create_directories(const path& Path); ///////////////////////////////////////////////////////////////////////////////////////////// // make_relative_path const filesystem::path make_relative_path(const filesystem::path& AbsolutePath, const filesystem::path& ReferencePath) { // The AbsolutePath must actually *be* an absolute path! return_val_if_fail(AbsolutePath.is_complete(), filesystem::path()); // As a special-case, if the AbsolutePath and ReferencePath don't share the same root name, return the AbsolutePath (which is the best we can do) if(AbsolutePath.root_name() != ReferencePath.root_name()) return AbsolutePath; filesystem::path relative_path; const filesystem::path root_path = ReferencePath; const filesystem::path absolute_path(AbsolutePath); filesystem::path::iterator a = root_path.begin(); filesystem::path::iterator b = absolute_path.begin(); while(a != root_path.end() && b != absolute_path.end() && *a == *b) { ++a; ++b; } for(; a != root_path.end(); ++a) relative_path /= filesystem::generic_path(".."); for(; b != absolute_path.end(); ++b) relative_path /= filesystem::generic_path(*b); return relative_path; } ////////////////////////////////////////////////////////////////////////////////// // extension const ustring extension(const path& Path) { ustring leaf = Path.leaf(); ustring::size_type n = leaf.rfind('.'); if (n != ustring::npos) return leaf.substr(n); else return ustring(); } ////////////////////////////////////////////////////////////////////////////////// // replace_extension const path replace_extension(const path& Path, const string_t& NewExtension) { ustring temp = Path.generic_utf8_string(); return generic_path(temp.substr(0, temp.rfind('.')) + ustring::from_utf8(NewExtension)); } ////////////////////////////////////////////////////////////////////////////////// // create_directory bool_t create_directory(const path& Path) { return_val_if_fail(!Path.empty(), false); if(exists(Path)) { if(is_directory(Path)) return true; k3d::log() << error << "Path [" << Path.native_console_string() << "] exists and is not a directory" << std::endl; return false; } #ifdef K3D_API_WIN32 if ( ::CreateDirectoryA( Path.native_filesystem_string().c_str(), 0 ) ) return true; #else // K3D_API_WIN32 if ( ::mkdir( Path.native_filesystem_string().c_str(), S_IRWXU|S_IRWXG|S_IRWXO ) == 0 ) return true; #endif // !K3D_API_WIN32 k3d::log() << error << "Error creating directory [" << Path.native_console_string() << "]" << std::endl; return false; } ////////////////////////////////////////////////////////////////////////////////// // create_directories bool_t create_directories(const path& Path) { return_val_if_fail(!Path.empty(), false); if(exists(Path)) { if(is_directory(Path)) return true; k3d::log() << error << "Path [" << Path.native_console_string() << "] exists and is not a directory" << std::endl; return false; } // First create branch, by calling ourself recursively if(!create_directories(Path.branch_path())) return false; // Now that parent's path exists, create the directory return create_directory(Path); } ////////////////////////////////////////////////////////////////////////////////// // is_directory bool_t is_directory(const path& Path) { #ifdef K3D_API_WIN32 const DWORD attributes = ::GetFileAttributesA(Path.native_filesystem_string().c_str()); return attributes & FILE_ATTRIBUTE_DIRECTORY; #else // K3D_API_WIN32 struct stat path_stat; if(::stat(Path.native_filesystem_string().c_str(), &path_stat) != 0) return false; return S_ISDIR(path_stat.st_mode); #endif // !K3D_API_WIN32 } ////////////////////////////////////////////////////////////////////////////////// // remove bool_t remove(const path& Path) { #ifdef K3D_API_WIN32 if(is_directory(Path)) return ::RemoveDirectory(Path.native_filesystem_string().c_str()); return ::DeleteFile(Path.native_filesystem_string().c_str()); #else // K3D_API_WIN32 if(is_directory(Path)) return 0 == ::rmdir(Path.native_filesystem_string().c_str()); return 0 == ::unlink(Path.native_filesystem_string().c_str()); #endif // !K3D_API_WIN32 } ////////////////////////////////////////////////////////////////////////////////// // rename bool_t rename(const path& Source, const path& Target) { #ifdef K3D_API_WIN32 return ::MoveFile(Source.native_filesystem_string().c_str(), Target.native_filesystem_string().c_str()); #else // K3D_API_WIN32 return 0 == ::rename(Source.native_filesystem_string().c_str(), Target.native_filesystem_string().c_str()); #endif // !K3D_API_WIN32 } ////////////////////////////////////////////////////////////////////////////////// // copy_file bool_t copy_file(const path& Source, const path& Target) { #ifdef K3D_API_WIN32 return ::CopyFile(Source.native_filesystem_string().c_str(), Target.native_filesystem_string().c_str(), false); #else // K3D_API_WIN32 struct stat source_stat; if(0 != ::stat(Source.native_filesystem_string().c_str(), &source_stat)) return false; const int source_file = ::open(Source.native_filesystem_string().c_str(), O_RDONLY); if(source_file < 1) return false; const int target_file = ::open(Target.native_filesystem_string().c_str(), O_WRONLY | O_CREAT | O_EXCL, source_stat.st_mode); if(target_file < 1) { ::close(source_file); return false; } bool_t result = true; const std::size_t buffer_size = 32768; boost::scoped_array buffer(new char[buffer_size]); for(ssize_t bytes_read = ::read(source_file, buffer.get(), buffer_size); bytes_read > 0; bytes_read = ::read(source_file, buffer.get(), buffer_size)) { if(::write(target_file, buffer.get(), bytes_read) < 0) { result = false; break; } } if(::close(source_file) < 0 ) result = false; if(::close(target_file) < 0 ) result = false; return result; #endif // !K3D_API_WIN32 } ////////////////////////////////////////////////////////////////////////////////// // up_to_date bool_t up_to_date(const path& Source, const path& Target) { // Get the last modification time of the source ... time_t source_modified = 0; return_val_if_fail(system::file_modification_time(Source, source_modified), false); // Get the last modification time of the target (if it exists) ... time_t target_modified = 0; system::file_modification_time(Target, target_modified); return source_modified <= target_modified; } ////////////////////////////////////////////////////////////////////////////////// // split_native_paths const path_list split_native_paths(const ustring& Paths) { path_list results; ustring::size_type begin = 0; const ustring::size_type end = Paths.size(); for(ustring::size_type separator = Paths.find(detail::NATIVE_SEARCHPATH_SEPARATOR, begin); separator != ustring::npos; separator = Paths.find(detail::NATIVE_SEARCHPATH_SEPARATOR, begin)) { results.push_back(native_path(Paths.substr(begin, separator - begin))); begin = separator + 1; } if(begin < end) results.push_back(native_path(Paths.substr(begin, end - begin))); return results; } ////////////////////////////////////////////////////////////////////////////////// // directory_iterator::implementation #ifdef K3D_API_WIN32 class directory_iterator::implementation { public: implementation(const path& Path) : handle(INVALID_HANDLE_VALUE), branch_path(Path) { path temp = Path + "\\*"; handle = ::FindFirstFile(temp.native_filesystem_string().c_str(), &data); skip_dots(); if(handle != INVALID_HANDLE_VALUE) full_path = branch_path / generic_path(ustring::from_utf8(data.cFileName)); } implementation() : handle(INVALID_HANDLE_VALUE) { } ~implementation() { if(handle != INVALID_HANDLE_VALUE) ::FindClose(handle); } directory_iterator::reference dereference() const { return full_path; } void increment() { internal_increment(); skip_dots(); if(handle != INVALID_HANDLE_VALUE) full_path = branch_path / generic_path(ustring::from_utf8(data.cFileName)); } bool_t equal(const implementation& rhs) const { return handle == rhs.handle; } private: void internal_increment() { if(0 == ::FindNextFile(handle, &data)) { ::FindClose(handle); handle = INVALID_HANDLE_VALUE; } } void skip_dots() { while(handle != INVALID_HANDLE_VALUE && data.cFileName[0]=='.' && (data.cFileName[1]=='\0' || (data.cFileName[1]=='.' && data.cFileName[2]=='\0'))) internal_increment(); } HANDLE handle; WIN32_FIND_DATA data; const path branch_path; path full_path; }; #else // K3D_API_WIN32 class directory_iterator::implementation { public: implementation(const path& Path) : handle(0), current(0), branch_path(Path) { handle = ::opendir(Path.native_filesystem_string().c_str()); internal_increment(); skip_dots(); if(current) full_path = branch_path / generic_path(current->d_name); } implementation() : handle(0), current(0) { } ~implementation() { if(handle) ::closedir(handle); } directory_iterator::reference dereference() const { return full_path; } void increment() { internal_increment(); skip_dots(); if(current) full_path = branch_path / generic_path(current->d_name); } bool_t equal(const implementation& rhs) { return current == rhs.current; } private: void internal_increment() { if(handle) { current = ::readdir(handle); if(!current) { ::closedir(handle); handle = 0; } } } void skip_dots() { while(current && current->d_name[0]=='.' && (current->d_name[1]=='\0' || (current->d_name[1]=='.' && current->d_name[2]=='\0'))) internal_increment(); } DIR* handle; dirent* current; const path branch_path; path full_path; }; #endif // !K3D_API_WIN32 ////////////////////////////////////////////////////////////////////////////////// // directory_iterator directory_iterator::directory_iterator(const path& Path) : m_implementation(new implementation(Path)) { } directory_iterator::directory_iterator() : m_implementation(new implementation()) { } directory_iterator::~directory_iterator() { delete m_implementation; } directory_iterator::reference directory_iterator::dereference() const { return m_implementation->dereference(); } void directory_iterator::increment() { m_implementation->increment(); } bool_t directory_iterator::equal(const directory_iterator& rhs) const { return m_implementation->equal(*rhs.m_implementation); } } // namespace filesystem } // namespace k3d ================================================ FILE: k3dsdk/path.h ================================================ #ifndef K3DSDK_PATH_H #define K3DSDK_PATH_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace filesystem { /// Portable filesystem path that closely follows the boost::filesystem::path interface, with some important exceptions /** \note Never throws an exception */ /** \note Stores paths in UTF-8 encoding. All input and output is in UTF-8 encoding. */ class path { public: /// Constructs an empty path path(); /// Constructs a path from a string containing the generic grammar friend path generic_path(const ustring& GenericPath); /// Constructs a path from a string containing the generic grammar (the string is assumed to contain UTF-8 data, no character set conversion is applied) friend path generic_path(const string_t& GenericPath); /// Constructs a path from a native file string, i.e. any valid Posix or Win32 path (doesn't matter which platform we were compiled on) friend path native_path(const ustring& NativePath); /// Path concatenation path& operator/=(const path& rhs); /// Path concatenation path operator/(const path& rhs) const; /// Appending text (useful for file extensions) path operator+(const ustring& rhs) const; /// Appending text (useful for file extensions) path operator+(const string_t& rhs) const; /// Returns the generic form of the path as a UTF-8 encoded string ustring generic_utf8_string() const; /// Returns the native form of the path as a UTF-8 encoded string ustring native_utf8_string() const; /// Returns the native form of the path as a string suitable for console output string_t native_console_string() const; /// Returns the native form of the path as a string suitable for use with the underlying OS filesystem string_t native_filesystem_string() const; // modification functions: // path& normalize(); // decomposition functions: path root_path() const; ustring root_name() const; ustring root_directory() const; // path relative_path() const; ustring leaf() const; path branch_path() const; // query functions: bool_t empty() const; bool_t is_complete() const; /* bool_t has_root_path() const; bool_t has_root_name() const; bool_t has_root_directory() const; bool_t has_relative_path() const; bool_t has_leaf() const; bool_t has_branch_path() const; */ // iteration: class iterator { public: typedef std::forward_iterator_tag iterator_category; typedef ustring value_type; typedef ustring& reference; typedef ustring* pointer; typedef ptrdiff_t difference_type; iterator(); iterator(const ustring& Storage); ~iterator(); value_type operator*(); bool_t operator==(const iterator& RHS); bool_t operator!=(const iterator& RHS); iterator& operator++(); private: class implementation; implementation* const m_implementation; }; iterator begin() const; iterator end() const; // relational operators: bool_t operator==(const path& that) const; bool_t operator!=(const path& that) const; bool_t operator<(const path& that) const; bool_t operator<=(const path& that) const; bool_t operator>(const path& that) const; bool_t operator>=(const path& that) const; private: path(const ustring& GenericPath); ustring storage; }; /// Constructs a path from a string containing the generic grammar path generic_path(const ustring& GenericPath); /// Constructs a path from a string containing the generic grammar (the string is assumed to contain UTF-8 data, no character set conversion is applied) path generic_path(const string_t& GenericPath); /// Constructs a path from a native file string, i.e. any valid Posix or Win32 path (doesn't matter which platform we were compiled on) path native_path(const ustring& NativePath); /// Defines a collection of paths typedef std::vector path_list; /// Returns true if the operating system reports that the given file exists bool_t exists(const path& Path); /// Converts the given absolute path into a relative path, relative to the given reference path const path make_relative_path(const path& AbsolutePath, const path& ReferencePath); /// If Path.leaf() contains a dot, returns the substring of Path.leaf() starting from the last dot. Otherwise, returns empty string const ustring extension(const path& Path); /// If Path.leaf() contains a dot, replaces the substring of Path.leaf() starting from the last dot with the given text. Otherwise, returns empty string. const path replace_extension(const path& Path, const string_t& NewExtension); /// Creates the given directory bool_t create_directory(const path& Path); /// Creates the given directory, including any missing parent directories bool_t create_directories(const path& Path); /// Returns true if the given path is a directory bool_t is_directory(const path& Path); /// Removes a file bool_t remove(const path& Path); /// Renames a file bool_t rename(const path& Source, const path& Target); /// Copies a file bool_t copy_file(const path& Source, const path& Target); /// Returns true iff the Target exists and is newer than the Source bool_t up_to_date(const path& Source, const path& Target); /// Splits a string containing delimited paths (such as the PATH environment variable) into a collection of individual paths /** \note: Splits the string using the filesystem delimiter for the native system (the system we were compiled on). */ const path_list split_native_paths(const ustring& Paths); /// Provides iteration over the contents of a directory class directory_iterator : public boost::iterator_facade { public: /// Creates the "begin" iterator for the contents of the given directory explicit directory_iterator(const path& Path); /// Creates an "end" iterator directory_iterator(); ~directory_iterator(); private: class implementation; implementation* m_implementation; friend class boost::iterator_core_access; reference dereference() const; void increment(); bool_t equal(const directory_iterator& rhs) const; }; } // namespace filesystem } // namespace k3d #endif // !K3DSDK_PATH_H ================================================ FILE: k3dsdk/persistent_lookup.cpp ================================================ // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { //////////////////////////////////////////////////////////////////////////////// // persistent_lookup persistent_lookup::persistent_lookup() { m_id_map[0] = 0; m_object_map[0] = 0; } ipersistent_lookup::id_type persistent_lookup::lookup_id(iunknown* Object) { if(!m_id_map.count(Object)) { const id_type new_id = m_id_map.size() + 1; m_id_map[Object] = new_id; m_object_map[new_id] = Object; } return m_id_map[Object]; } iunknown* persistent_lookup::lookup_object(const id_type ID) { if(!m_object_map.count(ID)) return 0; return m_object_map[ID]; } void persistent_lookup::insert_lookup(const id_type ID, iunknown* Object) { m_id_map[Object] = ID; m_object_map[ID] = Object; } } // namespace k3d ================================================ FILE: k3dsdk/persistent_lookup.h ================================================ #ifndef K3DSDK_PERSISTENT_LOOKUP_H #define K3DSDK_PERSISTENT_LOOKUP_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { /// Concrete implementation of ipersistent_lookup class persistent_lookup : public ipersistent_lookup { public: persistent_lookup(); id_type lookup_id(iunknown* Object); iunknown* lookup_object(const id_type ID); void insert_lookup(const id_type ID, iunknown* Object); private: std::map m_id_map; std::map m_object_map; }; } // namespace k3d #endif // !K3DSDK_PERSISTENT_LOOKUP_H ================================================ FILE: k3dsdk/persistent_property_collection.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // persistent_property_collection persistent_property_collection::persistent_property_collection() { } persistent_property_collection::~persistent_property_collection() { } void persistent_property_collection::enable_serialization(const string_t& Name, ipersistent& Property) { if(std::count(m_names.begin(), m_names.end(), Name)) { log() << error << "cannot enable serialization for property with duplicate name [" << Name << "]" << std::endl; return; } if(std::count(m_properties.begin(), m_properties.end(), &Property)) { log() << error << "serialization is already enabled for property [" << Name << "]" << std::endl; return; } m_names.push_back(Name); m_properties.push_back(&Property); } void persistent_property_collection::disable_serialization(ipersistent& Property) { for(uint_t i = 0; i != m_names.size(); ++i) { if(m_properties[i] == &Property) { m_names.erase(m_names.begin() + i); m_properties.erase(m_properties.begin() + i); return; } } } const std::vector > persistent_property_collection::persistent_objects() { std::vector > results; for(uint_t i = 0; i != m_names.size(); ++i) results.push_back(std::make_pair(m_names[i], m_properties[i])); return results; } void persistent_property_collection::save(xml::element& Element, const ipersistent::save_context& Context) { // If we don't have anything to save, we're done ... if(m_properties.empty()) return; // Save property values ... xml::element& xml_properties = Element.append(xml::element("properties")); for(uint_t i = 0; i != m_names.size(); ++i) (*m_properties[i]).save(xml_properties, Context); // Save property metadata ... /** \todo Next time we break backwards compatibility on documents, merge properties and their metadata */ for(uint_t i = 0; i != m_names.size(); ++i) { if(imetadata* const metadata = dynamic_cast(m_properties[i])) { const imetadata::metadata_t pairs = metadata->get_metadata(); if(pairs.size()) { xml::element& xml_metadata = xml_properties.append(xml::element("metadata", xml::attribute("name", m_names[i]))); for(imetadata::metadata_t::const_iterator pair = pairs.begin(); pair != pairs.end(); ++pair) xml_metadata.append(xml::element("pair", xml::attribute("name", pair->first), pair->second)); } } } } void persistent_property_collection::load(xml::element& Element, const ipersistent::load_context& Context) { xml::element* const xml_properties = xml::find_element(Element, "properties"); if(!xml_properties) return; // Keep-track of whether this object is a document node (required for user-properties) ... k3d::inode* const node = dynamic_cast(this); // Keep-track of xml property names as we go, for error-detection ... std::set xml_property_names; // Load tags ... for(xml::element::elements_t::iterator xml_property = xml_properties->children.begin(); xml_property != xml_properties->children.end(); ++xml_property) { if(xml_property->name != "property") continue; const string_t xml_property_name = xml::attribute_text(*xml_property, "name"); if(xml_property_name.empty()) { log() << error << "property with missing name attribute will not be loaded" << std::endl; continue; } if(xml_property_names.count(xml_property_name)) { log() << error << "property with duplicate name [" << xml_property_name << "] will not be loaded" << std::endl; continue; } xml_property_names.insert(xml_property_name); bool xml_property_used = false; // Try matching the XML property to a builtin property ... if(!xml_property_used) { for(uint_t i = 0; i != m_names.size(); ++i) { if(xml_property_name == m_names[i]) { m_properties[i]->load(*xml_property, Context); xml_property_used = true; break; } } } // See if the XML property is a user-property to be instantiated ... if(!xml_property_used && node) { const string_t xml_user_property = xml::attribute_text(*xml_property, "user_property"); if(xml_user_property == "generic" || xml_user_property == "vanilla" /* for backwards compatibility */) { xml_property_used = true; const string_t type = xml::attribute_text(*xml_property, "type"); const string_t name = xml::attribute_text(*xml_property, "name"); const string_t label = xml::attribute_text(*xml_property, "label"); const string_t description = xml::attribute_text(*xml_property, "description"); k3d::iproperty* const new_property = property::create(*node, type, name, label, description); if(new_property) { if(k3d::ipersistent* const persistent = dynamic_cast(new_property)) persistent->load(*xml_property, Context); } else { log() << error << k3d_file_reference << ": error creating property [" << name << "] with type [" << type << "]" << std::endl; } } else if(xml_user_property == "renderman") { xml_property_used = true; const string_t type = xml::attribute_text(*xml_property, "type"); const string_t parameter_type = xml::attribute_text(*xml_property, "parameter_type"); const string_t parameter_name = xml::attribute_text(*xml_property, "parameter_name"); const string_t name = xml::attribute_text(*xml_property, "name"); const string_t label = xml::attribute_text(*xml_property, "label"); const string_t description = xml::attribute_text(*xml_property, "description"); k3d::iproperty* new_property = 0; if(parameter_type == "attribute") new_property = property::ri::create_attribute(*node, type, parameter_name, name, label, description); else if(parameter_type == "option") new_property = property::ri::create_option(*node, type, parameter_name, name, label, description); if(new_property) { if(k3d::ipersistent* const persistent = dynamic_cast(new_property)) persistent->load(*xml_property, Context); } else { log() << error << k3d_file_reference << ": error creating property [" << name << "] with type [" << type << "]" << std::endl; } } else if(xml_user_property.size()) { log() << error << "unknown user property type: " << xml_user_property << std::endl; } } } // Load tags ... for(xml::element::elements_t::iterator xml_metadata = xml_properties->children.begin(); xml_metadata != xml_properties->children.end(); ++xml_metadata) { if(xml_metadata->name != "metadata") continue; const string_t xml_metadata_name = xml::attribute_text(*xml_metadata, "name"); if(xml_metadata_name.empty()) { log() << error << "property metadata with missing name attribute will not be loaded" << std::endl; continue; } if(!xml_property_names.count(xml_metadata_name)) { log() << error << "property metadata with unknown name [" << xml_metadata_name << "] will not be loaded" << std::endl; continue; } // Try matching the XML metadata to a property ... for(uint_t i = 0; i != m_names.size(); ++i) { if(xml_metadata_name != m_names[i]) continue; imetadata::metadata_t pairs; for(xml::element::elements_t::const_iterator xml_pair = xml_metadata->children.begin(); xml_pair != xml_metadata->children.end(); ++xml_pair) { if(xml_pair->name != "pair") continue; pairs.insert(std::make_pair(xml::attribute_text(*xml_pair, "name"), xml_pair->text)); } if(imetadata* const metadata = dynamic_cast(m_properties[i])) metadata->set_metadata(pairs); break; } } } } // namespace k3d ================================================ FILE: k3dsdk/persistent_property_collection.h ================================================ #ifndef K3DSDK_PERSISTENT_PROPERTY_COLLECTION_H #define K3DSDK_PERSISTENT_PROPERTY_COLLECTION_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // persistent_property_collection /// Automates serialization of properties class persistent_property_collection : public ipersistent_collection { public: void enable_serialization(const string_t& Name, ipersistent& Property); void disable_serialization(ipersistent& Property); const std::vector > persistent_objects(); protected: persistent_property_collection(); virtual ~persistent_property_collection(); void save(xml::element& Element, const ipersistent::save_context& Context); void load(xml::element& Element, const ipersistent::load_context& Context); private: persistent_property_collection(const persistent_property_collection&); persistent_property_collection& operator=(const persistent_property_collection&); typedef std::vector names_t; typedef std::vector properties_t; names_t m_names; properties_t m_properties; }; } // namespace k3d #endif // !K3DSDK_PERSISTENT_PROPERTY_COLLECTION_H ================================================ FILE: k3dsdk/pipeline.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // pipeline::implementation class pipeline::implementation { public: implementation(istate_recorder* StateRecorder) : state_recorder(StateRecorder) { } ~implementation() { clear(); } void set_dependencies(dependencies_t& Dependencies, ihint* Hint = 0) { // Don't let any NULLs creep in ... if(Dependencies.erase(static_cast(0))) log() << warning << "Cannot assign a dependency to a NULL property" << std::endl; // If we're recording undo/redo data, record the new state ... if(state_recorder && state_recorder->current_change_set()) state_recorder->current_change_set()->record_new_state(new set_dependencies_container(*this, Dependencies)); // Update our internal graph, keep track of the original state as we go ... dependencies_t old_dependencies; for(dependencies_t::iterator dependency = Dependencies.begin(); dependency != Dependencies.end(); ++dependency) { dependencies_t::iterator old_dependency = get_dependency(dependency->first); old_dependencies.insert(*old_dependency); old_dependency->second = dependency->second; m_change_connections[dependency->first].disconnect(); m_delete_connections[dependency->second].disconnect(); if(dependency->second) { m_change_connections[dependency->first] = dependency->second->property_changed_signal().connect( signal::make_loop_safe_slot( dependency->first->property_changed_signal())); m_delete_connections[dependency->second] = dependency->second->property_deleted_signal().connect(sigc::bind(sigc::mem_fun(*this, &implementation::on_property_deleted), dependency->second)); } dependency->first->property_set_dependency(dependency->second); } // If we're recording undo/redo data, keep track of the original state ... if(state_recorder && state_recorder->current_change_set()) state_recorder->current_change_set()->record_old_state(new set_dependencies_container(*this, old_dependencies)); // Notify observers that the pipeline has changed ... changed_signal.emit(Dependencies); // Synthesize change notifications for every property whose parent was set ... for(dependencies_t::iterator dependency = Dependencies.begin(); dependency != Dependencies.end(); ++dependency) dependency->first->property_changed_signal().emit(Hint); } void clear() { for(connections_t::iterator connection = m_change_connections.begin(); connection != m_change_connections.end(); ++connection) connection->second.disconnect(); m_change_connections.clear(); for(connections_t::iterator connection = m_delete_connections.begin(); connection != m_delete_connections.end(); ++connection) connection->second.disconnect(); m_delete_connections.clear(); dependencies.clear(); } void on_property_deleted(iproperty* Property) { dependencies_t::iterator dependency = dependencies.find(Property); if(dependency != dependencies.end()) { if(state_recorder && state_recorder->current_change_set()) { dependencies_t old_dependencies; old_dependencies.insert(*dependency); state_recorder->current_change_set()->record_old_state(new set_dependencies_container(*this, old_dependencies)); state_recorder->current_change_set()->record_new_state(new delete_property_container(*this, Property)); } dependencies.erase(dependency); } m_delete_connections[Property].disconnect(); m_delete_connections.erase(Property); dependencies_t new_dependencies; for(dependencies_t::iterator dependency = dependencies.begin(); dependency != dependencies.end(); ++dependency) { if(dependency->second == Property) { dependency->first->property_set_dependency(0); new_dependencies.insert(std::make_pair(dependency->first, static_cast(0))); } } new_dependencies[Property] = 0; set_dependencies(new_dependencies); } dependencies_t::iterator get_dependency(iproperty* Property) { assert(Property); dependencies_t::iterator result = dependencies.find(Property); if(result == dependencies.end()) { result = dependencies.insert(std::make_pair(Property, static_cast(0))).first; m_delete_connections[Property].disconnect(); m_delete_connections[Property] = Property->property_deleted_signal().connect(sigc::bind(sigc::mem_fun(*this, &implementation::on_property_deleted), Property)); } return result; } /// Used to implement undo/redo state changes when pipeline connections are modified class set_dependencies_container : public istate_container { public: set_dependencies_container(pipeline::implementation& Pipeline, const ipipeline::dependencies_t& Dependencies) : m_pipeline(Pipeline), m_dependencies(Dependencies) { } ~set_dependencies_container() { } void restore_state() { m_pipeline.set_dependencies(m_dependencies); } private: pipeline::implementation& m_pipeline; ipipeline::dependencies_t m_dependencies; }; /// Used to implement undo/redo state changes when a pipeline property has been deleted class delete_property_container : public istate_container { public: delete_property_container(pipeline::implementation& Pipeline, iproperty* const Property) : m_pipeline(Pipeline), m_property(Property) { } ~delete_property_container() { } void restore_state() { m_pipeline.on_property_deleted(m_property); } private: pipeline::implementation& m_pipeline; iproperty* const m_property; }; /// Optionally records changes to the pipeline for undo/redo istate_recorder* const state_recorder; /// Stores the set of all property dependencies ipipeline::dependencies_t dependencies; /// Defines storage for per-property signal connections typedef std::map connections_t; /// Stores connections between property change signals (so a change to a source property is automatically passed-along to its dependent properties) connections_t m_change_connections; /// Stores connections to property delete signals (so we can clean-up when a property goes away) connections_t m_delete_connections; /// Signal that is emitted whenever the pipeline is modified ipipeline::dependency_signal_t changed_signal; }; ///////////////////////////////////////////////////////////////////////////// // pipeline pipeline::pipeline(istate_recorder* StateRecorder) : m_implementation(new implementation(StateRecorder)) { } pipeline::~pipeline() { delete m_implementation; } void pipeline::set_dependencies(dependencies_t& Dependencies, ihint* Hint) { m_implementation->set_dependencies(Dependencies, Hint); } iproperty* pipeline::dependency(iproperty& Property) { return Property.property_dependency(); } const ipipeline::dependencies_t& pipeline::dependencies() { return m_implementation->dependencies; } ipipeline::dependency_signal_t& pipeline::dependency_signal() { return m_implementation->changed_signal; } void pipeline::clear() { m_implementation->clear(); } void pipeline::connect(iproperty& From, iproperty& To) { dependencies_t dependencies; dependencies.insert(std::make_pair(&To, &From)); set_dependencies(dependencies); } } // namespace k3d ================================================ FILE: k3dsdk/pipeline.h ================================================ #ifndef K3DSDK_PIPELINE_H #define K3DSDK_PIPELINE_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class istate_recorder; ///////////////////////////////////////////////////////////////////////////// // pipeline /// Provides a concrete implementation of ipipeline that can be used to manage arbitrary connections between properties class pipeline : public ipipeline, public sigc::trackable { public: /// Initialize the pipeline with (optional) undo/redo suppport pipeline(istate_recorder* StateRecorder = 0); ~pipeline(); // ipipeline methods void set_dependencies(dependencies_t& Dependencies, ihint* Hint = 0); iproperty* dependency(iproperty& Property); const dependencies_t& dependencies(); dependency_signal_t& dependency_signal(); /// Remove all pipeline connections (not undoable) void clear(); /// Makes a connection between two properties void connect(iproperty& From, iproperty& To); private: class implementation; implementation* const m_implementation; }; } // namespace k3d #endif // !K3DSDK_PIPELINE_H ================================================ FILE: k3dsdk/pipeline_data.h ================================================ #ifndef K3DSDK_PIPELINE_DATA_H #define K3DSDK_PIPELINE_DATA_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { template class pipeline_data_traits { public: static T* create() { return new T(); } static T* clone(const T& Other) { return new T(Other); } }; template class pipeline_data { public: typedef T value_type; typedef T element_type; pipeline_data() : originator(false) { } pipeline_data(const pipeline_data& Other) : storage(Other.storage), originator(false) { } pipeline_data(T* Other) : storage(Other), originator(true) { } T& create() { storage.reset(pipeline_data_traits::create()); originator = storage.get() ? true : false; return *storage; } T& create(T* Instance) { assert_critical(Instance); storage.reset(Instance); originator = storage.get() ? true : false; return *storage; } template T& create(Y* Instance) { storage.reset(Instance); originator = storage.get() ? true : false; return *storage; } void reset() { storage.reset(); originator = false; } const T& operator*() const { return *storage; } const T* operator->() const { return storage.operator->(); } const T* get() const { return storage.get(); } T& writable() { if(originator) return *storage; storage.reset(pipeline_data_traits::clone(*storage)); originator = true; return *storage; } long use_count() const { return storage.use_count(); } pipeline_data& operator=(const pipeline_data& Other) { storage = Other.storage; originator = false; return *this; } operator bool() const { return static_cast(storage); } bool operator!() const { return !storage; } bool_t operator==(const pipeline_data& Other) const { return storage.get() == Other.storage.get(); } bool_t operator!=(const pipeline_data& Other) const { return storage.get() != Other.storage.get(); } private: typedef boost::shared_ptr storage_type; storage_type storage; bool_t originator; }; } // namespace k3d #endif // !K3DSDK_PIPELINE_DATA_H ================================================ FILE: k3dsdk/pipeline_profiler.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////// // pipeline_profiler::implementation class pipeline_profiler::implementation { public: sigc::signal node_execution_signal; std::stack timers; std::stack adjustments; }; ///////////////////////////////////////////////////////////////////// // pipeline_profile pipeline_profiler::pipeline_profiler() : m_implementation(new implementation()) { } pipeline_profiler::~pipeline_profiler() { delete m_implementation; } void pipeline_profiler::start_execution(inode& Node, const string_t& Task) { m_implementation->timers.push(timer()); m_implementation->adjustments.push(0.0); } /** * Start a pipeline profiler entry with an adjustment. * The adjustment value effectively moves the start forward in time. */ void pipeline_profiler::start_execution(inode& Node, const string_t& Task, const double Adjustment) { m_implementation->timers.push(timer()); m_implementation->adjustments.push(Adjustment); } void pipeline_profiler::finish_execution(inode& Node, const string_t& Task) { return_if_fail(m_implementation->timers.size()); const double elapsed = m_implementation->timers.top().elapsed(); const double adjustment = m_implementation->adjustments.top(); m_implementation->node_execution_signal.emit(Node, Task, elapsed - adjustment); m_implementation->timers.pop(); m_implementation->adjustments.pop(); if(m_implementation->adjustments.size()) m_implementation->adjustments.top() += elapsed; } /** * Manually add a timing entry */ void pipeline_profiler::add_timing_entry(inode& Node, const string_t& Task, const double TimingValue) { m_implementation->node_execution_signal.emit(Node, Task, TimingValue); } sigc::connection pipeline_profiler::connect_node_execution_signal(const sigc::slot& Slot) { return m_implementation->node_execution_signal.connect(Slot); } } // namespace k3d ================================================ FILE: k3dsdk/pipeline_profiler.h ================================================ #ifndef K3DSDK_PIPELINE_PROFILER_H #define K3DSDK_PIPELINE_PROFILER_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { /// Concrete implementation of ipipeline_profiler that collects and distributes profiling data for the K-3D visualization pipeline class pipeline_profiler : public ipipeline_profiler { public: pipeline_profiler(); ~pipeline_profiler(); void start_execution(inode& Node, const string_t& Task); void start_execution(inode& Node, const string_t& Task, const double Adjustment); void finish_execution(inode& Node, const string_t& Task); void add_timing_entry(inode& Node, const string_t& Task, const double TimingValue); sigc::connection connect_node_execution_signal(const sigc::slot& Slot); private: class implementation; implementation* const m_implementation; }; } // namespace k3d #endif // !K3DSDK_PIPELINE_PROFILER_H ================================================ FILE: k3dsdk/plane.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // plane plane::plane(const vector3& Normal, const double Distance) : normal(normalize(Normal)), distance(Distance) { } plane::plane(const vector3& Normal, const point3& Point) : normal(normalize(Normal)), distance(-to_vector(Point) * normal) { } plane::plane(const point3& PointA, const point3& PointB, const point3& PointC) : normal(normalize((PointA - PointB) ^ (PointC - PointB))), distance(-to_vector(PointA) * normal) { } std::ostream& operator<<(std::ostream& Stream, const plane& RHS) { Stream << RHS.normal << " " << RHS.distance; return Stream; } std::istream& operator>>(std::istream& Stream, plane& RHS) { Stream >> RHS.normal >> RHS.distance; return Stream; } const plane operator*(const matrix4& Matrix, const plane& Plane) { return plane(Matrix * Plane.normal, Matrix * to_point(Plane.distance * Plane.normal)); } const plane operator*(const plane& Plane, const matrix4& Matrix) { return Matrix * Plane; } } // namespace k3d ================================================ FILE: k3dsdk/plane.h ================================================ #ifndef K3DSDK_PLANE_H #define K3DSDK_PLANE_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { class matrix4; class point3; /// Encapsulates a 3D plane surface class plane { public: /// Constructs a plane from its normal and distance from the origin plane(const vector3& Normal, const double Distance); /// Constructs a plane from its normal and one point located within the plane plane(const vector3& Normal, const point3& Point); /// Constructs a plane from three points contained within the plane plane(const point3& PointA, const point3& PointB, const point3& PointC); /// Stores the plane's normal vector vector3 normal; /// Stores the plane's distance from the origin double distance; }; std::ostream& operator<<(std::ostream& Stream, const plane& RHS); std::istream& operator>>(std::istream& Stream, plane& RHS); /// Linear transformation if a plane by a transformation matrix const plane operator*(const matrix4& Matrix, const plane& Plane); /// Linear transformation if a plane by a transformation matrix const plane operator*(const plane& Plane, const matrix4& Matrix); } // namespace k3d #endif // !K3DSDK_PLANE_H ================================================ FILE: k3dsdk/plugin.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include namespace k3d { /////////////////////////////////////////////////////////////////////////////////// // sort_by_name bool_t sort_by_name::operator()(iplugin_factory* LHS, iplugin_factory* RHS) { return LHS->name() < RHS->name(); } bool_t sort_by_name::operator()(inode* LHS, inode* RHS) { return LHS->name() < RHS->name(); } namespace plugin { namespace detail { iunknown* create_application_plugin(const k3d::string_t& Plugin) { iplugin_factory* const plugin_factory = plugin::factory::lookup(Plugin); if(!plugin_factory) { log() << error << "No plugin factory [" << Plugin << "]" << std::endl; } else { return detail::create_application_plugin(*plugin_factory); } return 0; } iunknown* create_application_plugin(iplugin_factory& Factory) { if(iapplication_plugin_factory* const application_plugin_factory = dynamic_cast(&Factory)) { if(iunknown* const unknown = application_plugin_factory->create_plugin()) { return unknown; } else { log() << error << "Couldn't create application plugin [" << Factory.name() << "]" << std::endl; } } else { log() << error << "Not an application plugin factory [" << Factory.name() << "]" << std::endl; } return 0; } iunknown* create_application_plugin(const uuid& ClassID) { if(iplugin_factory* const plugin_factory = plugin::factory::lookup(ClassID)) { return create_application_plugin(*plugin_factory); } else { log() << error << "No plugin factory [" << ClassID << "]" << std::endl; } return 0; } inode* create_document_plugin(const k3d::string_t& Plugin, idocument& Document, const k3d::string_t& Name) { k3d::iplugin_factory* const plugin_factory = plugin::factory::lookup(Plugin); if(!plugin_factory) { log() << error << "No plugin factory [" << Plugin << "]" << std::endl; } else { return create_document_plugin(*plugin_factory, Document, Name); } return 0; } inode* create_document_plugin(iplugin_factory& Factory, idocument& Document, const k3d::string_t& Name) { if(idocument_plugin_factory* const document_plugin_factory = dynamic_cast(&Factory)) { if(inode* const object = document_plugin_factory->create_plugin(Factory, Document)) { return object; } else { log() << error << "Couldn't create document plugin [" << Factory.name() << "]" << std::endl; } } else { log() << error << "Not a document plugin factory [" << Factory.name() << "]" << std::endl; } return 0; } inode* create_document_plugin(const uuid& ClassID, idocument& Document, const k3d::string_t& Name) { if(iplugin_factory* const plugin_factory = plugin::factory::lookup(ClassID)) { return create_document_plugin(*plugin_factory, Document, Name); } else { log() << error << "No plugin factory [" << ClassID << "]" << std::endl; } return 0; } } // namespace detail namespace factory { static collection_t g_factories; const collection_t lookup() { return g_factories; } iplugin_factory* lookup(const uuid& ID) { for(collection_t::const_iterator factory = g_factories.begin(); factory != g_factories.end(); ++factory) { if((*factory)->factory_id() == ID) return *factory; } return 0; } iplugin_factory* lookup(const k3d::string_t& Name) { collection_t results; for(collection_t::const_iterator factory = g_factories.begin(); factory != g_factories.end(); ++factory) { if((*factory)->name() == Name) results.push_back(*factory); } switch(results.size()) { case 0: return 0; case 1: return *results.begin(); default: k3d::log() << error << "Multiple plugin factories with name [" << Name << "]" << std::endl; return 0; } } const collection_t lookup(const string_t& MetadataName, const string_t& MetadataValue) { collection_t results; for(collection_t::const_iterator factory = g_factories.begin(); factory != g_factories.end(); ++factory) { const iplugin_factory::metadata_t metadata = (**factory).metadata(); iplugin_factory::metadata_t::const_iterator pair = metadata.find(MetadataName); if(pair == metadata.end()) continue; if(pair->second != MetadataValue) continue; results.push_back(*factory); } return results; } const collection_t lookup(const std::type_info& Interface) { collection_t results; for(collection_t::const_iterator factory = g_factories.begin(); factory != g_factories.end(); ++factory) { if((*factory)->implements(Interface) == false) continue; results.push_back(*factory); } return results; } const collection_t lookup(const mime::type& Type) { collection_t results; for(collection_t::const_iterator factory = g_factories.begin(); factory != g_factories.end(); ++factory) { k3d::iplugin_factory::metadata_t metadata = (**factory).metadata(); const string_t mime_types = metadata["k3d:mime-types"]; typedef boost::char_separator separator_t; separator_t separator(" "); typedef boost::tokenizer tokenizer_t; tokenizer_t tokenizer(mime_types, separator); for(tokenizer_t::const_iterator mime_type = tokenizer.begin(); mime_type != tokenizer.end(); ++mime_type) { if(Type == *mime_type) { results.push_back(*factory); break; } } } return results; } const collection_t lookup(const std::type_info& Interface, const mime::type& Type) { collection_t results; for(collection_t::const_iterator factory = g_factories.begin(); factory != g_factories.end(); ++factory) { if((*factory)->implements(Interface) == false) continue; k3d::iplugin_factory::metadata_t metadata = (**factory).metadata(); const string_t mime_types = metadata["k3d:mime-types"]; typedef boost::char_separator separator_t; separator_t separator(" "); typedef boost::tokenizer tokenizer_t; tokenizer_t tokenizer(mime_types, separator); for(tokenizer_t::const_iterator mime_type = tokenizer.begin(); mime_type != tokenizer.end(); ++mime_type) { if(Type == *mime_type) { results.push_back(*factory); break; } } } return results; } } // namespace factory } // namespace plugin void register_plugin_factories(iplugin_factory_collection& Collection) { plugin::factory::g_factories.insert(plugin::factory::g_factories.end(), Collection.factories().begin(), Collection.factories().end()); } } // namespace k3d ================================================ FILE: k3dsdk/plugin.h ================================================ #ifndef K3DSDK_PLUGIN_H #define K3DSDK_PLUGIN_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { class inode; class iplugin_factory; class uuid; namespace mime { class type; } /// Convenience functor for sorting factory collections and nodes alphabetically by name. struct sort_by_name { bool_t operator()(iplugin_factory* LHS, iplugin_factory* RHS); bool_t operator()(inode* LHS, inode* RHS); }; namespace plugin { namespace factory { /// Defines storage for a collection of plugin factories typedef std::vector collection_t; /// Returns the set of all available plugin factories. const collection_t lookup(); /// Returns the plugin factory that implements a specific factory ID, or NULL. iplugin_factory* lookup(const uuid& ID); /// Returns the plugin factory that matches the given name, or NULL. Note: returns NULL if more than one factory matches Name. iplugin_factory* lookup(const string_t& Name); /// Returns the set of plugin factories that match the given metadata name-value pair. const collection_t lookup(const string_t& MetadataName, const string_t& MetadataValue); /// Returns the set of plugin factories that implement a specific interface. const collection_t lookup(const std::type_info& Interface); /// Returns the set of plugin factories that implement a specific interface. template const collection_t lookup() { return lookup(typeid(interface_t)); } /// Returns the set of plugin factories that match a MIME type. const collection_t lookup(const mime::type& Type); /// Returns the set of plugin factories that implement a specific interface and match a MIME type. const collection_t lookup(const std::type_info& Interface, const mime::type& Type); /// Returns the set of plugin factories that implement a specific interface and match a MIME type. template const collection_t lookup(const mime::type& Type) { return lookup(typeid(interface_t), Type); } } // namespace factory /// Creates an application plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) template interface_t* create(const string_t& FactoryName) { if(iunknown* const unknown = detail::create_application_plugin(FactoryName)) { if(interface_t* const result = dynamic_cast(unknown)) { return result; } else { log() << error << "Plugin doesn't implement interface: " << FactoryName << std::endl; } delete unknown; } return 0; } /// Creates an application plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) template interface_t* create(iplugin_factory& Factory) { if(iunknown* const unknown = detail::create_application_plugin(Factory)) { if(interface_t* const result = dynamic_cast(unknown)) { return result; } else { log() << error << "Plugin doesn't implement interface: " << Factory.name() << std::endl; } delete unknown; } return 0; } /// Creates an application plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) template interface_t* create(const uuid& FactoryID) { if(iunknown* const unknown = detail::create_application_plugin(FactoryID)) { if(interface_t* const result = dynamic_cast(unknown)) { return result; } else { log() << error << "Plugin doesn't implement interface: " << FactoryID << std::endl; } delete unknown; } return 0; } /// Creates an application plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) inline iunknown* create(const string_t& FactoryName) { return detail::create_application_plugin(FactoryName); } /// Creates an application plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) inline iunknown* create(iplugin_factory& Factory) { return detail::create_application_plugin(Factory); } /// Creates an application plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) inline iunknown* create(const uuid& FactoryID) { return detail::create_application_plugin(FactoryID); } /// Creates a document plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) template interface_t* create(const string_t& FactoryName, idocument& Document, const string_t& Name = string_t()) { if(inode* const node = detail::create_document_plugin(FactoryName, Document, Name)) { if(interface_t* const result = dynamic_cast(node)) { node->set_name(Name); undoable_new(node, Document); Document.nodes().add_nodes(make_collection(node)); return result; } else { log() << error << "Plugin doesn't implement interface: " << FactoryName << std::endl; } delete node; } return 0; } /// Creates a document plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) template interface_t* create(iplugin_factory& Factory, idocument& Document, const string_t& Name = string_t()) { if(inode* const node = detail::create_document_plugin(Factory, Document, Name)) { if(interface_t* const result = dynamic_cast(node)) { node->set_name(Name); undoable_new(node, Document); Document.nodes().add_nodes(make_collection(node)); return result; } else { log() << error << "Plugin doesn't implement interface: " << Factory.name() << std::endl; } delete node; } return 0; } /// Creates a document plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) template interface_t* create(const uuid& FactoryID, idocument& Document, const string_t& Name = string_t()) { if(inode* const node = detail::create_document_plugin(FactoryID, Document, Name)) { if(interface_t* const result = dynamic_cast(node)) { node->set_name(Name); undoable_new(node, Document); Document.nodes().add_nodes(make_collection(node)); return result; } else { log() << error << "Plugin doesn't implement interface: " << FactoryID << std::endl; } delete node; } return 0; } /// Creates a document plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) inline iunknown* create(const string_t& FactoryName, idocument& Document, const string_t& Name = string_t()) { if(inode* const node = detail::create_document_plugin(FactoryName, Document, Name)) { node->set_name(Name); undoable_new(node, Document); Document.nodes().add_nodes(make_collection(node)); return node; } return 0; } /// Creates a document plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) inline iunknown* create(iplugin_factory& Factory, idocument& Document, const string_t& Name = string_t()) { if(inode* const node = detail::create_document_plugin(Factory, Document, Name)) { node->set_name(Name); undoable_new(node, Document); Document.nodes().add_nodes(make_collection(node)); return node; } return 0; } /// Creates a document plugin, returning the requested interface if implemented, otherwise NULL (cleans-up on failure) inline iunknown* create(const uuid& FactoryID, idocument& Document, const string_t& Name = string_t()) { if(inode* const node = detail::create_document_plugin(FactoryID, Document, Name)) { node->set_name(Name); undoable_new(node, Document); Document.nodes().add_nodes(make_collection(node)); return node; } return 0; } } // namespace plugin } // namespace k3d #endif // !K3DSDK_PLUGIN_H ================================================ FILE: k3dsdk/plugin_factory.cpp ================================================ // K3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // plugin_factory plugin_factory::plugin_factory(const uuid& FactoryID, const std::string& Name, const std::string& ShortDescription, const std::string& Categories, const quality_t Quality, const metadata_t& Metadata) : m_factory_id(FactoryID), m_name(Name), m_short_description(ShortDescription), m_quality(Quality), m_metadata(Metadata) { assert(m_factory_id != k3d::uuid::null()); typedef boost::tokenizer > tokenizer_t; boost::char_separator separator; tokenizer_t tokenizer(Categories, separator); std::copy(tokenizer.begin(), tokenizer.end(), std::back_inserter(m_categories)); } const uuid& plugin_factory::factory_id() { return m_factory_id; } const std::string plugin_factory::name() { return m_name; } const std::string plugin_factory::short_description() { return m_short_description; } const iplugin_factory::categories_t& plugin_factory::categories() { return m_categories; } k3d::iplugin_factory::quality_t plugin_factory::quality() { return m_quality; } k3d::iplugin_factory::metadata_t plugin_factory::metadata() { return m_metadata; } std::ostream& operator<<(std::ostream& Stream, const iplugin_factory::quality_t& RHS) { switch(RHS) { case iplugin_factory::STABLE: Stream << "stable"; break; case iplugin_factory::EXPERIMENTAL: Stream << "experimental"; break; case iplugin_factory::DEPRECATED: Stream << "deprecated"; break; default: assert_not_reached(); } return Stream; } std::istream& operator>>(std::istream& Stream, iplugin_factory::quality_t& RHS) { std::string c; Stream >> c; if("stable" == c) RHS = iplugin_factory::STABLE; else if("experimental" == c) RHS = iplugin_factory::EXPERIMENTAL; else if("deprecated" == c) RHS = iplugin_factory::DEPRECATED; else log() << error << error << "Could not extract value [" << c << "]" << std::endl; return Stream; } } // namespace k3d ================================================ FILE: k3dsdk/plugin_factory.h ================================================ #ifndef K3DSDK_PLUGIN_FACTORY_H #define K3DSDK_PLUGIN_FACTORY_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // plugin_factory /// Provides a boilerplate implementation of iplugin_factory class plugin_factory : public iplugin_factory { public: plugin_factory(const uuid& FactoryID, const std::string& Name, const std::string& ShortDescription, const std::string& Categories, const quality_t Quality, const metadata_t& Metadata = metadata_t()); const uuid& factory_id(); const std::string name(); const std::string short_description(); const categories_t& categories(); quality_t quality(); metadata_t metadata(); private: const uuid m_factory_id; const std::string m_name; const std::string m_short_description; categories_t m_categories; const quality_t m_quality; const metadata_t m_metadata; }; } // namespace k3d #endif // !K3DSDK_PLUGIN_FACTORY_H ================================================ FILE: k3dsdk/plugin_factory_collection.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace detail { ///////////////////////////////////////////////////////////////////////////// // same_factory_id class same_factory_id { public: same_factory_id(const uuid& FactoryID) : m_factory_id(FactoryID) { } bool operator()(iplugin_factory* Factory) const { return Factory->factory_id() == m_factory_id; } private: const uuid m_factory_id; }; ///////////////////////////////////////////////////////////////////////////// // same_name class same_name { public: same_name(const std::string& Name) : m_name(Name) { } bool operator()(iplugin_factory* Factory) const { return Factory->name() == m_name; } private: const std::string m_name; }; typedef sigc::signal message_signal_t; ///////////////////////////////////////////////////////////////////////////// // plugin_registry /// Implements iplugin_registry, allowing modules to register new plugin factories, which are pushed into two collections - a set of all plugin factories, and a set of factories for the given module class plugin_registry : public iplugin_registry { public: plugin_registry(message_signal_t& MessageSignal, iplugin_factory_collection::factories_t& Factories) : m_message_signal(MessageSignal), m_factories(Factories) { } void register_factory(iplugin_factory& Factory) { m_message_signal.emit(string_cast(boost::format(_("Loading plugin %1%")) % Factory.name())); // Ensure we don't have any duplicate class IDs ... if(std::count_if(m_factories.begin(), m_factories.end(), same_factory_id(Factory.factory_id()))) { log() << error << "Plugin factory [" << Factory.name() << "] with duplicate factory ID [" << Factory.factory_id() << "] will not be registered." << std::endl; return; } // Warn if we have duplicate names ... if(std::count_if(m_factories.begin(), m_factories.end(), same_name(Factory.name()))) { log() << error << "Plugin factory [" << Factory.factory_id() << "] with duplicate name [" << Factory.name() << "] will not be registered." << std::endl; return; } // Stash that baby! m_factories.insert(&Factory); } private: message_signal_t& m_message_signal; iplugin_factory_collection::factories_t& m_factories; }; /// Stores a mapping of plugin class id to plugin factory, so we can lookup recently-loaded factories quickly std::map proxied_factories; /// Stores a mapping of plugin class id to plugin module path, so we can load modules that were proxied std::map proxied_modules; iplugin_factory* load_proxied_factory(const uuid& FactoryID) { // See if this factory has been loaded ... if(proxied_factories.count(FactoryID) && proxied_factories[FactoryID]) return proxied_factories[FactoryID]; // OK, just load the module already! register_plugins_entry_point register_plugins = 0; os_load_module(proxied_modules[FactoryID], register_plugins); if(!register_plugins) return 0; // It's a K-3D module, all-right - give it a chance to register its plugins log() << info << "Loading plugin module " << proxied_modules[FactoryID].native_console_string() << std::endl; message_signal_t message_signal; iplugin_factory_collection::factories_t factories; plugin_registry registry(message_signal, factories); register_plugins(registry); for(iplugin_factory_collection::factories_t::iterator factory = factories.begin(); factory != factories.end(); ++factory) proxied_factories[(*factory)->factory_id()] = (*factory); return proxied_factories[FactoryID]; } ///////////////////////////////////////////////////////////////////////////// // application_plugin_factory_proxy /// Proxies plugin factories so we can delay loading shared libraries at runtime until they're needed class application_plugin_factory_proxy : public iplugin_factory, public iapplication_plugin_factory { public: application_plugin_factory_proxy(const uuid& FactoryID, const std::string& Name, const std::string& ShortDescription, const iplugin_factory::categories_t& Categories, const iplugin_factory::quality_t Quality, const iplugin_factory::interfaces_t& Interfaces, const iplugin_factory::metadata_t& Metadata) : m_factory(0), m_application_factory(0), m_factory_id(FactoryID), m_name(Name), m_short_description(ShortDescription), m_categories(Categories), m_quality(Quality), m_interfaces(Interfaces), m_metadata(Metadata) { } const uuid& factory_id() { return m_factory_id; } const std::string name() { return m_name; } const std::string short_description() { return m_short_description; } const categories_t& categories() { return m_categories; } quality_t quality() { return m_quality; } bool implements(const std::type_info& InterfaceType) { for(iplugin_factory::interfaces_t::const_iterator iface = m_interfaces.begin(); iface != m_interfaces.end(); ++iface) { if((**iface) == InterfaceType) return true; } return false; } const interfaces_t interfaces() { return m_interfaces; } metadata_t metadata() { return m_metadata; } iunknown* create_plugin() { if(!m_factory) { m_factory = load_proxied_factory(m_factory_id); if(!m_factory) { k3d::log() << error << "Couldn't load proxied factory for plugin: " << name() << std::endl; return 0; } } if(!m_application_factory) { m_application_factory = dynamic_cast(m_factory); if(!m_application_factory) { k3d::log() << error << "Not an application plugin factory: " << name() << std::endl; return 0; } } return m_application_factory->create_plugin(); } private: iplugin_factory* m_factory; iapplication_plugin_factory* m_application_factory; const uuid m_factory_id; const std::string m_name; const std::string m_short_description; const iplugin_factory::categories_t m_categories; const iplugin_factory::quality_t m_quality; const iplugin_factory::interfaces_t m_interfaces; const iplugin_factory::metadata_t m_metadata; }; ///////////////////////////////////////////////////////////////////////////// // document_plugin_factory_proxy /// Proxies plugin factories so we can delay loading shared libraries at runtime until they're needed class document_plugin_factory_proxy : public iplugin_factory, public idocument_plugin_factory { public: document_plugin_factory_proxy(const uuid& FactoryID, const std::string& Name, const std::string& ShortDescription, const iplugin_factory::categories_t& Categories, const iplugin_factory::quality_t Quality, const iplugin_factory::interfaces_t& Interfaces, const iplugin_factory::metadata_t& Metadata) : m_factory(0), m_document_factory(0), m_factory_id(FactoryID), m_name(Name), m_short_description(ShortDescription), m_categories(Categories), m_quality(Quality), m_interfaces(Interfaces), m_metadata(Metadata) { } const uuid& factory_id() { return m_factory_id; } const std::string name() { return m_name; } const std::string short_description() { return m_short_description; } const categories_t& categories() { return m_categories; } quality_t quality() { return m_quality; } bool implements(const std::type_info& InterfaceType) { for(iplugin_factory::interfaces_t::const_iterator iface = m_interfaces.begin(); iface != m_interfaces.end(); ++iface) { if((**iface) == InterfaceType) return true; } return false; } const interfaces_t interfaces() { return m_interfaces; } metadata_t metadata() { return m_metadata; } inode* create_plugin(iplugin_factory& Factory, idocument& Document) { if(!m_factory) { m_factory = load_proxied_factory(m_factory_id); if(!m_factory) { k3d::log() << error << "Couldn't load proxied factory for plugin: " << name() << std::endl; return 0; } } if(!m_document_factory) { m_document_factory = dynamic_cast(m_factory); if(!m_document_factory) { k3d::log() << error << "Not a document plugin factory: " << name() << std::endl; return 0; } } return m_document_factory->create_plugin(Factory, Document); } private: iplugin_factory* m_factory; idocument_plugin_factory* m_document_factory; const uuid m_factory_id; const std::string m_name; const std::string m_short_description; const iplugin_factory::categories_t m_categories; const iplugin_factory::quality_t m_quality; const iplugin_factory::interfaces_t m_interfaces; const iplugin_factory::metadata_t m_metadata; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////// // plugin_factory_collection::implementation struct plugin_factory_collection::implementation { bool proxy_module(const filesystem::path& Path, const filesystem::path& ProxyPath) { m_message_signal.emit(string_cast(boost::format(_("Proxying plugin module %1%")) % Path.native_utf8_string().raw())); try { filesystem::ifstream proxy_stream(ProxyPath); xml::element xml_document; proxy_stream >> xml_document; if(xml_document.name != "k3dml") throw std::runtime_error("Not a k3dml document"); xml::element* const xml_module = xml::find_element(xml_document, "module"); if(!xml_module) throw std::runtime_error("Missing tag"); xml::element* const xml_plugins = xml::find_element(*xml_module, "plugins"); if(!xml_plugins) throw std::runtime_error("Missing tag"); for(xml::element::elements_t::iterator xml_plugin = xml_plugins->children.begin(); xml_plugin != xml_plugins->children.end(); ++xml_plugin) { if(xml_plugin->name != "plugin") continue; const std::string factory_name = xml::attribute_text(*xml_plugin, "name"); m_message_signal.emit(string_cast(boost::format(_("Proxying plugin %1%")) % factory_name)); const uuid plugin_factory_id = xml::attribute_value(*xml_plugin, "factory_id", uuid::null()); if(plugin_factory_id == uuid::null()) { log() << error << "Plugin " << factory_name << " with missing factory ID will not be loaded" << std::endl; continue; } // Ensure we don't have any duplicate factory IDs ... if(std::count_if(m_factories.begin(), m_factories.end(), detail::same_factory_id(plugin_factory_id))) { log() << error << "Plugin " << factory_name << " with duplicate factory ID " << plugin_factory_id << " will not be loaded" << std::endl; continue; } // Warn if we have duplicate names ... if(std::count_if(m_factories.begin(), m_factories.end(), detail::same_name(factory_name))) { log() << error << "Plugin factory [" << plugin_factory_id << "] with duplicate name [" << factory_name << "] will not be loaded." << std::endl; continue; } const std::string plugin_short_description = xml::element_text(*xml_plugin, "short_description"); const iplugin_factory::quality_t plugin_quality = xml::attribute_value(*xml_plugin, "quality", iplugin_factory::EXPERIMENTAL); const std::string plugin_type = xml::attribute_text(*xml_plugin, "type"); iplugin_factory::categories_t plugin_categories; if(xml::element* const xml_categories = xml::find_element(*xml_plugin, "categories")) { for(xml::element::elements_t::iterator xml_category = xml_categories->children.begin(); xml_category != xml_categories->children.end(); ++xml_category) { if(xml_category->name != "category") continue; plugin_categories.push_back(xml_category->text); } } iplugin_factory::interfaces_t plugin_interfaces; if(xml::element* const xml_interfaces = xml::find_element(*xml_plugin, "interfaces")) { for(xml::element::elements_t::iterator xml_interface = xml_interfaces->children.begin(); xml_interface != xml_interfaces->children.end(); ++xml_interface) { if(xml_interface->name != "interface") continue; plugin_interfaces.push_back(type_id(xml_interface->text)); } } plugin_interfaces.erase(std::find(plugin_interfaces.begin(), plugin_interfaces.end(), static_cast(0)), plugin_interfaces.end()); iplugin_factory::metadata_t metadata; if(xml::element* const xml_metadata = xml::find_element(*xml_plugin, "metadata")) { for(xml::element::elements_t::iterator xml_pair = xml_metadata->children.begin(); xml_pair != xml_metadata->children.end(); ++xml_pair) { if(xml_pair->name != "pair") continue; metadata.insert(std::make_pair(xml::attribute_text(*xml_pair, "name"), xml::attribute_text(*xml_pair, "value"))); } } if(plugin_type == "application") { m_factories.insert(new detail::application_plugin_factory_proxy(plugin_factory_id, factory_name, plugin_short_description, plugin_categories, plugin_quality, plugin_interfaces, metadata)); } else if(plugin_type == "document") { m_factories.insert(new detail::document_plugin_factory_proxy(plugin_factory_id, factory_name, plugin_short_description, plugin_categories, plugin_quality, plugin_interfaces, metadata)); } else { log() << error << "Unknown plugin factory type " << plugin_type << " will be ignored" << std::endl; continue; } detail::proxied_modules[plugin_factory_id] = Path; detail::proxied_factories[plugin_factory_id] = 0; } return true; } catch(std::exception& e) { log() << error << "Error proxying plugin module " << ProxyPath.native_console_string() << std::endl; return false; } return false; } /// Stores a signal that will be emitted to display loading progress detail::message_signal_t m_message_signal; /// Stores the set of available plugin factories factories_t m_factories; }; ///////////////////////////////////////////////////////////////////////////// // plugin_factory_collection plugin_factory_collection::plugin_factory_collection() : m_implementation(new implementation()) { } plugin_factory_collection::~plugin_factory_collection() { delete m_implementation; } sigc::connection plugin_factory_collection::connect_message_signal(const sigc::slot& Slot) { return m_implementation->m_message_signal.connect(Slot); } void plugin_factory_collection::bind_module(const std::string& ModuleName, register_plugins_entry_point RegisterPlugins) { return_if_fail(RegisterPlugins); m_implementation->m_message_signal.emit(string_cast(boost::format(_("Binding plugin module %1%")) % ModuleName)); detail::plugin_registry registry(m_implementation->m_message_signal, m_implementation->m_factories); RegisterPlugins(registry); } void plugin_factory_collection::load_module(const filesystem::path& Path, const load_proxy_t LoadProxies) { // K-3D modules now have the same extension on all platforms ... if(filesystem::extension(Path).lowercase().raw() != ".module") return; // If the module can be proxied for fast startup, do that and return ... if(LoadProxies == LOAD_PROXIES) { filesystem::path proxy_path = Path + ".proxy"; if(filesystem::exists(proxy_path) && m_implementation->proxy_module(Path, proxy_path)) return; } // OK, just load the module ... m_implementation->m_message_signal.emit(string_cast(boost::format(_("Loading plugin module %1%")) % Path.native_utf8_string().raw())); register_plugins_entry_point register_plugins = 0; os_load_module(Path, register_plugins); if(!register_plugins) return; // It's a K-3D module, all-right - give it a chance to register its plugins detail::plugin_registry registry(m_implementation->m_message_signal, m_implementation->m_factories); register_plugins(registry); } void plugin_factory_collection::load_modules(const filesystem::path& Path, const bool Recursive, const load_proxy_t LoadProxies) { m_implementation->m_message_signal.emit(string_cast(boost::format(_("Searching for plugins in %1%")) % Path.native_utf8_string().raw())); // Create a sorted list of files in this directory ... std::vector files; for(k3d::filesystem::directory_iterator path(Path); path != k3d::filesystem::directory_iterator(); ++path) files.push_back(*path); std::sort(files.begin(), files.end()); // Load modules for(std::vector::const_iterator file = files.begin(); file != files.end(); ++file) { if(!filesystem::is_directory(*file)) load_module(*file, LoadProxies); } // Optionally descend recursively into subdirectories ... if(Recursive) { for(std::vector::const_iterator file = files.begin(); file != files.end(); ++file) { if(filesystem::is_directory(*file)) load_modules(*file, Recursive, LoadProxies); } } } void plugin_factory_collection::load_modules(const std::string& Paths, const bool Recursive, const load_proxy_t LoadProxies) { const system::paths_t paths = system::decompose_path_list(Paths); for(system::paths_t::const_iterator path = paths.begin(); path != paths.end(); ++path) load_modules(*path, Recursive, LoadProxies); } const iplugin_factory_collection::factories_t& plugin_factory_collection::factories() { return m_implementation->m_factories; } } // namespace k3d ================================================ FILE: k3dsdk/plugin_factory_collection.h ================================================ #ifndef K3DSDK_PLUGIN_FACTORY_COLLECTION_H #define K3DSDK_PLUGIN_FACTORY_COLLECTION_H // K-3D // Copyright (c) 1995-2004, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Declares plugin_factory_collection, an implementation of iplugin_factory_collection that can load plugin factories from shared libraries \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace filesystem { class path; } ///////////////////////////////////////////////////////////////////////////// // plugin_factory_collection /// Provides an implementation of iplugin_factory_collection that can load plugin factories from shared libraries class plugin_factory_collection : public iplugin_factory_collection { public: plugin_factory_collection(); ~plugin_factory_collection(); enum load_proxy_t { LOAD_PROXIES, IGNORE_PROXIES }; /// Connects a signal emitted to display human-readable progress messages while loading plugin modules sigc::connection connect_message_signal(const sigc::slot& Slot); /// Binds a statically-linked plugin module void bind_module(const std::string& ModuleName, register_plugins_entry_point RegisterPlugins); /// Loads a single plugin module void load_module(const filesystem::path& Path, const load_proxy_t LoadProxies); /// Loads plugin modules from a directory, optionally descending recursively into subdirectories void load_modules(const filesystem::path& Path, const bool Recursive, const load_proxy_t LoadProxies); /// Loads plugin modules from zero-to-many directories, optionally descending recursively into each directory void load_modules(const std::string& Paths, const bool Recursive, const load_proxy_t LoadProxies); // iplugin_factory_collection implementation const factories_t& factories(); private: plugin_factory_collection(const plugin_factory_collection&); plugin_factory_collection& operator=(const plugin_factory_collection&); struct implementation; implementation* const m_implementation; }; } // namespace k3d #endif // !K3DSDK_PLUGIN_FACTORY_COLLECTION_H ================================================ FILE: k3dsdk/plugins_detail.h ================================================ #ifndef K3DSDK_PLUGINS_DETAIL_H #define K3DSDK_PLUGINS_DETAIL_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { namespace plugin { namespace detail { iunknown* create_application_plugin(const k3d::string_t& FactoryName); iunknown* create_application_plugin(iplugin_factory& Factory); iunknown* create_application_plugin(const uuid& FactoryID); inode* create_document_plugin(const k3d::string_t& FactoryName, idocument& Document, const k3d::string_t& Name); inode* create_document_plugin(iplugin_factory& Factory, idocument& Document, const k3d::string_t& Name); inode* create_document_plugin(const uuid& FactoryID, idocument& Document, const k3d::string_t& Name); } // namespace detail } // namespace plugin } // namespace k3d #endif // !K3DSDK_PLUGINS_DETAIL_H ================================================ FILE: k3dsdk/point2.h ================================================ #ifndef K3DSDK_POINT2_H #define K3DSDK_POINT2_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /**************************************************************** * * C++ Vector and Matrix Algebra routines * Author: Jean-Francois DOUE * Version 3.1 --- October 1993 * ****************************************************************/ // // From "Graphics Gems IV / Edited by Paul S. Heckbert // Academic Press, 1994, ISBN 0-12-336156-9 // "You are free to use and modify this code in any way // you like." (p. xv) // // Modified by J. Nagle, March 1997 // - All functions are inline. // - All functions are const-correct. // - All checking is via the standard "assert" macro. // // Modified by Tim Shead for use with K-3D, January 1998 #include #include #include #include namespace k3d { class vector2; ///////////////////////////////////////////////////////////////////////////// // point2 /// Encapsulates a location in two-dimensional space class point2 { public: /// Stores the point values double n[2]; point2() { n[0] = n[1] = 0.0; } point2(const double x, const double y) { n[0] = x; n[1] = y; } point2(const point2& v) { n[0] = v.n[0]; n[1] = v.n[1]; } /// Addition of a vector point2& operator+=(const vector2& v); /// Subtraction of a vector point2& operator-=(const vector2& v); /// Multiplication by a constant point2& operator*=(const double d) { n[0] *= d; n[1] *= d; return *this; } /// Division by a constant point2& operator/=(const double d) { return_val_if_fail(d, *this); double d_inv = 1./d; n[0] *= d_inv; n[1] *= d_inv; return *this; } /// Returns an indexed dimension by reference double& operator[](int i) { return n[i]; } /// Returns an indexed dimension by value double operator[](int i) const { return n[i]; } friend std::ostream& operator<<(std::ostream& Stream, const point2& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.n[0] << " " << RHS.n[1]; return Stream; } friend std::istream& operator>>(std::istream& Stream, point2& RHS) { Stream >> RHS.n[0] >> RHS.n[1]; return Stream; } }; /// Negation inline const point2 operator-(const point2& a) { return point2(-a.n[0], -a.n[1]); } /// Addition /** \note We implement this as a convenience for the benefit of linear interpolation - adding two points has no geometric meaning */ inline const point2 operator+(const point2& a, const point2& b) { return point2(a.n[0] + b.n[0], a.n[1] + b.n[1]); } /// Multiplication by a constant inline const point2 operator*(const point2& a, const double d) { return point2(d * a.n[0], d * a.n[1]); } /// Multiplication by a constant inline const point2 operator*(const double d, const point2& a) { return a * d; } /// Division by a constant inline const point2 operator/(const point2& a, const double d) { return_val_if_fail(d, point2()); double d_inv = 1./d; return point2(a.n[0]*d_inv, a.n[1]*d_inv); } /// Equality inline bool operator==(const point2& a, const point2& b) { return a.n[0] == b.n[0] && a.n[1] == b.n[1]; } /// Non-equality inline bool operator!=(const point2& a, const point2& b) { return !(a == b); } namespace difference { /// Specialization of difference::test for point2 inline void test(const point2& A, const point2& B, accumulator& Result) { range_test(A.n, A.n + 2, B.n, B.n + 2, Result); } } // namespace difference } // namespace k3d #endif // !K3DSDK_POINT2_H ================================================ FILE: k3dsdk/point3.h ================================================ #ifndef K3DSDK_POINT3_H #define K3DSDK_POINT3_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Vector (points, vectors and normals) routines \author Timothy M. Shead (tshead@k-3d.com) */ /**************************************************************** * * C++ Vector and Matrix Algebra routines * Author: Jean-Francois DOUE * Version 3.1 --- October 1993 * ****************************************************************/ // // From "Graphics Gems IV / Edited by Paul S. Heckbert // Academic Press, 1994, ISBN 0-12-336156-9 // "You are free to use and modify this code in any way // you like." (p. xv) // // Modified by J. Nagle, March 1997 // - All functions are inline. // - All functions are const-correct. // - All checking is via the standard "assert" macro. // // Modified by Tim Shead for use with K-3D, January 1998 #include #include #include #include namespace k3d { class vector3; ///////////////////////////////////////////////////////////////////////////// // point3 /// Encapsulates a location in three-dimensional space class point3 { public: /// Stores the point values double n[3]; point3() { n[0] = n[1] = n[2] = 0.0; } point3(const double x, const double y, const double z) { n[0] = x; n[1] = y; n[2] = z; } point3(const double d[3]) { n[0] = d[0]; n[1] = d[1]; n[2] = d[2]; } /// Addition of a vector point3& operator+=(const vector3& v); /// Subtraction of a vector point3& operator-=(const vector3& v); /// Multiplication by a constant point3& operator*=(const double d) { n[0] *= d; n[1] *= d; n[2] *= d; return *this; } /// Division by a constant point3& operator/=(const double d) { return_val_if_fail(d, *this); double d_inv = 1./d; n[0] *= d_inv; n[1] *= d_inv; n[2] *= d_inv; return *this; } /// Returns an indexed dimension by reference double& operator[](int i) { return n[i]; } /// Returns an indexed dimension by value double operator[](int i) const { return n[i]; } friend std::ostream& operator<<(std::ostream& Stream, const point3& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.n[0] << " " << RHS.n[1] << " " << RHS.n[2]; return Stream; } friend std::istream& operator>>(std::istream& Stream, point3& RHS) { Stream >> RHS.n[0] >> RHS.n[1] >> RHS.n[2]; return Stream; } }; /// Negation inline const point3 operator-(const point3& a) { return point3(-a.n[0], -a.n[1], -a.n[2]); } /// Addition /** \note We implement this as a convenience for the benefit of linear interpolation - adding two points has no geometric meaning */ inline const point3 operator+(const point3& a, const point3& b) { return point3(a.n[0]+ b.n[0], a.n[1] + b.n[1], a.n[2] + b.n[2]); } /// Multiplication by a constant inline const point3 operator*(const point3& a, const double d) { return point3(d*a.n[0], d*a.n[1], d*a.n[2]); } /// Multiplication by a constant inline const point3 operator*(const double d, const point3& a) { return a*d; } /// Division by a constant inline const point3 operator/(const point3& a, const double d) { return_val_if_fail(d, point3()); double d_inv = 1./d; return point3(a.n[0]*d_inv, a.n[1]*d_inv, a.n[2]*d_inv); } /// Equality inline bool operator==(const point3& a, const point3& b) { return (a.n[0] == b.n[0]) && (a.n[1] == b.n[1]) && (a.n[2] == b.n[2]); } /// Inequality inline bool operator!=(const point3& a, const point3& b) { return !(a == b); } namespace difference { /// Specialization of difference::test for point3 inline void test(const point3& A, const point3& B, accumulator& Result) { range_test(A.n, A.n + 3, B.n, B.n + 3, Result); } } // namespace difference } // namespace k3d #endif // !K3DSDK_POINT3_H ================================================ FILE: k3dsdk/point4.h ================================================ #ifndef K3DSDK_POINT4_H #define K3DSDK_POINT4_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \brief Vector (points, vectors and normals) routines \author Timothy M. Shead (tshead@k-3d.com) */ /**************************************************************** * * C++ Vector and Matrix Algebra routines * Author: Jean-Francois DOUE * Version 3.1 --- October 1993 * ****************************************************************/ // // From "Graphics Gems IV / Edited by Paul S. Heckbert // Academic Press, 1994, ISBN 0-12-336156-9 // "You are free to use and modify this code in any way // you like." (p. xv) // // Modified by J. Nagle, March 1997 // - All functions are inline. // - All functions are const-correct. // - All checking is via the standard "assert" macro. // // Modified by Tim Shead for use with K-3D, January 1998 #include #include #include #include namespace k3d { class vector4; ///////////////////////////////////////////////////////////////////////////// // point4 /// Encapsulates a four-dimensional location class point4 { public: /// Stores the point values double n[4]; point4() { n[0] = n[1] = n[2] = n[3] = 0.0; } point4(const double x, const double y, const double z, const double w) { n[0] = x; n[1] = y; n[2] = z; n[3] = w; } /// Addition of a vector point4& operator+=(const vector4& v); /// Subtraction of a vector point4& operator-=(const vector4& v); /// Multiplication by a constant point4& operator*=(const double d) { n[0] *= d; n[1] *= d; n[2] *= d; n[3] *= d; return *this; } /// Division by a constant point4& operator/=(const double d) { return_val_if_fail(d, *this); double d_inv = 1./d; n[0] *= d_inv; n[1] *= d_inv; n[2] *= d_inv; n[3] *= d_inv; return *this; } /// Returns an indexed dimension by reference double& operator[](int i) { return n[i]; } /// Returns an indexed dimension by value double operator[](int i) const { return n[i]; } friend std::ostream& operator<<(std::ostream& Stream, const point4& RHS) { boost::io::ios_flags_saver stream_state(Stream); Stream << std::setprecision(17) << RHS.n[0] << " " << RHS.n[1] << " " << RHS.n[2] << " " << RHS.n[3]; return Stream; } friend std::istream& operator>>(std::istream& Stream, point4& RHS) { Stream >> RHS.n[0] >> RHS.n[1] >> RHS.n[2] >> RHS.n[3]; return Stream; } }; /// Negation inline const point4 operator-(const point4& a) { return point4(-a.n[0],-a.n[1],-a.n[2],-a.n[3]); } /// Addition /** \note We implement this as a convenience for the benefit of linear interpolation - adding two points has no geometric meaning */ inline const point4 operator+(const point4& a, const point4& b) { return point4(a.n[0] + b.n[0], a.n[1] + b.n[1], a.n[2] + b.n[2], a.n[3] + b.n[3]); } /// Multiplication by a constant inline const point4 operator*(const point4& a, const double d) { return point4(d*a.n[0], d*a.n[1], d*a.n[2], d*a.n[3] ); } /// Multiplication by a constant inline const point4 operator*(const double d, const point4& a) { return a*d; } /// Division by a constant inline const point4 operator/(const point4& a, const double d) { return_val_if_fail(d, point4()); double d_inv = 1./d; return point4(a.n[0]*d_inv, a.n[1]*d_inv, a.n[2]*d_inv, a.n[3]*d_inv); } /// Equality inline bool operator==(const point4& a, const point4& b) { return (a.n[0] == b.n[0]) && (a.n[1] == b.n[1]) && (a.n[2] == b.n[2]) && (a.n[3] == b.n[3]); } /// Inequality inline bool operator!=(const point4& a, const point4& b) { return !(a == b); } namespace difference { /// Specialization of difference::test for point4 inline void test(const point4& A, const point4& B, accumulator& Result) { range_test(A.n, A.n + 4, B.n, B.n + 4, Result); } } // namespace difference } // namespace k3d #endif // !K3DSDK_POINT4_H ================================================ FILE: k3dsdk/pointer_demand_storage.h ================================================ #ifndef K3DSDK_POINTER_DEMAND_STORAGE_H #define K3DSDK_POINTER_DEMAND_STORAGE_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include namespace k3d { namespace data { ///////////////////////////////////////////////////////////////////////////// // pointer_demand_storage /// Read-only storage policy that stores a value by pointer, created on-demand template class pointer_demand_storage : public signal_policy_t { // This policy only works for data stored by-pointer BOOST_STATIC_ASSERT((boost::is_pointer::value)); public: typedef typename boost::remove_pointer::type non_pointer_t; typedef pointer_demand_storage this_t; typedef std::vector pending_hints_t; /// Set the slot that will be called to bring the underlying data up-to-date void set_update_slot(const sigc::slot& Slot) { m_update_slot = Slot; update(); } /// Returns a slot that will invoke the update() method sigc::slot make_slot() { return sigc::mem_fun(*this, &this_t::update); } /// Store an object as the new value, taking control of its lifetime void reset(pointer_t NewValue = 0, ihint* const Hint = 0) { // Prevent updates while we're executing ... if(m_executing) return; if(NewValue) { // If the new value is non-NULL, cancel any pending updates ... std::for_each(m_pending_hints.begin(), m_pending_hints.end(), delete_object()); m_pending_hints.clear(); } else { // Otherwise, ensure that we execute next time we're called ... m_pending_hints.push_back(Hint ? Hint->clone() : static_cast(0)); } m_value.reset(NewValue); signal_policy_t::set_value(Hint); } /// Schedule an update for the value the next time it's read void update(ihint* const Hint = 0) { // Prevent updates while we're executing ... if(m_executing) return; m_pending_hints.push_back(Hint ? Hint->clone() : static_cast(0)); signal_policy_t::set_value(Hint); } /// Accesses the underlying value, creating it if it doesn't already exist pointer_t internal_value() { if(!m_value.get()) m_value.reset(new non_pointer_t()); if(!m_pending_hints.empty()) { m_executing = true; // Create a temporary copy of pending hints in-case we are updated while executing ... const pending_hints_t pending_hints(m_pending_hints); m_update_slot(pending_hints, *m_value); std::for_each(m_pending_hints.begin(), m_pending_hints.end(), delete_object()); m_pending_hints.clear(); m_executing = false; } return m_value.get(); } protected: template pointer_demand_storage(const init_t& Init) : signal_policy_t(Init), m_executing(false) { } ~pointer_demand_storage() { std::for_each(m_pending_hints.begin(), m_pending_hints.end(), delete_object()); } private: /// Storage for this policy's value boost::scoped_ptr m_value; /// Stores a slot that will be called to bring this policy's value up-to-date sigc::slot m_update_slot; /// Stores a collection of pending hints to be updated pending_hints_t m_pending_hints; /// Used to prevent problems with recursion while executing bool_t m_executing; }; } // namespace data } // namespace k3d #endif // !K3DSDK_POINTER_DEMAND_STORAGE_H ================================================ FILE: k3dsdk/polyhedron.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) \author Bart Janssens (bart.janssens@lid.kviv.be) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace polyhedron { ///////////////////////////////////////////////////////////////////////////////////////////// // const_primitive const_primitive::const_primitive( const typed_array& ShellTypes, const mesh::indices_t& FaceShells, const mesh::indices_t& FaceFirstLoops, const mesh::counts_t& FaceLoopCounts, const mesh::selection_t& FaceSelections, const mesh::materials_t& FaceMaterials, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& ClockwiseEdges, const mesh::selection_t& EdgeSelections, const mesh::indices_t& VertexPoints, const mesh::selection_t& VertexSelections, const mesh::table_t& ConstantAttributes, const mesh::table_t& FaceAttributes, const mesh::table_t& EdgeAttributes, const mesh::table_t& VertexAttributes ) : shell_types(ShellTypes), face_shells(FaceShells), face_first_loops(FaceFirstLoops), face_loop_counts(FaceLoopCounts), face_selections(FaceSelections), face_materials(FaceMaterials), loop_first_edges(LoopFirstEdges), clockwise_edges(ClockwiseEdges), edge_selections(EdgeSelections), vertex_points(VertexPoints), vertex_selections(VertexSelections), constant_attributes(ConstantAttributes), face_attributes(FaceAttributes), edge_attributes(EdgeAttributes), vertex_attributes(VertexAttributes) { } const_primitive::const_primitive(const primitive& Primitive) : shell_types(Primitive.shell_types), face_shells(Primitive.face_shells), face_first_loops(Primitive.face_first_loops), face_loop_counts(Primitive.face_loop_counts), face_selections(Primitive.face_selections), face_materials(Primitive.face_materials), loop_first_edges(Primitive.loop_first_edges), clockwise_edges(Primitive.clockwise_edges), edge_selections(Primitive.edge_selections), vertex_points(Primitive.vertex_points), vertex_selections(Primitive.vertex_selections), constant_attributes(Primitive.constant_attributes), face_attributes(Primitive.face_attributes), edge_attributes(Primitive.edge_attributes), vertex_attributes(Primitive.vertex_attributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // primitive primitive::primitive( typed_array& ShellTypes, mesh::indices_t& FaceShells, mesh::indices_t& FaceFirstLoops, mesh::counts_t& FaceLoopCounts, mesh::selection_t& FaceSelections, mesh::materials_t& FaceMaterials, mesh::indices_t& LoopFirstEdges, mesh::indices_t& ClockwiseEdges, mesh::selection_t& EdgeSelections, mesh::indices_t& VertexPoints, mesh::selection_t& VertexSelections, mesh::table_t& ConstantAttributes, mesh::table_t& FaceAttributes, mesh::table_t& EdgeAttributes, mesh::table_t& VertexAttributes ) : shell_types(ShellTypes), face_shells(FaceShells), face_first_loops(FaceFirstLoops), face_loop_counts(FaceLoopCounts), face_selections(FaceSelections), face_materials(FaceMaterials), loop_first_edges(LoopFirstEdges), clockwise_edges(ClockwiseEdges), edge_selections(EdgeSelections), vertex_points(VertexPoints), vertex_selections(VertexSelections), constant_attributes(ConstantAttributes), face_attributes(FaceAttributes), edge_attributes(EdgeAttributes), vertex_attributes(VertexAttributes) { } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh::primitive& GenericPrimitive) { GenericPrimitive.type = "polyhedron"; GenericPrimitive.structure.clear(); GenericPrimitive.attributes.clear(); primitive* const result = new primitive( GenericPrimitive.structure["shell"].create >("shell_types"), GenericPrimitive.structure["face"].create("face_shells"), GenericPrimitive.structure["face"].create("face_first_loops"), GenericPrimitive.structure["face"].create("face_loop_counts"), GenericPrimitive.structure["face"].create("face_selections"), GenericPrimitive.structure["face"].create("face_materials"), GenericPrimitive.structure["loop"].create("loop_first_edges"), GenericPrimitive.structure["edge"].create("clockwise_edges"), GenericPrimitive.structure["edge"].create("edge_selections"), GenericPrimitive.structure["vertex"].create("vertex_points"), GenericPrimitive.structure["vertex"].create("vertex_selections"), GenericPrimitive.attributes["constant"], GenericPrimitive.attributes["face"], GenericPrimitive.attributes["edge"], GenericPrimitive.attributes["vertex"] ); result->face_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->edge_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); result->vertex_points.set_metadata_value(metadata::key::domain(), metadata::value::point_indices_domain()); result->vertex_selections.set_metadata_value(metadata::key::role(), metadata::value::selection_role()); return result; } primitive* create(mesh& Mesh) { mesh::primitive& generic_primitive = Mesh.primitives.create("polyhedron"); return create(generic_primitive); } ///////////////////////////////////////////////////////////////////////////////////////////// // create primitive* create(mesh& Mesh, const mesh::points_t& Vertices, const mesh::counts_t& VertexCounts, const mesh::indices_t& VertexIndices, imaterial* const Material) { try { if(std::count_if(VertexCounts.begin(), VertexCounts.end(), std::bind2nd(std::less(), 3))) { throw std::runtime_error("each face must have three-or-more vertices."); } const uint_t expected_indices = std::accumulate(VertexCounts.begin(), VertexCounts.end(), 0); if(VertexIndices.size() != expected_indices) { std::ostringstream buffer; buffer << "expected [" << expected_indices << "] vertex indices, received [" << VertexIndices.size() << "]"; throw std::runtime_error(buffer.str()); } if(std::count_if(VertexIndices.begin(), VertexIndices.end(), std::bind2nd(std::greater_equal(), Vertices.size()))) { throw std::runtime_error("vertex indices out-of-bounds"); } // Append points to the mesh (create the arrays if they don't already exist) ... mesh::points_t& points = Mesh.points ? Mesh.points.writable() : Mesh.points.create(); mesh::selection_t& point_selection = Mesh.point_selection ? Mesh.point_selection.writable() : Mesh.point_selection.create(); const uint_t point_offset = points.size(); points.insert(points.end(), Vertices.begin(), Vertices.end()); point_selection.insert(point_selection.end(), Vertices.size(), 0.0); Mesh.point_attributes.set_row_count(points.size()); // Append a new polyhedron to the mesh ... primitive* const polyhedron = create(Mesh); polyhedron->shell_types.push_back(POLYGONS); uint_t face_vertex = 0; const uint_t face_begin = 0; const uint_t face_end = face_begin + VertexCounts.size(); for(uint_t face = face_begin; face != face_end; ++face) { polyhedron->face_shells.push_back(0); polyhedron->face_first_loops.push_back(polyhedron->loop_first_edges.size()); polyhedron->face_loop_counts.push_back(1); polyhedron->face_selections.push_back(0.0); polyhedron->face_materials.push_back(Material); polyhedron->loop_first_edges.push_back(polyhedron->clockwise_edges.size()); const uint_t vertex_begin = 0; const uint_t vertex_end = vertex_begin + VertexCounts[face]; const uint_t loop_begin = polyhedron->clockwise_edges.size(); for(uint_t vertex = vertex_begin; vertex != vertex_end; ++vertex, ++face_vertex) { polyhedron->vertex_points.push_back(point_offset + VertexIndices[face_vertex]); polyhedron->vertex_selections.push_back(0.0); polyhedron->clockwise_edges.push_back(polyhedron->clockwise_edges.size() + 1); polyhedron->edge_selections.push_back(0.0); } polyhedron->clockwise_edges.back() = loop_begin; } return polyhedron; } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } ///////////////////////////////////////////////////////////////////////////////////////////// // validate const_primitive* validate(const mesh& Mesh, const mesh::primitive& Primitive) { if(Primitive.type != "polyhedron") return 0; try { require_valid_primitive(Mesh, Primitive); const mesh::table_t& shell_structure = require_structure(Primitive, "shell"); const mesh::table_t& face_structure = require_structure(Primitive, "face"); const mesh::table_t& loop_structure = require_structure(Primitive, "loop"); const mesh::table_t& edge_structure = require_structure(Primitive, "edge"); const mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); const mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); const mesh::table_t& face_attributes = require_attributes(Primitive, "face"); const mesh::table_t& edge_attributes = require_attributes(Primitive, "edge"); const mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); const typed_array& shell_types = require_array >(Primitive, shell_structure, "shell_types"); const mesh::indices_t& face_shells = require_array(Primitive, face_structure, "face_shells"); const mesh::indices_t& face_first_loops = require_array(Primitive, face_structure, "face_first_loops"); const mesh::counts_t& face_loop_counts = require_array(Primitive, face_structure, "face_loop_counts"); const mesh::selection_t& face_selections = require_array(Primitive, face_structure, "face_selections"); const mesh::materials_t& face_materials = require_array(Primitive, face_structure, "face_materials"); const mesh::indices_t& loop_first_edges = require_array(Primitive, loop_structure, "loop_first_edges"); const mesh::indices_t& clockwise_edges = require_array(Primitive, edge_structure, "clockwise_edges"); const mesh::selection_t& edge_selections = require_array(Primitive, edge_structure, "edge_selections"); const mesh::indices_t& vertex_points = require_array(Primitive, vertex_structure, "vertex_points"); const mesh::selection_t& vertex_selections = require_array(Primitive, vertex_structure, "vertex_selections"); require_metadata(Primitive, face_selections, "face_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, edge_selections, "edge_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, vertex_points, "vertex_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_metadata(Primitive, vertex_selections, "vertex_selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, loop_structure, "loop", std::accumulate(face_loop_counts.begin(), face_loop_counts.end(), 0)); require_table_row_count(Primitive, vertex_structure, "vertex", edge_structure.row_count()); // Check for out-of-bound shell indices ... const uint_t face_begin = 0; const uint_t face_end = face_begin + face_shells.size(); for(uint_t face = face_begin; face != face_end; ++face) { if(face_shells[face] >= shell_types.size()) { log() << error << "face shell out-of-bounds for face " << face << ": " << face_shells[face] << " >= " << shell_types.size() << std::endl; return 0; } } // Check for out-of-bound indices and infinite loops in our edge lists ... const uint_t loop_begin = 0; const uint_t loop_end = loop_begin + loop_first_edges.size(); const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + clockwise_edges.size(); for(uint_t loop = loop_begin; loop != loop_end; ++loop) { const uint_t first_edge = loop_first_edges[loop]; if(first_edge >= edge_end) { log() << error << "loop first edge index out-of-bounds for loop " << loop << std::endl; return 0; } uint_t edge_slow = first_edge; uint_t edge_fast = first_edge; uint_t cycle_count = 0; while(true) { edge_slow = clockwise_edges[edge_slow]; if(edge_slow >= edge_end) { log() << error << "clockwise edge index out-of-bounds for edge " << edge_slow << std::endl; return 0; } edge_fast = clockwise_edges[clockwise_edges[edge_fast]]; if(edge_fast >= edge_end) { log() << error << "clockwise edge index out-of-bounds for edge " << edge_fast << std::endl; return 0; } if(edge_slow == edge_fast) ++cycle_count; if(cycle_count > 2) { log() << error << "infinite loop at loop index " << loop << std::endl; return 0; } if(edge_slow == first_edge) break; } } return new const_primitive(shell_types, face_shells, face_first_loops, face_loop_counts, face_selections, face_materials, loop_first_edges, clockwise_edges, edge_selections, vertex_points, vertex_selections, constant_attributes, face_attributes, edge_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, mesh::primitive& Primitive) { if(Primitive.type != "polyhedron") return 0; try { require_valid_primitive(Mesh, Primitive); mesh::table_t& shell_structure = require_structure(Primitive, "shell"); mesh::table_t& face_structure = require_structure(Primitive, "face"); mesh::table_t& loop_structure = require_structure(Primitive, "loop"); mesh::table_t& edge_structure = require_structure(Primitive, "edge"); mesh::table_t& vertex_structure = require_structure(Primitive, "vertex"); mesh::table_t& constant_attributes = require_attributes(Primitive, "constant"); mesh::table_t& face_attributes = require_attributes(Primitive, "face"); mesh::table_t& edge_attributes = require_attributes(Primitive, "edge"); mesh::table_t& vertex_attributes = require_attributes(Primitive, "vertex"); typed_array& shell_types = require_array >(Primitive, shell_structure, "shell_types"); mesh::indices_t& face_shells = require_array(Primitive, face_structure, "face_shells"); mesh::indices_t& face_first_loops = require_array(Primitive, face_structure, "face_first_loops"); mesh::counts_t& face_loop_counts = require_array(Primitive, face_structure, "face_loop_counts"); mesh::selection_t& face_selections = require_array(Primitive, face_structure, "face_selections"); mesh::materials_t& face_materials = require_array(Primitive, face_structure, "face_materials"); mesh::indices_t& loop_first_edges = require_array(Primitive, loop_structure, "loop_first_edges"); mesh::indices_t& clockwise_edges = require_array(Primitive, edge_structure, "clockwise_edges"); mesh::selection_t& edge_selections = require_array(Primitive, edge_structure, "edge_selections"); mesh::indices_t& vertex_points = require_array(Primitive, vertex_structure, "vertex_points"); mesh::selection_t& vertex_selections = require_array(Primitive, vertex_structure, "vertex_selections"); require_metadata(Primitive, face_selections, "face_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, edge_selections, "edge_selections", metadata::key::role(), metadata::value::selection_role()); require_metadata(Primitive, vertex_points, "vertex_points", metadata::key::domain(), metadata::value::point_indices_domain()); require_metadata(Primitive, vertex_selections, "vertex_selections", metadata::key::role(), metadata::value::selection_role()); require_table_row_count(Primitive, loop_structure, "loop", std::accumulate(face_loop_counts.begin(), face_loop_counts.end(), 0)); require_table_row_count(Primitive, vertex_structure, "vertex", edge_structure.row_count()); // Check for out-of-bound shell indices ... const uint_t face_begin = 0; const uint_t face_end = face_begin + face_shells.size(); for(uint_t face = face_begin; face != face_end; ++face) { if(face_shells[face] >= shell_types.size()) { log() << error << "face shell out-of-bounds for face " << face << ": " << face_shells[face] << " >= " << shell_types.size() << std::endl; return 0; } } // Check for out-of-bound indices and infinite loops in our edge lists ... const uint_t loop_begin = 0; const uint_t loop_end = loop_begin + loop_first_edges.size(); const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + clockwise_edges.size(); for(uint_t loop = loop_begin; loop != loop_end; ++loop) { const uint_t first_edge = loop_first_edges[loop]; if(first_edge >= edge_end) { log() << error << "loop first edge index out-of-bounds for loop " << loop << std::endl; return 0; } uint_t edge_slow = first_edge; uint_t edge_fast = first_edge; uint_t cycle_count = 0; while(true) { edge_slow = clockwise_edges[edge_slow]; if(edge_slow >= edge_end) { log() << error << "clockwise edge index out-of-bounds for edge " << edge_slow << std::endl; return 0; } edge_fast = clockwise_edges[clockwise_edges[edge_fast]]; if(edge_fast >= edge_end) { log() << error << "clockwise edge index out-of-bounds for edge " << edge_fast << std::endl; return 0; } if(edge_slow == edge_fast) ++cycle_count; if(cycle_count > 2) { log() << error << "infinite loop at loop index " << loop << std::endl; return 0; } if(edge_slow == first_edge) break; } } return new primitive(shell_types, face_shells, face_first_loops, face_loop_counts, face_selections, face_materials, loop_first_edges, clockwise_edges, edge_selections, vertex_points, vertex_selections, constant_attributes, face_attributes, edge_attributes, vertex_attributes); } catch(std::exception& e) { log() << error << e.what() << std::endl; } return 0; } primitive* validate(const mesh& Mesh, pipeline_data& Primitive) { if(!Primitive.get()) return 0; if(Primitive->type != "polyhedron") return 0; return validate(Mesh, Primitive.writable()); } ///////////////////////////////////////////////////////////////////////////////////////////// // add_triangle void add_triangle(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t V1, const uint_t V2, const uint_t V3, imaterial* const Material) { return_if_fail(Shell < Polyhedron.shell_types.size()); Polyhedron.face_shells.push_back(Shell); Polyhedron.face_first_loops.push_back(Polyhedron.loop_first_edges.size()); Polyhedron.face_loop_counts.push_back(1); Polyhedron.face_selections.push_back(0); Polyhedron.face_materials.push_back(Material); Polyhedron.loop_first_edges.push_back(Polyhedron.clockwise_edges.size()); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() - 2); Polyhedron.edge_selections.push_back(0); Polyhedron.edge_selections.push_back(0); Polyhedron.edge_selections.push_back(0); Polyhedron.vertex_points.push_back(V1); Polyhedron.vertex_points.push_back(V2); Polyhedron.vertex_points.push_back(V3); Polyhedron.vertex_selections.push_back(0); Polyhedron.vertex_selections.push_back(0); Polyhedron.vertex_selections.push_back(0); } ///////////////////////////////////////////////////////////////////////////////////////////// // add_quadrilateral void add_quadrilateral(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t V1, const uint_t V2, const uint_t V3, const uint_t V4, imaterial* const Material) { return_if_fail(Shell < Polyhedron.shell_types.size()); Polyhedron.face_shells.push_back(Shell); Polyhedron.face_first_loops.push_back(Polyhedron.loop_first_edges.size()); Polyhedron.face_loop_counts.push_back(1); Polyhedron.face_selections.push_back(0); Polyhedron.face_materials.push_back(Material); Polyhedron.loop_first_edges.push_back(Polyhedron.clockwise_edges.size()); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() - 3); Polyhedron.edge_selections.push_back(0); Polyhedron.edge_selections.push_back(0); Polyhedron.edge_selections.push_back(0); Polyhedron.edge_selections.push_back(0); Polyhedron.vertex_points.push_back(V1); Polyhedron.vertex_points.push_back(V2); Polyhedron.vertex_points.push_back(V3); Polyhedron.vertex_points.push_back(V4); Polyhedron.vertex_selections.push_back(0); Polyhedron.vertex_selections.push_back(0); Polyhedron.vertex_selections.push_back(0); Polyhedron.vertex_selections.push_back(0); } ///////////////////////////////////////////////////////////////////////////////////////////// // add_face void add_face(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const mesh::points_t& Vertices, imaterial* const Material) { add_face(Mesh, Polyhedron, Shell, Vertices, std::vector(), Material); } void add_face(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const mesh::points_t& Vertices, const std::vector& Holes, imaterial* const Material) { return_if_fail(Mesh.points); return_if_fail(Mesh.point_selection); return_if_fail(Shell < Polyhedron.shell_types.size()); return_if_fail(Vertices.size() > 1); for(uint_t hole = 0; hole != Holes.size(); ++hole) return_if_fail(Holes[hole].size() > 1); mesh::points_t& points = Mesh.points.writable(); mesh::selection_t& point_selection = Mesh.point_selection.writable(); Polyhedron.face_shells.push_back(Shell); Polyhedron.face_first_loops.push_back(Polyhedron.loop_first_edges.size()); Polyhedron.face_loop_counts.push_back(Holes.size() + 1); Polyhedron.face_selections.push_back(0); Polyhedron.face_materials.push_back(Material); Polyhedron.loop_first_edges.push_back(Polyhedron.clockwise_edges.size()); for(mesh::points_t::const_iterator point = Vertices.begin(); point != Vertices.end(); ++point) { Polyhedron.vertex_points.push_back(points.size()); Polyhedron.vertex_selections.push_back(0); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.edge_selections.push_back(0); points.push_back(*point); point_selection.push_back(0); } Polyhedron.clockwise_edges.back() = Polyhedron.loop_first_edges.back(); for(uint_t hole = 0; hole != Holes.size(); ++hole) { Polyhedron.loop_first_edges.push_back(Polyhedron.clockwise_edges.size()); for(mesh::points_t::const_iterator point = Holes[hole].begin(); point != Holes[hole].end(); ++point) { Polyhedron.vertex_points.push_back(points.size()); Polyhedron.vertex_selections.push_back(0); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.edge_selections.push_back(0); points.push_back(*point); point_selection.push_back(0); } Polyhedron.clockwise_edges.back() = Polyhedron.loop_first_edges.back(); } } ///////////////////////////////////////////////////////////////////////////////////////////// // add_grid void add_grid(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t Rows, const uint_t Columns, imaterial* const Material) { try { if(!Rows) throw std::runtime_error("Cannot create grid with zero rows."); if(!Columns) throw std::runtime_error("Cannot create grid with zero columns."); if(Shell >= Polyhedron.shell_types.size()) throw std::runtime_error("Invalid shell."); const uint_t rows = Rows; const uint_t columns = Columns; const uint_t point_rows = rows + 1; const uint_t point_columns = columns + 1; // Append points to the mesh (create the arrays if they don't already exist) ... mesh::points_t& points = Mesh.points ? Mesh.points.writable() : Mesh.points.create(); mesh::selection_t& point_selection = Mesh.point_selection ? Mesh.point_selection.writable() : Mesh.point_selection.create(); const uint_t point_offset = points.size(); points.insert(points.end(), point_rows * point_columns, point3()); point_selection.insert(point_selection.end(), point_rows * point_columns, 0); Mesh.point_attributes.set_row_count(points.size()); // Append faces to the polyhedron ... for(uint_t row = 0; row != rows; ++row) { for(uint_t column = 0; column != columns; ++column) { Polyhedron.face_shells.push_back(Shell); Polyhedron.face_first_loops.push_back(Polyhedron.loop_first_edges.size()); Polyhedron.face_loop_counts.push_back(1); Polyhedron.face_selections.push_back(0); Polyhedron.face_materials.push_back(Material); Polyhedron.loop_first_edges.push_back(Polyhedron.clockwise_edges.size()); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() - 3); Polyhedron.edge_selections.insert(Polyhedron.edge_selections.end(), 4, 0); Polyhedron.vertex_points.push_back(point_offset + ((row + 0) * point_columns) + column + 0); Polyhedron.vertex_points.push_back(point_offset + ((row + 0) * point_columns) + column + 1); Polyhedron.vertex_points.push_back(point_offset + ((row + 1) * point_columns) + column + 1); Polyhedron.vertex_points.push_back(point_offset + ((row + 1) * point_columns) + column + 0); Polyhedron.vertex_selections.insert(Polyhedron.vertex_selections.end(), 4, 0); } } } catch(std::exception& e) { log() << error << e.what() << std::endl; } } ///////////////////////////////////////////////////////////////////////////////////////////// // add_cylinder void add_cylinder(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t Rows, const uint_t Columns, imaterial* const Material) { try { if(!Rows) throw std::runtime_error("Cannot create cylinder with zero rows."); if(Columns < 2) throw std::runtime_error("Cannot create cylinder with <2 columns."); if(Shell >= Polyhedron.shell_types.size()) throw std::runtime_error("Invalid shell."); const uint_t rows = Rows; const uint_t columns = Columns; const uint_t point_rows = rows + 1; const uint_t point_columns = columns; // Append points to the mesh (create the arrays if they don't already exist) ... mesh::points_t& points = Mesh.points ? Mesh.points.writable() : Mesh.points.create(); mesh::selection_t& point_selection = Mesh.point_selection ? Mesh.point_selection.writable() : Mesh.point_selection.create(); const uint_t point_offset = points.size(); points.insert(points.end(), point_rows * point_columns, point3()); point_selection.insert(point_selection.end(), point_rows * point_columns, 0); Mesh.point_attributes.set_row_count(points.size()); // Append faces to the polyhedron ... for(uint_t row = 0; row != rows; ++row) { for(uint_t column = 0; column != columns; ++column) { Polyhedron.face_shells.push_back(Shell); Polyhedron.face_first_loops.push_back(Polyhedron.loop_first_edges.size()); Polyhedron.face_loop_counts.push_back(1); Polyhedron.face_selections.push_back(0); Polyhedron.face_materials.push_back(Material); Polyhedron.loop_first_edges.push_back(Polyhedron.clockwise_edges.size()); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() - 3); Polyhedron.edge_selections.insert(Polyhedron.edge_selections.end(), 4, 0); Polyhedron.vertex_points.push_back(point_offset + ((row + 0) * point_columns) + (column + 0) % point_columns); Polyhedron.vertex_points.push_back(point_offset + ((row + 0) * point_columns) + (column + 1) % point_columns); Polyhedron.vertex_points.push_back(point_offset + ((row + 1) * point_columns) + (column + 1) % point_columns); Polyhedron.vertex_points.push_back(point_offset + ((row + 1) * point_columns) + (column + 0) % point_columns); Polyhedron.vertex_selections.insert(Polyhedron.vertex_selections.end(), 4, 0); } } } catch(std::exception& e) { log() << error << e.what() << std::endl; } } ///////////////////////////////////////////////////////////////////////////////////////////// // add_torus void add_torus(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t Rows, const uint_t Columns, imaterial* const Material) { try { if(Rows < 2) throw std::runtime_error("Cannot create torus with <2 rows."); if(Columns < 2) throw std::runtime_error("Cannot create torus with <2 columns."); if(Shell >= Polyhedron.shell_types.size()) throw std::runtime_error("Invalid shell."); const uint_t rows = Rows; const uint_t columns = Columns; const uint_t point_rows = rows; const uint_t point_columns = columns; // Append points to the mesh (create the arrays if they don't already exist) ... mesh::points_t& points = Mesh.points ? Mesh.points.writable() : Mesh.points.create(); mesh::selection_t& point_selection = Mesh.point_selection ? Mesh.point_selection.writable() : Mesh.point_selection.create(); const uint_t point_offset = points.size(); points.insert(points.end(), point_rows * point_columns, point3()); point_selection.insert(point_selection.end(), point_rows * point_columns, 0); Mesh.point_attributes.set_row_count(points.size()); // Append faces to the polyhedron ... for(uint_t row = 0; row != rows; ++row) { for(uint_t column = 0; column != columns; ++column) { Polyhedron.face_shells.push_back(Shell); Polyhedron.face_first_loops.push_back(Polyhedron.loop_first_edges.size()); Polyhedron.face_loop_counts.push_back(1); Polyhedron.face_selections.push_back(0); Polyhedron.face_materials.push_back(Material); Polyhedron.loop_first_edges.push_back(Polyhedron.clockwise_edges.size()); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() + 1); Polyhedron.clockwise_edges.push_back(Polyhedron.clockwise_edges.size() - 3); Polyhedron.edge_selections.insert(Polyhedron.edge_selections.end(), 4, 0); Polyhedron.vertex_points.push_back(point_offset + (((row + 0) % point_rows) * point_columns) + (column + 0) % point_columns); Polyhedron.vertex_points.push_back(point_offset + (((row + 0) % point_rows) * point_columns) + (column + 1) % point_columns); Polyhedron.vertex_points.push_back(point_offset + (((row + 1) % point_rows) * point_columns) + (column + 1) % point_columns); Polyhedron.vertex_points.push_back(point_offset + (((row + 1) % point_rows) * point_columns) + (column + 0) % point_columns); Polyhedron.vertex_selections.insert(Polyhedron.vertex_selections.end(), 4, 0); } } } catch(std::exception& e) { log() << error << e.what() << std::endl; } } ///////////////////////////////////////////////////////////////////////////////////////////// // is_triangles bool_t is_triangles(const const_primitive& Polyhedron) { const uint_t face_begin = 0; const uint_t face_end = face_begin + Polyhedron.face_first_loops.size(); for(uint_t face = face_begin; face != face_end; ++face) { uint_t edge_count = 0; const uint_t first_edge = Polyhedron.loop_first_edges[Polyhedron.face_first_loops[face]]; for(uint_t edge = first_edge; ; ) { ++edge_count; edge = Polyhedron.clockwise_edges[edge]; if(edge == first_edge) break; } if(edge_count != 3) return false; } return true; } ///////////////////////////////////////////////////////////////////////////////////////////// // is_solid bool_t is_solid(const const_primitive& Polyhedron) { // K-3D uses a split-edge data structure to represent polyhedra. // We test for solidity by counting the number of edges that // connect each pair of points in the polyhedron. A polyhedron is // solid if-and-only-if each pair of points is used by two edges. mesh::bools_t boundary_edges; mesh::indices_t adjacent_edges; create_edge_adjacency_lookup(Polyhedron.vertex_points, Polyhedron.clockwise_edges, boundary_edges, adjacent_edges); return std::find(boundary_edges.begin(), boundary_edges.end(), true) == boundary_edges.end(); } ///////////////////////////////////////////////////////////////////////////////////////////// // is_sds bool_t is_sds(const const_primitive& Polyhedron) { return Polyhedron.shell_types.size() && (Polyhedron.shell_types[0] == CATMULL_CLARK); } ////////////////////////////////////////////////////////////////////////////// // create_counterclockwise_edge_lookup void create_counterclockwise_edge_lookup(const const_primitive& Polyhedron, mesh::indices_t& CounterclockwiseEdges) { CounterclockwiseEdges.resize(Polyhedron.clockwise_edges.size()); const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + Polyhedron.clockwise_edges.size(); for(uint_t edge = edge_begin; edge != edge_end; ++edge) CounterclockwiseEdges[Polyhedron.clockwise_edges[edge]] = edge; } ////////////////////////////////////////////////////////////////////////////// // center const point3 center(const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const mesh::points_t& Points, const uint_t EdgeIndex) { point3 result(0, 0, 0); uint_t count = 0; for(uint_t edge = EdgeIndex; ; ) { result += to_vector(Points[VertexPoints[edge]]); ++count; edge = ClockwiseEdges[edge]; if(edge == EdgeIndex) break; } if(count) result /= static_cast(count); return result; } ////////////////////////////////////////////////////////////////////////////// // normal const normal3 normal(const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const mesh::points_t& Points, const uint_t EdgeIndex) { // Calculates the normal for an edge loop using the summation method, which is more robust than the three-point methods (handles zero-length edges) normal3 result(0, 0, 0); for(uint_t edge = EdgeIndex; ; ) { const point3& i = Points[VertexPoints[edge]]; const point3& j = Points[VertexPoints[ClockwiseEdges[edge]]]; result[0] += (i[1] + j[1]) * (j[2] - i[2]); result[1] += (i[2] + j[2]) * (j[0] - i[0]); result[2] += (i[0] + j[0]) * (j[1] - i[1]); edge = ClockwiseEdges[edge]; if(edge == EdgeIndex) break; } return 0.5 * result; } const normal3 normal(const point3& i, const point3& j, const point3& k) { normal3 result(0, 0, 0); result[0] += (i[1] + j[1]) * (j[2] - i[2]); result[1] += (i[2] + j[2]) * (j[0] - i[0]); result[2] += (i[0] + j[0]) * (j[1] - i[1]); result[0] += (j[1] + k[1]) * (k[2] - j[2]); result[1] += (j[2] + k[2]) * (k[0] - j[0]); result[2] += (j[0] + k[0]) * (k[1] - j[1]); result[0] += (k[1] + i[1]) * (i[2] - k[2]); result[1] += (k[2] + i[2]) * (i[0] - k[0]); result[2] += (k[0] + i[0]) * (i[1] - k[1]); return 0.5 * result; } void create_face_normal_lookup(const mesh& Mesh, const const_primitive& Polyhedron, mesh::normals_t& Normals) { Normals.resize(Polyhedron.face_first_loops.size(), normal3(0, 0, 0)); return_if_fail(Mesh.points); const mesh::points_t& points = *Mesh.points; const uint_t face_begin = 0; const uint_t face_end = face_begin + Polyhedron.face_first_loops.size(); for(uint_t face = face_begin; face != face_end; ++face) { for(uint_t edge = Polyhedron.loop_first_edges[Polyhedron.face_first_loops[face]]; ; ) { const point3& i = points[Polyhedron.vertex_points[edge]]; const point3& j = points[Polyhedron.vertex_points[Polyhedron.clockwise_edges[edge]]]; Normals[face][0] += 0.5 * (i[1] + j[1]) * (j[2] - i[2]); Normals[face][1] += 0.5 * (i[2] + j[2]) * (j[0] - i[0]); Normals[face][2] += 0.5 * (i[0] + j[0]) * (j[1] - i[1]); edge = Polyhedron.clockwise_edges[edge]; if(edge == Polyhedron.loop_first_edges[Polyhedron.face_first_loops[face]]) break; } } } namespace detail { ///////////////////////////////////////////////////////////////////////////////////////////// // find_companion_worker class find_companion_worker { public: find_companion_worker( const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const std::vector& PointEdges, mesh::bools_t& BoundaryEdges, mesh::indices_t& AdjacentEdges) : m_edge_points(VertexPoints), m_clockwise_edges(ClockwiseEdges), m_point_edges(PointEdges), m_boundary_edges(BoundaryEdges), m_adjacent_edges(AdjacentEdges) { } void operator()(const k3d::parallel::blocked_range& range) const { const uint_t edge_begin = range.begin(); const uint_t edge_end = range.end(); for(uint_t edge = edge_begin; edge != edge_end; ++edge) { const uint_t vertex1 = m_edge_points[edge]; const uint_t vertex2 = m_edge_points[m_clockwise_edges[edge]]; const mesh::indices_t& point_edges = m_point_edges[vertex2]; const uint_t first_index = 0; const uint_t last_index = point_edges.size(); m_adjacent_edges[edge] = edge; for(uint_t i = first_index; i != last_index; ++i) { const uint_t companion = point_edges[i]; if(m_edge_points[m_clockwise_edges[companion]] == vertex1) { m_boundary_edges[edge] = false; m_adjacent_edges[edge] = companion; break; } } } } private: const mesh::indices_t& m_edge_points; const mesh::indices_t& m_clockwise_edges; const std::vector& m_point_edges; mesh::bools_t& m_boundary_edges; mesh::indices_t& m_adjacent_edges; }; /// Returns true if a and b are collinear, up to the give threshold /** * The surfaces of the parallelogram formed by the projections of a and b in the * XY, XZ and YZ plane all need to be < Threshold for the points to be collinear */ const bool_t is_collinear(const vector3& a, const vector3& b, const double_t Threshold) { if(std::abs(a[0]*b[1] - a[1]*b[0]) > Threshold) return false; if(std::abs(a[0]*b[2] - a[2]*b[0]) > Threshold) return false; if(std::abs(a[1]*b[2] - a[2]*b[1]) > Threshold) return false; return true; } /////////////////////////////////////////////////// // create_triangles (taken from the triangulate_faces plugin, put here for sharing with CGAL module. class create_triangles : public triangulator { typedef triangulator base; public: mesh::primitive* process(const mesh& Input, const const_primitive& Polyhedron, mesh& Output) { // Allocate new data structures for our output ... input_polyhedron = &Polyhedron; mesh::primitive* const result = new mesh::primitive(); output_polyhedron.reset(create(*result)); output_points = &Output.points.create(new mesh::points_t(*Input.points)); output_point_selection = &Output.point_selection.create(new mesh::selection_t(Input.points->size(), 0.0)); // Setup copying of attribute arrays ... output_polyhedron->constant_attributes = input_polyhedron->constant_attributes; output_polyhedron->face_attributes = input_polyhedron->face_attributes.clone_types(); face_attributes_copier.reset(new table_copier(input_polyhedron->face_attributes, output_polyhedron->face_attributes)); output_polyhedron->edge_attributes = input_polyhedron->edge_attributes.clone_types(); edge_attributes_copier.reset(new table_copier(input_polyhedron->edge_attributes, output_polyhedron->edge_attributes)); output_polyhedron->vertex_attributes = input_polyhedron->vertex_attributes.clone_types(); vertex_attributes_copier.reset(new table_copier(input_polyhedron->vertex_attributes, output_polyhedron->vertex_attributes)); Output.point_attributes = Input.point_attributes.clone(); point_attributes_copier.reset(new table_copier(Input.point_attributes, Output.point_attributes)); // Create the output polyhedron ... const uint_t face_begin = 0; const uint_t face_end = face_begin + Polyhedron.face_first_loops.size(); for(uint_t face = face_begin; face != face_end; ++face) { if(Polyhedron.face_selections[face]) { base::process( *Input.points, Polyhedron.face_first_loops, Polyhedron.face_loop_counts, Polyhedron.loop_first_edges, Polyhedron.vertex_points, Polyhedron.clockwise_edges, face); } else { add_existing_face(face); } } output_polyhedron->shell_types.assign(input_polyhedron->shell_types.size(), POLYGONS); return result; } private: void start_face(const uint_t Face) { current_face = Face; } void add_vertex(const point3& Coordinates, uint_t Vertices[4], uint_t Edges[4], double Weights[4], uint_t& NewVertex) { NewVertex = output_points->size(); output_points->push_back(Coordinates); output_point_selection->push_back(0.0); point_attributes_copier->push_back(4, Vertices, Weights); new_edge_attributes[NewVertex] = new_edge_record(Edges, Weights); } void add_triangle(uint_t Vertices[3], uint_t Edges[3]) { output_polyhedron->face_shells.push_back(input_polyhedron->face_shells[current_face]); output_polyhedron->face_first_loops.push_back(output_polyhedron->loop_first_edges.size()); output_polyhedron->face_loop_counts.push_back(1); output_polyhedron->face_selections.push_back(1.0); output_polyhedron->face_materials.push_back(input_polyhedron->face_materials[current_face]); face_attributes_copier->push_back(current_face); output_polyhedron->loop_first_edges.push_back(output_polyhedron->clockwise_edges.size()); output_polyhedron->vertex_points.push_back(Vertices[0]); output_polyhedron->vertex_points.push_back(Vertices[1]); output_polyhedron->vertex_points.push_back(Vertices[2]); output_polyhedron->vertex_selections.push_back(0.0); output_polyhedron->vertex_selections.push_back(0.0); output_polyhedron->vertex_selections.push_back(0.0); output_polyhedron->clockwise_edges.push_back(output_polyhedron->vertex_points.size() - 2); output_polyhedron->clockwise_edges.push_back(output_polyhedron->vertex_points.size() - 1); output_polyhedron->clockwise_edges.push_back(output_polyhedron->vertex_points.size() - 3); output_polyhedron->edge_selections.push_back(0.0); output_polyhedron->edge_selections.push_back(0.0); output_polyhedron->edge_selections.push_back(0.0); for(uint_t i = 0; i != 3; ++i) { if(new_edge_attributes.count(Vertices[i])) { edge_attributes_copier->push_back(4, new_edge_attributes[Vertices[i]].edges, new_edge_attributes[Vertices[i]].weights); vertex_attributes_copier->push_back(4, new_edge_attributes[Vertices[i]].edges, new_edge_attributes[Vertices[i]].weights); } else { edge_attributes_copier->push_back(Edges[i]); vertex_attributes_copier->push_back(Edges[i]); } } } void add_existing_face(const uint_t Face) { output_polyhedron->face_shells.push_back(input_polyhedron->face_shells[Face]); output_polyhedron->face_first_loops.push_back(output_polyhedron->loop_first_edges.size()); output_polyhedron->face_loop_counts.push_back(input_polyhedron->face_loop_counts[Face]); output_polyhedron->face_selections.push_back(0.0); output_polyhedron->face_materials.push_back(input_polyhedron->face_materials[Face]); face_attributes_copier->push_back(Face); const uint_t loop_begin = input_polyhedron->face_first_loops[Face]; const uint_t loop_end = loop_begin + input_polyhedron->face_loop_counts[Face]; for(uint_t loop = loop_begin; loop != loop_end; ++loop) { output_polyhedron->loop_first_edges.push_back(output_polyhedron->vertex_points.size()); const uint_t first_edge = input_polyhedron->loop_first_edges[loop]; const uint_t edge_offset = output_polyhedron->vertex_points.size() - first_edge; for(uint_t edge = first_edge; ;) { output_polyhedron->vertex_points.push_back(input_polyhedron->vertex_points[edge]); output_polyhedron->vertex_selections.push_back(0.0); output_polyhedron->clockwise_edges.push_back(input_polyhedron->clockwise_edges[edge] + edge_offset); output_polyhedron->edge_selections.push_back(0.0); edge_attributes_copier->push_back(edge); vertex_attributes_copier->push_back(edge); edge = input_polyhedron->clockwise_edges[edge]; if(edge == first_edge) break; } } } const const_primitive* input_polyhedron; mesh::points_t* output_points; mesh::selection_t* output_point_selection; boost::scoped_ptr output_polyhedron; boost::shared_ptr face_attributes_copier; boost::shared_ptr edge_attributes_copier; boost::shared_ptr vertex_attributes_copier; boost::shared_ptr point_attributes_copier; uint_t current_face; struct new_edge_record { new_edge_record() { } new_edge_record(uint_t Edges[4], double_t Weights[4]) { std::copy(Edges, Edges + 4, edges); std::copy(Weights, Weights + 4, weights); } uint_t edges[4]; double_t weights[4]; }; std::map new_edge_attributes; }; } // namespace detail ///////////////////////////////////////////////////////////////////////////////////////////// // create_edge_adjacency_lookup void create_point_out_edge_lookup(const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, std::vector& AdjacencyList) { const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + ClockwiseEdges.size(); for(uint_t edge = edge_begin; edge != edge_end; ++edge) { AdjacencyList[VertexPoints[edge]].push_back(edge); } } void create_edge_adjacency_lookup(const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, mesh::bools_t& BoundaryEdges, mesh::indices_t& AdjacentEdges) { const k3d::uint_t count = VertexPoints.empty() ? 0 : *std::max_element(VertexPoints.begin(), VertexPoints.end()) + 1; if(!count) return; std::vector point_edges(count); create_point_out_edge_lookup(VertexPoints, ClockwiseEdges, point_edges); BoundaryEdges.assign(VertexPoints.size(), true); AdjacentEdges.assign(VertexPoints.size(), 0); const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + VertexPoints.size(); // Making this parallel decreases running time by 20 % on a Pentium D. k3d::parallel::parallel_for( k3d::parallel::blocked_range(edge_begin, edge_end, k3d::parallel::grain_size()), detail::find_companion_worker(VertexPoints, ClockwiseEdges, point_edges, BoundaryEdges, AdjacentEdges)); } ///////////////////////////////////////////////////////////////////////////////////////////// // create_edge_face_lookup void create_edge_face_lookup(const const_primitive& Polyhedron, mesh::indices_t& EdgeFaces) { EdgeFaces.assign(Polyhedron.clockwise_edges.size(), 0); const uint_t face_begin = 0; const uint_t face_end = face_begin + Polyhedron.face_first_loops.size(); for(uint_t face = face_begin; face != face_end; ++face) { const uint_t loop_begin = Polyhedron.face_first_loops[face]; const uint_t loop_end = loop_begin + Polyhedron.face_loop_counts[face]; for(uint_t loop = loop_begin; loop != loop_end; ++loop) { const uint_t first_edge = Polyhedron.loop_first_edges[loop]; for(uint_t edge = first_edge; ;) { EdgeFaces[edge] = face; edge = Polyhedron.clockwise_edges[edge]; if(edge == first_edge) break; } } } } void create_loop_edge_count_lookup(const const_primitive& Polyhedron, mesh::counts_t& LoopEdgeCounts) { LoopEdgeCounts.assign(Polyhedron.loop_first_edges.size(), 0); const uint_t loop_begin = 0; const uint_t loop_end = loop_begin + Polyhedron.loop_first_edges.size(); for(uint_t loop = loop_begin; loop != loop_end; ++loop) { const uint_t first_edge = Polyhedron.loop_first_edges[loop]; for(uint_t edge = first_edge; ;) { ++LoopEdgeCounts[loop]; edge = Polyhedron.clockwise_edges[edge]; if(edge == first_edge) break; } } } ///////////////////////////////////////////////////////////////////////////////////////////// // create_point_face_lookup void create_point_face_lookup(const mesh::indices_t& FaceFirstLoops, const mesh::indices_t& FaceLoopCounts, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const mesh::points_t& Points, mesh::indices_t& PointFirstFaces, mesh::counts_t& PointFaceCounts, mesh::indices_t& PointFaces) { log() << warning << k3d_file_reference << " is deprecated" << std::endl; std::vector > adjacency_list(Points.size()); const uint_t face_begin = 0; const uint_t face_end = face_begin + FaceFirstLoops.size(); for(uint_t face = face_begin; face != face_end; ++face) { const uint_t loop_begin = FaceFirstLoops[face]; const uint_t loop_end = loop_begin + FaceLoopCounts[face]; for(uint_t loop = loop_begin; loop != loop_end; ++loop) { const uint_t first_edge = LoopFirstEdges[loop]; for(uint_t edge = first_edge; ;) { adjacency_list[VertexPoints[edge]].push_back(face); edge = ClockwiseEdges[edge]; if(edge == first_edge) break; } } } PointFirstFaces.assign(Points.size(), 0); PointFaceCounts.assign(Points.size(), 0); PointFaces.clear(); const uint_t point_begin = 0; const uint_t point_end = point_begin + Points.size(); for(uint_t point = point_begin; point != point_end; ++point) { PointFirstFaces[point] = PointFaces.size(); PointFaceCounts[point] = adjacency_list[point].size(); PointFaces.insert(PointFaces.end(), adjacency_list[point].begin(), adjacency_list[point].end()); } } void create_point_face_lookup(const mesh& Mesh, const const_primitive& Polyhedron, std::vector& AdjacencyList) { AdjacencyList.resize(Mesh.points->size()); const uint_t face_begin = 0; const uint_t face_end = face_begin + Polyhedron.face_shells.size(); for(uint_t face = face_begin; face != face_end; ++face) { const uint_t loop_begin = Polyhedron.face_first_loops[face]; const uint_t loop_end = loop_begin + Polyhedron.face_loop_counts[face]; for(uint_t loop = loop_begin; loop != loop_end; ++loop) { const uint_t first_edge = Polyhedron.loop_first_edges[loop]; for(uint_t edge = first_edge; ;) { AdjacencyList[Polyhedron.vertex_points[edge]].push_back(face); edge = Polyhedron.clockwise_edges[edge]; if(edge == first_edge) break; } } } } ///////////////////////////////////////////////////////////////////////////////////////////// // create_point_out_edge_lookup void create_point_out_edge_lookup(const mesh& Mesh, const const_primitive& Polyhedron, std::vector& AdjacencyList) { AdjacencyList.resize(Mesh.points->size()); create_point_out_edge_lookup(Polyhedron.vertex_points, Polyhedron.clockwise_edges, AdjacencyList); } ///////////////////////////////////////////////////////////////////////////////////////////// // create_point_in_edge_lookup void create_point_in_edge_lookup(const mesh& Mesh, const const_primitive& Polyhedron, std::vector& AdjacencyList) { AdjacencyList.resize(Mesh.points->size()); const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + Polyhedron.clockwise_edges.size(); for(uint_t edge = edge_begin; edge != edge_end; ++edge) { AdjacencyList[Polyhedron.vertex_points[Polyhedron.clockwise_edges[edge]]].push_back(edge); } } ///////////////////////////////////////////////////////////////////////////////////////////// // create_point_edge_lookup void create_point_edge_lookup(const mesh& Mesh, const const_primitive& Polyhedron, std::vector& AdjacencyList) { AdjacencyList.resize(Mesh.points->size()); const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + Polyhedron.clockwise_edges.size(); for(uint_t edge = edge_begin; edge != edge_end; ++edge) { AdjacencyList[Polyhedron.vertex_points[edge]].push_back(edge); AdjacencyList[Polyhedron.vertex_points[Polyhedron.clockwise_edges[edge]]].push_back(edge); } } ///////////////////////////////////////////////////////////////////////////////////////////// // create_point_edge_lookup void create_point_edge_lookup(const mesh::indices_t& VertexPoints, mesh::indices_t& PointEdges, mesh::indices_t& PointFirstEdges, mesh::counts_t& PointEdgeCounts) { log() << warning << k3d_file_reference << " is deprecated" << std::endl; if(PointEdgeCounts.empty()) create_point_valence_lookup(0, VertexPoints, PointEdgeCounts); const uint_t point_count = PointEdgeCounts.size(); mesh::counts_t found_edges(point_count, 0); PointFirstEdges.assign(point_count, 0); // first edge in point_edges for each point PointEdges.assign(VertexPoints.size(), 0); uint_t count = 0; for(uint_t point = 0; point != point_count; ++point) { PointFirstEdges[point] = count; count += PointEdgeCounts[point]; } const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + VertexPoints.size(); for(uint_t edge = edge_begin; edge != edge_end; ++edge) { const uint_t point = VertexPoints[edge]; PointEdges[PointFirstEdges[point] + found_edges[point]] = edge; ++found_edges[point]; } } ///////////////////////////////////////////////////////////////////////////////////////////// // create_point_valence_lookup void create_point_valence_lookup(const uint_t PointCount, const mesh::indices_t& VertexPoints, mesh::counts_t& Valences) { log() << warning << k3d_file_reference << " is deprecated" << std::endl; Valences.assign(PointCount, 0); // Add 1 for each edge that starts at a point uint_t edge_count = VertexPoints.size(); for (uint_t edge = 0; edge != edge_count; ++edge) { const uint_t edge_point = VertexPoints[edge]; if(edge_point >= Valences.size()) // In case PointCount was not known to the caller Valences.resize(edge_point + 1, 0); ++Valences[edge_point]; } } ///////////////////////////////////////////////////////////////////////////////////////////// // create_boundary_face_lookup void create_boundary_face_lookup(const mesh::indices_t& FaceFirstLoops, const mesh::indices_t& FaceLoopCounts, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& ClockwiseEdges, const mesh::bools_t& BoundaryEdges, const mesh::indices_t& AdjacentEdges, mesh::bools_t& BoundaryFaces) { BoundaryFaces.clear(); BoundaryFaces.resize(FaceFirstLoops.size()); const uint_t face_begin = 0; const uint_t face_end = face_begin + FaceFirstLoops.size(); for(uint_t face = face_begin; face != face_end; ++face) { const uint_t loop_begin = FaceFirstLoops[face]; const uint_t loop_end = loop_begin + FaceLoopCounts[face]; for(uint_t loop = loop_begin; loop != loop_end; ++loop) { const uint_t first_edge = LoopFirstEdges[loop]; for(uint_t edge = first_edge; ;) { if (BoundaryEdges[edge]) { BoundaryFaces[face] = true; break; } edge = ClockwiseEdges[edge]; if(edge == first_edge) break; } } } } ///////////////////////////////////////////////////////////////////////////////////////////// // mark_collinear_edges void mark_collinear_edges(mesh::indices_t& RedundantEdges, const mesh::selection_t& EdgeSelection, const mesh::points_t& Points, const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const mesh::counts_t& VertexValences, const mesh::bools_t& BoundaryEdges, const mesh::indices_t& AdjacentEdges, const double_t Threshold) { for(uint_t edge = 0; edge != VertexPoints.size(); ++edge) { if(!EdgeSelection[edge]) continue; const uint_t clockwise = ClockwiseEdges[edge]; const uint_t p1_index = VertexPoints[edge]; const uint_t p2_index = VertexPoints[clockwise]; const uint_t p3_index = VertexPoints[ClockwiseEdges[clockwise]]; // valence must be 2 for internal edges or 1 for boundary edges if(!((!BoundaryEdges[clockwise] && VertexValences[p2_index] == 2) || (BoundaryEdges[clockwise] && VertexValences[p2_index] == 1))) continue; const point3& p1 = Points[p1_index]; const point3& p2 = Points[p2_index]; const point3& p3 = Points[p3_index]; if(detail::is_collinear(p1-p2, p1-p3, Threshold)) { RedundantEdges.push_back(clockwise); } } } void mark_coplanar_edges(const mesh::indices_t& Companions, const mesh::bools_t& BoundaryEdges, const mesh::normals_t& Normals, const mesh::indices_t& EdgeFaces, const mesh::selection_t& FaceSelection, mesh::indices_t& RedundantEdges, const double_t Threshold) { for(uint_t edge = 0; edge != Companions.size(); ++edge) { if(BoundaryEdges[edge]) continue; const uint_t face = EdgeFaces[edge]; if(!FaceSelection[face]) continue; const uint_t companion = Companions[edge]; const uint_t companion_face = EdgeFaces[companion]; if(!FaceSelection[companion_face]) continue; if((!Normals[face].length()) || (std::abs((Normals[face] * Normals[companion_face]) - 1) < Threshold)) RedundantEdges.push_back(edge); } } //////////////////////////////////////////// // triangulate mesh::primitive* triangulate(const mesh& Input, const const_primitive& Polyhedron, mesh& Output) { return detail::create_triangles().process(Input, Polyhedron, Output); } //////////////////////////////////////////// // delete_components void delete_components(const mesh& Mesh, primitive& Polyhedron, const mesh::bools_t& RemovePoints, mesh::bools_t& RemoveEdges, mesh::bools_t& RemoveLoops, mesh::bools_t& RemoveFaces) { // Sanity checks ... return_if_fail(RemovePoints.size() == Mesh.points->size()); return_if_fail(RemoveEdges.size() == Polyhedron.clockwise_edges.size()); return_if_fail(RemoveLoops.size() == Polyhedron.loop_first_edges.size()); return_if_fail(RemoveFaces.size() == Polyhedron.face_shells.size()); // Cache some useful stuff up-front ... const uint_t face_begin = 0; const uint_t face_end = face_begin + Polyhedron.face_shells.size(); const uint_t edge_begin = 0; const uint_t edge_end = edge_begin + Polyhedron.clockwise_edges.size(); const uint_t loop_begin = 0; const uint_t loop_end = loop_begin + Polyhedron.loop_first_edges.size(); // Mark edges to be implicitly removed because their points are going away ... for(uint_t edge = edge_begin; edge != edge_end; ++edge) { if(!RemovePoints[Polyhedron.vertex_points[edge]]) continue; RemoveEdges[edge] = true; } // Mark loops to be implicitly removed because they have fewer than three edges remaining ... for(uint_t loop = loop_begin; loop != loop_end; ++loop) { const uint_t first_edge = Polyhedron.loop_first_edges[loop]; uint_t remaining_edge_count = 0; for(uint_t edge = first_edge; ;) { if(!RemoveEdges[edge]) ++remaining_edge_count; edge = Polyhedron.clockwise_edges[edge]; if(edge == first_edge) break; } if(remaining_edge_count < 3) RemoveLoops[loop] = true; } // Mark faces to be implicitly removed because their first loop is going away ... for(uint_t face = face_begin; face != face_end; ++face) { if(RemoveFaces[face]) continue; if(RemoveLoops[Polyhedron.face_first_loops[face]]) RemoveFaces[face] = true; } // Mark loops and edges to be implicitly removed because their face is going away ... for(uint_t face = face_begin; face != face_end; ++face) { if(!RemoveFaces[face]) continue; const uint_t loop_begin = Polyhedron.face_first_loops[face]; const uint_t loop_end = loop_begin + Polyhedron.face_loop_counts[face]; for(uint_t loop = loop_begin; loop != loop_end; ++loop) { RemoveLoops[loop] = true; const uint_t first_edge = Polyhedron.loop_first_edges[loop]; for(uint_t edge = first_edge; ;) { RemoveEdges[edge] = true; edge = Polyhedron.clockwise_edges[edge]; if(edge == first_edge) break; } } } // Compute new first edges for loops ... mesh::indices_t new_first_edge(Polyhedron.loop_first_edges.size()); for(uint_t loop = loop_begin; loop != loop_end; ++loop) { if(RemoveLoops[loop]) continue; const uint_t first_edge = Polyhedron.loop_first_edges[loop]; for(uint_t edge = first_edge; ;) { if(!RemoveEdges[edge]) { new_first_edge[loop] = edge; break; } edge = Polyhedron.clockwise_edges[edge]; if(edge == first_edge) break; } } // Compute new clockwise_edges ... mesh::indices_t new_clockwise_edge(Polyhedron.clockwise_edges.size()); for(uint_t loop = loop_begin; loop != loop_end; ++loop) { if(RemoveLoops[loop]) continue; const uint_t first_edge = Polyhedron.loop_first_edges[loop]; mesh::indices_t remaining_edges; for(uint_t edge = first_edge; ;) { if(!RemoveEdges[edge]) remaining_edges.push_back(edge); edge = Polyhedron.clockwise_edges[edge]; if(edge == first_edge) break; } for(uint_t e = 0; e != remaining_edges.size(); ++e) { new_clockwise_edge[remaining_edges[e]] = remaining_edges[(e+1)%remaining_edges.size()]; } } // Compute maps and remaining component counts ... mesh::indices_t face_map; mesh::create_index_removal_map(RemoveFaces, face_map); const uint_t remaining_faces = std::count(RemoveFaces.begin(), RemoveFaces.end(), false); mesh::indices_t loop_map; mesh::create_index_removal_map(RemoveLoops, loop_map); const uint_t remaining_loops = std::count(RemoveLoops.begin(), RemoveLoops.end(), false); mesh::indices_t edge_map; mesh::create_index_removal_map(RemoveEdges, edge_map); const uint_t remaining_edges = std::count(RemoveEdges.begin(), RemoveEdges.end(), false); // Delete faces, updating loop indices as we go ... for(uint_t face = face_begin; face != face_end; ++face) { if(RemoveFaces[face]) continue; Polyhedron.face_shells[face_map[face]] = Polyhedron.face_shells[face]; Polyhedron.face_first_loops[face_map[face]] = loop_map[Polyhedron.face_first_loops[face]]; Polyhedron.face_loop_counts[face_map[face]] = Polyhedron.face_loop_counts[face]; Polyhedron.face_selections[face_map[face]] = Polyhedron.face_selections[face]; Polyhedron.face_materials[face_map[face]] = Polyhedron.face_materials[face]; } Polyhedron.face_shells.resize(remaining_faces); Polyhedron.face_first_loops.resize(remaining_faces); Polyhedron.face_loop_counts.resize(remaining_faces); Polyhedron.face_selections.resize(remaining_faces); Polyhedron.face_materials.resize(remaining_faces); // Delete face attributes ... table_copier face_attribute_copier(Polyhedron.face_attributes); for(uint_t face = face_begin; face != face_end; ++face) { if(RemoveFaces[face]) continue; face_attribute_copier.copy(face, face_map[face]); } Polyhedron.face_attributes.set_row_count(remaining_faces); // Delete loops, updating edge indices as we go ... for(uint_t loop = loop_begin; loop != loop_end; ++loop) { if(RemoveLoops[loop]) continue; Polyhedron.loop_first_edges[loop_map[loop]] = edge_map[new_first_edge[loop]]; } Polyhedron.loop_first_edges.resize(remaining_loops); // Delete edges, updating edge indices as we go ... for(uint_t edge = edge_begin; edge != edge_end; ++edge) { if(RemoveEdges[edge]) continue; Polyhedron.clockwise_edges[edge_map[edge]] = edge_map[new_clockwise_edge[edge]]; Polyhedron.edge_selections[edge_map[edge]] = Polyhedron.edge_selections[edge]; Polyhedron.vertex_points[edge_map[edge]] = Polyhedron.vertex_points[edge]; Polyhedron.vertex_selections[edge_map[edge]] = Polyhedron.vertex_selections[edge]; } Polyhedron.clockwise_edges.resize(remaining_edges); Polyhedron.edge_selections.resize(remaining_edges); Polyhedron.vertex_points.resize(remaining_edges); Polyhedron.vertex_selections.resize(remaining_edges); // Delete edge attributes ... table_copier edge_attribute_copier(Polyhedron.edge_attributes); for(uint_t edge = edge_begin; edge != edge_end; ++edge) { if(RemoveEdges[edge]) continue; edge_attribute_copier.copy(edge, edge_map[edge]); } Polyhedron.edge_attributes.set_row_count(remaining_edges); // Delete vertex attributes ... table_copier vertex_attribute_copier(Polyhedron.vertex_attributes); for(uint_t edge = edge_begin; edge != edge_end; ++edge) { if(RemoveEdges[edge]) continue; vertex_attribute_copier.copy(edge, edge_map[edge]); } Polyhedron.vertex_attributes.set_row_count(remaining_edges); } } // namespace polyhedron } // namespace k3d ================================================ FILE: k3dsdk/polyhedron.h ================================================ #ifndef K3DSDK_POLYHEDRON_H #define K3DSDK_POLYHEDRON_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) \author Bart Janssens (bart.janssens@lid.kviv.be) */ #include namespace k3d { namespace polyhedron { /// Defines allowable polyhedron types enum polyhedron_type { POLYGONS = 0, CATMULL_CLARK = 1, }; class primitive; /// Gathers the member arrays of a polyhedron primitive into a convenient package class const_primitive { public: const_primitive( const typed_array& ShellTypes, const mesh::indices_t& FaceShells, const mesh::indices_t& FaceFirstLoops, const mesh::counts_t& FaceLoopCounts, const mesh::selection_t& FaceSelections, const mesh::materials_t& FaceMaterials, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& ClockwiseEdges, const mesh::selection_t& EdgeSelections, const mesh::indices_t& VertexPoints, const mesh::selection_t& VertexSelections, const mesh::table_t& ConstantAttributes, const mesh::table_t& FaceAttributes, const mesh::table_t& EdgeAttributes, const mesh::table_t& VertexAttributes ); /// Implicit conversion const_primitive(const primitive& Primitive); const typed_array& shell_types; const mesh::indices_t& face_shells; const mesh::indices_t& face_first_loops; const mesh::counts_t& face_loop_counts; const mesh::selection_t& face_selections; const mesh::materials_t& face_materials; const mesh::indices_t& loop_first_edges; const mesh::indices_t& clockwise_edges; const mesh::selection_t& edge_selections; const mesh::indices_t& vertex_points; const mesh::selection_t& vertex_selections; const mesh::table_t& constant_attributes; const mesh::table_t& face_attributes; const mesh::table_t& edge_attributes; const mesh::table_t& vertex_attributes; }; /// Gathers the member arrays of a polyhedron primitive into a convenient package class primitive { public: primitive( typed_array& ShellTypes, mesh::indices_t& FaceShells, mesh::indices_t& FaceFirstLoops, mesh::counts_t& FaceLoopCounts, mesh::selection_t& FaceSelections, mesh::materials_t& FaceMaterials, mesh::indices_t& LoopFirstEdges, mesh::indices_t& ClockwiseEdges, mesh::selection_t& EdgeSelections, mesh::indices_t& VertexPoints, mesh::selection_t& VertexSelections, mesh::table_t& ConstantAttributes, mesh::table_t& FaceAttributes, mesh::table_t& EdgeAttributes, mesh::table_t& VertexAttributes ); typed_array& shell_types; mesh::indices_t& face_shells; mesh::indices_t& face_first_loops; mesh::counts_t& face_loop_counts; mesh::selection_t& face_selections; mesh::materials_t& face_materials; mesh::indices_t& loop_first_edges; mesh::indices_t& clockwise_edges; mesh::selection_t& edge_selections; mesh::indices_t& vertex_points; mesh::selection_t& vertex_selections; mesh::table_t& constant_attributes; mesh::table_t& face_attributes; mesh::table_t& edge_attributes; mesh::table_t& vertex_attributes; }; /// Creates a new polyhedron mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh::primitive& GenericPrimitive); /// Creates a new polyhedron mesh primitive, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh); /// Creates a new polyhedron mesh primitive from a list of vertices and face indices, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh, const mesh::points_t& Vertices, const mesh::counts_t& VertexCounts, const mesh::indices_t& VertexIndices, imaterial* const Material); /// Creates a new polyhedron mesh primitive from a list of vertices, texture coordinates, and face indices, returning references to its member arrays. /// The caller is responsible for the lifetime of the returned object. primitive* create(mesh& Mesh, const mesh::points_t& Vertices, const mesh::counts_t& VertexCounts, const mesh::indices_t& VertexIndices, const mesh::texture_coordinates_t& TextureCoordinates, imaterial* const Material); /// Tests the given mesh primitive to see if it is a valid polyhedron, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. const_primitive* validate(const mesh& Mesh, const mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid polyhedron, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, mesh::primitive& GenericPrimitive); /// Tests the given mesh primitive to see if it is a valid polyhedron, returning references to its member arrays, or NULL. /// The caller is responsible for the lifetime of the returned object. primitive* validate(const mesh& Mesh, pipeline_data& GenericPrimitive); /// Adds a triangle to an existing polyhedron shell. Preconditions: the polyhedron must already contain at least one shell. void add_triangle(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t V1, const uint_t V2, const uint_t V3, imaterial* const Material); /// Adds a quadrilateral to an existing polyhedron shell. Preconditions: the polyhedron must already contain at least one shell. void add_quadrilateral(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t V1, const uint_t V2, const uint_t V3, const uint_t V4, imaterial* const Material); /// Adds a face to an existing polyhedron shell. Preconditions: the polyhedron must already contain at least one shell. void add_face(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const mesh::points_t& Vertices, imaterial* const Material); /// Adds a face with holes to an existing polyhedron shell. Preconditions: the polyhedron must already contain at least one shell. void add_face(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const mesh::points_t& Vertices, const std::vector& Holes, imaterial* const Material); /// Adds a set of points and faces that form a topological "grid" with the given number of rows and columns to an existing polyhedron. /// The geometry (vertex coordinates) of the grid is undefined, and must be set by the caller after add_grid() returns. /// Preconditions: the polyhedron must contain at last one shell. Postconditions: the polyhedron contains Rows x Columns new faces and /// Rows x Columns x 4 new half edges, and the mesh contains (Rows + 1) x (Columns + 1) new points. void add_grid(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t Rows, const uint_t Columns, imaterial* const Material); /// Adds a set of points and faces that form a topological "cylinder" with the given number of rows and columns to an existing polyhedron. /// The geometry (vertex coordinates) of the cylinder is undefined, and must be set by the caller after add_cylinder() returns. /// Note that many surfaces-of-revolution can be represented as topological cylinders, including disks, cones, cylinders, /// hyperboloids, paraboloids, and spheres. /// Preconditions: the polyhedron must contain at least one shell. Postconditions: the polyhedron contains Rows x Columns new faces and /// Rows x Columns x 4 new half edges, and the mesh contains (Rows + 1) x Columns new points. void add_cylinder(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t Rows, const uint_t Columns, imaterial* const Material); /// Adds a set of points and faces that form a topological "torus" with the given number of rows and columns to an existing polyhedron. /// The geometry (vertex coordinates) of the torus is undefined, and must be set by the caller after add_torus() returns. /// Preconditions: the polyhedron must contain at least one shell. Postconditions: the polyhedron contains Rows x Columns new faces and /// Rows x Columns x 4 new half edges, and the mesh contains Rows x Columns new points. void add_torus(mesh& Mesh, primitive& Polyhedron, const uint_t Shell, const uint_t Rows, const uint_t Columns, imaterial* const Material); /// Returns true iff every face in the given polyhedron is a triangle. bool_t is_triangles(const const_primitive& Polyhedron); /// Returns true iff the given polyhedron is a solid (i.e. it has no topological holes). bool_t is_solid(const const_primitive& Polyhedron); /// Returns true iff the given polyhedron should be rendered as a Subdivision surface /** \note The implementation looks at the flags set on the first (outer) shell. We should consider whether SDS should be set on a per-shell basis? */ bool_t is_sds(const const_primitive& Polyhedron); /// Initializes arrays for constant-time lookup of counterclockwise edges. void create_counterclockwise_edge_lookup(const const_primitive& Polyhedron, mesh::indices_t& CounterclockwiseEdges); /// Calculates the center (average) for an edge loop (returns the origin for degenerate cases). const point3 center(const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const mesh::points_t& Points, const uint_t EdgeIndex); /// Calculates the normal for an edge loop (returns a zero-length normal for degenerate cases). const normal3 normal(const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const mesh::points_t& Points, const uint_t EdgeIndex); /// Calculates the normal for a triangle (returns a zero-length normal for degenerate cases). const normal3 normal(const point3& A, const point3& B, const point3& C); /// Initializes arrays for constant-time lookup from faces to normal vectors. void create_face_normal_lookup(const mesh& Mesh, const const_primitive& Polyhedron, mesh::normals_t& Normals); /// Initializes arrays for constant-time lookup from an edge to the adjacent edge (if any) void create_edge_adjacency_lookup(const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, mesh::bools_t& BoundaryEdges, mesh::indices_t& AdjacentEdges); /// Initializes an array for constant-time lookup from an edge to the face that owns it void create_edge_face_lookup(const const_primitive& Polyhedron, mesh::indices_t& EdgeFaces); /// Initializes an array for constant-time lookup from loops to edge counts void create_loop_edge_count_lookup(const const_primitive& Polyhedron, mesh::counts_t& LoopEdgeCounts); /// Initialize arrays for fast lookup from a vertex to its adjacent faces /** \deprecated Use the adjacency-list version of create_point_face_lookup() instead */ void create_point_face_lookup(const mesh::indices_t& FaceFirstLoops, const mesh::indices_t& FaceLoopCounts, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const mesh::points_t& Points, mesh::indices_t& PointFirstFaces, mesh::counts_t& PointFaceCounts, mesh::indices_t& PointFaces); /// Creates an adjacency list for fast lookup from a vertex to its adjacent faces. void create_point_face_lookup(const mesh& Mesh, const const_primitive& Polyhedron, std::vector& AdjacencyList); /// Creates an adjacency list for fast lookup from a vertex to its out-edges. void create_point_out_edge_lookup(const mesh& Mesh, const const_primitive& Polyhedron, std::vector& AdjacencyList); /// Creates an adjacency list for fast lookup from a vertex to its in-edges. void create_point_in_edge_lookup(const mesh& Mesh, const const_primitive& Polyhedron, std::vector& AdjacencyList); /// Creates an adjacency list for fast lookup from a vertex to its incident (in- or out-) edges. void create_point_edge_lookup(const mesh& Mesh, const const_primitive& Polyhedron, std::vector& AdjacencyList); /// Initialize arrays for fast lookup from a point index to all edges that start from it. If PointEdgeCounts is filled (by create_vertex_valence_lookup) it is used, otherwise it is created /** \deprecated Use create_point_out_edge_lookup() instead */ void create_point_edge_lookup(const mesh::indices_t& VertexPoints, mesh::indices_t& PointEdges, mesh::indices_t& PointFirstEdges, mesh::counts_t& PointEdgeCounts); /// Initialize Valences array for constant time lookup of vertex valence (number of incoming edges) /** * \param PointCount Initial guess for the number of points. Valences will be expanded to the correct size if this is too small * \param VertexPoints The indices of the edge points * \param Valences will store the number of edges for each point */ /** \deprecated Use create_point_in_edge_lookup() instead */ void create_point_valence_lookup(const uint_t PointCount, const mesh::indices_t& VertexPoints, mesh::counts_t& Valences); /// Initialise boundary_faces array for constant time lookup of faces that are on the mesh boundary. BoundaryEdges and AdjacentEdges can be created using create_edge_adjacency_lookup void create_boundary_face_lookup(const mesh::indices_t& FaceFirstLoops, const mesh::indices_t& FaceLoopCounts, const mesh::indices_t& LoopFirstEdges, const mesh::indices_t& ClockwiseEdges, const mesh::bools_t& BoundaryEdges, const mesh::indices_t& AdjacentEdges, mesh::bools_t& BoundaryFaces); /// Adds edges that are collinear and with points of valence 1 for boundary edges or valence 2 otherwise to EdgeList void mark_collinear_edges(mesh::indices_t& RedundantEdges, const mesh::selection_t& EdgeSelection, const mesh::points_t& Points, const mesh::indices_t& VertexPoints, const mesh::indices_t& ClockwiseEdges, const mesh::counts_t& VertexValences, const mesh::bools_t& BoundaryEdges, const mesh::indices_t& AdjacentEdges, const double_t Threshold = 1e-8); /// Marks edges that are shared by coplanar faces among the selected faces void mark_coplanar_edges(const mesh::indices_t& Companions, const mesh::bools_t& BoundaryEdges, const mesh::normals_t& Normals, const mesh::indices_t& EdgeFaces, const mesh::selection_t& FaceSelection, mesh::indices_t& RedundantEdges, const double_t Threshold = 1e-8); /// Triangulates the input polyhedron, storing the resulting primitive and storing point data in Output mesh::primitive* triangulate(const mesh& Input, const const_primitive& Polyhedron, mesh& Output); /// Removes edges, loops, and faces from a polyhedron, cleaning-up references and attributes. void delete_components(const mesh& Mesh, primitive& Polyhedron, const mesh::bools_t& RemovePoints, mesh::bools_t& RemoveEdges, mesh::bools_t& RemoveLoops, mesh::bools_t& RemoveFaces); } // namespace polyhedron } // namespace k3d #endif // !K3DSDK_POLYHEDRON_H ================================================ FILE: k3dsdk/primitive_validation.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { void require_valid_points(const mesh& Mesh) { const uint_t point_count = Mesh.points ? Mesh.points->size() : 0; const uint_t point_selection_count = Mesh.point_selection ? Mesh.point_selection->size() : 0; if(point_count != point_selection_count) throw std::runtime_error("Mismatched point and point_selection array lengths."); if(0 == Mesh.point_attributes.column_count()) return; const uint_t point_attribute_count = Mesh.point_attributes.row_count(); if(point_count != point_attribute_count) { std::ostringstream buffer; buffer << "Point attribute table incorrect length [" << point_attribute_count << "], expected [" << point_count << "]"; throw std::runtime_error(buffer.str()); } for(mesh::table_t::const_iterator array_iterator = Mesh.point_attributes.begin(); array_iterator != Mesh.point_attributes.end(); ++array_iterator) { const array* const current_array = array_iterator->second.get(); if(!current_array) throw std::runtime_error("NULL mesh point attributes array."); if(current_array->size() != point_count) throw std::runtime_error("Array length mismatch for mesh point attributes"); } } static void require_valid_table(const mesh& Mesh, const string_t& Name, const table& Table) { if(Name == "constant" && Table.column_count() && Table.row_count() != 1) throw std::runtime_error("'constant' table must have length 1."); for(mesh::table_t::const_iterator array_iterator = Table.begin(); array_iterator != Table.end(); ++array_iterator) { const array* const current_array = array_iterator->second.get(); if(!current_array) throw std::runtime_error("NULL table array."); const array* const first_array = Table.begin()->second.get(); if(current_array->size() != first_array->size()) throw std::runtime_error("Array length mismatch for table [" + Name + "]"); if(current_array->get_metadata_value(metadata::key::domain()) == metadata::value::point_indices_domain()) { if(!Mesh.points) throw std::runtime_error("Mesh missing points array."); if(!Mesh.point_selection) throw std::runtime_error("Mesh missing point selections array."); require_valid_points(Mesh); const mesh::indices_t* const indices = dynamic_cast(current_array); if(!indices) throw std::runtime_error("Point indices array must be an index type."); const mesh::indices_t::const_iterator max = std::max_element(indices->begin(), indices->end()); if(max != indices->end() && *max >= Mesh.points->size()) throw std::runtime_error("Point indices array out-of-bounds."); } } } void require_valid_primitive(const mesh& Mesh, const mesh::primitive& Primitive) { for(mesh::named_tables_t::const_iterator structure = Primitive.structure.begin(); structure != Primitive.structure.end(); ++structure) require_valid_table(Mesh, structure->first, structure->second); for(mesh::named_tables_t::const_iterator attributes = Primitive.attributes.begin(); attributes != Primitive.attributes.end(); ++attributes) require_valid_table(Mesh, attributes->first, attributes->second); for(mesh::named_tables_t::const_iterator attributes = Primitive.attributes.begin(); attributes != Primitive.attributes.end(); ++attributes) { if(0 == attributes->second.column_count()) continue; const mesh::named_tables_t::const_iterator structure = Primitive.structure.find(attributes->first); if(structure != Primitive.structure.end()) { if(structure->second.row_count() != attributes->second.row_count()) { std::ostringstream buffer; buffer << "[" << Primitive.type << "] attribute table [" << structure->first << "] incorrect length [" << attributes->second.row_count() << "], expected [" << structure->second.row_count() << "]"; throw std::runtime_error(buffer.str()); } } } } const mesh::table_t& require_structure(const mesh::primitive& Primitive, const string_t& Name) { const table* const structure = Primitive.structure.lookup(Name); if(!structure) throw std::runtime_error("[" + Primitive.type + "] primitive missing structure [" + Name + "]"); return *structure; } mesh::table_t& require_structure(mesh::primitive& Primitive, const string_t& Name) { table* const structure = Primitive.structure.writable(Name); if(!structure) throw std::runtime_error("[" + Primitive.type + "] primitive missing structure [" + Name + "]"); return *structure; } const mesh::table_t& require_attributes(const mesh::primitive& Primitive, const string_t& Name) { const table* const attributes = Primitive.attributes.lookup(Name); if(!attributes) throw std::runtime_error("[" + Primitive.type + "] primitive missing attributes [" + Name + "]"); return *attributes; } mesh::table_t& require_attributes(mesh::primitive& Primitive, const string_t& Name) { table* const attributes = Primitive.attributes.writable(Name); if(!attributes) throw std::runtime_error("[" + Primitive.type + "] primitive missing attributes [" + Name + "]"); return *attributes; } void require_table_row_count(const mesh::primitive& Primitive, const table& Table, const string_t& TableName, const uint_t RowCount) { if(TableName == "constant") throw std::runtime_error("'constant' tables are automatically tested, and must have length 1."); if(0 == Table.column_count()) return; if(Table.row_count() != RowCount) { std::ostringstream buffer; buffer << "[" << Primitive.type << "] table [" << TableName << "] incorrect length [" << Table.row_count() << "], expected [" << RowCount << "]"; throw std::runtime_error(buffer.str()); } } void require_metadata(const mesh::primitive& Primitive, const array& Array, const string_t& ArrayName, const string_t& MetadataName, const string_t& MetadataValue) { if(Array.get_metadata_value(MetadataName) != MetadataValue) { std::ostringstream buffer; buffer << "[" << Primitive.type << "] primitive [" << ArrayName << "] array missing [" << MetadataName << "] metadata value [" << MetadataValue << "]"; throw std::runtime_error(buffer.str()); } } } // namespace k3d ================================================ FILE: k3dsdk/primitive_validation.h ================================================ #ifndef K3DSDK_PRIMITIVE_VALIDATION_H #define K3DSDK_PRIMITIVE_VALIDATION_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include namespace k3d { //@{ /// Helper methods for use with in mesh primitive validate() functions only! /// Performs automated validation of mesh point data: /// /// * Validates that the number of points, point selections, and point attributes match. /// * Validates that every array in the point attributes table is the same length. /// /// Note: this is called implicitly by require_valid_primitive() if your primitive /// uses points, you don't need to call it yourself in most circumstances. void require_valid_points(const mesh& Mesh); /// Performs automated validation of the structure of a mesh primitive: /// /// * Validates that "constant" tables have length 1. /// * Validates that the mesh has point data if the primitive contains point indices. /// * Validates that primitive point indices are within bounds. /// * Validates that every array in a given table is the same length. /// * Validates that matching structure and attribute tables contain the same number of rows. void require_valid_primitive(const mesh& Mesh, const mesh::primitive& Primitive); /// Tests a primitive to verify that it contains the named structure table, throws an exception otherwise. const mesh::table_t& require_structure(const mesh::primitive& Primitive, const string_t& Name); /// Tests a primitive to verify that it contains the named structure table, throws an exception otherwise. mesh::table_t& require_structure(mesh::primitive& Primitive, const string_t& Name); /// Tests a primitive to verify that it contains the named attribute table, throws an exception otherwise. const mesh::table_t& require_attributes(const mesh::primitive& Primitive, const string_t& Name); /// Tests a primitive to verify that it contains the named attribute table, throws an exception otherwise. mesh::table_t& require_attributes(mesh::primitive& Primitive, const string_t& Name); /// Tests a table to verify that it matches the given row count, throws an exception otherwise. void require_table_row_count(const mesh::primitive& Primitive, const table& Table, const string_t& TableName, const uint_t RowCount); /// Tests a table to verify that it contains an array with given name and type, throws an exception otherwise. template const ArrayT& require_array(const mesh::primitive& Primitive, const mesh::table_t& Table, const string_t& Name) { const ArrayT* const array = Table.lookup(Name); if(!array) throw std::runtime_error("[" + Primitive.type + "] primitive missing array [" + Name + "]"); return *array; } /// Tests a table to verify that it contains an array with given name and type, throws an exception otherwise. template ArrayT& require_array(mesh::primitive& Primitive, mesh::table_t& Table, const string_t& Name) { ArrayT* const array = Table.writable(Name); if(!array) throw std::runtime_error("[" + Primitive.type + "] primitive missing array [" + Name + "]"); return *array; } /// Tests an array to verify that it has metadata with the given name and value, throws an exception otherwise. void require_metadata(const mesh::primitive& Primitive, const array& Array, const string_t& ArrayName, const string_t& MetadataName, const string_t& MetadataValue); //@} } // namespace k3d #endif // !K3DSDK_PRIMITIVE_VALIDATION_H ================================================ FILE: k3dsdk/property.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace property { namespace detail { ////////////////////////////////////////////////////////////////////////////////////////// // user_property /// Wraps a k3d_data object to mark it as a user property template class user_property : public property_t, public iuser_property, public metadata::storage { public: template user_property(const init_t& Init) : property_t(Init) { } }; /////////////////////////////////////////////////////////////////////////////////////////// // null_property_collection /// This is an ugly hack, but it allows user properties to be fully constructed before they're added to their property collection struct null_property_collection : public iproperty_collection { void register_property(iproperty&) { } void register_properties(const properties_t&) { } void unregister_property(iproperty&) { } void unregister_properties(const properties_t&) { } const properties_t& properties() { static properties_t properties; return properties; } sigc::connection connect_properties_changed_signal(const sigc::slot&) { return sigc::connection(); } }; ///////////////////////////////////////////////////////////////////////////// // user_serialization /// Serialization policy for generic user properties template class user_serialization : public property_policy_t, public ipersistent { // This policy only works for data stored by-value BOOST_STATIC_ASSERT((!boost::is_pointer::value)); public: void save(xml::element& Element, const ipersistent::save_context&) { xml::element xml_storage( "property", string_cast(property_policy_t::internal_value()), xml::attribute("name", property_policy_t::name()), xml::attribute("label", static_cast(*this).property_label()), xml::attribute("description", static_cast(*this).property_description()), xml::attribute("type", type_string()), xml::attribute("user_property", "generic")); Element.append(xml_storage); } void load(xml::element& Element, const ipersistent::load_context&) { string_t value = Element.text; property_policy_t::set_value(from_string(value, property_policy_t::internal_value()), 0); } protected: template user_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } }; ///////////////////////////////////////////////////////////////////////////// // mesh_serialization /// Serialization policy for generic user properties that store k3d::mesh template class user_mesh_serialization : public property_policy_t, public ipersistent { // This policy only works for data stored by-pointer BOOST_STATIC_ASSERT((boost::is_pointer::value)); public: void save(xml::element& Element, const ipersistent::save_context&) { // User mesh properties should always be empty ... assert_error(0 == property_policy_t::internal_value()); xml::element xml_storage( "property", string_cast(property_policy_t::internal_value()), xml::attribute("name", property_policy_t::name()), xml::attribute("label", static_cast(*this).property_label()), xml::attribute("description", static_cast(*this).property_description()), xml::attribute("type", type_string()), xml::attribute("user_property", "generic")); Element.append(xml_storage); } void load(xml::element&, const ipersistent::load_context&) { // User mesh properties should always be empty ... } protected: template user_mesh_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } }; ///////////////////////////////////////////////////////////////////////////// // user_node_serialization /// Serialization policy for data containers that store a document node and can be serialized as XML template class user_node_serialization : public property_policy_t, public ipersistent { // If this assertion fires, it means that you're trying to use node_serialization with a non-node data type BOOST_STATIC_ASSERT((boost::is_base_and_derived::type>::value)); public: void save(xml::element& Element, const ipersistent::save_context& Context) { if(property_policy_t::internal_node()) { Element.append( xml::element( "property", string_cast(Context.lookup.lookup_id(property_policy_t::internal_node())), xml::attribute("name", property_policy_t::name()), xml::attribute("label", static_cast(*this).property_label()), xml::attribute("description", static_cast(*this).property_description()), xml::attribute("type", type_string()), xml::attribute("user_property", "generic"))); } else { Element.append( xml::element( "property", "0", xml::attribute("name", property_policy_t::name()), xml::attribute("label", static_cast(*this).property_label()), xml::attribute("description", static_cast(*this).property_description()), xml::attribute("type", type_string()), xml::attribute("user_property", "generic"))); } } void load(xml::element& Element, const ipersistent::load_context& Context) { string_t value = Element.text; property_policy_t::set_value(dynamic_cast(Context.lookup.lookup_object(from_string(value, static_cast(0)))), 0); } protected: template user_node_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } private: ipersistent_lookup::id_type m_node_id; }; ///////////////////////////////////////////////////////////////////////////// // property_factory /// Helper class for instantiating user property instances class property_factory { public: property_factory(inode& Owner, iproperty_collection& PropertyCollection, ipersistent_collection& PersistentCollection, const std::type_info& Type, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value, iproperty*& Result) : owner(Owner), property_collection(PropertyCollection), persistent_collection(PersistentCollection), type(Type), name(Name), label(Label), description(Description), value(Value), result(Result) { } template void create_property(const T& DefaultValue) const { if(result) return; if(typeid(T) != type) return; T initial_value = DefaultValue; if(!value.empty()) { try { initial_value = boost::any_cast(value); } catch(...) { log() << error << "error extracting default value for user property [" << name << "] with type [" << demangle(type) << "]" << std::endl; return; } } null_property_collection temp_property_collection; result = new PropertyT( init_owner(owner.document(), temp_property_collection, persistent_collection, &owner) + init_name(make_token(name.c_str())) + init_label(make_token(label.c_str())) + init_description(make_token(description.c_str())) + init_value(initial_value) ); property_collection.register_property(*result); } template void create_path_property(const T& DefaultValue) const { if(result) return; if(typeid(T) != type) return; T initial_value = DefaultValue; if(!value.empty()) { try { initial_value = boost::any_cast(value); } catch(...) { log() << error << "error extracting default value for user property [" << name << "] with type [" << demangle(type) << "]" << std::endl; return; } } null_property_collection temp_property_collection; result = new PropertyT( init_owner(owner.document(), temp_property_collection, persistent_collection, &owner) + init_name(make_token(name.c_str())) + init_label(make_token(label.c_str())) + init_description(make_token(description.c_str())) + init_value(initial_value) + init_path_mode(k3d::ipath_property::WRITE) + init_path_type("any") ); property_collection.register_property(*result); } template void operator()(T DefaultValue) const { create_property >(DefaultValue); } void operator()(filesystem::path DefaultValue) const { create_path_property >(DefaultValue); } void operator()(mesh* DefaultValue) const { create_property >(DefaultValue); } void operator()(imaterial* DefaultValue) const { create_property >(DefaultValue); } void operator()(gl::imesh_painter* DefaultValue) const { create_property >(DefaultValue); } void operator()(k3d::ri::imesh_painter* DefaultValue) const { create_property >(DefaultValue); } void operator()(k3d::ri::itexture* DefaultValue) const { create_property >(DefaultValue); } void operator()(k3d::inode* DefaultValue) const { create_property >(DefaultValue); } private: inode& owner; iproperty_collection& property_collection; ipersistent_collection& persistent_collection; const std::type_info& type; const string_t& name; const string_t& label; const string_t& description; const boost::any& value; iproperty*& result; }; ////////////////////////////////////////////////////////////////////////////////////////// // renderman_parameter_list_name_t /// Helper class used to set a renderman property's parameter list name class renderman_parameter_list_name_t { public: explicit renderman_parameter_list_name_t(const char* const Name) : m_name(Name) { } const char* parameter_list_name() const { return m_name; } private: const char* const m_name; }; inline const initializer_t init_parameter_list_name(const char* const Name) { return initializer_t(renderman_parameter_list_name_t(Name)); } ///////////////////////////////////////////////////////////////////////////// // renderman_attribute_property /// Property policy that exposes a data container as a K-3D renderman property template class renderman_attribute_property : public name_policy_t, public iproperty, public iwritable_property, public k3d::ri::iattribute_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return boost::any_cast(source->property_internal_value()); return name_policy_t::internal_value(); } const string_t property_name() { return name_policy_t::name(); } const string_t property_label() { return m_label; } const string_t property_description() { return m_description; } const std::type_info& property_type() { return typeid(value_t); } const boost::any property_internal_value() { return name_policy_t::internal_value(); } const boost::any property_pipeline_value() { return pipeline_value(); } const string_t property_attribute_name() { return m_attribute_name; } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { const value_t* const new_value = boost::any_cast(&Value); if(!new_value) return false; name_policy_t::set_value(*new_value, Hint); return true; } protected: template renderman_attribute_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_attribute_name(Init.parameter_list_name()), m_dependency(0) { Init.property_collection().register_property(*this); } ~renderman_attribute_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; const char* const m_attribute_name; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // renderman_option_property /// Property policy that exposes a data container as a K-3D renderman property template class renderman_option_property : public name_policy_t, public iproperty, public iwritable_property, public k3d::ri::ioption_property { public: const value_t pipeline_value() { iproperty* const source = property_lookup(this); if(source != this) return boost::any_cast(source->property_internal_value()); return name_policy_t::internal_value(); } const string_t property_name() { return name_policy_t::name(); } const string_t property_label() { return m_label; } const string_t property_description() { return m_description; } const std::type_info& property_type() { return typeid(value_t); } const boost::any property_internal_value() { return name_policy_t::internal_value(); } const boost::any property_pipeline_value() { return pipeline_value(); } const string_t property_option_name() { return m_option_name; } inode* property_node() { return m_node; } typename name_policy_t::changed_signal_t& property_changed_signal() { return name_policy_t::changed_signal(); } deleted_signal_t& property_deleted_signal() { return m_deleted_signal; } iproperty* property_dependency() { return m_dependency; } void property_set_dependency(iproperty* Dependency) { m_dependency = Dependency; } bool property_set_value(const boost::any Value, ihint* const Hint) { const value_t* const new_value = boost::any_cast(&Value); if(!new_value) return false; name_policy_t::set_value(*new_value, Hint); return true; } protected: template renderman_option_property(const init_t& Init) : name_policy_t(Init), m_node(Init.node()), m_label(Init.label()), m_description(Init.description()), m_option_name(Init.parameter_list_name()), m_dependency(0) { Init.property_collection().register_property(*this); } ~renderman_option_property() { m_deleted_signal.emit(); } private: inode* const m_node; const char* const m_label; const char* const m_description; const char* const m_option_name; deleted_signal_t m_deleted_signal; iproperty* m_dependency; }; ///////////////////////////////////////////////////////////////////////////// // renderman_attribute_serialization /// Serialization policy for data containers that can be serialized as XML template class renderman_attribute_serialization : public property_policy_t, public ipersistent { // This policy only works for data stored by-value BOOST_STATIC_ASSERT((!boost::is_pointer::value)); public: void save(xml::element& Element, const ipersistent::save_context&) { xml::element xml_storage( "property", string_cast(property_policy_t::internal_value()), xml::attribute("name", property_policy_t::name()), xml::attribute("label", static_cast(*this).property_label()), xml::attribute("description", static_cast(*this).property_description()), xml::attribute("type", type_string()), xml::attribute("parameter_type", "attribute"), xml::attribute("parameter_name", property_policy_t::property_attribute_name()), xml::attribute("user_property", "renderman")); Element.append(xml_storage); } void load(xml::element& Element, const ipersistent::load_context&) { string_t value = Element.text; property_policy_t::set_value(from_string(value, property_policy_t::internal_value())); } protected: template renderman_attribute_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } }; ///////////////////////////////////////////////////////////////////////////// // renderman_option_serialization /// Serialization policy for data containers that can be serialized as XML template class renderman_option_serialization : public property_policy_t, public ipersistent { // This policy only works for data stored by-value BOOST_STATIC_ASSERT((!boost::is_pointer::value)); public: void save(xml::element& Element, const ipersistent::save_context&) { xml::element xml_storage( "property", string_cast(property_policy_t::internal_value()), xml::attribute("name", property_policy_t::name()), xml::attribute("label", static_cast(*this).property_label()), xml::attribute("description", static_cast(*this).property_description()), xml::attribute("type", type_string()), xml::attribute("parameter_type", "option"), xml::attribute("parameter_name", property_policy_t::property_option_name()), xml::attribute("user_property", "renderman")); Element.append(xml_storage); } void load(xml::element& Element, const ipersistent::load_context&) { string_t value = Element.text; property_policy_t::set_value(from_string(value, property_policy_t::internal_value())); } protected: template renderman_option_serialization(const init_t& Init) : property_policy_t(Init) { Init.persistent_collection().enable_serialization(Init.name(), *this); } }; ///////////////////////////////////////////////////////////////////////////// // renderman_attribute_factory /// Helper class for instantiating user property instances class renderman_attribute_factory { public: renderman_attribute_factory(inode& Owner, iproperty_collection& PropertyCollection, ipersistent_collection& PersistentCollection, const std::type_info& Type, const string_t& AttributeName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value, iproperty*& Result) : owner(Owner), property_collection(PropertyCollection), persistent_collection(PersistentCollection), type(Type), attribute_name(AttributeName), name(Name), label(Label), description(Description), value(Value), result(Result) { } template void create_property() const { if(result) return; if(typeid(T) != type) return; T initial_value; if(!value.empty()) try { initial_value = boost::any_cast(value); } catch(...) { log() << error << "error extracting default value for attribute [" << name << "] with type [" << demangle(type) << "]" << std::endl; return; } null_property_collection temp_property_collection; result = new PropertyT( init_owner(owner.document(), temp_property_collection, persistent_collection, &owner) + init_parameter_list_name(make_token(attribute_name.c_str())) + init_name(make_token(name.c_str())) + init_label(make_token(label.c_str())) + init_description(make_token(description.c_str())) + init_value(initial_value) ); property_collection.register_property(*result); } template void operator()(T) const { create_property >(); } private: inode& owner; iproperty_collection& property_collection; ipersistent_collection& persistent_collection; const std::type_info& type; const string_t& attribute_name; const string_t& name; const string_t& label; const string_t& description; const boost::any& value; iproperty*& result; }; ///////////////////////////////////////////////////////////////////////////// // renderman_option_factory /// Helper class for instantiating user property instances class renderman_option_factory { public: renderman_option_factory(inode& Owner, iproperty_collection& PropertyCollection, ipersistent_collection& PersistentCollection, const std::type_info& Type, const string_t& OptionName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value, iproperty*& Result) : owner(Owner), property_collection(PropertyCollection), persistent_collection(PersistentCollection), type(Type), option_name(OptionName), name(Name), label(Label), description(Description), value(Value), result(Result) { } template void create_property() const { if(result) return; if(typeid(T) != type) return; T initial_value; if(!value.empty()) try { initial_value = boost::any_cast(value); } catch(...) { log() << error << "error extracting default value for option [" << name << "] with type [" << demangle(type) << "]" << std::endl; return; } null_property_collection temp_property_collection; result = new PropertyT( init_owner(owner.document(), temp_property_collection, persistent_collection, &owner) + init_parameter_list_name(make_token(option_name.c_str())) + init_name(make_token(name.c_str())) + init_label(make_token(label.c_str())) + init_description(make_token(description.c_str())) + init_value(initial_value) ); property_collection.register_property(*result); } template void operator()(T) const { create_property >(); } private: inode& owner; iproperty_collection& property_collection; ipersistent_collection& persistent_collection; const std::type_info& type; const string_t& option_name; const string_t& name; const string_t& label; const string_t& description; const boost::any& value; iproperty*& result; }; } // namespace detail void connect(idocument& Document, iproperty& From, iproperty& To) { ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&To, &From)); Document.pipeline().set_dependencies(dependencies); } iproperty* connection(idocument& Document, iproperty& Property) { return Document.pipeline().dependency(Property); } void disconnect(idocument& Document, iproperty& Property) { ipipeline::dependencies_t dependencies; dependencies.insert(std::make_pair(&Property, static_cast(0))); Document.pipeline().set_dependencies(dependencies); } iproperty* get(iunknown& Object, const string_t& Name) { // If the object doesn't have properties, we're done ... iproperty_collection* const property_collection = dynamic_cast(&Object); if(!property_collection) return 0; // Get the object's properties ... const iproperty_collection::properties_t properties(property_collection->properties()); // Look for a property with a matching name ... for(iproperty_collection::properties_t::const_iterator property_iterator = properties.begin(); property_iterator != properties.end(); ++property_iterator) { // if the name matches, we're done ... if((*property_iterator)->property_name() == Name) return *property_iterator; } // No property by that name! return 0; } const boost::any internal_value(iproperty& Property) { return Property.property_internal_value(); } const boost::any internal_value(iunknown& Object, const string_t& Name) { // Look for the property by name ... if(iproperty* const property = get(Object, Name)) return internal_value(*property); return boost::any(); } const boost::any pipeline_value(iproperty& Property) { return Property.property_pipeline_value(); } const boost::any pipeline_value(iunknown& Object, const string_t& Name) { if(iproperty* const property = get(Object, Name)) return pipeline_value(*property); return boost::any(); } bool set_internal_value(iunknown& Object, const string_t Name, const boost::any& Value) { // If the object isn't a property collection, we're done ... iproperty_collection* const property_collection = dynamic_cast(&Object); if(!property_collection) { log() << error << k3d_file_reference << " : object has no property collection!" << std::endl; return false; } // Look for a property with a matching name ... const iproperty_collection::properties_t properties(property_collection->properties()); for(iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { // Name doesn't match, so keep going ... if((*property)->property_name() != Name) continue; // Success ... return set_internal_value(**property, Value); } // Couldn't find a property by that name! log() << error << k3d_file_reference << " : could not find property [" << Name << "]" << std::endl; return false; } bool set_internal_value(iproperty& Property, const boost::any& Value) { // If the property type doesn't match, we're done ... if(Value.type() != Property.property_type()) { log() << error << "Value type [" << demangle(Value.type()) << "] doesn't match property [" << Property.property_name() << "] type [" << demangle(Property.property_type()) << "]" << std::endl; return false; } // If the property is read-only, we're done ... iwritable_property* const writable_property = dynamic_cast(&Property); if(!writable_property) { log() << error << "Property [" << Property.property_name() << "] is not writable!" << std::endl; return false; } return writable_property->property_set_value(Value); } //////////////////////////////////////////////////////////////////////////////////////////// // user_properties const std::vector user_properties(iunknown& Object) { std::vector results; if(iproperty_collection* const property_collection = dynamic_cast(&Object)) { const iproperty_collection::properties_t& properties = property_collection->properties(); for(iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) { if(dynamic_cast(*property)) results.push_back(*property); } } return results; } ///////////////////////////////////////////////////////////////////////////// // create iproperty* create(inode& Owner, const std::type_info& Type, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value) { iproperty_collection* const property_collection = dynamic_cast(&Owner); return_val_if_fail(property_collection, 0); ipersistent_collection* const persistent_collection = dynamic_cast(&Owner); return_val_if_fail(persistent_collection, 0); iproperty* result = 0; boost::mpl::for_each(detail::property_factory(Owner, *property_collection, *persistent_collection, Type, Name, Label, Description, Value, result)); return result; } ///////////////////////////////////////////////////////////////////////////// // create iproperty* create(inode& Owner, const string_t& Type, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value) { const std::type_info* const type_info = type_id(Type); return_val_if_fail(type_info, 0); return create(Owner, *type_info, Name, Label, Description, Value); } namespace ri { ///////////////////////////////////////////////////////////////////////////// // create_attribute iproperty* create_attribute(inode& Owner, const std::type_info& Type, const string_t& AttributeName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value) { iproperty_collection* const property_collection = dynamic_cast(&Owner); return_val_if_fail(property_collection, 0); ipersistent_collection* const persistent_collection = dynamic_cast(&Owner); return_val_if_fail(persistent_collection, 0); iproperty* result = 0; boost::mpl::for_each(k3d::property::detail::renderman_attribute_factory(Owner, *property_collection, *persistent_collection, Type, AttributeName, Name, Label, Description, Value, result)); return result; } ///////////////////////////////////////////////////////////////////////////// // create_attribute iproperty* create_attribute(inode& Owner, const string_t& Type, const string_t& AttributeName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value) { const std::type_info* const type_info = type_id(Type); return_val_if_fail(type_info, 0); return create_attribute(Owner, *type_info, AttributeName, Name, Label, Description, Value); } ///////////////////////////////////////////////////////////////////////////// // create_option iproperty* create_option(inode& Owner, const std::type_info& Type, const string_t& OptionName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value) { iproperty_collection* const property_collection = dynamic_cast(&Owner); return_val_if_fail(property_collection, 0); ipersistent_collection* const persistent_collection = dynamic_cast(&Owner); return_val_if_fail(persistent_collection, 0); iproperty* result = 0; boost::mpl::for_each(k3d::property::detail::renderman_option_factory(Owner, *property_collection, *persistent_collection, Type, OptionName, Name, Label, Description, Value, result)); return result; } ///////////////////////////////////////////////////////////////////////////// // create_option iproperty* create_option(inode& Owner, const string_t& Type, const string_t& OptionName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value) { const std::type_info* const type_info = type_id(Type); return_val_if_fail(type_info, 0); return create_option(Owner, *type_info, OptionName, Name, Label, Description, Value); } } // namespace ri } // namespace property } // namespace k3d ================================================ FILE: k3dsdk/property.h ================================================ #ifndef K3DSDK_PROPERTY_H #define K3DSDK_PROPERTY_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { class idocument; class inode; class iunknown; namespace property { /// Makes a connection from one property to another. void connect(idocument& Document, iproperty& From, iproperty& To); /// Returns the connection to a property (if any), or NULL. iproperty* connection(idocument& Document, iproperty& Property); /// Disconnects a property from its dependency (if any). void disconnect(idocument& Document, iproperty& Property); /// Returns a matching property by name, or NULL iproperty* get(iunknown& Object, const string_t& Name); /// Returns a matching property by name and type, or NULL template iproperty* get(iunknown& Object, const string_t& Name) { iproperty* const property = get(Object, Name); return property && (property->property_type() == typeid(value_t)) ? property : 0; } /// Returns the "internal" value of a property - the value of the property itself, regardless of any pipeline dependencies const boost::any internal_value(iunknown& Object, const string_t& Name); /// Returns the "internal" value of a property - the value of the property itself, regardless of any pipeline dependencies template const value_t internal_value(iunknown& Object, const string_t& Name) { return boost::any_cast(internal_value(Object, Name)); } /// Returns the "internal" value of a property - the value of the property itself, regardless of any pipeline dependencies const boost::any internal_value(iproperty& Property); /// Returns the "internal" value of a property - the value of the property itself, regardless of any pipeline dependencies template const value_t internal_value(iproperty& Property) { return boost::any_cast(internal_value(Property)); } /// Returns the "pipeline" value of a property - the value of the property, possibly overridden by pipeline dependencies const boost::any pipeline_value(iunknown& Object, const string_t& Name); /// Returns the "pipeline" value of a property - the value of the property, possibly overridden by pipeline dependencies template const value_t pipeline_value(iunknown& Object, const string_t& Name) { return boost::any_cast(pipeline_value(Object, Name)); } /// Returns the "pipeline" value of a property - the value of the property, possibly overridden by pipeline dependencies const boost::any pipeline_value(iproperty& Property); /// Returns the "pipeline" value of a property - the value of the property, possibly overridden by pipeline dependencies template const value_t pipeline_value(iproperty& Property) { return boost::any_cast(pipeline_value(Property)); } /** \brief Sets the value of a named property \return true, iff the value was set successfully, false otherwise (couldn't find a property with a matching name, it wasn't writable, or the type didn't match) */ bool set_internal_value(iunknown& Object, const string_t Name, const boost::any& Value); /** \brief Sets the value of a property \return true, iff the value was set successfully, false otherwise (the property wasn't writable or the type didn't match) */ bool set_internal_value(iproperty& Property, const boost::any& Value); /// Returns the set of user properties (if any) owned by an object const std::vector user_properties(iunknown& Object); /// Creates a new user property with the given type and initial value. iproperty* create(inode& Owner, const std::type_info& Type, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()); /// Creates a new user property with the given type and initial value. iproperty* create(inode& Owner, const string_t& Type, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()); /// Creates a new user property with the given type and initial value. template iproperty* create(inode& Owner, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()) { return create(Owner, typeid(T), Name, Label, Description, Value); } namespace ri { /// Creates a new RenderMan attribute with the given type, name, and value iproperty* create_attribute(inode& Owner, const std::type_info& Type, const string_t& AttributeName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()); /// Creates a new RenderMan attribute with the given type, name, and value iproperty* create_attribute(inode& Owner, const string_t& Type, const string_t& AttributeName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()); /// Creates a new RenderMan attribute with the given type, name, and value template iproperty* create_attribute(inode& Owner, const string_t& AttributeName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()) { return create_attribute(Owner, typeid(T), AttributeName, Name, Label, Description, Value); } /// Creates a new RenderMan option with the given type, name, and value iproperty* create_option(inode& Owner, const std::type_info& Type, const string_t& OptionName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()); /// Creates a new RenderMan option with the given type, name, and value iproperty* create_option(inode& Owner, const string_t& Type, const string_t& OptionName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()); /// Creates a new RenderMan option with the given type, name, and value template iproperty* create_option(inode& Owner, const string_t& OptionName, const string_t& Name, const string_t& Label, const string_t& Description, const boost::any& Value = boost::any()) { return create_option(Owner, typeid(T), OptionName, Name, Label, Description, Value); } } // namespace ri } // namespace property } // namespace k3d #endif // !K3DSDK_PROPERTY_H ================================================ FILE: k3dsdk/property_collection.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // property_collection property_collection::property_collection() { } property_collection::~property_collection() { for(properties_t::iterator property = m_properties.begin(); property != m_properties.end(); ++property) { if(dynamic_cast(*property)) delete *property; } } void property_collection::register_property(iproperty& Property) { m_properties.erase(std::remove(m_properties.begin(), m_properties.end(), &Property), m_properties.end()); m_properties.push_back(&Property); m_changed_signal.emit(0); } void property_collection::register_properties(const properties_t& Properties) { for(properties_t::const_iterator property = Properties.begin(); property != Properties.end(); ++property) { m_properties.erase(std::remove(m_properties.begin(), m_properties.end(), *property), m_properties.end()); m_properties.push_back(*property); } m_properties.erase(std::remove(m_properties.begin(), m_properties.end(), static_cast(0)), m_properties.end()); m_changed_signal.emit(0); } void property_collection::unregister_property(iproperty& Property) { m_properties.erase(std::remove(m_properties.begin(), m_properties.end(), &Property), m_properties.end()); m_changed_signal.emit(0); } void property_collection::unregister_properties(const properties_t& Properties) { for(properties_t::const_iterator property = Properties.begin(); property != Properties.end(); ++property) m_properties.erase(std::remove(m_properties.begin(), m_properties.end(), *property), m_properties.end()); m_changed_signal.emit(0); } const iproperty_collection::properties_t& property_collection::properties() { return m_properties; } sigc::connection property_collection::connect_properties_changed_signal(const sigc::slot& Slot) { return m_changed_signal.connect(Slot); } } // namespace k3d ================================================ FILE: k3dsdk/property_collection.h ================================================ #ifndef K3DSDK_PROPERTY_COLLECTION_H #define K3DSDK_PROPERTY_COLLECTION_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // property_collection /// Provides a default implementation of iproperty_collection class property_collection : public iproperty_collection { public: property_collection(); virtual ~property_collection(); void register_property(iproperty& Property); void register_properties(const properties_t& Properties); void unregister_property(iproperty& Property); void unregister_properties(const properties_t& Properties); const properties_t& properties(); sigc::connection connect_properties_changed_signal(const sigc::slot& Slot); private: /// Contains the collection of all properties properties_t m_properties; /// Change-notification signal for the collection sigc::signal m_changed_signal; }; } // namespace k3d #endif // !K3DSDK_PROPERTY_COLLECTION_H ================================================ FILE: k3dsdk/property_group_collection.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // property_group_collection property_group_collection::property_group_collection() { } property_group_collection::~property_group_collection() { } const iproperty_group_collection::groups_t property_group_collection::property_groups() { return m_groups; } void property_group_collection::register_property_group(const group& Group) { m_groups.push_back(Group); } void property_group_collection::unregister_property_group(const std::string& Name) { groups_t::iterator group = m_groups.begin(); while (group != m_groups.end()) { if (group->name == Name) { group = m_groups.erase(group); } else { ++group; } } } void property_group_collection::clear() { m_groups.clear(); } } // namespace k3d ================================================ FILE: k3dsdk/property_group_collection.h ================================================ #ifndef K3DSDK_PROPERTY_GROUP_COLLECTION_H #define K3DSDK_PROPERTY_GROUP_COLLECTION_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include namespace k3d { ///////////////////////////////////////////////////////////////////////////// // property_group_collection /// Provides a default implementation of iproperty_group_collection class property_group_collection : public iproperty_group_collection { public: property_group_collection(); virtual ~property_group_collection(); const groups_t property_groups(); protected: /// Clears the collection, removing all groups void clear(); /// Stores a new group void register_property_group(const group& Group); /// Removes the group(s) named Name void unregister_property_group(const string_t& Name); private: /// Contains the collection of property groups groups_t m_groups; }; } // namespace k3d #endif // !K3DSDK_PROPERTY_GROUP_COLLECTION_H ================================================ FILE: k3dsdk/property_types.h ================================================ #ifndef K3DSDK_PROPERTY_TYPES_H #define K3DSDK_PROPERTY_TYPES_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include namespace k3d { namespace property { /// Enumerates all of the types that can be stored using user properties. typedef boost::mpl::vector17< k3d::bool_t, k3d::color, k3d::double_t, k3d::filesystem::path, k3d::gl::imesh_painter*, k3d::imaterial*, k3d::inode*, k3d::int32_t, k3d::matrix4, k3d::mesh*, k3d::normal3, k3d::point3, k3d::point4, k3d::ri::imesh_painter*, k3d::ri::itexture*, k3d::string_t, k3d::vector3 > types; } // namespace property } // namespace k3d #endif // !K3DSDK_PROPERTY_TYPES_H ================================================ FILE: k3dsdk/property_types_ri.h ================================================ #ifndef K3DSDK_PROPERTY_TYPES_RI_H #define K3DSDK_PROPERTY_TYPES_RI_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Tim Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace property { namespace ri { /// Enumerates all of the types that can be stored using RenderMan attributes. typedef boost::mpl::vector< k3d::ri::color, k3d::ri::hpoint, k3d::ri::integer, k3d::ri::matrix, k3d::ri::normal, k3d::ri::point, k3d::ri::real, k3d::ri::string, k3d::ri::vector > attribute_types; /// Enumerates all of the types that can be stored using RenderMan options. typedef boost::mpl::vector< k3d::ri::color, k3d::ri::hpoint, k3d::ri::integer, k3d::ri::matrix, k3d::ri::normal, k3d::ri::point, k3d::ri::real, k3d::ri::string, k3d::ri::vector > option_types; } // namespace ri } // namespace property } // namespace k3d #endif // !K3DSDK_PROPERTY_TYPES_RI_H ================================================ FILE: k3dsdk/python/CMakeLists.txt ================================================ PROJECT(k3dsdk-python) INCLUDE_DIRECTORIES(${k3d_SOURCE_DIR}) INCLUDE_DIRECTORIES(${k3dsdk_BINARY_DIR}) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_GLIBMM_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_SIGC_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${K3D_PYTHON_INCLUDE_DIRS}) LINK_DIRECTORIES(${K3D_SIGC_LIB_DIRS}) K3D_ADD_LIBRARY(k3dsdk-python-arrays SHARED typed_array_python.cpp typed_array_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python-arrays) TARGET_LINK_LIBRARIES(k3dsdk-python-arrays k3dsdk ${K3D_PYTHON_LIBS} ${Boost_PYTHON_LIBRARY} ) K3D_ADD_LIBRARY(k3dsdk-python-const-arrays SHARED const_typed_array_python.cpp const_typed_array_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python-const-arrays) TARGET_LINK_LIBRARIES(k3dsdk-python-const-arrays k3dsdk ${K3D_PYTHON_LIBS} ${Boost_PYTHON_LIBRARY} ) K3D_ADD_LIBRARY(k3dsdk-python-values SHARED angle_axis_python.cpp angle_axis_python.h bitmap_python.cpp bitmap_python.h bounding_box3_python.cpp bounding_box3_python.h color_python.cpp color_python.h const_bitmap_python.cpp const_bitmap_python.h euler_angles_python.cpp euler_angles_python.h filesystem_python.cpp filesystem_python.h matrix4_python.cpp matrix4_python.h normal3_python.cpp normal3_python.h point2_python.cpp point2_python.h point3_python.cpp point3_python.h point4_python.cpp point4_python.h texture3_python.cpp texture3_python.h uuid_python.cpp uuid_python.h vector2_python.cpp vector2_python.h vector3_python.cpp vector3_python.h vector4_python.cpp vector4_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python-values) TARGET_LINK_LIBRARIES(k3dsdk-python-values k3dsdk ${Boost_PYTHON_LIBRARY} ${K3D_PYTHON_LIBS} ) K3D_ADD_LIBRARY(k3dsdk-python-mesh SHARED mesh_python.cpp mesh_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python-mesh) TARGET_LINK_LIBRARIES(k3dsdk-python-mesh k3dsdk-python-arrays) TARGET_LINK_LIBRARIES(k3dsdk-python-mesh k3dsdk-python-const-arrays) K3D_ADD_LIBRARY(k3dsdk-python-interfaces SHARED any_python.cpp any_python.h offscreen_context_factory_gl_python.cpp offscreen_context_factory_gl_python.h idocument_exporter_python.cpp idocument_exporter_python.h idocument_importer_python.cpp idocument_importer_python.h idocument_python.cpp idocument_python.h ifile_change_notifier_python.cpp ifile_change_notifier_python.h ikeyframer_python.cpp ikeyframer_python.h imesh_storage_python.cpp imesh_storage_python.h imeta_object_python.cpp imeta_object_python.h imetadata_python.cpp imetadata_python.h inode_python.cpp inode_python.h inode_selection_python.cpp inode_selection_python.h iplugin_factory_python.cpp iplugin_factory_python.h iproperty_collection_python.cpp iproperty_collection_python.h iproperty_python.cpp iproperty_python.h irender_camera_frame_python.cpp irender_camera_frame_python.h irender_camera_preview_python.cpp irender_camera_preview_python.h isnappable_python.cpp isnappable_python.h iunknown_python.cpp iunknown_python.h iuser_interface_python.cpp iuser_interface_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python-interfaces) TARGET_LINK_LIBRARIES(k3dsdk-python-interfaces k3dsdk-python-mesh) TARGET_LINK_LIBRARIES(k3dsdk-python-interfaces k3dsdk-python-values) K3D_ADD_LIBRARY(k3dsdk-python-b SHARED table_python.cpp table_python.h const_table_python.cpp const_table_python.h const_named_arrays_python.cpp const_named_arrays_python.h const_named_tables_python.cpp const_named_tables_python.h euler_python.cpp euler_python.h geometry_python.cpp geometry_python.h log_python.cpp log_python.h mime_python.cpp mime_python.h named_arrays_python.cpp named_arrays_python.h named_tables_python.cpp named_tables_python.h node_python.cpp node_python.h parallel_python.cpp plugin_python.cpp plugin_python.h property_python.cpp property_python.h resource_python.cpp resource_python.h ri_python.cpp ri_python.h selection_python.cpp selection_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python-b) TARGET_LINK_LIBRARIES(k3dsdk-python-b k3dsdk-python-arrays) TARGET_LINK_LIBRARIES(k3dsdk-python-b k3dsdk-python-const-arrays) TARGET_LINK_LIBRARIES(k3dsdk-python-b k3dsdk-python-interfaces) TARGET_LINK_LIBRARIES(k3dsdk-python-b k3dsdk-resource) K3D_ADD_LIBRARY(k3dsdk-python-primitives SHARED bezier_triangle_patch_python.cpp bezier_triangle_patch_python.h bicubic_patch_python.cpp bicubic_patch_python.h bilinear_patch_python.cpp bilinear_patch_python.h blobby_python.cpp blobby_python.h cone_python.cpp cone_python.h cubic_curve_python.cpp cubic_curve_python.h cylinder_python.cpp cylinder_python.h disk_python.cpp disk_python.h hyperboloid_python.cpp hyperboloid_python.h linear_curve_python.cpp linear_curve_python.h nurbs_curve_python.cpp nurbs_curve_python.h nurbs_patch_python.cpp nurbs_patch_python.h paraboloid_python.cpp paraboloid_python.h particle_python.cpp particle_python.h polyhedron_python.cpp polyhedron_python.h sphere_python.cpp sphere_python.h teapot_python.cpp teapot_python.h torus_python.cpp torus_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python-primitives) TARGET_LINK_LIBRARIES(k3dsdk-python-primitives k3dsdk-python-b) K3D_ADD_LIBRARY(k3dsdk-python SHARED difference_python.cpp difference_python.h instance_wrapper_python.h file_signal_python.cpp file_signal_python.h object_model_python.cpp object_model_python.h script_python.cpp script_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python) TARGET_LINK_LIBRARIES(k3dsdk-python k3dsdk-python-primitives ${Boost_PYTHON_LIBRARY} ) INSTALL(TARGETS k3dsdk-python-arrays RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(TARGETS k3dsdk-python-const-arrays RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(TARGETS k3dsdk-python-values RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(TARGETS k3dsdk-python-mesh RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(TARGETS k3dsdk-python-interfaces RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(TARGETS k3dsdk-python-b RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(TARGETS k3dsdk-python-primitives RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) INSTALL(TARGETS k3dsdk-python RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) IF(K3D_BUILD_NGUI_MODULE) INCLUDE_DIRECTORIES(${K3D_GTKMM_INCLUDE_DIRS}) K3D_ADD_LIBRARY(k3dsdk-python-atk SHARED atk_python.cpp atk_python.h ) K3D_GENERATE_DEF_FILE(k3dsdk-python-atk) TARGET_LINK_LIBRARIES(k3dsdk-python-atk k3dsdk ${Boost_PYTHON_LIBRARY} ${K3D_PYTHON_LIBS} ${K3D_GTKMM_LIBS} ) TARGET_LINK_LIBRARIES(k3dsdk-python k3dsdk-python-atk) INSTALL(TARGETS k3dsdk-python-atk RUNTIME DESTINATION bin LIBRARY DESTINATION ${K3D_LIBDIR} ARCHIVE DESTINATION ${K3D_LIBDIR}) ENDIF() ================================================ FILE: k3dsdk/python/angle_axis_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include using namespace boost::python; #include namespace k3d { namespace python { void define_class_angle_axis() { class_("angle_axis", "Encodes a change in orientation as a rotation around an arbitrary axis.\n" "@note: This is the preferred datatype for storing orientation " "in K-3D because it does not suffer from gimbal-lock.", no_init) .def(init()) .def(init()) .def_readwrite("angle", &k3d::angle_axis::angle, "Stores the rotation angle in radians.") .def_readwrite("axis", &k3d::angle_axis::axis, "Stores the axis of rotation as a L{vector3}.") .def(self == self) .def(self != self) .def(self_ns::str(self)); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/angle_axis_python.h ================================================ #ifndef K3DSDK_PYTHON_ANGLE_AXIS_PYTHON_H #define K3DSDK_PYTHON_ANGLE_AXIS_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_angle_axis(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_ANGLE_AXIS_PYTHON_H ================================================ FILE: k3dsdk/python/any_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { const object any_to_python(const boost::any& Value) { const std::type_info& type = Value.type(); if(Value.empty()) return object(); if(type == typeid(k3d::bool_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::int8_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::int16_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::int32_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::int64_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::uint8_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::uint16_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::uint32_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::uint64_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::double_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::string_t)) return object(boost::any_cast(Value)); if(type == typeid(k3d::ustring)) return object(boost::any_cast(Value).raw()); if(type == typeid(filesystem::path)) return object(boost::any_cast(Value)); if(type == typeid(k3d::angle_axis)) return object(boost::any_cast(Value)); if(type == typeid(k3d::color)) return object(boost::any_cast(Value)); if(type == typeid(k3d::point2)) return object(boost::any_cast(Value)); if(type == typeid(k3d::point3)) return object(boost::any_cast(Value)); if(type == typeid(k3d::normal3)) return object(boost::any_cast(Value)); if(type == typeid(k3d::texture3)) return object(boost::any_cast(Value)); if(type == typeid(k3d::vector3)) return object(boost::any_cast(Value)); if(type == typeid(k3d::point4)) return object(boost::any_cast(Value)); if(type == typeid(k3d::matrix4)) return object(boost::any_cast(Value)); if(type == typeid(k3d::euler_angles)) return object(boost::any_cast(Value)); if(type == typeid(k3d::selection::set)) return object(boost::any_cast(Value)); if(type == typeid(k3d::bounding_box3)) return object(boost::any_cast(Value)); if(type == typeid(k3d::mesh*)) return wrap(boost::any_cast(Value)); if(type == typeid(const k3d::mesh*)) return wrap(boost::any_cast(Value)); if(type == typeid(k3d::bitmap*)) return wrap(boost::any_cast(Value)); if(type == typeid(const k3d::bitmap*)) return wrap(boost::any_cast(Value)); if(type == typeid(k3d::inode*)) return wrap_unknown(boost::any_cast(Value)); if(type == typeid(k3d::idocument*)) { k3d::idocument* const value = boost::any_cast(Value); return value ? object(wrap(value)) : object(); } if(type == typeid(const k3d::ri::render_state*)) { return wrap(boost::any_cast(Value)); } if(type == typeid(std::vector)) { std::vector nodes = boost::any_cast >(Value); boost::python::list results; for(k3d::uint_t i = 0; i != nodes.size(); ++i) results.append(wrap_unknown(nodes[i])); return results; } if(type == typeid(std::vector)) { std::vector value = boost::any_cast >(Value); boost::python::list results; for(k3d::uint_t i = 0; i != value.size(); ++i) results.append(any_to_python(value[i])); return results; } if(type == typeid(k3d::typed_array)) { k3d::typed_array nodes = boost::any_cast >(Value); boost::python::list results; for(k3d::uint_t i = 0; i != nodes.size(); ++i) results.append(nodes[i]); return results; } typedef std::map profiler_task_records_t; typedef std::map profiler_node_records_t; if(type == typeid(profiler_node_records_t)) { boost::python::dict python_node_records; profiler_node_records_t node_records = boost::any_cast(Value); for(profiler_node_records_t::const_iterator node_record = node_records.begin(); node_record != node_records.end(); ++node_record) { boost::python::dict python_task_records; k3d::inode* const node = node_record->first; profiler_task_records_t task_records = node_record->second; for(profiler_task_records_t::const_iterator task_record = task_records.begin(); task_record != task_records.end(); ++task_record) python_task_records[task_record->first] = task_record->second; python_node_records[wrap_unknown(node)] = python_task_records; } return python_node_records; } throw std::invalid_argument("can't convert unrecognized type [" + demangle(type) + "] to boost::python::object"); } #define safe_extract(type, value) { extract extractor(value); if(extractor.check()) return extractor(); } const boost::any python_to_any(const object& Value) { PyObject* const value = Value.ptr(); if(PyBool_Check(value)) return extract(Value)(); if(PyInt_Check(value)) return extract(Value)(); if(PyFloat_Check(value)) return extract(Value)(); if(PyString_Check(value)) return extract(Value)(); safe_extract(k3d::filesystem::path, Value); safe_extract(k3d::angle_axis, Value); safe_extract(k3d::color, Value); safe_extract(k3d::point2, Value); safe_extract(k3d::point3, Value); safe_extract(k3d::normal3, Value); safe_extract(k3d::texture3, Value); safe_extract(k3d::vector3, Value); safe_extract(k3d::point4, Value); safe_extract(k3d::matrix4, Value); safe_extract(k3d::euler_angles, Value); safe_extract(k3d::selection::set, Value); safe_extract(k3d::bounding_box3, Value); { extract value(Value); if(value.check()) return boost::any(value().wrapped_ptr()); } { extract value(Value); if(value.check()) return boost::any(value().wrapped_ptr()); } { extract value(Value); if(value.check()) { std::vector results; boost::python::list list = value(); for(int i = 0; i != boost::python::len(list); ++i) results.push_back(python_to_any(list[i])); return results; } } throw std::invalid_argument("can't convert unrecognized python value"); } template static DestinationT from_sequence(const object& Value) { const k3d::uint_t size = boost::python::len(Value); if(size != Size) throw std::invalid_argument("Sequence must be of length " + k3d::string_cast(Size)); DestinationT destination; for(k3d::uint_t i = 0; i != size; ++i) destination[i] = boost::python::extract(Value[i]); return destination; } const boost::any python_to_any(const object& Value, const std::type_info& TargetType) { PyObject* const value = Value.ptr(); if(TargetType == typeid(bool)) return boost::any(PyObject_IsTrue(value) ? true : false); if(TargetType == typeid(int)) { return_val_if_fail(PyInt_Check(value), boost::any()); return boost::any(static_cast(PyInt_AsLong(value))); } if(TargetType == typeid(long)) { if(PyInt_Check(value)) return boost::any(static_cast(PyInt_AsLong(value))); if(PyLong_Check(value)) return boost::any(static_cast(PyLong_AsLong(value))); throw std::invalid_argument("can't convert Python value to long"); } if(TargetType == typeid(unsigned long)) return boost::any(extract(Value)()); if(TargetType == typeid(double)) { if(PyFloat_Check(value)) return boost::any(PyFloat_AsDouble(value)); if(PyInt_Check(value)) return boost::any(static_cast(PyInt_AsLong(value))); if(PyLong_Check(value)) return boost::any(static_cast(PyLong_AsLong(value))); throw std::invalid_argument("can't convert Python value to double"); } if(TargetType == typeid(std::string)) { return_val_if_fail(PyString_Check(value), boost::any()); return boost::any(std::string(PyString_AsString(value))); } if(TargetType == typeid(filesystem::path)) return boost::any(extract(Value)()); if(TargetType == typeid(k3d::angle_axis)) return boost::any(extract(Value)()); if(TargetType == typeid(k3d::color)) return boost::any(extract(Value)()); if(TargetType == typeid(k3d::point3)) return boost::any(from_sequence(Value)); if(TargetType == typeid(k3d::point4)) return boost::any(from_sequence(Value)); if(TargetType == typeid(k3d::normal3)) return boost::any(from_sequence(Value)); if(TargetType == typeid(k3d::vector3)) return boost::any(from_sequence(Value)); if(TargetType == typeid(k3d::texture3)) return boost::any(from_sequence(Value)); if(TargetType == typeid(k3d::matrix4)) return boost::any(extract(Value)()); if(TargetType == typeid(k3d::selection::set)) return boost::any(extract(Value)()); if(TargetType == typeid(k3d::bounding_box3)) return boost::any(extract(Value)()); if(TargetType == typeid(k3d::inode*)) { if(Value == boost::python::object()) return boost::any(static_cast(0)); extract node(Value); if(node.check()) return boost::any(node().wrapped_ptr()); return boost::any(static_cast(0)); } if(TargetType == typeid(const k3d::bitmap*)) return boost::any(extract(Value)().wrapped_ptr()); if(TargetType == typeid(k3d::bitmap*)) return boost::any(extract(Value)().wrapped_ptr()); if(TargetType == typeid(std::vector)) { std::vector results; boost::python::list nodes = extract(Value); const k3d::uint_t count = boost::python::len(nodes); results.resize(count); for(k3d::uint_t i = 0; i != count; ++i) results[i] = &dynamic_cast(extract(nodes[i])().wrapped()); return boost::any(results); } if(TargetType == typeid(k3d::typed_array)) { k3d::typed_array results; boost::python::list values = extract(Value); const k3d::uint_t count = boost::python::len(values); results.resize(count); for(k3d::uint_t i = 0; i != count; ++i) { results[i] = extract(values[i])(); } return boost::any(results); } throw std::invalid_argument("Can't convert Python value to unrecognized type [" + demangle(TargetType) + "]"); } const ustring python_to_ustring(const boost::python::object& Value) { if(PyString_Check(Value.ptr())) { return ustring::from_utf8(PyString_AsString(Value.ptr())); } else if(PyUnicode_Check(Value.ptr())) { return ustring::from_utf8(PyString_AsString(Value.attr("encode")("UTF-8").ptr())); } throw std::invalid_argument("Can't convert Python value to a Unicode string."); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/any_python.h ================================================ #ifndef K3DSDK_PYTHON_ANY_PYTHON_H #define K3DSDK_PYTHON_ANY_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace python { /// Converts a boost::any object to a Python object const boost::python::object any_to_python(const boost::any& Value); /// Converts a Python value to a boost::any object const boost::any python_to_any(const boost::python::object& Value); /// Converts a Python value to a boost::any object, with the target type explicitly specified const boost::any python_to_any(const boost::python::object& Value, const std::type_info& TargetType); /// Converts a Python value to a Unicode string const ustring python_to_ustring(const boost::python::object& Value); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_ANY_PYTHON_H ================================================ FILE: k3dsdk/python/atk_python.cpp ================================================ // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { namespace detail { boost::python::object wrap(AtkObject* Object); /// Converts the given string to a name suitable as Python function name /** * TODO: Move this to the SDK, so the conversion is always consistent? */ const k3d::string_t script_name(const k3d::string_t& Name) { return boost::replace_all_copy(Name, " ", "_"); } const k3d::int32_t action_index(AtkAction* Action, const k3d::string_t& ActionName) { return_val_if_fail(Action, -1); for(k3d::uint_t i = 0; i != atk_action_get_n_actions(Action); ++i) { if(std::string(atk_action_get_name(Action, i)) == ActionName) return i; } return -1; } /// Performs the action with the given name. Requires Self to be an AtkAction and the action must exist (caller needs to check this) k3d::bool_t do_named_action(atk_object_wrapper& Self, const k3d::string_t& ActionName) { AtkObject* atk_object = Self.wrapped_ptr(); return_val_if_fail(ATK_IS_ACTION(atk_object), false); AtkAction* action = ATK_ACTION(atk_object); k3d::int32_t action_idx = action_index(action, ActionName); return_val_if_fail(action_idx > -1, false); k3d::bool_t result = atk_action_do_action(action, action_idx); k3d::user_interface().synchronize(); return result; } /// Proxy for click action static void click(atk_object_wrapper& Self) { do_named_action(Self, "click"); } k3d::bool_t has_action(AtkObject* Object, const k3d::string_t& ActionName) { if(!ATK_IS_ACTION(Object)) return false; return action_index(ATK_ACTION(Object), ActionName) > -1; } void define_action_methods(AtkObject* Object, boost::python::object& Instance) { if(ATK_IS_ACTION(Object)) { if(has_action(Object, "click")) { utility::add_method(utility::make_function(&click, ""), "click", Instance); } } } /// Get the item with role Role and name Key static object get_item_name(atk_object_wrapper& Self, const string_t& Key, const AtkRole Role) { AtkObject* atk_obj = Self.wrapped_ptr(); AtkObject* found = 0; for(k3d::uint_t i = 0; i != atk_object_get_n_accessible_children(atk_obj); ++i) { AtkObject* child = atk_object_ref_accessible_child(atk_obj, i); const gchar* name_ptr = atk_object_get_name(child); const k3d::string_t name_str(name_ptr ? name_ptr : ""); if(name_str == Key && atk_object_get_role(child) == Role) { if(found) throw std::runtime_error("Duplicate value for key: " + Key); found = child; } } if(!found) throw std::runtime_error("unknown key: " + Key); return wrap(found); } /// Get the item with index Key and role Role, with indices counted within children of the same type static object get_item_idx(atk_object_wrapper& Self, const k3d::uint_t Key, const AtkRole Role) { AtkObject* atk_obj = Self.wrapped_ptr(); const k3d::uint_t child_count = atk_object_get_n_accessible_children(atk_obj); if(Key >= child_count) throw std::runtime_error("index out of range: " + Key); k3d::uint_t idx = 0; for(k3d::uint_t i = 0; i != child_count; ++i) { AtkObject* child = atk_object_ref_accessible_child(atk_obj, i); if(atk_object_get_role(child) == Role) { if(idx == Key) return wrap(child); ++idx; } } std::stringstream error; error << "No child with role " << atk_role_get_name(Role) << " at index " << Key; throw std::runtime_error(error.str()); } template static object get_item(atk_object_wrapper& Self, object Key) { if(PyString_Check(Key.ptr())) return get_item_name(Self, boost::python::extract(Key), static_cast(Role::value)); else if(PyInt_Check(Key.ptr())) return get_item_idx(Self, boost::python::extract(Key), static_cast(Role::value)); else throw std::runtime_error("Item lookup key must be a string or an integer"); } class role_method_creator { public: role_method_creator(boost::python::object& Instance) : m_instance(Instance) { } template void operator()(T RoleIdx) { const string_t role_name(atk_role_get_name(static_cast(RoleIdx.value))); const string_t function_name(script_name(role_name)); const string_t doc1 = "Get a " + role_name + " by name."; const string_t doc2 = "Get a " + role_name + " by index."; utility::add_method(utility::make_function(&get_item, doc1.c_str()), function_name, m_instance); } private: boost::python::object& m_instance; }; /// Wrap an AtkObject, adding additional dynamic methods for any actions it may have boost::python::object wrap(AtkObject* Object) { boost::python::object wrapped = k3d::python::wrap(Object); role_method_creator creator(wrapped); boost::mpl::for_each >(creator); define_action_methods(Object, wrapped); return wrapped; } } // namespace detail static k3d::string_t name(atk_object_wrapper& Self) { const gchar* the_name = atk_object_get_name(Self.wrapped_ptr()); if(!the_name) return ""; return k3d::string_t(the_name); } class atk { public: static object root() { return detail::wrap(atk_get_root()); } }; void define_class_atk_object() { scope outer = class_("atk", no_init) .def("root", &atk::root, "Returns the root ATK object for the K-3D application") .staticmethod("root"); class_("object", "Wraps an ATK object", no_init) .def("name", &name, "Get the name of the ATK object"); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/atk_python.h ================================================ #ifndef K3DSDK_PYTHON_ATK_PYTHON_H #define K3DSDK_PYTHON_ATK_PYTHON_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Bart Janssens */ #include #include #include namespace k3d { namespace python { /// We use ATK and not ATKMM, since the latter only gets a Glib::RefPtr to AtkObject, which causes problems with Python wrapping typedef instance_wrapper atk_object_wrapper; void define_class_atk_object(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_ATK_PYTHON_H ================================================ FILE: k3dsdk/python/bezier_triangle_patch_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class bezier_triangle_patch { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object patch_first_points(wrapper& Self) { return wrap(Self.wrapped().patch_first_points); } static object patch_orders(wrapper& Self) { return wrap(Self.wrapped().patch_orders); } static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); } static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); } static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); } static object patch_point_weights(wrapper& Self) { return wrap(Self.wrapped().patch_point_weights); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object patch_first_points(wrapper& Self) { return wrap(Self.wrapped().patch_first_points); } static object patch_orders(wrapper& Self) { return wrap(Self.wrapped().patch_orders); } static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); } static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); } static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); } static object patch_point_weights(wrapper& Self) { return wrap(Self.wrapped().patch_point_weights); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::bezier_triangle_patch::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::bezier_triangle_patch::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::bezier_triangle_patch::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_bezier_triangle_patch() { scope outer = class_("bezier_triangle_patch", no_init) .def("create", &bezier_triangle_patch::create) .staticmethod("create") .def("validate", &bezier_triangle_patch::validate) .def("validate", &bezier_triangle_patch::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("patch_first_points", &bezier_triangle_patch::const_primitive::patch_first_points) .def("patch_orders", &bezier_triangle_patch::const_primitive::patch_orders) .def("patch_selections", &bezier_triangle_patch::const_primitive::patch_selections) .def("patch_materials", &bezier_triangle_patch::const_primitive::patch_materials) .def("patch_points", &bezier_triangle_patch::const_primitive::patch_points) .def("patch_point_weights", &bezier_triangle_patch::const_primitive::patch_point_weights) .def("constant_attributes", &bezier_triangle_patch::const_primitive::constant_attributes) .def("patch_attributes", &bezier_triangle_patch::const_primitive::patch_attributes) .def("parameter_attributes", &bezier_triangle_patch::const_primitive::parameter_attributes) .def("vertex_attributes", &bezier_triangle_patch::const_primitive::vertex_attributes) ; class_("primitive", no_init) .def("patch_first_points", &bezier_triangle_patch::primitive::patch_first_points) .def("patch_orders", &bezier_triangle_patch::primitive::patch_orders) .def("patch_selections", &bezier_triangle_patch::primitive::patch_selections) .def("patch_materials", &bezier_triangle_patch::primitive::patch_materials) .def("patch_points", &bezier_triangle_patch::primitive::patch_points) .def("patch_point_weights", &bezier_triangle_patch::primitive::patch_point_weights) .def("constant_attributes", &bezier_triangle_patch::primitive::constant_attributes) .def("patch_attributes", &bezier_triangle_patch::primitive::patch_attributes) .def("parameter_attributes", &bezier_triangle_patch::primitive::parameter_attributes) .def("vertex_attributes", &bezier_triangle_patch::primitive::vertex_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/bezier_triangle_patch_python.h ================================================ #ifndef K3DSDK_PYTHON_BEZIER_TRIANGLE_PATCH_PYTHON_H #define K3DSDK_PYTHON_BEZIER_TRIANGLE_PATCH_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_bezier_triangle_patch(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_BEZIER_TRIANGLE_PATCH_PYTHON_H ================================================ FILE: k3dsdk/python/bicubic_patch_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class bicubic_patch { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); } static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); } static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); } static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); } static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::bicubic_patch::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::bicubic_patch::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::bicubic_patch::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_bicubic_patch() { scope outer = class_("bicubic_patch", no_init) .def("create", &bicubic_patch::create) .staticmethod("create") .def("validate", &bicubic_patch::validate) .def("validate", &bicubic_patch::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("patch_selections", &bicubic_patch::const_primitive::patch_selections) .def("patch_materials", &bicubic_patch::const_primitive::patch_materials) .def("patch_points", &bicubic_patch::const_primitive::patch_points) .def("constant_attributes", &bicubic_patch::const_primitive::constant_attributes) .def("patch_attributes", &bicubic_patch::const_primitive::patch_attributes) .def("parameter_attributes", &bicubic_patch::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("patch_selections", &bicubic_patch::primitive::patch_selections) .def("patch_materials", &bicubic_patch::primitive::patch_materials) .def("patch_points", &bicubic_patch::primitive::patch_points) .def("constant_attributes", &bicubic_patch::primitive::constant_attributes) .def("patch_attributes", &bicubic_patch::primitive::patch_attributes) .def("parameter_attributes", &bicubic_patch::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/bicubic_patch_python.h ================================================ #ifndef K3DSDK_PYTHON_BICUBIC_PATCH_PYTHON_H #define K3DSDK_PYTHON_BICUBIC_PATCH_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_bicubic_patch(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_BICUBIC_PATCH_PYTHON_H ================================================ FILE: k3dsdk/python/bilinear_patch_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class bilinear_patch { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); } static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); } static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); } static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); } static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::bilinear_patch::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::bilinear_patch::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::bilinear_patch::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_bilinear_patch() { scope outer = class_("bilinear_patch", no_init) .def("create", &bilinear_patch::create) .staticmethod("create") .def("validate", &bilinear_patch::validate) .def("validate", &bilinear_patch::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("patch_selections", &bilinear_patch::const_primitive::patch_selections) .def("patch_materials", &bilinear_patch::const_primitive::patch_materials) .def("patch_points", &bilinear_patch::const_primitive::patch_points) .def("constant_attributes", &bilinear_patch::const_primitive::constant_attributes) .def("patch_attributes", &bilinear_patch::const_primitive::patch_attributes) .def("parameter_attributes", &bilinear_patch::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("patch_selections", &bilinear_patch::primitive::patch_selections) .def("patch_materials", &bilinear_patch::primitive::patch_materials) .def("patch_points", &bilinear_patch::primitive::patch_points) .def("constant_attributes", &bilinear_patch::primitive::constant_attributes) .def("patch_attributes", &bilinear_patch::primitive::patch_attributes) .def("parameter_attributes", &bilinear_patch::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/bilinear_patch_python.h ================================================ #ifndef K3DSDK_PYTHON_BILINEAR_PATCH_PYTHON_H #define K3DSDK_PYTHON_BILINEAR_PATCH_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_bilinear_patch(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_BILINEAR_PATCH_PYTHON_H ================================================ FILE: k3dsdk/python/bitmap_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static void assign(bitmap_wrapper& Self, bitmap_wrapper& RHS) { Self.wrapped() = RHS.wrapped(); } static void assign_const(bitmap_wrapper& Self, const_bitmap_wrapper& RHS) { Self.wrapped() = RHS.wrapped(); } static void reset(bitmap_wrapper& Self, const unsigned long Width, const unsigned long Height) { k3d::bitmap temp(Width, Height); Self.wrapped().swap(temp); } static tuple get_pixel(bitmap_wrapper& Self, const unsigned long X, const unsigned long Y) { if(X >= Self.wrapped().width()) throw std::invalid_argument("X value out-of-range"); if(Y >= Self.wrapped().height()) throw std::invalid_argument("Y value out-of-range"); const k3d::bitmap::view_t& bitmap = boost::gil::view(Self.wrapped()); k3d::pixel& pixel = bitmap(X, Y); return boost::python::make_tuple( boost::gil::get_color(pixel, boost::gil::red_t()), boost::gil::get_color(pixel, boost::gil::green_t()), boost::gil::get_color(pixel, boost::gil::blue_t()), boost::gil::get_color(pixel, boost::gil::alpha_t())); } static void set_pixel(bitmap_wrapper& Self, const unsigned long X, const unsigned long Y, const tuple& Pixel) { if(X >= Self.wrapped().width()) throw std::invalid_argument("X value out-of-range"); if(Y >= Self.wrapped().height()) throw std::invalid_argument("Y value out-of-range"); if(len(Pixel) != 4) throw std::invalid_argument("Pixel argument must be a 4-tuple"); const k3d::bitmap::view_t& bitmap = boost::gil::view(Self.wrapped()); k3d::pixel& pixel = bitmap(X, Y); pixel = k3d::pixel( boost::python::extract(Pixel[0])(), boost::python::extract(Pixel[1])(), boost::python::extract(Pixel[2])(), boost::python::extract(Pixel[3])()); } static const unsigned long width(bitmap_wrapper& Self) { return Self.wrapped().width(); } static const unsigned long height(bitmap_wrapper& Self) { return Self.wrapped().height(); } void define_class_bitmap() { class_("bitmap", "Stores a two-dimensional half-precision floating-point RGBA bitmap image.") .def("assign", &assign, "Replaces the current contents with a copy of the given bitmap.\n\n" ">>> mycopy.assign(myoriginal)\n\n") .def("assign", &assign_const, "Replaces the current contents with a copy of the given bitmap.\n\n" ">>> mycopy.assign(myoriginal)\n\n") .def("reset", &reset, "Replaces the current contents with an uninitialized bitmap with the given dimensions.\n\n" ">>> mybitmap.reset(640, 480)\n\n") .def("width", &width, "Returns the width of the image in pixels.") .def("height", &height, "Returns the height of the image in pixels.") .def("get_pixel", &get_pixel) .def("set_pixel", &set_pixel) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/bitmap_python.h ================================================ #ifndef K3DSDK_PYTHON_BITMAP_PYTHON_H #define K3DSDK_PYTHON_BITMAP_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper bitmap_wrapper; void define_class_bitmap(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_BITMAP_PYTHON_H ================================================ FILE: k3dsdk/python/blobby_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class blobby { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object first_primitives(wrapper& Self) { return wrap(Self.wrapped().first_primitives); } static object primitive_counts(wrapper& Self) { return wrap(Self.wrapped().primitive_counts); } static object first_operators(wrapper& Self) { return wrap(Self.wrapped().first_operators); } static object operator_counts(wrapper& Self) { return wrap(Self.wrapped().operator_counts); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object primitives(wrapper& Self) { return wrap(Self.wrapped().primitives); } static object primitive_first_floats(wrapper& Self) { return wrap(Self.wrapped().primitive_first_floats); } static object primitive_float_counts(wrapper& Self) { return wrap(Self.wrapped().primitive_float_counts); } static object operators(wrapper& Self) { return wrap(Self.wrapped().operators); } static object operator_first_operands(wrapper& Self) { return wrap(Self.wrapped().operator_first_operands); } static object operator_operand_counts(wrapper& Self) { return wrap(Self.wrapped().operator_operand_counts); } static object floats(wrapper& Self) { return wrap(Self.wrapped().floats); } static object operands(wrapper& Self) { return wrap(Self.wrapped().operands); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object first_primitives(wrapper& Self) { return wrap(Self.wrapped().first_primitives); } static object primitive_counts(wrapper& Self) { return wrap(Self.wrapped().primitive_counts); } static object first_operators(wrapper& Self) { return wrap(Self.wrapped().first_operators); } static object operator_counts(wrapper& Self) { return wrap(Self.wrapped().operator_counts); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object primitives(wrapper& Self) { return wrap(Self.wrapped().primitives); } static object primitive_first_floats(wrapper& Self) { return wrap(Self.wrapped().primitive_first_floats); } static object primitive_float_counts(wrapper& Self) { return wrap(Self.wrapped().primitive_float_counts); } static object operators(wrapper& Self) { return wrap(Self.wrapped().operators); } static object operator_first_operands(wrapper& Self) { return wrap(Self.wrapped().operator_first_operands); } static object operator_operand_counts(wrapper& Self) { return wrap(Self.wrapped().operator_operand_counts); } static object floats(wrapper& Self) { return wrap(Self.wrapped().floats); } static object operands(wrapper& Self) { return wrap(Self.wrapped().operands); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::blobby::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::blobby::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::blobby::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_blobby() { scope outer = class_("blobby", no_init) .def("create", &blobby::create) .staticmethod("create") .def("validate", &blobby::validate) .def("validate", &blobby::validate_const) .staticmethod("validate") ; enum_("primitive_type") .value("CONSTANT", k3d::blobby::CONSTANT) .value("ELLIPSOID", k3d::blobby::ELLIPSOID) .value("SEGMENT", k3d::blobby::SEGMENT) .attr("__module__") = "k3d"; enum_("operator_type") .value("ADD", k3d::blobby::ADD) .value("MULTIPLY", k3d::blobby::MULTIPLY) .value("MAXIMUM", k3d::blobby::MAXIMUM) .value("MINIMUM", k3d::blobby::MINIMUM) .value("SUBTRACT", k3d::blobby::SUBTRACT) .value("DIVIDE", k3d::blobby::DIVIDE) .value("NEGATE", k3d::blobby::NEGATE) .value("IDENTITY", k3d::blobby::IDENTITY) .attr("__module__") = "k3d"; class_("const_primitive", no_init) .def("first_primitives", &blobby::const_primitive::first_primitives) .def("primitive_counts", &blobby::const_primitive::primitive_counts) .def("first_operators", &blobby::const_primitive::first_operators) .def("operator_counts", &blobby::const_primitive::operator_counts) .def("materials", &blobby::const_primitive::materials) .def("primitives", &blobby::const_primitive::primitives) .def("primitive_first_floats", &blobby::const_primitive::primitive_first_floats) .def("primitive_float_counts", &blobby::const_primitive::primitive_float_counts) .def("operators", &blobby::const_primitive::operators) .def("operator_first_operands", &blobby::const_primitive::operator_first_operands) .def("operator_operand_counts", &blobby::const_primitive::operator_operand_counts) .def("floats", &blobby::const_primitive::floats) .def("operands", &blobby::const_primitive::operands) .def("constant_attributes", &blobby::const_primitive::constant_attributes) .def("surface_attributes", &blobby::const_primitive::surface_attributes) .def("parameter_attributes", &blobby::const_primitive::parameter_attributes) .def("vertex_attributes", &blobby::const_primitive::vertex_attributes) ; class_("primitive", no_init) .def("first_primitives", &blobby::primitive::first_primitives) .def("primitive_counts", &blobby::primitive::primitive_counts) .def("first_operators", &blobby::primitive::first_operators) .def("operator_counts", &blobby::primitive::operator_counts) .def("materials", &blobby::primitive::materials) .def("primitives", &blobby::primitive::primitives) .def("primitive_first_floats", &blobby::primitive::primitive_first_floats) .def("primitive_float_counts", &blobby::primitive::primitive_float_counts) .def("operators", &blobby::primitive::operators) .def("operator_first_operands", &blobby::primitive::operator_first_operands) .def("operator_operand_counts", &blobby::primitive::operator_operand_counts) .def("floats", &blobby::primitive::floats) .def("operands", &blobby::primitive::operands) .def("constant_attributes", &blobby::primitive::constant_attributes) .def("surface_attributes", &blobby::primitive::surface_attributes) .def("parameter_attributes", &blobby::primitive::parameter_attributes) .def("vertex_attributes", &blobby::primitive::vertex_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/blobby_python.h ================================================ #ifndef K3DSDK_PYTHON_BLOBBY_PYTHON_H #define K3DSDK_PYTHON_BLOBBY_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_blobby(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_BLOBBY_PYTHON_H ================================================ FILE: k3dsdk/python/bounding_box3_python.cpp ================================================ // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include using namespace boost::python; #include namespace k3d { namespace python { void define_class_bounding_box3() { class_("bounding_box3", "Stores a three-dimensional bounding box.") .def(init()) .def("empty", &k3d::bounding_box3::empty, "Returns True if the bounding box is empty.\n\n" "@note: An empty bounding box has a non-existent volume, " "whereas a bounding box that contains a single point will have zero volume.") .def("width", &k3d::bounding_box3::width, "Returns the width of the bounding box (its dimension along X).") .def("height", &k3d::bounding_box3::height, "Returns the height of the bounding box (its dimension along Y).") .def("depth", &k3d::bounding_box3::depth, "Returns the depth of the bounding box (its dimension along Z).") .def(self == self) .def(self != self) .def(self_ns::str(self)); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/bounding_box3_python.h ================================================ #ifndef K3DSDK_PYTHON_BOUNDING_BOX3_PYTHON_H #define K3DSDK_PYTHON_BOUNDING_BOX3_PYTHON_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_bounding_box3(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_BOUNDING_BOX3_PYTHON_H ================================================ FILE: k3dsdk/python/color_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include using namespace boost::python; namespace k3d { namespace python { void define_class_color() { class_("color", "Stores a color using half-precision floating-point RGB values.\n\n" "@note: The values [0, 1] are mapped to the values [0, 255] in integer color types. " "Values outside the range [0, 1] are explicitly allowed.") .def(init()) .def_readwrite("red", &k3d::color::red, "Stores red component of the color.") .def_readwrite("green", &k3d::color::green, "Stores green component of the color.") .def_readwrite("blue", &k3d::color::blue, "Stores blue component of the color.") .def(self + self) .def(self - self) .def(self * double()) .def(double() * self) .def(self == self) .def(self != self) .def(self_ns::str(self)); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/color_python.h ================================================ #ifndef K3DSDK_PYTHON_COLOR_PYTHON_H #define K3DSDK_PYTHON_COLOR_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_color(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_COLOR_PYTHON_H ================================================ FILE: k3dsdk/python/cone_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class cone { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object heights(wrapper& Self) { return wrap(Self.wrapped().heights); } static object radii(wrapper& Self) { return wrap(Self.wrapped().radii); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object heights(wrapper& Self) { return wrap(Self.wrapped().heights); } static object radii(wrapper& Self) { return wrap(Self.wrapped().radii); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::cone::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::cone::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::cone::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_cone() { scope outer = class_("cone", no_init) .def("create", &cone::create) .staticmethod("create") .def("validate", &cone::validate) .def("validate", &cone::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("matrices", &cone::const_primitive::matrices) .def("materials", &cone::const_primitive::materials) .def("heights", &cone::const_primitive::heights) .def("radii", &cone::const_primitive::radii) .def("sweep_angles", &cone::const_primitive::sweep_angles) .def("selections", &cone::const_primitive::selections) .def("constant_attributes", &cone::const_primitive::constant_attributes) .def("surface_attributes", &cone::const_primitive::surface_attributes) .def("parameter_attributes", &cone::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("matrices", &cone::primitive::matrices) .def("materials", &cone::primitive::materials) .def("heights", &cone::primitive::heights) .def("radii", &cone::primitive::radii) .def("sweep_angles", &cone::primitive::sweep_angles) .def("selections", &cone::primitive::selections) .def("constant_attributes", &cone::primitive::constant_attributes) .def("surface_attributes", &cone::primitive::surface_attributes) .def("parameter_attributes", &cone::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/cone_python.h ================================================ #ifndef K3DSDK_PYTHON_CONE_PYTHON_H #define K3DSDK_PYTHON_CONE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_cone(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_CONE_PYTHON_H ================================================ FILE: k3dsdk/python/const_bitmap_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static tuple get_pixel(const_bitmap_wrapper& Self, const unsigned long X, const unsigned long Y) { if(X >= Self.wrapped().width()) throw std::invalid_argument("X value out-of-range"); if(Y >= Self.wrapped().height()) throw std::invalid_argument("Y value out-of-range"); const k3d::bitmap::const_view_t& bitmap = boost::gil::const_view(Self.wrapped()); const k3d::pixel& pixel = bitmap(X, Y); return boost::python::make_tuple( boost::gil::get_color(pixel, boost::gil::red_t()), boost::gil::get_color(pixel, boost::gil::green_t()), boost::gil::get_color(pixel, boost::gil::blue_t()), boost::gil::get_color(pixel, boost::gil::alpha_t())); } static const unsigned long width(const_bitmap_wrapper& Self) { return Self.wrapped().width(); } static const unsigned long height(const_bitmap_wrapper& Self) { return Self.wrapped().height(); } void define_class_const_bitmap() { class_("const_bitmap", "Stores a two-dimensional half-precision floating-point RGBA bitmap image.", no_init) .def("width", &width, "Returns the width of the image in pixels.") .def("height", &height, "Returns the height of the image in pixels.") .def("get_pixel", &get_pixel) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/const_bitmap_python.h ================================================ #ifndef K3DSDK_PYTHON_CONST_BITMAP_PYTHON_H #define K3DSDK_PYTHON_CONST_BITMAP_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper const_bitmap_wrapper; void define_class_const_bitmap(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_CONST_BITMAP_PYTHON_H ================================================ FILE: k3dsdk/python/const_named_arrays_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static list keys(const_named_arrays_wrapper& Self) { list results; for(k3d::named_arrays::const_iterator array = Self.wrapped().begin(); array != Self.wrapped().end(); ++array) results.append(array->first); return results; } static object get_item(const_named_arrays_wrapper& Self, const string_t& Key) { k3d::named_arrays::const_iterator iterator = Self.wrapped().find(Key); if(iterator == Self.wrapped().end()) throw std::runtime_error("unknown key: " + Key); return wrap_array(iterator->second.get()); } void define_class_const_named_arrays() { class_("const_named_arrays", "Stores an immutable (read-only) collection of named arrays (with unrelated lengths).", no_init) .def("keys", &keys, "Returns a list containing names for all the arrays in the collection.") .def("__len__", &utility::wrapped_len) .def("__getitem__", &get_item); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/const_named_arrays_python.h ================================================ #ifndef K3DSDK_PYTHON_CONST_NAMED_ARRAYS_PYTHON_H #define K3DSDK_PYTHON_CONST_NAMED_ARRAYS_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper const_named_arrays_wrapper; void define_class_const_named_arrays(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_CONST_NAMED_ARRAYS_PYTHON_H ================================================ FILE: k3dsdk/python/const_named_tables_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include using namespace boost::python; namespace k3d { namespace python { static object const_named_tables_get_item(const_named_tables_wrapper& Self, int Item) { if(Item < 0 || Item >= Self.wrapped().size()) throw std::out_of_range("index out-of-range"); k3d::named_tables::const_iterator item(Self.wrapped().begin()); std::advance(item, Item); return wrap(item->second); } static list keys(const_named_tables_wrapper& Self) { list results; for(k3d::named_tables::const_iterator table = Self.wrapped().begin(); table != Self.wrapped().end(); ++table) results.append(table->first); return results; } /////////////////////////////////////////////////////////////////////////////////////////////////// // define_class_const_named_tables void define_class_const_named_tables() { class_("const_named_tables", no_init) .def("__len__", &utility::wrapped_len) .def("__getitem__", &utility::wrapped_get_wrapped_item_by_key) .def("__getitem__", &const_named_tables_get_item) .def("keys", &keys, "Returns a list containing names for all the tables in the collection.") ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/const_named_tables_python.h ================================================ #ifndef K3DSDK_PYTHON_CONST_NAMED_TABLES_PYTHON_H #define K3DSDK_PYTHON_CONST_NAMED_TABLES_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper const_named_tables_wrapper; void define_class_const_named_tables(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_CONST_NAMED_TABLES_PYTHON_H ================================================ FILE: k3dsdk/python/const_table_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static list keys(const_table_wrapper& Self) { list results; for(k3d::table::const_iterator array = Self.wrapped().begin(); array != Self.wrapped().end(); ++array) results.append(array->first); return results; } static object get_item1(const_table_wrapper& Self, const string_t& Key) { k3d::table::const_iterator iterator = Self.wrapped().find(Key); if(iterator == Self.wrapped().end()) throw std::runtime_error("unknown key: " + Key); return wrap_array(iterator->second.get()); } static object get_item2(const_table_wrapper& Self, int Item) { if(Item < 0 || Item >= Self.wrapped().column_count()) throw std::out_of_range("index out-of-range"); k3d::table::const_iterator iterator = Self.wrapped().begin(); std::advance(iterator, Item); return wrap_array(iterator->second.get()); } static uint_t row_count(const_table_wrapper& Self) { return Self.wrapped().row_count(); } void define_class_const_table() { class_("const_table", "Stores an immutable (read-only) collection of attribute arrays (named arrays with identical lengths).", no_init) .def("keys", &keys, "Returns a list containing names for all the arrays in the collection.") .def("__len__", &row_count) .def("__getitem__", &get_item1) .def("__getitem__", &get_item2) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/const_table_python.h ================================================ #ifndef K3DSDK_PYTHON_CONST_TABLE_PYTHON_H #define K3DSDK_PYTHON_CONST_TABLE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper const_table_wrapper; void define_class_const_table(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_CONST_TABLE_PYTHON_H ================================================ FILE: k3dsdk/python/const_typed_array_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include namespace k3d { namespace python { static boost::python::object get_item_imaterial(instance_wrapper >& Self, int Item) { if(Item < 0 || Item >= Self.wrapped().size()) throw std::out_of_range("index out-of-range"); return wrap(Self.wrapped().at(Item)); } static boost::python::object get_item_inode(instance_wrapper >& Self, int Item) { if(Item < 0 || Item >= Self.wrapped().size()) throw std::out_of_range("index out-of-range"); return wrap(Self.wrapped().at(Item)); } template static string_t get_metadata_value(const self_t& Self, const string_t& Name) { return Self.wrapped().get_metadata_value(Name); } template static const string_t array_str(const self_t& Self) { std::ostringstream buffer; buffer << Self.wrapped(); return buffer.str(); } template static boost::python::dict get_metadata(const self_t& Self) { boost::python::dict result; const array::metadata_t metadata = Self.wrapped().get_metadata(); for(array::metadata_t::const_iterator pair = metadata.begin(); pair != metadata.end(); ++pair) result[pair->first] = pair->second; return result; } ////////////////////////////////////////////////////////////////////////////////////////////// // define_class_const_typed_array template static void define_class_const_typed_array(const char* const ClassName, const char* const DocString) { typedef instance_wrapper wrapper_type; boost::python::class_(ClassName, DocString, boost::python::no_init) .def("__len__", &utility::wrapped_len) .def("__getitem__", &utility::wrapped_get_item) .def("__str__", &array_str) .def("get_metadata_value", &get_metadata_value) .def("get_metadata", &get_metadata) ; } template<> void define_class_const_typed_array >(const char* const ClassName, const char* const DocString) { typedef const k3d::typed_array array_type; typedef instance_wrapper wrapper_type; boost::python::class_(ClassName, DocString, boost::python::no_init) .def("__len__", &utility::wrapped_len) .def("__getitem__", &get_item_imaterial) .def("get_metadata_value", &get_metadata_value) .def("get_metadata", &get_metadata) ; } template<> void define_class_const_typed_array >(const char* const ClassName, const char* const DocString) { typedef const k3d::typed_array array_type; typedef instance_wrapper wrapper_type; boost::python::class_(ClassName, DocString, boost::python::no_init) .def("__len__", &utility::wrapped_len) .def("__getitem__", &get_item_inode) .def("get_metadata_value", &get_metadata_value) .def("get_metadata", &get_metadata) ; } ////////////////////////////////////////////////////////////////////////////////////////////// // const_typed_array_array_factory class const_typed_array_array_factory { public: const_typed_array_array_factory(const k3d::array& Input, boost::python::object& Output) : input(Input), output(Output) { output = boost::python::object(); if(const k3d::uint_t_array* const array = dynamic_cast(&input)) output = wrap(array); } template void operator()(T) const { if(output != boost::python::object()) return; typedef const k3d::typed_array array_type; if(array_type* const array = dynamic_cast(&input)) output = wrap(array); } private: const k3d::array& input; boost::python::object& output; }; ////////////////////////////////////////////////////////////////////////////////////////////// // wrap_array boost::python::object wrap_array(const k3d::array* Wrapped) { if(Wrapped) return wrap_array(*Wrapped); return boost::python::object(); } boost::python::object wrap_array(const k3d::array& Wrapped) { boost::python::object result; boost::mpl::for_each(const_typed_array_array_factory(Wrapped, result)); return result; } ////////////////////////////////////////////////////////////////////////////////////////////// // define_const_typed_array_classes void define_const_typed_array_classes() { define_class_const_typed_array >("const_typed_array_bool_t", "Stores an immutable (read-only) collection of boolean values."); define_class_const_typed_array >("const_typed_array_double_t", "Stores an immutable (read-only) collection of floating-point values."); define_class_const_typed_array >("const_typed_array_int8_t", "Stores an immutable (read-only) collection of 8-bit integer values."); define_class_const_typed_array >("const_typed_array_int16_t", "Stores an immutable (read-only) collection of 16-bit integer values."); define_class_const_typed_array >("const_typed_array_int32_t", "Stores an immutable (read-only) collection of 32-bit integer values."); define_class_const_typed_array >("const_typed_array_int64_t", "Stores an immutable (read-only) collection of 64-bit integer values."); define_class_const_typed_array >("const_typed_array_imaterial", "Stores an immutable (read-only) collection of L{imaterial} objects."); define_class_const_typed_array >("const_typed_array_inode", "Stores an immutable (read-only) collection of L{inode} objects."); define_class_const_typed_array >("const_typed_array_color", "Stores an immutable (read-only) collection of L{color} values."); define_class_const_typed_array >("const_typed_array_matrix4", "Stores an immutable (read-only) collection of L{matrix4} values."); define_class_const_typed_array >("const_typed_array_normal3", "Stores an immutable (read-only) collection of L{normal3} values."); define_class_const_typed_array >("const_typed_array_point2", "Stores an immutable (read-only) collection of L{point2} values."); define_class_const_typed_array >("const_typed_array_point3", "Stores an immutable (read-only) collection of L{point3} values."); define_class_const_typed_array >("const_typed_array_point4", "Stores an immutable (read-only) collection of L{point4} values."); define_class_const_typed_array >("const_typed_array_string_t", "Stores an immutable (read-only) collection of string values."); define_class_const_typed_array >("const_typed_array_texture3", "Stores an immutable (read-only) collection of L{texture3} values."); define_class_const_typed_array >("const_typed_array_uint8_t", "Stores an immutable (read-only) collection of unsigned 8-bit integer values."); define_class_const_typed_array >("const_typed_array_uint16_t", "Stores an immutable (read-only) collection of unsigned 16-bit integer values."); define_class_const_typed_array >("const_typed_array_uint32_t", "Stores an immutable (read-only) collection of unsigned 32-bit integer values."); define_class_const_typed_array >("const_typed_array_uint64_t", "Stores an immutable (read-only) collection of unsigned 64-bit integer values."); define_class_const_typed_array >("const_typed_array_vector2", "Stores an immutable (read-only) collection of L{vector2} values."); define_class_const_typed_array >("const_typed_array_vector3", "Stores an immutable (read-only) collection of L{vector3} values."); define_class_const_typed_array("const_uint_t_array", "Stores an immutable (read-only) collection of 32- or 64-bit values (depending on platform)."); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/const_typed_array_python.h ================================================ #ifndef K3DSDK_PYTHON_CONST_TYPED_ARRAY_PYTHON_H #define K3DSDK_PYTHON_CONST_TYPED_ARRAY_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { boost::python::object wrap_array(const k3d::array* Wrapped); boost::python::object wrap_array(const k3d::array& Wrapped); void define_const_typed_array_classes(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_CONST_TYPED_ARRAY_PYTHON_H ================================================ FILE: k3dsdk/python/cubic_curve_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class cubic_curve { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object periodic(wrapper& Self) { return wrap(Self.wrapped().periodic); } static object material(wrapper& Self) { return wrap(Self.wrapped().material); } static object curve_first_points(wrapper& Self) { return wrap(Self.wrapped().curve_first_points); } static object curve_point_counts(wrapper& Self) { return wrap(Self.wrapped().curve_point_counts); } static object curve_selections(wrapper& Self) { return wrap(Self.wrapped().curve_selections); } static object curve_points(wrapper& Self) { return wrap(Self.wrapped().curve_points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object curve_attributes(wrapper& Self) { return wrap(Self.wrapped().curve_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object periodic(wrapper& Self) { return wrap(Self.wrapped().periodic); } static object material(wrapper& Self) { return wrap(Self.wrapped().material); } static object curve_first_points(wrapper& Self) { return wrap(Self.wrapped().curve_first_points); } static object curve_point_counts(wrapper& Self) { return wrap(Self.wrapped().curve_point_counts); } static object curve_selections(wrapper& Self) { return wrap(Self.wrapped().curve_selections); } static object curve_points(wrapper& Self) { return wrap(Self.wrapped().curve_points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object curve_attributes(wrapper& Self) { return wrap(Self.wrapped().curve_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::cubic_curve::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::cubic_curve::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::cubic_curve::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_cubic_curve() { scope outer = class_("cubic_curve", no_init) .def("create", &cubic_curve::create) .staticmethod("create") .def("validate", &cubic_curve::validate) .def("validate", &cubic_curve::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("periodic", &cubic_curve::const_primitive::periodic) .def("material", &cubic_curve::const_primitive::material) .def("curve_first_points", &cubic_curve::const_primitive::curve_first_points) .def("curve_point_counts", &cubic_curve::const_primitive::curve_point_counts) .def("curve_selections", &cubic_curve::const_primitive::curve_selections) .def("curve_points", &cubic_curve::const_primitive::curve_points) .def("constant_attributes", &cubic_curve::const_primitive::constant_attributes) .def("curve_attributes", &cubic_curve::const_primitive::curve_attributes) .def("parameter_attributes", &cubic_curve::const_primitive::parameter_attributes) .def("vertex_attributes", &cubic_curve::const_primitive::vertex_attributes) ; class_("primitive", no_init) .def("periodic", &cubic_curve::primitive::periodic) .def("material", &cubic_curve::primitive::material) .def("curve_first_points", &cubic_curve::primitive::curve_first_points) .def("curve_point_counts", &cubic_curve::primitive::curve_point_counts) .def("curve_selections", &cubic_curve::primitive::curve_selections) .def("curve_points", &cubic_curve::primitive::curve_points) .def("constant_attributes", &cubic_curve::primitive::constant_attributes) .def("curve_attributes", &cubic_curve::primitive::curve_attributes) .def("parameter_attributes", &cubic_curve::primitive::parameter_attributes) .def("vertex_attributes", &cubic_curve::primitive::vertex_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/cubic_curve_python.h ================================================ #ifndef K3DSDK_PYTHON_CUBIC_CURVE_PYTHON_H #define K3DSDK_PYTHON_CUBIC_CURVE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_cubic_curve(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_CUBIC_CURVE_PYTHON_H ================================================ FILE: k3dsdk/python/cylinder_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class cylinder { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object radii(wrapper& Self) { return wrap(Self.wrapped().radii); } static object z_min(wrapper& Self) { return wrap(Self.wrapped().z_min); } static object z_max(wrapper& Self) { return wrap(Self.wrapped().z_max); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object radii(wrapper& Self) { return wrap(Self.wrapped().radii); } static object z_min(wrapper& Self) { return wrap(Self.wrapped().z_min); } static object z_max(wrapper& Self) { return wrap(Self.wrapped().z_max); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::cylinder::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::cylinder::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::cylinder::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_cylinder() { scope outer = class_("cylinder", no_init) .def("create", &cylinder::create) .staticmethod("create") .def("validate", &cylinder::validate) .def("validate", &cylinder::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("matrices", &cylinder::const_primitive::matrices) .def("materials", &cylinder::const_primitive::materials) .def("radii", &cylinder::const_primitive::radii) .def("z_min", &cylinder::const_primitive::z_min) .def("z_max", &cylinder::const_primitive::z_max) .def("sweep_angles", &cylinder::const_primitive::sweep_angles) .def("selections", &cylinder::const_primitive::selections) .def("constant_attributes", &cylinder::const_primitive::constant_attributes) .def("surface_attributes", &cylinder::const_primitive::surface_attributes) .def("parameter_attributes", &cylinder::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("matrices", &cylinder::primitive::matrices) .def("materials", &cylinder::primitive::materials) .def("radii", &cylinder::primitive::radii) .def("z_min", &cylinder::primitive::z_min) .def("z_max", &cylinder::primitive::z_max) .def("sweep_angles", &cylinder::primitive::sweep_angles) .def("selections", &cylinder::primitive::selections) .def("constant_attributes", &cylinder::primitive::constant_attributes) .def("surface_attributes", &cylinder::primitive::surface_attributes) .def("parameter_attributes", &cylinder::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/cylinder_python.h ================================================ #ifndef K3DSDK_PYTHON_CYLINDER_PYTHON_H #define K3DSDK_PYTHON_CYLINDER_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_cylinder(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_CYLINDER_PYTHON_H ================================================ FILE: k3dsdk/python/difference_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { class difference { public: static void const_mesh(const_mesh_wrapper& A, const_mesh_wrapper& B, k3d::difference::accumulator& Result) { k3d::difference::test(A.wrapped(), B.wrapped(), Result); } static void mesh(mesh_wrapper& A, mesh_wrapper& B, k3d::difference::accumulator& Result) { k3d::difference::test(A.wrapped(), B.wrapped(), Result); } static void matrix4(k3d::matrix4& A, k3d::matrix4& B, k3d::difference::accumulator& Result) { k3d::difference::test(A, B, Result); } static void const_points(instance_wrapper& A, instance_wrapper& B, k3d::difference::accumulator& Result) { A.wrapped().difference(B.wrapped(), Result); } static void points(instance_wrapper& A, instance_wrapper& B, k3d::difference::accumulator& Result) { A.wrapped().difference(B.wrapped(), Result); } static void points_list(instance_wrapper& A, list B, k3d::difference::accumulator& Result) { k3d::mesh::points_t b; utility::copy(B, b); A.wrapped().difference(b, Result); } static void const_points_list(instance_wrapper& A, list B, k3d::difference::accumulator& Result) { k3d::mesh::points_t b; utility::copy(B, b); A.wrapped().difference(b, Result); } }; static std::size_t exact_count(k3d::difference::accumulator& Self) { return boost::accumulators::count(Self.exact); } static k3d::bool_t exact_min(k3d::difference::accumulator& Self) { return boost::accumulators::min(Self.exact); } static k3d::bool_t exact_max(k3d::difference::accumulator& Self) { return boost::accumulators::max(Self.exact); } static std::size_t ulps_count(k3d::difference::accumulator& Self) { return boost::accumulators::count(Self.ulps); } static k3d::double_t ulps_min(k3d::difference::accumulator& Self) { return boost::accumulators::min(Self.ulps); } static k3d::double_t ulps_max(k3d::difference::accumulator& Self) { return boost::accumulators::max(Self.ulps); } static k3d::double_t ulps_mean(k3d::difference::accumulator& Self) { return boost::accumulators::mean(Self.ulps); } static k3d::double_t ulps_median(k3d::difference::accumulator& Self) { return boost::accumulators::median(Self.ulps); } //static k3d::double_t ulps_variance(k3d::difference::accumulator& Self) { return boost::accumulators::variance(Self.ulps); } //static k3d::double_t ulps_standard_deviation(k3d::difference::accumulator& Self) { return std::sqrt(boost::accumulators::variance(Self.ulps)); } void define_namespace_difference() { boost::python::scope outer = boost::python::class_("difference", boost::python::no_init) .def("test", &difference::const_mesh, "Computes the difference between two meshes using fuzzy-comparisons for floating-point types.") .def("test", &difference::mesh, "Computes the difference between two meshes using fuzzy-comparisons for floating-point types.") .def("test", &difference::matrix4, "Computes the difference between two matrices using fuzzy-comparisons for floating-point types.") .def("test", &difference::points, "Computes the difference between two point arrays using fuzzy-comparisons for floating-point types.") .def("test", &difference::const_points, "Computes the difference between two point arrays using fuzzy-comparisons for floating-point types.") .def("test", &difference::points_list, "Computes the difference between a point array and a list using fuzzy-comparisons for floating-point types.") .def("test", &difference::const_points_list, "Computes the difference between a point array and a list using fuzzy-comparisons for floating-point types.") .staticmethod("test") ; boost::python::class_("accumulator") .def("exact_count", &exact_count) .def("exact_min", &exact_min) .def("exact_max", &exact_max) .def("ulps_count", &ulps_count) .def("ulps_min", &ulps_min) .def("ulps_max", &ulps_max) .def("ulps_mean", &ulps_mean) .def("ulps_median", &ulps_median) //.def("ulps_variance", &ulps_variance) //.def("ulps_standard_deviation", &ulps_standard_deviation) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/difference_python.h ================================================ #ifndef K3DSDK_PYTHON_DIFFERENCE_PYTHON_H #define K3DSDK_PYTHON_DIFFERENCE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_difference(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_DIFFERENCE_PYTHON_H ================================================ FILE: k3dsdk/python/disk_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class disk { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object heights(wrapper& Self) { return wrap(Self.wrapped().heights); } static object radii(wrapper& Self) { return wrap(Self.wrapped().radii); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object heights(wrapper& Self) { return wrap(Self.wrapped().heights); } static object radii(wrapper& Self) { return wrap(Self.wrapped().radii); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::disk::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::disk::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::disk::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_disk() { scope outer = class_("disk", no_init) .def("create", &disk::create) .staticmethod("create") .def("validate", &disk::validate) .def("validate", &disk::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("matrices", &disk::const_primitive::matrices) .def("materials", &disk::const_primitive::materials) .def("heights", &disk::const_primitive::heights) .def("radii", &disk::const_primitive::radii) .def("sweep_angles", &disk::const_primitive::sweep_angles) .def("selections", &disk::const_primitive::selections) .def("constant_attributes", &disk::const_primitive::constant_attributes) .def("surface_attributes", &disk::const_primitive::surface_attributes) .def("parameter_attributes", &disk::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("matrices", &disk::primitive::matrices) .def("materials", &disk::primitive::materials) .def("heights", &disk::primitive::heights) .def("radii", &disk::primitive::radii) .def("sweep_angles", &disk::primitive::sweep_angles) .def("selections", &disk::primitive::selections) .def("constant_attributes", &disk::primitive::constant_attributes) .def("surface_attributes", &disk::primitive::surface_attributes) .def("parameter_attributes", &disk::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/disk_python.h ================================================ #ifndef K3DSDK_PYTHON_DISK_PYTHON_H #define K3DSDK_PYTHON_DISK_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_disk(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_DISK_PYTHON_H ================================================ FILE: k3dsdk/python/euler_angles_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { /* euler_angles::euler_angles(const k3d::euler_angles& EulerAngles) : base(EulerAngles) { } euler_angles::euler_angles(const euler_angles::AngleOrder Order, const double A, const double B, const double C) : base(radians(A), radians(B), radians(C), Order) { } const double euler_angles::getitem(const int Item) const { if(Item < 0 || Item > 2) throw std::out_of_range("index out-of-range"); return degrees((*this)[Item]); } void euler_angles::setitem(const int Item, const double Value) { if(Item < 0 || Item > 2) throw std::out_of_range("index out-of-range"); (*this)[Item] = radians(Value); } const std::string euler_angles::str() const { std::stringstream buffer; buffer << "(\""; switch(order) { case euler_angles::XYZstatic: buffer << "xyz"; break; case euler_angles::XYXstatic: buffer << "xyx"; break; case euler_angles::XZYstatic: buffer << "xzy"; break; case euler_angles::XZXstatic: buffer << "xzx"; break; case euler_angles::YZXstatic: buffer << "yzx"; break; case euler_angles::YZYstatic: buffer << "yzy"; break; case euler_angles::YXZstatic: buffer << "yxz"; break; case euler_angles::YXYstatic: buffer << "yxy"; break; case euler_angles::ZXYstatic: buffer << "zxy"; break; case euler_angles::ZXZstatic: buffer << "zxz"; break; case euler_angles::ZYXstatic: buffer << "zyx"; break; case euler_angles::ZYZstatic: buffer << "zyz"; break; case euler_angles::ZYXrotating: buffer << "zyx_rotating"; break; case euler_angles::XYXrotating : buffer << "xyx_rotating"; break; case euler_angles::YZXrotating: buffer << "yzx_rotating"; break; case euler_angles::XZXrotating : buffer << "xzx_rotating"; break; case euler_angles::XZYrotating: buffer << "xzy_rotating"; break; case euler_angles::YZYrotating : buffer << "yzy_rotating"; break; case euler_angles::ZXYrotating: buffer << "zxy_rotating"; break; case euler_angles::YXYrotating : buffer << "yxy_rotating"; break; case euler_angles::YXZrotating: buffer << "yxz_rotating"; break; case euler_angles::ZXZrotating : buffer << "zxz_rotating"; break; case euler_angles::XYZrotating: buffer << "xyz_rotating"; break; case euler_angles::ZYZrotating: buffer << "zyz_rotating"; break; } buffer << "\", " << degrees((*this)[0]) << ", " << degrees((*this)[1]) << ", " << degrees((*this)[2]); buffer << ")"; return buffer.str(); } */ const euler_angles euler_angles_add(const euler_angles& LHS, const euler_angles& RHS) { if(LHS.order != RHS.order) throw std::invalid_argument("argument order must match"); return k3d::euler_angles(LHS[0] + RHS[0], LHS[1] + RHS[1], LHS[2] + RHS[2], LHS.order); } const euler_angles euler_angles_mul(const euler_angles& LHS, const double_t RHS) { return k3d::euler_angles(LHS[0] * RHS, LHS[1] * RHS, LHS[2] * RHS, LHS.order); } const euler_angles euler_angles_rmul(const double_t LHS, const euler_angles& RHS) { return euler_angles_mul(RHS, LHS); } void define_class_euler_angles() { scope outer = class_("euler_angles", "Encodes a change in orientation as three rotations around mutally-perpendicular axes.", no_init) .def(init()) .def_readwrite("order", &k3d::euler_angles::order) .def("__len__", &utility::constant_len_len) .def("__getitem__", &utility::constant_len_get_item) .def("__setitem__", &utility::constant_len_set_item) .def("__add__", &euler_angles_add) .def("__mul__", &euler_angles_mul) .def("__rmul__", &euler_angles_rmul) .def(self_ns::str(self)) ; enum_("angle_order") .value("xyz", k3d::euler_angles::XYZstatic) .value("xyz", k3d::euler_angles::XYZstatic) .value("xyx", k3d::euler_angles::XYXstatic) .value("xzy", k3d::euler_angles::XZYstatic) .value("xzx", k3d::euler_angles::XZXstatic) .value("yzx", k3d::euler_angles::YZXstatic) .value("yzy", k3d::euler_angles::YZYstatic) .value("yxz", k3d::euler_angles::YXZstatic) .value("yxy", k3d::euler_angles::YXYstatic) .value("zxy", k3d::euler_angles::ZXYstatic) .value("zxz", k3d::euler_angles::ZXZstatic) .value("zyx", k3d::euler_angles::ZYXstatic) .value("zyz", k3d::euler_angles::ZYZstatic) .value("zyx_rotating", k3d::euler_angles::ZYXrotating) .value("xyx_rotating", k3d::euler_angles::XYXrotating) .value("yzx_rotating", k3d::euler_angles::YZXrotating) .value("xzx_rotating", k3d::euler_angles::XZXrotating) .value("xzy_rotating", k3d::euler_angles::XZYrotating) .value("yzy_rotating", k3d::euler_angles::YZYrotating) .value("zxy_rotating", k3d::euler_angles::ZXYrotating) .value("yxy_rotating", k3d::euler_angles::YXYrotating) .value("yxz_rotating", k3d::euler_angles::YXZrotating) .value("zxz_rotating", k3d::euler_angles::ZXZrotating) .value("xyz_rotating", k3d::euler_angles::XYZrotating) .value("zyz_rotating", k3d::euler_angles::ZYZrotating) .attr("__module__") = "k3d" ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/euler_angles_python.h ================================================ #ifndef K3DSDK_PYTHON_EULER_ANGLES_PYTHON_H #define K3DSDK_PYTHON_EULER_ANGLES_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_euler_angles(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_EULER_ANGLES_PYTHON_H ================================================ FILE: k3dsdk/python/euler_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { class euler { public: }; void define_namespace_euler() { scope outer = class_("euler", no_init); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/euler_python.h ================================================ #ifndef K3DSDK_PYTHON_EULER_PYTHON_H #define K3DSDK_PYTHON_EULER_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_euler(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_EULER_PYTHON_H ================================================ FILE: k3dsdk/python/file_signal_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include using namespace boost::python; namespace k3d { namespace python { ////////////////////////////////////////////////////////////////////////////// // file_signal sigc::connection file_signal::connect_output_signal(const sigc::slot& Slot) { return signal.connect(Slot); } void write(file_signal& Self, const string_t& Output) { Self.signal.emit(Output); } ////////////////////////////////////////////////////////////////////////////// // define_class_file_signal void define_class_file_signal() { class_("file_signal", "Converts file output to a C++ signal.", no_init) .def("write", &write) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/file_signal_python.h ================================================ #ifndef K3DSDK_PYTHON_FILE_SIGNAL_PYTHON_H #define K3DSDK_PYTHON_FILE_SIGNAL_PYTHON_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { /// Helper class that converts Python output to a signal. Mainly useful when /// redirecting Python stdout and stderr to interactive dialogs. class file_signal { public: /// Connects a slot to a signal that will be called with Python output sigc::connection connect_output_signal(const sigc::slot& Slot); private: friend void write(file_signal&, const string_t&); sigc::signal signal; }; void define_class_file_signal(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_FILE_SIGNAL_PYTHON_H ================================================ FILE: k3dsdk/python/filesystem_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { const k3d::string_t root_name(const k3d::filesystem::path& Self) { return Self.root_name().raw(); } const k3d::string_t root_directory(const k3d::filesystem::path& Self) { return Self.root_directory().raw(); } const k3d::string_t leaf(const k3d::filesystem::path& Self) { return Self.leaf().raw(); } const k3d::string_t path_string(const k3d::filesystem::path& Self) { return Self.native_filesystem_string(); } class filesystem { public: static const k3d::filesystem::path generic_path(const k3d::string_t& GenericPath) { return k3d::filesystem::generic_path(GenericPath); } static const k3d::filesystem::path native_path(const k3d::string_t& NativePath) { return k3d::filesystem::native_path(k3d::ustring::from_utf8(NativePath)); } }; void define_namespace_filesystem() { scope outer = class_("filesystem", no_init) .def("generic_path", filesystem::generic_path) .staticmethod("generic_path") .def("native_path", filesystem::native_path) .staticmethod("native_path") ; class_("path", "Stores a filesystem path") .def(self == self) .def(self != self) .def(self / self) .def("root_path", &k3d::filesystem::path::root_path) .def("root_name", root_name) .def("root_directory", root_directory) .def("leaf", leaf) .def("branch_path", &k3d::filesystem::path::branch_path) .def("empty", &k3d::filesystem::path::empty) .def("is_complete", &k3d::filesystem::path::is_complete) .def("__str__", path_string) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/filesystem_python.h ================================================ #ifndef K3DSDK_PYTHON_FILESYSTEM_PYTHON_H #define K3DSDK_PYTHON_FILESYSTEM_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Bart Janssens (bart.janssens@lid.kviv.be) */ namespace k3d { namespace python { void define_namespace_filesystem(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_FILESYSTEM_PYTHON_H ================================================ FILE: k3dsdk/python/geometry_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { /////////////////////////////////////////////////////////////////////////////////////////////////// // geometry class geometry { public: class point_selection { public: class const_storage { public: typedef owned_instance_wrapper wrapper; static object index_begin(wrapper& Self) { return wrap(Self.wrapped().index_begin); } static object index_end(wrapper& Self) { return wrap(Self.wrapped().index_end); } static object weight(wrapper& Self) { return wrap(Self.wrapped().weight); } }; class storage { public: typedef owned_instance_wrapper wrapper; static object index_begin(wrapper& Self) { return wrap(Self.wrapped().index_begin); } static object index_end(wrapper& Self) { return wrap(Self.wrapped().index_end); } static object weight(wrapper& Self) { return wrap(Self.wrapped().weight); } }; static object create1(k3d::selection::set& Set) { return wrap_owned(k3d::geometry::point_selection::create(Set)); } static object create2(k3d::selection::set& Set, const double_t Weight) { return wrap_owned(k3d::geometry::point_selection::create(Set, Weight)); } static object validate(selection_storage_wrapper& Storage) { return wrap_owned(k3d::geometry::point_selection::validate(Storage.wrapped())); } static void append1(storage::wrapper& Storage, const double_t Weight) { k3d::geometry::point_selection::append(Storage.wrapped(), Weight); } static void append2(storage::wrapper& Storage, const uint_t Begin, const uint_t End, const double_t Weight) { k3d::geometry::point_selection::append(Storage.wrapped(), Begin, End, Weight); } static void merge(const_storage::wrapper& Storage, mesh_wrapper& Mesh) { k3d::geometry::point_selection::merge(Storage.wrapped(), Mesh.wrapped()); } }; class primitive_selection { public: class const_storage { public: typedef owned_instance_wrapper wrapper; static object primitive_begin(wrapper& Self) { return wrap(Self.wrapped().primitive_begin); } static object primitive_end(wrapper& Self) { return wrap(Self.wrapped().primitive_end); } static object primitive_selection_type(wrapper& Self) { return wrap(Self.wrapped().primitive_selection_type); } static object primitive_first_range(wrapper& Self) { return wrap(Self.wrapped().primitive_first_range); } static object primitive_range_count(wrapper& Self) { return wrap(Self.wrapped().primitive_range_count); } static object index_begin(wrapper& Self) { return wrap(Self.wrapped().index_begin); } static object index_end(wrapper& Self) { return wrap(Self.wrapped().index_end); } static object weight(wrapper& Self) { return wrap(Self.wrapped().weight); } }; class storage { public: typedef owned_instance_wrapper wrapper; static object primitive_begin(wrapper& Self) { return wrap(Self.wrapped().primitive_begin); } static object primitive_end(wrapper& Self) { return wrap(Self.wrapped().primitive_end); } static object primitive_selection_type(wrapper& Self) { return wrap(Self.wrapped().primitive_selection_type); } static object primitive_first_range(wrapper& Self) { return wrap(Self.wrapped().primitive_first_range); } static object primitive_range_count(wrapper& Self) { return wrap(Self.wrapped().primitive_range_count); } static object index_begin(wrapper& Self) { return wrap(Self.wrapped().index_begin); } static object index_end(wrapper& Self) { return wrap(Self.wrapped().index_end); } static object weight(wrapper& Self) { return wrap(Self.wrapped().weight); } }; static object create1(k3d::selection::set& Set) { return wrap_owned(k3d::geometry::primitive_selection::create(Set)); } static object create2(k3d::selection::set& Set, const k3d::selection::type SelectionType) { return wrap_owned(k3d::geometry::primitive_selection::create(Set, SelectionType)); } static object create3(k3d::selection::set& Set, const uint_t PrimitiveBegin, const uint_t PrimitiveEnd, const k3d::selection::type SelectionType) { return wrap_owned(k3d::geometry::primitive_selection::create(Set, PrimitiveBegin, PrimitiveEnd, SelectionType)); } static object validate(selection_storage_wrapper& Storage) { return wrap_owned(k3d::geometry::primitive_selection::validate(Storage.wrapped())); } static void append1(storage::wrapper& Storage, const uint_t PrimitiveBegin, const uint_t PrimitiveEnd, const k3d::selection::type SelectionType, const uint_t Begin, const uint_t End, const double_t Weight) { k3d::geometry::primitive_selection::append(Storage.wrapped(), PrimitiveBegin, PrimitiveEnd, SelectionType, Begin, End, Weight); } static void append2(storage::wrapper& Storage, const k3d::selection::type SelectionType, const uint_t Begin, const uint_t End, const double_t Weight) { k3d::geometry::primitive_selection::append(Storage.wrapped(), SelectionType, Begin, End, Weight); } static void append3(storage::wrapper& Storage, const k3d::selection::type SelectionType, const double_t Weight) { k3d::geometry::primitive_selection::append(Storage.wrapped(), SelectionType, Weight); } static void append4(storage::wrapper& Storage, const uint_t Begin, const uint_t End, const double_t Weight) { k3d::geometry::primitive_selection::append(Storage.wrapped(), Begin, End, Weight); } static void append5(storage::wrapper& Storage, const double_t Weight) { k3d::geometry::primitive_selection::append(Storage.wrapped(), Weight); } static void merge(const_storage::wrapper& Storage, mesh_wrapper& Mesh) { k3d::geometry::primitive_selection::merge(Storage.wrapped(), Mesh.wrapped()); } }; class selection { public: }; }; void define_namespace_geometry() { scope outer = class_("geometry", no_init) ; { scope inner = class_("point_selection", no_init) .def("create", &geometry::point_selection::create1) .def("create", &geometry::point_selection::create2) .staticmethod("create") .def("validate", &geometry::point_selection::validate) .staticmethod("validate") .def("append", &geometry::point_selection::append1) .def("append", &geometry::point_selection::append2) .staticmethod("append") .def("merge", &geometry::point_selection::merge) .staticmethod("merge") ; class_("const_storage", no_init) .def("index_begin", &geometry::point_selection::const_storage::index_begin) .def("index_end", &geometry::point_selection::const_storage::index_end) .def("weight", &geometry::point_selection::const_storage::weight) ; class_("storage", no_init) .def("index_begin", &geometry::point_selection::storage::index_begin) .def("index_end", &geometry::point_selection::storage::index_end) .def("weight", &geometry::point_selection::storage::weight) ; } { scope inner = class_("primitive_selection", no_init) .def("create", &geometry::primitive_selection::create1) .def("create", &geometry::primitive_selection::create2) .staticmethod("create") .def("validate", &geometry::primitive_selection::validate) .staticmethod("validate") .def("append", &geometry::primitive_selection::append1) .def("append", &geometry::primitive_selection::append2) .def("append", &geometry::primitive_selection::append3) .def("append", &geometry::primitive_selection::append4) .def("append", &geometry::primitive_selection::append5) .staticmethod("append") .def("merge", &geometry::primitive_selection::merge) .staticmethod("merge") ; class_("const_storage", no_init) .def("primitive_begin", &geometry::primitive_selection::const_storage::primitive_begin) .def("primitive_end", &geometry::primitive_selection::const_storage::primitive_end) .def("primitive_selection_type", &geometry::primitive_selection::const_storage::primitive_selection_type) .def("primitive_first_range", &geometry::primitive_selection::const_storage::primitive_first_range) .def("primitive_range_count", &geometry::primitive_selection::const_storage::primitive_range_count) .def("index_begin", &geometry::primitive_selection::const_storage::index_begin) .def("index_end", &geometry::primitive_selection::const_storage::index_end) .def("weight", &geometry::primitive_selection::const_storage::weight) ; class_("storage", no_init) .def("primitive_begin", &geometry::primitive_selection::storage::primitive_begin) .def("primitive_end", &geometry::primitive_selection::storage::primitive_end) .def("primitive_selection_type", &geometry::primitive_selection::storage::primitive_selection_type) .def("primitive_first_range", &geometry::primitive_selection::storage::primitive_first_range) .def("primitive_range_count", &geometry::primitive_selection::storage::primitive_range_count) .def("index_begin", &geometry::primitive_selection::storage::index_begin) .def("index_end", &geometry::primitive_selection::storage::index_end) .def("weight", &geometry::primitive_selection::storage::weight) ; } { scope inner = class_("selection", no_init) .def("create", &k3d::geometry::selection::create) .staticmethod("create") ; } } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/geometry_python.h ================================================ #ifndef K3DSDK_PYTHON_GEOMETRY_PYTHON_H #define K3DSDK_PYTHON_GEOMETRY_PYTHON_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_geometry(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_GEOMETRY_PYTHON_H ================================================ FILE: k3dsdk/python/hyperboloid_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class hyperboloid { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object start_points(wrapper& Self) { return wrap(Self.wrapped().start_points); } static object end_points(wrapper& Self) { return wrap(Self.wrapped().end_points); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object start_points(wrapper& Self) { return wrap(Self.wrapped().start_points); } static object end_points(wrapper& Self) { return wrap(Self.wrapped().end_points); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::hyperboloid::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::hyperboloid::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::hyperboloid::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_hyperboloid() { scope outer = class_("hyperboloid", no_init) .def("create", &hyperboloid::create) .staticmethod("create") .def("validate", &hyperboloid::validate) .def("validate", &hyperboloid::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("matrices", &hyperboloid::const_primitive::matrices) .def("materials", &hyperboloid::const_primitive::materials) .def("start_points", &hyperboloid::const_primitive::start_points) .def("end_points", &hyperboloid::const_primitive::end_points) .def("sweep_angles", &hyperboloid::const_primitive::sweep_angles) .def("selections", &hyperboloid::const_primitive::selections) .def("constant_attributes", &hyperboloid::const_primitive::constant_attributes) .def("surface_attributes", &hyperboloid::const_primitive::surface_attributes) .def("parameter_attributes", &hyperboloid::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("matrices", &hyperboloid::primitive::matrices) .def("materials", &hyperboloid::primitive::materials) .def("start_points", &hyperboloid::primitive::start_points) .def("end_points", &hyperboloid::primitive::end_points) .def("sweep_angles", &hyperboloid::primitive::sweep_angles) .def("selections", &hyperboloid::primitive::selections) .def("constant_attributes", &hyperboloid::primitive::constant_attributes) .def("surface_attributes", &hyperboloid::primitive::surface_attributes) .def("parameter_attributes", &hyperboloid::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/hyperboloid_python.h ================================================ #ifndef K3DSDK_PYTHON_HYPERBOLOID_PYTHON_H #define K3DSDK_PYTHON_HYPERBOLOID_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_hyperboloid(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_HYPERBOLOID_PYTHON_H ================================================ FILE: k3dsdk/python/idocument_exporter_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { /////////////////////////////////////////////////////////////////////////////////////////////// // idocument_exporter static bool_t write_file(iunknown_wrapper& Self, idocument_wrapper& Document, const filesystem::path& Path) { return Self.wrapped().write_file(Document.wrapped(), Path); } void define_methods_idocument_exporter(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(make_function(write_file), "write_file", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/idocument_exporter_python.h ================================================ #ifndef K3DSDK_PYTHON_IDOCUMENT_EXPORTER_PYTHON_H #define K3DSDK_PYTHON_IDOCUMENT_EXPORTER_PYTHON_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_idocument_exporter(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IDOCUMENT_EXPORTER_PYTHON_H ================================================ FILE: k3dsdk/python/idocument_importer_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { /////////////////////////////////////////////////////////////////////////////////////////////// // idocument_importer static void get_file_metadata(iunknown_wrapper& Self, const filesystem::path& Path) { Self.wrapped().get_file_metadata(Path); } static bool_t read_file(iunknown_wrapper& Self, const filesystem::path& Path, idocument_wrapper& Document) { return Self.wrapped().read_file(Path, Document.wrapped()); } void define_methods_idocument_importer(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(make_function(read_file), "read_file", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/idocument_importer_python.h ================================================ #ifndef K3DSDK_PYTHON_IDOCUMENT_IMPORTER_PYTHON_H #define K3DSDK_PYTHON_IDOCUMENT_IMPORTER_PYTHON_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_idocument_importer(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IDOCUMENT_IMPORTER_PYTHON_H ================================================ FILE: k3dsdk/python/idocument_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { static const bool save(idocument_wrapper& Self, const string_t& Path) { boost::scoped_ptr exporter(k3d::plugin::create(k3d::classes::DocumentExporter())); if(!exporter) throw std::runtime_error("no exporter plugin available"); return exporter->write_file(Self.wrapped(), filesystem::native_path(ustring::from_utf8(Path))); } static void start_change_set(idocument_wrapper& Self) { k3d::start_state_change_set(Self.wrapped(), K3D_CHANGE_SET_CONTEXT); } static void cancel_change_set(idocument_wrapper& Self) { k3d::cancel_state_change_set(Self.wrapped(), K3D_CHANGE_SET_CONTEXT); } static void finish_change_set(idocument_wrapper& Self, const string_t& Label) { k3d::finish_state_change_set(Self.wrapped(), Label, K3D_CHANGE_SET_CONTEXT); } static void redraw_all(idocument_wrapper& Self) { k3d::gl::redraw_all(Self.wrapped(), k3d::gl::irender_viewport::ASYNCHRONOUS); } static void delete_node(idocument_wrapper& Self, object& Node) { extract node(Node); if(!node.check()) throw std::invalid_argument("argument isn't a node"); k3d::delete_nodes(Self.wrapped(), k3d::make_collection(node().wrapped_ptr())); } void define_class_idocument() { class_("idocument") .def("save", &save) .def("start_change_set", &start_change_set) .def("cancel_change_set", &cancel_change_set) .def("finish_change_set", &finish_change_set) .def("redraw_all", &redraw_all) .def("delete_node", &delete_node) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/idocument_python.h ================================================ #ifndef K3DSDK_PYTHON_IDOCUMENT_PYTHON_H #define K3DSDK_PYTHON_IDOCUMENT_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper idocument_wrapper; void define_class_idocument(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IDOCUMENT_PYTHON_H ================================================ FILE: k3dsdk/python/ifile_change_notifier_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { /////////////////////////////////////////////////////////////////////////////////////////////// // file_change_receiver class file_change_receiver { public: void file_changed(const filesystem::path& Path) { changed_files.push_back(Path); } boost::python::list changed() { boost::python::list result; for(k3d::uint_t i = 0; i != changed_files.size(); ++i) result.append(changed_files[i]); return result; } void clear() { changed_files.clear(); } private: std::vector changed_files; }; /////////////////////////////////////////////////////////////////////////////////////////////// // ifile_change_notifier static uint_t watch_file(iunknown_wrapper& Self, const filesystem::path& Path, file_change_receiver& Receiver) { return Self.wrapped().watch_file(Path, sigc::bind(sigc::mem_fun(Receiver, &file_change_receiver::file_changed), Path)); } static void unwatch_file(iunknown_wrapper& Self, const uint_t WatchID) { Self.wrapped().unwatch_file(WatchID); } static void wait_for_changes(iunknown_wrapper& Self) { Self.wrapped().wait_for_changes(); } static uint_t change_count(iunknown_wrapper& Self) { return Self.wrapped().change_count(); } static void signal_change(iunknown_wrapper& Self) { Self.wrapped().signal_change(); } void define_class_file_change_receiver() { class_("file_change_receiver", "Helper class that caches file-change notifications for later retrieval.") .def("changed", &file_change_receiver::changed, "Retrieves the list of files that have changed.") .def("clear", &file_change_receiver::clear, "Clears the list of files that have changed.") ; } void define_methods_ifile_change_notifier(k3d::iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&watch_file, "Watch a file for changes.\n\n" "@rtype: integer watch identifier\n"), "watch_file", Instance); utility::add_method(utility::make_function(&unwatch_file, "Stops watching a file for changes."), "unwatch_file", Instance); utility::add_method(utility::make_function(&wait_for_changes, "Blocks indefinitely until at least one file change has been received."), "wait_for_changes", Instance); utility::add_method(utility::make_function(&change_count, "Returns the number of file changes that are pending, ready to be signalled. This method never blocks."), "change_count", Instance); utility::add_method(utility::make_function(&signal_change, "Signals the next file change that is pending, if any. This method never blocks."), "signal_change", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/ifile_change_notifier_python.h ================================================ #ifndef K3DSDK_PYTHON_IFILE_CHANGE_NOTIFIER_PYTHON_H #define K3DSDK_PYTHON_IFILE_CHANGE_NOTIFIER_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) \author Bart Janssens (bart.janssens@lid.kviv.be) */ #include namespace k3d { class iunknown; namespace python { void define_class_file_change_receiver(); void define_methods_ifile_change_notifier(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IFILE_CHANGE_NOTIFIER_PYTHON_H ================================================ FILE: k3dsdk/python/ikeyframer_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static void keyframe(iunknown_wrapper& Self) { Self.wrapped().keyframe(); } static void delete_key(iunknown_wrapper& Self, iunknown_wrapper& TimeProperty) { k3d::iproperty* property = TimeProperty.wrapped_ptr(); Self.wrapped().delete_key(property); } static object input_property(iunknown_wrapper& Self) { return wrap_unknown(Self.wrapped().input_property()); } static list get_keys(iunknown_wrapper& Self) { list results; const k3d::ikeyframer::keys_t keys = Self.wrapped().get_keys(); for(k3d::ikeyframer::keys_t::const_iterator key = keys.begin(); key != keys.end(); ++key) results.append(wrap_unknown(*key)); return results; } void define_methods_ikeyframer(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&keyframe, "Set a keyframe. Inputs are implementation-dependent, and may come from properties."), "keyframe", Instance); utility::add_method(utility::make_function(&delete_key, "Delete the keyframe referenced by the given time property."), "delete_key", Instance); utility::add_method(utility::make_function(&input_property, "Get the property used to input the key values.\n\n" "@rtype: L{iproperty}\n" "@return: The input property.\n\n"), "input_property", Instance); utility::add_method(utility::make_function(&get_keys, "Returns a list with all the time properties for the keyframes."), "get_keys", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/ikeyframer_python.h ================================================ #ifndef K3DSDK_PYTHON_IKEYFRAMER_PYTHON_H #define K3DSDK_PYTHON_IKEYFRAMER_PYTHON_H // K-3D // Copyright (c) 1995-2009, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_ikeyframer(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IKEYFRAMER_PYTHON_H ================================================ FILE: k3dsdk/python/imesh_storage_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static object create_mesh(iunknown_wrapper& Self) { k3d::mesh* const mesh = new k3d::mesh(); Self.wrapped().reset_mesh(mesh); return wrap(mesh); } static object set_mesh(iunknown_wrapper& Self, mesh_wrapper& Mesh) { k3d::mesh* const mesh = new k3d::mesh(Mesh.wrapped()); Self.wrapped().reset_mesh(mesh); return wrap(mesh); } static void clear_mesh(iunknown_wrapper& Self) { Self.wrapped().reset_mesh(0); } void define_methods_imesh_storage(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&create_mesh, "Creates a new L{mesh} object whose lifetime will be managed by the imesh_storage object.\n\n" "@return: Returns a new L{mesh} object."), "create_mesh", Instance); utility::add_method(utility::make_function(&set_mesh, "Assigns a shallow-copy of an existing L{mesh} object whose lifetime will be managed by the imesh_storage object.\n\n" "@return: Returns the copied L{mesh} object."), "set_mesh", Instance); utility::add_method(utility::make_function(&clear_mesh, "Deletes the stored mesh and resets the storage to a null mesh."), "clear_mesh", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/imesh_storage_python.h ================================================ #ifndef K3DSDK_PYTHON_IMESH_STORAGE_PYTHON_H #define K3DSDK_PYTHON_IMESH_STORAGE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_imesh_storage(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IMESH_STORAGE_PYTHON_H ================================================ FILE: k3dsdk/python/imeta_object_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include namespace k3d { namespace python { static boost::python::object execute(iunknown_wrapper& Self, const string_t& Command) { return any_to_python(Self.wrapped().execute(Command)); } /* static boost::python::object execute1(iunknown_wrapper& Self, const string_t& Command, const boost::python::object& Argument1) { return any_to_python(Self.wrapped().execute(Command, python_to_any(Argument1))); } static boost::python::object execute2(iunknown_wrapper& Self, const string_t& Command, const boost::python::object& Argument1, const boost::python::object& Argument2) { return any_to_python(Self.wrapped().execute(Command, python_to_any(Argument1), python_to_any(Argument2))); } static boost::python::object execute3(iunknown_wrapper& Self, const string_t& Command, const boost::python::object& Argument1, const boost::python::object& Argument2, const boost::python::object& Argument3) { return any_to_python(Self.wrapped().execute(Command, python_to_any(Argument1), python_to_any(Argument2), python_to_any(Argument3))); } */ void define_methods_imeta_object(k3d::iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&execute, "Executes an object method."), "execute", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/imeta_object_python.h ================================================ #ifndef K3DSDK_PYTHON_IMETA_OBJECT_PYTHON_H #define K3DSDK_PYTHON_IMETA_OBJECT_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_imeta_object(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IMETA_OBJECT_PYTHON_H ================================================ FILE: k3dsdk/python/imetadata_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static void set_metadata_value(iunknown_wrapper& Self, const string_t& Name, const string_t& Value) { Self.wrapped().set_metadata_value(Name, Value); } static boost::python::dict get_metadata(iunknown_wrapper& Self) { boost::python::dict result; const imetadata::metadata_t metadata = Self.wrapped().get_metadata(); for(imetadata::metadata_t::const_iterator pair = metadata.begin(); pair != metadata.end(); ++pair) result[pair->first] = pair->second; return result; } static string_t get_metadata_value(iunknown_wrapper& Self, const string_t& Name) { return Self.wrapped().get_metadata_value(Name); } static void erase_metadata_value(iunknown_wrapper& Self, const string_t& Name) { Self.wrapped().erase_metadata_value(Name); } void define_methods_imetadata(iunknown& Interface, boost::python::object& Instance) { utility::add_method(utility::make_function(&set_metadata_value), "set_metadata_value", Instance); utility::add_method(utility::make_function(&get_metadata), "get_metadata", Instance); utility::add_method(utility::make_function(&get_metadata_value), "get_metadata_value", Instance); utility::add_method(utility::make_function(&erase_metadata_value), "erase_metadata_value", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/imetadata_python.h ================================================ #ifndef K3DSDK_PYTHON_IMETADATA_PYTHON_H #define K3DSDK_PYTHON_IMETADATA_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_imetadata(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IMETADATA_PYTHON_H ================================================ FILE: k3dsdk/python/inode_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static object document(iunknown_wrapper& Self) { return wrap(Self.wrapped().document()); } static object factory(iunknown_wrapper& Self) { return wrap_unknown(Self.wrapped().factory()); } static boost::uint64_t hash(iunknown_wrapper& Self) { return reinterpret_cast(Self.wrapped_ptr()); } void define_methods_inode(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&document, "Returns the L{idocument} that owns this node."), "document", Instance); utility::add_method(utility::make_function(&factory, "Returns the plugin factory used to create this node type."), "factory", Instance); utility::add_method(utility::make_function(&hash, "Returns a hash value that can be used as a key when storing inode objects in a map."), "__hash__", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/inode_python.h ================================================ #ifndef K3DSDK_PYTHON_INODE_PYTHON_H #define K3DSDK_PYTHON_INODE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_inode(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_INODE_PYTHON_H ================================================ FILE: k3dsdk/python/inode_selection_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) \author Bart Janssens (bart.janssens@lid.kviv.be) */ #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static void select(iunknown_wrapper& Self, iunknown_wrapper& Node, const k3d::double_t Weight) { Self.wrapped().select(Node.wrapped(), Weight); } static double selection_weight(iunknown_wrapper& Self, iunknown_wrapper& Node) { return Self.wrapped().selection_weight(Node.wrapped()); } static list selected_nodes(iunknown_wrapper& Self) { list results; const k3d::inode_selection::selected_nodes_t selected_nodes = Self.wrapped().selected_nodes(); for(k3d::inode_selection::selected_nodes_t::const_iterator n = selected_nodes.begin(); n != selected_nodes.end(); ++n) results.append(wrap_unknown(*n)); return results; } static void deselect_all(iunknown_wrapper& Self) { Self.wrapped().deselect_all(); } void define_methods_inode_selection(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&select, "Select the supplied node with the given selection weight\n\n"), "select", Instance); utility::add_method(utility::make_function(&selection_weight, "Returns the selection weight of the supplied node.\n\n" "@rtype: double\n"), "selection_weight", Instance); utility::add_method(utility::make_function(&selected_nodes, "Returns a list of selected nodes\n\n" "@return: A list of L{inode} objects.\n\n"), "selected_nodes", Instance); utility::add_method(utility::make_function(&deselect_all, "Clears the stored selection."), "deselect_all", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/inode_selection_python.h ================================================ #ifndef K3DSDK_PYTHON_INODE_SELECTION_PYTHON_H #define K3DSDK_PYTHON_INODE_SELECTION_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) \author Bart Janssens (bart.janssens@lid.kviv.be) */ #include namespace k3d { class iunknown; namespace python { void define_methods_inode_selection(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_INODE_SELECTION_PYTHON_H ================================================ FILE: k3dsdk/python/instance_wrapper_python.h ================================================ #ifndef K3DSDK_PYTHON_INSTANCE_WRAPPER_PYTHON_H #define K3DSDK_PYTHON_INSTANCE_WRAPPER_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace python { //////////////////////////////////////////////////////////////////////////////////// // instance_wrapper template class instance_wrapper { public: typedef T wrapped_type; instance_wrapper() : m_wrapped(0) { } instance_wrapper(T* Wrapped) : m_wrapped(Wrapped) { } instance_wrapper(T& Wrapped) : m_wrapped(&Wrapped) { } friend const bool operator==(const instance_wrapper& lhs, const instance_wrapper& rhs) { return lhs.m_wrapped == rhs.m_wrapped; } T& wrapped() const { if(!m_wrapped) throw std::runtime_error("wrapped interface is null"); return *m_wrapped; } template Y& wrapped() const { return dynamic_cast(wrapped()); } T* wrapped_ptr() const { return m_wrapped; } template Y* wrapped_ptr() const { return dynamic_cast(wrapped_ptr()); } private: T* m_wrapped; }; template boost::python::object wrap(T* Wrapped) { return Wrapped ? boost::python::object(instance_wrapper(Wrapped)) : boost::python::object(); } template boost::python::object wrap(T& Wrapped) { return boost::python::object(instance_wrapper(Wrapped)); } } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_INSTANCE_WRAPPER_PYTHON_H ================================================ FILE: k3dsdk/python/iplugin_factory_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static const k3d::uuid factory_id(iunknown_wrapper& Self) { return Self.wrapped().factory_id(); } static const string_t name(iunknown_wrapper& Self) { return Self.wrapped().name(); } static const string_t short_description(iunknown_wrapper& Self) { return Self.wrapped().short_description(); } static const bool_t is_application_plugin(iunknown_wrapper& Self) { return Self.wrapped_ptr() ? true : false; } static const bool_t is_document_plugin(iunknown_wrapper& Self) { return Self.wrapped_ptr() ? true : false; } static const list categories(iunknown_wrapper& Self) { list results; const k3d::iplugin_factory::categories_t& categories = Self.wrapped().categories(); for(k3d::iplugin_factory::categories_t::const_iterator category = categories.begin(); category != categories.end(); ++category) results.append(*category); return results; } static const string_t quality(iunknown_wrapper& Self) { switch(Self.wrapped().quality()) { case k3d::iplugin_factory::STABLE: return "stable"; case k3d::iplugin_factory::EXPERIMENTAL: return "experimental"; case k3d::iplugin_factory::DEPRECATED: return "deprecated"; } k3d::log() << warning << "Unknown plugin factory quality enumeration" << std::endl; return "unknown"; } static boost::python::dict metadata(iunknown_wrapper& Self) { boost::python::dict result; const iplugin_factory::metadata_t metadata = Self.wrapped().metadata(); for(iplugin_factory::metadata_t::const_iterator pair = metadata.begin(); pair != metadata.end(); ++pair) result[pair->first] = pair->second; return result; } void define_methods_iplugin_factory(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&factory_id, "Returns a universally-unique identifier for this factory."), "factory_id", Instance); utility::add_method(utility::make_function(&name, "Returns the human-readable plugin name, which is displayed in the user interface and can be used to instantiate plugins."), "name", Instance); utility::add_method(utility::make_function(&short_description, "Returns a short human-readable description of the plugin's purpose."), "short_description", Instance); utility::add_method(utility::make_function(&is_application_plugin, "Returns true if the plugin is an application plugin."), "is_application_plugin", Instance); utility::add_method(utility::make_function(&is_document_plugin, "Returns true if the plugin is a document plugin."), "is_document_plugin", Instance); utility::add_method(utility::make_function(&categories, "Returns an arbitrary collection of human-readable categories used to organize the list of plugins in the user interface."), "categories", Instance); utility::add_method(utility::make_function(&quality, "Returns the string \"stable\", \"experimental\", or \"deprecated\"."), "quality", Instance); utility::add_method(utility::make_function(&metadata, "Returns plugin metadata as a dict containing name-value pairs."), "metadata", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/iplugin_factory_python.h ================================================ #ifndef K3DSDK_PYTHON_IPLUGIN_FACTORY_PYTHON_H #define K3DSDK_PYTHON_IPLUGIN_FACTORY_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_iplugin_factory(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IPLUGIN_FACTORY_PYTHON_H ================================================ FILE: k3dsdk/python/iproperty_collection_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static list properties(iunknown_wrapper& Self) { list results; const k3d::iproperty_collection::properties_t& properties = Self.wrapped().properties(); for(k3d::iproperty_collection::properties_t::const_iterator property = properties.begin(); property != properties.end(); ++property) results.append(wrap_unknown(*property)); return results; } static object get_property(iunknown_wrapper& Self, const string_t& Name) { return wrap_unknown(k3d::property::get(Self.wrapped(), Name)); } static bool has_property(iunknown_wrapper& Self, const string_t& Name) { return k3d::property::get(Self.wrapped(), Name) ? true : false; } void define_methods_iproperty_collection(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&properties, "Returns the set of all property.held within this collection.\n\n" "@return: A list of L{iproperty} objects."), "properties", Instance); utility::add_method(utility::make_function(&get_property, "Returns a single property by name.\n\n" "@rtype: L{iproperty}\n" "@return: The property object if it exists, or None."), "get_property", Instance); utility::add_method(utility::make_function(&has_property, "True if the named property is registered"), "has_property", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/iproperty_collection_python.h ================================================ #ifndef K3DSDK_PYTHON_IPROPERTY_COLLECTION_PYTHON_H #define K3DSDK_PYTHON_IPROPERTY_COLLECTION_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_iproperty_collection(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IPROPERTY_COLLECTION_PYTHON_H ================================================ FILE: k3dsdk/python/iproperty_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static const string_t name(iunknown_wrapper& Self) { return Self.wrapped().property_name(); } static const string_t label(iunknown_wrapper& Self) { return Self.wrapped().property_label(); } static const string_t description(iunknown_wrapper& Self) { return Self.wrapped().property_description(); } static const string_t type(iunknown_wrapper& Self) { return k3d::type_string(Self.wrapped().property_type()); } static object internal_value(iunknown_wrapper& Self) { return any_to_python(k3d::property::internal_value(Self.wrapped())); } static object pipeline_value(iunknown_wrapper& Self) { return any_to_python(k3d::property::pipeline_value(Self.wrapped())); } static object node(iunknown_wrapper& Self) { return any_to_python(Self.wrapped().property_node()); } static const bool is_writable(iunknown_wrapper& Self) { return Self.wrapped_ptr() ? true : false; } static void set_value(iunknown_wrapper& Self, const boost::python::object& Value) { if(k3d::iwritable_property* const writable = Self.wrapped_ptr()) { writable->property_set_value(python_to_any(Value, Self.wrapped().property_type())); return; } throw std::runtime_error("property " + Self.wrapped().property_name() + " is a read-only property"); } static const bool is_enumeration(iunknown_wrapper& Self) { return Self.wrapped_ptr() ? true : false; } static list enumeration_values(iunknown_wrapper& Self) { list results; if(k3d::ienumeration_property* const enumeration = Self.wrapped_ptr()) { const k3d::ienumeration_property::enumeration_values_t values = enumeration->enumeration_values(); for(k3d::ienumeration_property::enumeration_values_t::const_iterator value = values.begin(); value != values.end(); ++value) results.append(value->value); } return results; } static const string_t units(iunknown_wrapper& Self) { if(k3d::imeasurement_property* const measurement = Self.wrapped_ptr()) { const std::type_info& units = measurement->property_units(); if(units == typeid(void)) return "scalar"; if(units == typeid(k3d::measurement::angle)) return "angle"; if(units == typeid(k3d::measurement::area)) return "area"; if(units == typeid(k3d::measurement::distance)) return "distance"; if(units == typeid(k3d::measurement::force)) return "force"; if(units == typeid(k3d::measurement::mass)) return "mass"; if(units == typeid(k3d::measurement::pressure)) return "pressure"; if(units == typeid(k3d::measurement::time)) return "time"; if(units == typeid(k3d::measurement::volume)) return "volume"; return "unknown"; } return ""; } void define_methods_iproperty(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&name, "Unique identifier, used for serialization and scripting."), "name", Instance); utility::add_method(utility::make_function(&label, "Localized, human-readable text that labels the property in the user interface."), "label", Instance); utility::add_method(utility::make_function(&description, "Localized, human-readable description of the property."), "description", Instance); utility::add_method(utility::make_function(&type, "Returns the type of data the property stores as a string."), "type", Instance); utility::add_method(utility::make_function(&internal_value, "Returns the value stored by the property."), "internal_value", Instance); utility::add_method(utility::make_function(&pipeline_value, "Returns the property's 'pipeline' value, which will differ from its internal value if it's connected to another property by the Visualization Pipeline."), "pipeline_value", Instance); utility::add_method(utility::make_function(&node, "Returns the node (if any) that owns the property, or None."), "node", Instance); utility::add_method(utility::make_function(&is_writable, "Returns true if the property's internal value can be modified."), "is_writable", Instance); utility::add_method(utility::make_function(&set_value, "Sets the property's internal value."), "set_value", Instance); utility::add_method(utility::make_function(&is_enumeration, "Returns true if the property datatype is an enumeration."), "is_enumeration", Instance); utility::add_method(utility::make_function(&enumeration_values, "Returns a list containing the set of allowable property values, if the property is an enumeration."), "enumeration_value", Instance); utility::add_method(utility::make_function(&units, "Returns a string describing the real-world unit-of-measure stored by the property, if any."), "units", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/iproperty_python.h ================================================ #ifndef K3DSDK_PYTHON_IPROPERTY_PYTHON_H #define K3DSDK_PYTHON_IPROPERTY_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_iproperty(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IPROPERTY_PYTHON_H ================================================ FILE: k3dsdk/python/irender_camera_frame_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static bool_t render_camera_frame(iunknown_wrapper& Self, iunknown_wrapper& Camera, const filesystem::path& OutputImage, const bool_t ViewCompletedImage) { return Self.wrapped().render_camera_frame(Camera.wrapped(), OutputImage, ViewCompletedImage); } void define_methods_irender_camera_frame(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&render_camera_frame, "Renders an output image using the given camera and output path."), "render_camera_frame", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/irender_camera_frame_python.h ================================================ #ifndef K3DSDK_PYTHON_IRENDER_CAMERA_FRAME_PYTHON_H #define K3DSDK_PYTHON_IRENDER_CAMERA_FRAME_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_irender_camera_frame(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IRENDER_CAMERA_FRAME_PYTHON_H ================================================ FILE: k3dsdk/python/irender_camera_preview_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static bool_t render_camera_preview(iunknown_wrapper& Self, iunknown_wrapper& Camera) { return Self.wrapped().render_camera_preview(Camera.wrapped()); } void define_methods_irender_camera_preview(iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&render_camera_preview, "Renders a preview image using the given camera."), "render_camera_preview", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/irender_camera_preview_python.h ================================================ #ifndef K3DSDK_PYTHON_IRENDER_CAMERA_PREVIEW_PYTHON_H #define K3DSDK_PYTHON_IRENDER_CAMERA_PREVIEW_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_irender_camera_preview(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IRENDER_CAMERA_PREVIEW_PYTHON_H ================================================ FILE: k3dsdk/python/isnappable_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static void add_snap_source(iunknown_wrapper& Self, const string_t& Label, const point3& Position) { Self.wrapped().add_snap_source(new k3d::explicit_snap_source(Label, Position)); } static void add_snap_target(iunknown_wrapper& Self, const string_t& Label, const point3& Position) { Self.wrapped().add_snap_target(new k3d::explicit_snap_target(Label, Position)); } void define_methods_isnappable(iunknown& Interface, boost::python::object& Instance) { utility::add_method(utility::make_function(&add_snap_source, "Adds a new snap source to the object."), "add_snap_source", Instance); utility::add_method(utility::make_function(&add_snap_target, "Adds a new snap target to the object."), "add_snap_target", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/isnappable_python.h ================================================ #ifndef K3DSDK_PYTHON_ISNAPPABLE_PYTHON_H #define K3DSDK_PYTHON_ISNAPPABLE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_isnappable(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_ISNAPPABLE_PYTHON_H ================================================ FILE: k3dsdk/python/iunknown_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { object wrap_unknown(iunknown* Unknown) { return Unknown ? wrap_unknown(*Unknown) : object(); } object wrap_unknown(iunknown& Unknown) { object result = object(iunknown_wrapper(Unknown)); define_methods_imeta_object(Unknown, result); define_methods_offscreen_context_factory_gl(Unknown, result); define_methods_idocument_exporter(Unknown, result); define_methods_idocument_importer(Unknown, result); define_methods_ifile_change_notifier(Unknown, result); define_methods_ikeyframer(Unknown, result); define_methods_imesh_storage(Unknown, result); define_methods_imetadata(Unknown, result); define_methods_inode(Unknown, result); define_methods_inode_selection(Unknown, result); define_methods_iplugin_factory(Unknown, result); define_methods_iproperty(Unknown, result); define_methods_iproperty_collection(Unknown, result); define_methods_irender_camera_frame(Unknown, result); define_methods_irender_camera_preview(Unknown, result); define_methods_isnappable(Unknown, result); define_methods_iuser_interface(Unknown, result); return result; } // This rightfully belongs with the rest of the iproperty_collection code, but for some reason __getattr__ // doesn't seem to work with our dynamically-added instance methods. static object getattr(iunknown_wrapper& Self, const string_t& Name) { // Return K-3D properties as attributes whenever they're available ... if(k3d::iproperty_collection* const property_collection = Self.wrapped_ptr()) { if(k3d::iproperty* property = k3d::property::get(*property_collection, Name)) return any_to_python(k3d::property::pipeline_value(*property)); throw std::invalid_argument("unknown property: " + Name); } return object(); } // This rightfully belongs with the rest of the iproperty_collection code, but for some reason __getattr__ // doesn't seem to work with our dynamically-added instance methods. static void setattr(object& Self, const string_t& Name, const object& Value) { // If this is a K-3D property, set its internal value ... extract unknown(Self); if(unknown.check()) { if(k3d::iproperty_collection* const property_collection = unknown().wrapped_ptr()) { if(k3d::iproperty* const property = k3d::property::get(*property_collection, Name)) { if(k3d::iwritable_property* const writable = dynamic_cast(property)) { writable->property_set_value(python_to_any(Value, property->property_type())); return; } throw std::invalid_argument("read-only property: " + Name); } } } // Otherwise, fallback on default behavior ... Self.attr("__dict__")[Name] = Value; } static bool eq(const object& Self, const object& Other) { if(Other == boost::python::object()) return false; extract self(Self); extract other(Other); return self == other; } static bool ne(const object& Self, const object& Other) { if(Other == boost::python::object()) return false; extract self(Self); extract other(Other); return !(self == other); } void define_class_iunknown() { class_("iunknown", "Abstract interface that represents an object with unknown capabilities.\n\n" "Methods for other implemented interfaces are added dynamically at runtime.", no_init) .def("__getattr__", getattr) .def("__setattr__", setattr) .def("__eq__", eq) .def("__ne__", ne) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/iunknown_python.h ================================================ #ifndef K3DSDK_PYTHON_IUNKNOWN_PYTHON_H #define K3DSDK_PYTHON_IUNKNOWN_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper iunknown_wrapper; void define_class_iunknown(); boost::python::object wrap_unknown(k3d::iunknown* Wrapped); boost::python::object wrap_unknown(k3d::iunknown& Wrapped); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IUNKNOWN_PYTHON_H ================================================ FILE: k3dsdk/python/iuser_interface_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static void open_uri(iunknown_wrapper& Self, const string_t& URI) { Self.wrapped().open_uri(URI); } static void message(iunknown_wrapper& Self, const string_t& Message) { Self.wrapped().message(Message); } static void warning_message(iunknown_wrapper& Self, const string_t& Message) { Self.wrapped().warning_message(Message); } static void error_message(iunknown_wrapper& Self, const string_t& Message) { Self.wrapped().error_message(Message); } static unsigned long query_message(iunknown_wrapper& Self, const string_t& Message, const list& Buttons) { std::vector buttons; for(long i = 0; i != len(Buttons); ++i) buttons.push_back(extract(Buttons[i])); return Self.wrapped().query_message(Message, 0, buttons); } static void nag_message(iunknown_wrapper& Self, const string_t& Type, const boost::python::object& Message, const boost::python::object& SecondaryMessage) { Self.wrapped().nag_message(Type, python_to_ustring(Message), python_to_ustring(SecondaryMessage)); } static const filesystem::path get_file_path(iunknown_wrapper& Self, const string_t& Direction, const string_t& Type, const string_t& Message, const string_t& StartPath) { const filesystem::path old_path = filesystem::native_path(ustring::from_utf8(StartPath)); filesystem::path new_path; if(Direction == "r" || Direction == "read") Self.wrapped().get_file_path(k3d::ipath_property::READ, Type, Message, old_path, new_path); else if(Direction == "w" || Direction == "write") Self.wrapped().get_file_path(k3d::ipath_property::WRITE, Type, Message, old_path, new_path); else throw std::invalid_argument("unknown file path operation, should be \"read\" or \"write\""); return new_path; } static void synchronize(iunknown_wrapper& Self) { Self.wrapped().synchronize(); } void define_methods_iuser_interface(k3d::iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&open_uri, "Opens a Uniform Resource Identifier (URI) in the user's preferred application.\n" "@param URI: The URI string to be opened.\n" "@note: Depending on the user interface plugin, this might open an application, " "print a message to the console, display a dialog box, or do nothing."), "open_uri", Instance); utility::add_method(utility::make_function(&message, "Displays an information message to the user.\n" "@param message: The message string to be displayed.\n" "@note: Depending on the user interface plugin, this might print a message " "to the console, display a dialog box, or do nothing."), "message", Instance); utility::add_method(utility::make_function(&warning_message, "Displays a warning message to the user.\n" "@param message: The warning message string to be displayed.\n" "@note: Depending on the user interface plugin, this might print a message " "to the console, display a dialog box, or do nothing."), "warning_message", Instance); utility::add_method(utility::make_function(&error_message, "Displays a warning message to the user.\n" "@param message: The error message string to be displayed.\n" "@note: Depending on the user interface plugin, this might print a message " "to the console, display a dialog box, or do nothing."), "error_message", Instance); utility::add_method(utility::make_function(&query_message, "Query the user to choose from among a set of fixed options.\n" "@param message: The error message string to be displayed.\n" "@param options: A list of strings where each string is an option to be displayed.\n" "@return: Returns the one-based index of the option chosen by the user, or zero if " "the user cancelled the query.\n" "@note: Depending on the user interface plugin, this might print a message " "to the console, display a dialog box, or do nothing."), "query_message", Instance); utility::add_method(utility::make_function(&nag_message, "Display a message to the user that can be suppressed.\n" "@note: Depending on the user interface plugin, this might print a message " "to the console, display a dialog box, or do nothing."), "nag_message", Instance); utility::add_method(utility::make_function(&get_file_path, "Query the user to choose a filesystem path.\n" "@param direction: Either \"read\" or \"write\".\n" "@param type: The type of path to be accessed (used to group most-recently-used paths.\n" "@param message: Message string displayed to the user.\n" "@param start: The initial path to be displayed to the user.\n" "@return: Returns the path chosen by the as a string, empty string if the user cancels.\n" "@note: Depending on the user interface plugin, this might print a message " "to the console, display a dialog box, or do nothing."), "get_file_path", Instance); utility::add_method(utility::make_function(&synchronize, "Gives the user interface a chance to synchronize itself with the current application state."), "synchronize", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/iuser_interface_python.h ================================================ #ifndef K3DSDK_PYTHON_IUSER_INTERFACE_PYTHON_H #define K3DSDK_PYTHON_IUSER_INTERFACE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_iuser_interface(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_IUSER_INTERFACE_PYTHON_H ================================================ FILE: k3dsdk/python/linear_curve_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class linear_curve { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object periodic(wrapper& Self) { return wrap(Self.wrapped().periodic); } static object material(wrapper& Self) { return wrap(Self.wrapped().material); } static object curve_first_points(wrapper& Self) { return wrap(Self.wrapped().curve_first_points); } static object curve_point_counts(wrapper& Self) { return wrap(Self.wrapped().curve_point_counts); } static object curve_selections(wrapper& Self) { return wrap(Self.wrapped().curve_selections); } static object curve_points(wrapper& Self) { return wrap(Self.wrapped().curve_points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object curve_attributes(wrapper& Self) { return wrap(Self.wrapped().curve_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object periodic(wrapper& Self) { return wrap(Self.wrapped().periodic); } static object material(wrapper& Self) { return wrap(Self.wrapped().material); } static object curve_first_points(wrapper& Self) { return wrap(Self.wrapped().curve_first_points); } static object curve_point_counts(wrapper& Self) { return wrap(Self.wrapped().curve_point_counts); } static object curve_selections(wrapper& Self) { return wrap(Self.wrapped().curve_selections); } static object curve_points(wrapper& Self) { return wrap(Self.wrapped().curve_points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object curve_attributes(wrapper& Self) { return wrap(Self.wrapped().curve_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::linear_curve::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::linear_curve::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::linear_curve::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_linear_curve() { scope outer = class_("linear_curve", no_init) .def("create", &linear_curve::create) .staticmethod("create") .def("validate", &linear_curve::validate) .def("validate", &linear_curve::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("periodic", &linear_curve::const_primitive::periodic) .def("material", &linear_curve::const_primitive::material) .def("curve_first_points", &linear_curve::const_primitive::curve_first_points) .def("curve_point_counts", &linear_curve::const_primitive::curve_point_counts) .def("curve_selections", &linear_curve::const_primitive::curve_selections) .def("curve_points", &linear_curve::const_primitive::curve_points) .def("constant_attributes", &linear_curve::const_primitive::constant_attributes) .def("curve_attributes", &linear_curve::const_primitive::curve_attributes) .def("parameter_attributes", &linear_curve::const_primitive::parameter_attributes) .def("vertex_attributes", &linear_curve::const_primitive::vertex_attributes) ; class_("primitive", no_init) .def("periodic", &linear_curve::primitive::periodic) .def("material", &linear_curve::primitive::material) .def("curve_first_points", &linear_curve::primitive::curve_first_points) .def("curve_point_counts", &linear_curve::primitive::curve_point_counts) .def("curve_selections", &linear_curve::primitive::curve_selections) .def("curve_points", &linear_curve::primitive::curve_points) .def("constant_attributes", &linear_curve::primitive::constant_attributes) .def("curve_attributes", &linear_curve::primitive::curve_attributes) .def("parameter_attributes", &linear_curve::primitive::parameter_attributes) .def("vertex_attributes", &linear_curve::primitive::vertex_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/linear_curve_python.h ================================================ #ifndef K3DSDK_PYTHON_LINEAR_CURVE_PYTHON_H #define K3DSDK_PYTHON_LINEAR_CURVE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_linear_curve(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_LINEAR_CURVE_PYTHON_H ================================================ FILE: k3dsdk/python/log_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include using namespace boost::python; namespace k3d { namespace python { class log { public: static void critical(const string_t& Message) { k3d::log() << k3d::critical << Message << std::endl; } static void debug(const string_t& Message) { k3d::log() << k3d::debug << Message << std::endl; } static void error(const string_t& Message) { k3d::log() << k3d::error << Message << std::endl; } static void info(const string_t& Message) { k3d::log() << k3d::info << Message << std::endl; } static void warning(const string_t& Message) { k3d::log() << k3d::warning << Message << std::endl; } }; void define_namespace_log() { scope outer = class_("log", no_init) .def("critical", &log::critical, "Sends a critical message to the K-3D log.") .def("debug", &log::debug, "Sends a debug message to the K-3D log.") .def("error", &log::error, "Sends an error message to the K-3D log.") .def("info", &log::info, "Sends an informational message to the K-3D log.") .def("warning", &log::warning, "Sends a warning message to the K-3D log.") .staticmethod("critical") .staticmethod("debug") .staticmethod("error") .staticmethod("info") .staticmethod("warning"); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/log_python.h ================================================ #ifndef K3DSDK_PYTHON_LOG_PYTHON_H #define K3DSDK_PYTHON_LOG_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_log(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_LOG_PYTHON_H ================================================ FILE: k3dsdk/python/matrix4_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include namespace k3d { namespace python { static k3d::matrix4 row_major_factory(boost::python::object values) { std::vector temp; if(len(values) == 4) { for(uint_t i = 0; i != 4; ++i) { for(uint_t j = 0; j != 4; ++j) temp.push_back(boost::python::extract(values[i][j])()); } } else if(len(values) == 16) { for(uint_t i = 0; i != 16; ++i) temp.push_back(boost::python::extract(values[i])()); } else { throw std::runtime_error("row_major() requires a sequence of 16 values, or four sequences of four values."); } return k3d::matrix4::row_major(temp.begin(), temp.end()); } static boost::python::list row_major_values(const k3d::matrix4& Self) { boost::python::list results; for(uint_t i = 0; i != 4; ++i) { for(uint_t j = 0; j != 4; ++j) { results.append(Self[i][j]); } } return results; } static boost::python::list column_major_values(const k3d::matrix4& Self) { boost::python::list results; for(uint_t i = 0; i != 4; ++i) { for(uint_t j = 0; j != 4; ++j) { results.append(Self[j][i]); } } return results; } void define_class_matrix4() { boost::python::class_("matrix4", "Stores a 4x4 transformation matrix.") .def(boost::python::init()) .def(boost::python::init()) .def("row_major", row_major_factory, "Constructs a matrix4 from a sequence of values in row-major order.") .staticmethod("row_major") .def("__len__", &utility::constant_len_len) .def("__getitem__", &utility::constant_len_get_item) .def("__setitem__", &utility::constant_len_set_item) .def("row_major_values", row_major_values, "Returns the contents of the matrix as a list of floating-point values in row-major order.") .def("column_major_values", column_major_values, "Returns the contents of the matrix as a list of floating-point values in column-major order.") .def(boost::python::self * k3d::normal3()) .def(boost::python::self * k3d::point3()) .def(boost::python::self * k3d::vector3()) .def(boost::python::self * boost::python::self) .def(boost::python::self == boost::python::self) .def(boost::python::self != boost::python::self) .def(boost::python::self - boost::python::self) .def(boost::python::self + boost::python::self) .def(boost::python::self * double()) .def(double() * boost::python::self) .def(boost::python::self_ns::str(boost::python::self)); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/matrix4_python.h ================================================ #ifndef K3DSDK_PYTHON_MATRIX4_PYTHON_H #define K3DSDK_PYTHON_MATRIX4_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_matrix4(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_MATRIX4_PYTHON_H ================================================ FILE: k3dsdk/python/mesh_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { namespace detail { /////////////////////////////////////////////////////////////////////////////////////// // wrap_const_object template object wrap_const_object(const pipeline_data& Data) { if(!Data) return object(); return object(return_type(*Data)); } //////////////////////////////////////////////////////////////////////////////////////// // wrap_non_const_object template object wrap_non_const_object(pipeline_data& Data) { if(!Data) return object(); return object(wrap(Data.writable())); } //////////////////////////////////////////////////////////////////////////////////////// // create_object template object create_object(pipeline_data& Data) { return object(return_type(Data.create())); } /////////////////////////////////////////////////////////////////////////////////////////////// // wrap_const_array template object wrap_const_array(const pipeline_data& Data) { if(!Data) return object(); return object(instance_wrapper(*Data)); } /////////////////////////////////////////////////////////////////////////////////////////////// // wrap_non_const_array template object wrap_non_const_array(pipeline_data& Data) { if(!Data) return object(); return object(instance_wrapper(Data.writable())); } //////////////////////////////////////////////////////////////////////////////////////////////// // create_array template object create_array(pipeline_data& Data) { return object(instance_wrapper(Data.create())); } } // namespace detail /////////////////////////////////////////////////////////////////////////////////////////////////// // mesh static void mesh_copy_const(mesh_wrapper& Self, const_mesh_wrapper& RHS) { Self.wrapped() = RHS.wrapped(); } static void mesh_copy_non_const(mesh_wrapper& Self, mesh_wrapper& RHS) { Self.wrapped() = RHS.wrapped(); } static object mesh_create_point_selection(mesh_wrapper& Self) { return detail::create_array(Self.wrapped().point_selection); } static object mesh_create_points(mesh_wrapper& Self) { return detail::create_array(Self.wrapped().points); } static object mesh_point_selection(mesh_wrapper& Self) { return detail::wrap_non_const_array(Self.wrapped().point_selection); } static object mesh_points(mesh_wrapper& Self) { return detail::wrap_non_const_array(Self.wrapped().points); } static object mesh_point_attributes(mesh_wrapper& Self) { return wrap(Self.wrapped().point_attributes); } static object mesh_primitives(mesh_wrapper& Self) { return wrap(Self.wrapped().primitives); } static const string_t mesh_str(mesh_wrapper& Self) { std::ostringstream buffer; buffer << Self.wrapped(); return buffer.str(); } /////////////////////////////////////////////////////////////////////////////////////////////////// // const_mesh static object const_mesh_point_selection(const_mesh_wrapper& Self) { return detail::wrap_const_array(Self.wrapped().point_selection); } static object const_mesh_points(const_mesh_wrapper& Self) { return detail::wrap_const_array(Self.wrapped().points); } static object const_mesh_point_attributes(const_mesh_wrapper& Self) { return wrap(Self.wrapped().point_attributes); } static object const_mesh_primitives(const_mesh_wrapper& Self) { return wrap(Self.wrapped().primitives); } static const string_t const_mesh_str(const_mesh_wrapper& Self) { std::ostringstream buffer; buffer << Self.wrapped(); return buffer.str(); } /////////////////////////////////////////////////////////////////////////////////////////////////// // const_mesh_primitive static const string_t const_mesh_primitive_get_type(const_mesh_primitive_wrapper& Self) { return Self.wrapped().type; } static object const_mesh_primitive_get_structure(const_mesh_primitive_wrapper& Self) { return wrap(Self.wrapped().structure); } static object const_mesh_primitive_get_attributes(const_mesh_primitive_wrapper& Self) { return wrap(Self.wrapped().attributes); } static const string_t const_mesh_primitive_str(const_mesh_primitive_wrapper& Self) { std::ostringstream buffer; buffer << Self.wrapped(); return buffer.str(); } /////////////////////////////////////////////////////////////////////////////////////////////////// // mesh_primitive static const string_t mesh_primitive_get_type(mesh_primitive_wrapper& Self) { return Self.wrapped().type; } static void mesh_primitive_set_type(mesh_primitive_wrapper& Self, const string_t& Type) { Self.wrapped().type = Type; } static object mesh_primitive_get_structure(mesh_primitive_wrapper& Self) { return wrap(Self.wrapped().structure); } static object mesh_primitive_get_attributes(mesh_primitive_wrapper& Self) { return wrap(Self.wrapped().attributes); } static const string_t mesh_primitive_str(mesh_primitive_wrapper& Self) { std::ostringstream buffer; buffer << Self.wrapped(); return buffer.str(); } /////////////////////////////////////////////////////////////////////////////////////////////////// // const_mesh_primitives_t typedef instance_wrapper const_mesh_primitives_t_wrapper; static object const_mesh_primitives_t_get_item(const_mesh_primitives_t_wrapper& Self, int Item) { if(Item < 0 || Item >= Self.wrapped().size()) throw std::out_of_range("index out-of-range"); return wrap(Self.wrapped().at(Item).get()); } /////////////////////////////////////////////////////////////////////////////////////////////////// // mesh_primitives_t typedef instance_wrapper mesh_primitives_t_wrapper; static object mesh_primitives_t_get_item(mesh_primitives_t_wrapper& Self, int Item) { if(Item < 0 || Item >= Self.wrapped().size()) throw std::out_of_range("index out-of-range"); return detail::wrap_non_const_object(Self.wrapped().at(Item)); } static object mesh_primitives_t_create(mesh_primitives_t_wrapper& Self, const string_t& Type) { return wrap(Self.wrapped().create(Type)); } /////////////////////////////////////////////////////////////////////////////////////////////////// // define_class_mesh void define_class_mesh() { scope outer = class_("mesh", "Stores a heterogeneous collection of geometric mesh primitives.", no_init) .def("point_attributes", &mesh_point_attributes, "Returns a L{table} object containing a collection of mutable per-vertex data, or None.") .def("point_selection", &mesh_point_selection, "Returns an mutable L{double_array} object containing the selection state of every vertex in the mesh, or None.") .def("points", &mesh_points, "Returns an mutable L{const_point3_array} object containing the geometric coordinates of every vertex in the mesh, or None.") .def("copy", &mesh_copy_non_const, "Store a shallow copy of the given L{mesh}.") .def("copy", &mesh_copy_const, "Store a shallow copy of the given L{const_mesh}.") .def("create_point_selection", &mesh_create_point_selection, "Creates and returns a new L{double_array} object used to store the selection state of every vertex in the mesh.") .def("create_points", &mesh_create_points, "Creates and returns a new L{point3_array} object used to store the geometric coordinates of every vertex in the mesh.") .def("primitives", &mesh_primitives, "Returns the set of L{primitive} objects in the mesh.") .def("__str__", &mesh_str); class_("primitive", no_init) .def("type", &mesh_primitive_get_type) .def("structure", &mesh_primitive_get_structure) .def("attributes", &mesh_primitive_get_attributes) .def("__str__", &mesh_primitive_str) ; class_("primitives_t", no_init) .def("__len__", &utility::wrapped_len) .def("__getitem__", &mesh_primitives_t_get_item) .def("create", &mesh_primitives_t_create) ; } /////////////////////////////////////////////////////////////////////////////////////////////////// // define_class_mesh void define_class_const_mesh() { scope outer = class_("const_mesh", "Stores a heterogeneous, immutable collection of geometric mesh primitives.", no_init) .def("point_attributes", &const_mesh_point_attributes, "Returns a L{const_named_arrays} object containing a collection of immutable (read-only) per-vertex data, or None.") .def("point_selection", &const_mesh_point_selection, "Returns an immutable (read-only) L{const_double_array} object containing the selection state of every vertex in the mesh, or None.") .def("points", &const_mesh_points, "Returns an immutable (read-only) L{const_point3_array} object containing the geometric coordinates of every vertex in the mesh, or None.") .def("primitives", &const_mesh_primitives, "Returns the set of L{const_primitive} objects in the mesh.") .def("__str__", &const_mesh_str); class_("const_primitive", no_init) .def("type", &const_mesh_primitive_get_type) .def("structure", &const_mesh_primitive_get_structure) .def("attributes", &const_mesh_primitive_get_attributes) .def("__str__", &const_mesh_primitive_str) ; class_("const_primitives_t", no_init) .def("__len__", &utility::wrapped_len) .def("__getitem__", &const_mesh_primitives_t_get_item) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/mesh_python.h ================================================ #ifndef K3DSDK_PYTHON_MESH_PYTHON_H #define K3DSDK_PYTHON_MESH_PYTHON_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace python { typedef instance_wrapper mesh_wrapper; typedef instance_wrapper const_mesh_wrapper; typedef instance_wrapper mesh_primitive_wrapper; typedef instance_wrapper const_mesh_primitive_wrapper; void define_class_mesh(); void define_class_const_mesh(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_MESH_PYTHON_H ================================================ FILE: k3dsdk/python/mime_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { class mime { public: class type { public: static const k3d::mime::type lookup_file(const filesystem::path& File) { return k3d::mime::type::lookup(File); } static const k3d::mime::type lookup_data(const string_t& Data) { return k3d::mime::type::lookup(Data); } static const string_t str(k3d::mime::type& lhs) { return lhs.str(); } }; }; void define_namespace_mime() { scope outer = class_("mime", no_init); class_("type") .def("empty", &k3d::mime::type::empty, "Returns true if the MIME type is empty (unknown).") .def("lookup", mime::type::lookup_file, "Returns the MIME type of a file (could return an empty type if the file cannot be identified).") .def("lookup", mime::type::lookup_data, "Returns the MIME type of a data buffer (could return an empty type if the data cannot be identified).") .def("str", &k3d::mime::type::str, "Returns the MIME type as a string.") .def("__str__", mime::type::str, "") .def(self == self) .staticmethod("lookup"); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/mime_python.h ================================================ #ifndef K3DSDK_PYTHON_MIME_PYTHON_H #define K3DSDK_PYTHON_MIME_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_mime(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_MIME_PYTHON_H ================================================ FILE: k3dsdk/python/named_arrays_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { class named_arrays_array_factory { public: named_arrays_array_factory(const string_t& Name, const string_t& Type, boost::python::object& Array, k3d::named_arrays& Arrays) : name(Name), type(Type), array(Array), arrays(Arrays) { // Handle arrays of uint_t as a special-case ... if(Type == "k3d::uint_t") array = wrap(arrays.create(name)); } template void operator()(T) const { if(array != boost::python::object()) return; if(type != k3d::type_string()) return; array = wrap(arrays.create >(name)); } private: string_t name; string_t type; boost::python::object& array; k3d::named_arrays& arrays; }; static list keys(named_arrays_wrapper& Self) { list results; for(k3d::named_arrays::const_iterator array = Self.wrapped().begin(); array != Self.wrapped().end(); ++array) results.append(array->first); return results; } static object create(named_arrays_wrapper& Self, const string_t& Name, const string_t& Type) { if(Name.empty()) throw std::runtime_error("Empty array name"); boost::python::object result; boost::mpl::for_each(named_arrays_array_factory(Name, Type, result, Self.wrapped())); if(result == boost::python::object()) throw std::runtime_error("Cannot create array [" + Name + "] with unknown type [" + Type + "]"); return result; } static object create_array(named_arrays_wrapper& Self, const string_t& Name, const string_t& Type) { k3d::log() << warning << "create_array() is deprecated, use create() instead." << std::endl; return create(Self, Name, Type); } static void delete_1(named_arrays_wrapper& Self, const string_t& Name) { Self.wrapped().erase(Name); } static object get_item(named_arrays_wrapper& Self, const string_t& Key) { k3d::named_arrays::iterator iterator = Self.wrapped().find(Key); if(iterator == Self.wrapped().end()) throw std::runtime_error("unknown key: " + Key); return wrap_array(iterator->second.writable()); } void define_class_named_arrays() { class_("named_arrays", "Stores a mutable (read-write) collection of named arrays (named arrays of varying length).", no_init) .def("keys", &keys, "Returns a list containing names for all the arrays in the collection.") .def("create", &create, "Creates an array with given name and type.") .def("create_array", &create_array, "Creates an array with given name and type.") .def("delete", &delete_1, "Deletes an array with given name, if any.") .def("__len__", &utility::wrapped_len) .def("__getitem__", &get_item); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/named_arrays_python.h ================================================ #ifndef K3DSDK_PYTHON_NAMED_ARRAYS_PYTHON_H #define K3DSDK_PYTHON_NAMED_ARRAYS_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper named_arrays_wrapper; void define_class_named_arrays(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_NAMED_ARRAYS_PYTHON_H ================================================ FILE: k3dsdk/python/named_tables_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include using namespace boost::python; namespace k3d { namespace python { /////////////////////////////////////////////////////////////////////////////////////////////////// // named_tables static object named_tables_get_item(named_tables_wrapper& Self, int Item) { if(Item < 0 || Item >= Self.wrapped().size()) throw std::out_of_range("index out-of-range"); k3d::named_tables::iterator item(Self.wrapped().begin()); std::advance(item, Item); return wrap(item->second); } static object named_tables_create(named_tables_wrapper& Self, const string_t& Name) { if(Name.empty()) throw std::runtime_error("empty attribute name"); if(Self.wrapped().count(Name)) throw std::runtime_error("name already exists"); Self.wrapped().insert(std::make_pair(Name, k3d::table())); return wrap(Self.wrapped()[Name]); } static void delete_1(named_tables_wrapper& Self, const string_t& Name) { Self.wrapped().erase(Name); } static list keys(named_tables_wrapper& Self) { list results; for(k3d::named_tables::const_iterator table = Self.wrapped().begin(); table != Self.wrapped().end(); ++table) results.append(table->first); return results; } /////////////////////////////////////////////////////////////////////////////////////////////////// // define_class_named_tables void define_class_named_tables() { class_("named_tables", no_init) .def("__len__", &utility::wrapped_len) .def("__getitem__", &utility::wrapped_get_wrapped_item_by_key) .def("__getitem__", &named_tables_get_item) .def("create", &named_tables_create) .def("delete", &delete_1, "Deletes a set of attribute arrays with the given name, if any.") .def("keys", &keys, "Returns a list containing names for all the tables in the collection.") ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/named_tables_python.h ================================================ #ifndef K3DSDK_PYTHON_NAMED_TABLES_PYTHON_H #define K3DSDK_PYTHON_NAMED_TABLES_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper named_tables_wrapper; void define_class_named_tables(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_NAMED_TABLES_PYTHON_H ================================================ FILE: k3dsdk/python/node_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { namespace python { class node { public: static boost::python::list wrap_nodes(const std::vector& Nodes) { boost::python::list python_nodes; for(uint_t i = 0; i != Nodes.size(); ++i) python_nodes.append(wrap_unknown(*Nodes[i])); return python_nodes; } static boost::python::list lookup_all(idocument_wrapper& Document) { return wrap_nodes(k3d::node::lookup(Document.wrapped())); } static boost::python::list lookup_by_uuid(idocument_wrapper& Document, const uuid& ID) { return wrap_nodes(k3d::node::lookup(Document.wrapped(), ID)); } static boost::python::list lookup_by_name(idocument_wrapper& Document, const string_t& Name) { return wrap_nodes(k3d::node::lookup(Document.wrapped(), Name)); } static boost::python::list lookup_by_metadata(idocument_wrapper& Document, const string_t& MetadataName, const string_t& MetadataValue) { return wrap_nodes(k3d::node::lookup(Document.wrapped(), MetadataName, MetadataValue)); } static boost::python::object lookup_one_by_name(idocument_wrapper& Document, const string_t& Name) { return wrap_unknown(k3d::node::lookup_one(Document.wrapped(), Name)); } static void show_one(idocument_wrapper& Document, iunknown_wrapper& Node) { k3d::node::show(Document.wrapped(), Node.wrapped()); } static void hide_one(idocument_wrapper& Document, iunknown_wrapper& Node) { k3d::node::hide(Document.wrapped(), Node.wrapped()); } }; void define_namespace_node() { boost::python::scope outer = boost::python::class_("node", boost::python::no_init) .def("lookup", node::lookup_all, "Returns the set of all nodes in the given document.") .def("lookup", node::lookup_by_uuid, "Returns the set of nodes in a document that match a specific factory ID.") .def("lookup", node::lookup_by_name, "Returns the set of nodes in a document that match the given node name.") .def("lookup", node::lookup_by_metadata, "Returns the set of nodes in a document that match the given metadata name and value.") .staticmethod("lookup") .def("lookup_one", node::lookup_one_by_name, "Returns the one-and-only-one node in a document that matches the given node name, or None.") .staticmethod("lookup_one") .def("show", node::show_one, "Makes a node visible by adding it to every render engine in the document.") .staticmethod("show") .def("hide", node::hide_one, "Hides a node by removing it from every render engine in the document.") .staticmethod("hide") ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/node_python.h ================================================ #ifndef K3DSDK_PYTHON_NODE_PYTHON_H #define K3DSDK_PYTHON_NODE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_node(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_NODE_PYTHON_H ================================================ FILE: k3dsdk/python/normal3_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include using namespace boost::python; namespace k3d { namespace python { void define_class_normal3() { class_("normal3", "Stores a normal vector in three-dimensional space", no_init) .def(init()) .def(init()) .def("__len__", &utility::constant_len_len) .def("__getitem__", &utility::constant_len_get_item) .def("__setitem__", &utility::constant_len_set_item) .def(self == self) .def(self != self) .def(self * double()) .def(double() * self) .def(self += self) .def(self -= self) .def(self *= double()) .def(self /= double()) .def(self_ns::str(self)); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/normal3_python.h ================================================ #ifndef K3DSDK_PYTHON_NORMAL3_PYTHON_H #define K3DSDK_PYTHON_NORMAL3_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_normal3(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_NORMAL3_PYTHON_H ================================================ FILE: k3dsdk/python/nurbs_curve_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class nurbs_curve { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object material(wrapper& Self) { return wrap(Self.wrapped().material); } static object curve_first_points(wrapper& Self) { return wrap(Self.wrapped().curve_first_points); } static object curve_point_counts(wrapper& Self) { return wrap(Self.wrapped().curve_point_counts); } static object curve_orders(wrapper& Self) { return wrap(Self.wrapped().curve_orders); } static object curve_first_knots(wrapper& Self) { return wrap(Self.wrapped().curve_first_knots); } static object curve_selections(wrapper& Self) { return wrap(Self.wrapped().curve_selections); } static object curve_points(wrapper& Self) { return wrap(Self.wrapped().curve_points); } static object curve_point_weights(wrapper& Self) { return wrap(Self.wrapped().curve_point_weights); } static object curve_knots(wrapper& Self) { return wrap(Self.wrapped().curve_knots); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object curve_attributes(wrapper& Self) { return wrap(Self.wrapped().curve_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object material(wrapper& Self) { return wrap(Self.wrapped().material); } static object curve_first_points(wrapper& Self) { return wrap(Self.wrapped().curve_first_points); } static object curve_point_counts(wrapper& Self) { return wrap(Self.wrapped().curve_point_counts); } static object curve_orders(wrapper& Self) { return wrap(Self.wrapped().curve_orders); } static object curve_first_knots(wrapper& Self) { return wrap(Self.wrapped().curve_first_knots); } static object curve_selections(wrapper& Self) { return wrap(Self.wrapped().curve_selections); } static object curve_points(wrapper& Self) { return wrap(Self.wrapped().curve_points); } static object curve_point_weights(wrapper& Self) { return wrap(Self.wrapped().curve_point_weights); } static object curve_knots(wrapper& Self) { return wrap(Self.wrapped().curve_knots); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object curve_attributes(wrapper& Self) { return wrap(Self.wrapped().curve_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::nurbs_curve::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::nurbs_curve::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::nurbs_curve::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_nurbs_curve() { scope outer = class_("nurbs_curve", no_init) .def("create", &nurbs_curve::create) .staticmethod("create") .def("validate", &nurbs_curve::validate) .def("validate", &nurbs_curve::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("material", &nurbs_curve::const_primitive::material) .def("curve_first_points", &nurbs_curve::const_primitive::curve_first_points) .def("curve_point_counts", &nurbs_curve::const_primitive::curve_point_counts) .def("curve_orders", &nurbs_curve::const_primitive::curve_orders) .def("curve_first_knots", &nurbs_curve::const_primitive::curve_first_knots) .def("curve_selections", &nurbs_curve::const_primitive::curve_selections) .def("curve_points", &nurbs_curve::const_primitive::curve_points) .def("curve_point_weights", &nurbs_curve::const_primitive::curve_point_weights) .def("curve_knots", &nurbs_curve::const_primitive::curve_knots) .def("constant_attributes", &nurbs_curve::const_primitive::constant_attributes) .def("curve_attributes", &nurbs_curve::const_primitive::curve_attributes) .def("parameter_attributes", &nurbs_curve::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("material", &nurbs_curve::primitive::material) .def("curve_first_points", &nurbs_curve::primitive::curve_first_points) .def("curve_point_counts", &nurbs_curve::primitive::curve_point_counts) .def("curve_orders", &nurbs_curve::primitive::curve_orders) .def("curve_first_knots", &nurbs_curve::primitive::curve_first_knots) .def("curve_selections", &nurbs_curve::primitive::curve_selections) .def("curve_points", &nurbs_curve::primitive::curve_points) .def("curve_point_weights", &nurbs_curve::primitive::curve_point_weights) .def("curve_knots", &nurbs_curve::primitive::curve_knots) .def("constant_attributes", &nurbs_curve::primitive::constant_attributes) .def("curve_attributes", &nurbs_curve::primitive::curve_attributes) .def("parameter_attributes", &nurbs_curve::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/nurbs_curve_python.h ================================================ #ifndef K3DSDK_PYTHON_NURBS_CURVE_PYTHON_H #define K3DSDK_PYTHON_NURBS_CURVE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_nurbs_curve(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_NURBS_CURVE_PYTHON_H ================================================ FILE: k3dsdk/python/nurbs_patch_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class nurbs_patch { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object patch_first_points(wrapper& Self) { return wrap(Self.wrapped().patch_first_points); } static object patch_u_point_counts(wrapper& Self) { return wrap(Self.wrapped().patch_u_point_counts); } static object patch_v_point_counts(wrapper& Self) { return wrap(Self.wrapped().patch_v_point_counts); } static object patch_u_orders(wrapper& Self) { return wrap(Self.wrapped().patch_u_orders); } static object patch_v_orders(wrapper& Self) { return wrap(Self.wrapped().patch_v_orders); } static object patch_u_first_knots(wrapper& Self) { return wrap(Self.wrapped().patch_u_first_knots); } static object patch_v_first_knots(wrapper& Self) { return wrap(Self.wrapped().patch_v_first_knots); } static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); } static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); } static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); } static object patch_point_weights(wrapper& Self) { return wrap(Self.wrapped().patch_point_weights); } static object patch_u_knots(wrapper& Self) { return wrap(Self.wrapped().patch_u_knots); } static object patch_v_knots(wrapper& Self) { return wrap(Self.wrapped().patch_v_knots); } static object patch_trim_loop_counts(wrapper& Self) { return wrap(Self.wrapped().patch_trim_loop_counts); } static object patch_first_trim_loops(wrapper& Self) { return wrap(Self.wrapped().patch_first_trim_loops); } static object trim_loop_first_curves(wrapper& Self) { return wrap(Self.wrapped().trim_loop_first_curves); } static object trim_loop_curve_counts(wrapper& Self) { return wrap(Self.wrapped().trim_loop_curve_counts); } static object trim_loop_selections(wrapper& Self) { return wrap(Self.wrapped().trim_loop_selections); } static object curve_first_points(wrapper& Self) { return wrap(Self.wrapped().curve_first_points); } static object curve_point_counts(wrapper& Self) { return wrap(Self.wrapped().curve_point_counts); } static object curve_orders(wrapper& Self) { return wrap(Self.wrapped().curve_orders); } static object curve_first_knots(wrapper& Self) { return wrap(Self.wrapped().curve_first_knots); } static object curve_selections(wrapper& Self) { return wrap(Self.wrapped().curve_selections); } static object curve_points(wrapper& Self) { return wrap(Self.wrapped().curve_points); } static object curve_point_weights(wrapper& Self) { return wrap(Self.wrapped().curve_point_weights); } static object curve_knots(wrapper& Self) { return wrap(Self.wrapped().curve_knots); } static object points(wrapper& Self) { return wrap(Self.wrapped().points); } static object point_selections(wrapper& Self) { return wrap(Self.wrapped().point_selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object patch_first_points(wrapper& Self) { return wrap(Self.wrapped().patch_first_points); } static object patch_u_point_counts(wrapper& Self) { return wrap(Self.wrapped().patch_u_point_counts); } static object patch_v_point_counts(wrapper& Self) { return wrap(Self.wrapped().patch_v_point_counts); } static object patch_u_orders(wrapper& Self) { return wrap(Self.wrapped().patch_u_orders); } static object patch_v_orders(wrapper& Self) { return wrap(Self.wrapped().patch_v_orders); } static object patch_u_first_knots(wrapper& Self) { return wrap(Self.wrapped().patch_u_first_knots); } static object patch_v_first_knots(wrapper& Self) { return wrap(Self.wrapped().patch_v_first_knots); } static object patch_selections(wrapper& Self) { return wrap(Self.wrapped().patch_selections); } static object patch_materials(wrapper& Self) { return wrap(Self.wrapped().patch_materials); } static object patch_points(wrapper& Self) { return wrap(Self.wrapped().patch_points); } static object patch_point_weights(wrapper& Self) { return wrap(Self.wrapped().patch_point_weights); } static object patch_u_knots(wrapper& Self) { return wrap(Self.wrapped().patch_u_knots); } static object patch_v_knots(wrapper& Self) { return wrap(Self.wrapped().patch_v_knots); } static object patch_trim_loop_counts(wrapper& Self) { return wrap(Self.wrapped().patch_trim_loop_counts); } static object patch_first_trim_loops(wrapper& Self) { return wrap(Self.wrapped().patch_first_trim_loops); } static object trim_loop_first_curves(wrapper& Self) { return wrap(Self.wrapped().trim_loop_first_curves); } static object trim_loop_curve_counts(wrapper& Self) { return wrap(Self.wrapped().trim_loop_curve_counts); } static object trim_loop_selections(wrapper& Self) { return wrap(Self.wrapped().trim_loop_selections); } static object curve_first_points(wrapper& Self) { return wrap(Self.wrapped().curve_first_points); } static object curve_point_counts(wrapper& Self) { return wrap(Self.wrapped().curve_point_counts); } static object curve_orders(wrapper& Self) { return wrap(Self.wrapped().curve_orders); } static object curve_first_knots(wrapper& Self) { return wrap(Self.wrapped().curve_first_knots); } static object curve_selections(wrapper& Self) { return wrap(Self.wrapped().curve_selections); } static object curve_points(wrapper& Self) { return wrap(Self.wrapped().curve_points); } static object curve_point_weights(wrapper& Self) { return wrap(Self.wrapped().curve_point_weights); } static object curve_knots(wrapper& Self) { return wrap(Self.wrapped().curve_knots); } static object points(wrapper& Self) { return wrap(Self.wrapped().points); } static object point_selections(wrapper& Self) { return wrap(Self.wrapped().point_selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object patch_attributes(wrapper& Self) { return wrap(Self.wrapped().patch_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::nurbs_patch::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::nurbs_patch::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::nurbs_patch::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_nurbs_patch() { scope outer = class_("nurbs_patch", no_init) .def("create", &nurbs_patch::create) .staticmethod("create") .def("validate", &nurbs_patch::validate) .def("validate", &nurbs_patch::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("patch_first_points", &nurbs_patch::const_primitive::patch_first_points) .def("patch_u_point_counts", &nurbs_patch::const_primitive::patch_u_point_counts) .def("patch_v_point_counts", &nurbs_patch::const_primitive::patch_v_point_counts) .def("patch_u_orders", &nurbs_patch::const_primitive::patch_u_orders) .def("patch_v_orders", &nurbs_patch::const_primitive::patch_v_orders) .def("patch_u_first_knots", &nurbs_patch::const_primitive::patch_u_first_knots) .def("patch_v_first_knots", &nurbs_patch::const_primitive::patch_v_first_knots) .def("patch_selections", &nurbs_patch::const_primitive::patch_selections) .def("patch_materials", &nurbs_patch::const_primitive::patch_materials) .def("patch_points", &nurbs_patch::const_primitive::patch_points) .def("patch_point_weights", &nurbs_patch::const_primitive::patch_point_weights) .def("patch_u_knots", &nurbs_patch::const_primitive::patch_u_knots) .def("patch_v_knots", &nurbs_patch::const_primitive::patch_v_knots) .def("patch_trim_loop_counts", &nurbs_patch::const_primitive::patch_trim_loop_counts) .def("patch_first_trim_loops", &nurbs_patch::const_primitive::patch_first_trim_loops) .def("trim_loop_first_curves", &nurbs_patch::const_primitive::trim_loop_first_curves) .def("trim_loop_curve_counts", &nurbs_patch::const_primitive::trim_loop_curve_counts) .def("trim_loop_selections", &nurbs_patch::const_primitive::trim_loop_selections) .def("curve_first_points", &nurbs_patch::const_primitive::curve_first_points) .def("curve_point_counts", &nurbs_patch::const_primitive::curve_point_counts) .def("curve_orders", &nurbs_patch::const_primitive::curve_orders) .def("curve_first_knots", &nurbs_patch::const_primitive::curve_first_knots) .def("curve_selections", &nurbs_patch::const_primitive::curve_selections) .def("curve_points", &nurbs_patch::const_primitive::curve_points) .def("curve_point_weights", &nurbs_patch::const_primitive::curve_point_weights) .def("curve_knots", &nurbs_patch::const_primitive::curve_knots) .def("points", &nurbs_patch::const_primitive::points) .def("point_selections", &nurbs_patch::const_primitive::point_selections) .def("constant_attributes", &nurbs_patch::const_primitive::constant_attributes) .def("patch_attributes", &nurbs_patch::const_primitive::patch_attributes) .def("parameter_attributes", &nurbs_patch::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("patch_first_points", &nurbs_patch::primitive::patch_first_points) .def("patch_u_point_counts", &nurbs_patch::primitive::patch_u_point_counts) .def("patch_v_point_counts", &nurbs_patch::primitive::patch_v_point_counts) .def("patch_u_orders", &nurbs_patch::primitive::patch_u_orders) .def("patch_v_orders", &nurbs_patch::primitive::patch_v_orders) .def("patch_u_first_knots", &nurbs_patch::primitive::patch_u_first_knots) .def("patch_v_first_knots", &nurbs_patch::primitive::patch_v_first_knots) .def("patch_selections", &nurbs_patch::primitive::patch_selections) .def("patch_materials", &nurbs_patch::primitive::patch_materials) .def("patch_points", &nurbs_patch::primitive::patch_points) .def("patch_point_weights", &nurbs_patch::primitive::patch_point_weights) .def("patch_u_knots", &nurbs_patch::primitive::patch_u_knots) .def("patch_v_knots", &nurbs_patch::primitive::patch_v_knots) .def("patch_trim_loop_counts", &nurbs_patch::primitive::patch_trim_loop_counts) .def("patch_first_trim_loops", &nurbs_patch::primitive::patch_first_trim_loops) .def("trim_loop_first_curves", &nurbs_patch::primitive::trim_loop_first_curves) .def("trim_loop_curve_counts", &nurbs_patch::primitive::trim_loop_curve_counts) .def("trim_loop_selections", &nurbs_patch::primitive::trim_loop_selections) .def("curve_first_points", &nurbs_patch::primitive::curve_first_points) .def("curve_point_counts", &nurbs_patch::primitive::curve_point_counts) .def("curve_orders", &nurbs_patch::primitive::curve_orders) .def("curve_first_knots", &nurbs_patch::primitive::curve_first_knots) .def("curve_selections", &nurbs_patch::primitive::curve_selections) .def("curve_points", &nurbs_patch::primitive::curve_points) .def("curve_point_weights", &nurbs_patch::primitive::curve_point_weights) .def("curve_knots", &nurbs_patch::primitive::curve_knots) .def("points", &nurbs_patch::primitive::points) .def("point_selections", &nurbs_patch::primitive::point_selections) .def("constant_attributes", &nurbs_patch::primitive::constant_attributes) .def("patch_attributes", &nurbs_patch::primitive::patch_attributes) .def("parameter_attributes", &nurbs_patch::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/nurbs_patch_python.h ================================================ #ifndef K3DSDK_PYTHON_NURBS_PATCH_PYTHON_H #define K3DSDK_PYTHON_NURBS_PATCH_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_nurbs_patch(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_NURBS_PATCH_PYTHON_H ================================================ FILE: k3dsdk/python/object_model_python.cpp ================================================ // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #ifdef K3D_BUILD_NGUI_MODULE #include #endif // K3D_BUILD_NGUI_MODULE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // MinGW needs typeinfo #include #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { //////////////////////////////////////////////////////////////////////////////////// // k3d module helpers object module_create_plugin(const string_t& Type) { throw std::runtime_error("k3d.create_plugin() has been removed, use k3d.plugin.create() instead."); } void module_check_node_environment(const k3d::iscript_engine::context& Context, const string_t& PluginType) { k3d::iscript_engine::context::const_iterator n = Context.find("node"); if(n != Context.end()) { if(k3d::inode* const node = boost::any_cast(n->second)) { if(node->factory().name() == PluginType) { return; } } } k3d::user_interface().error_message(k3d::string_cast(boost::format("This script can only be used from within a %1% plugin.") % PluginType)); throw std::runtime_error("script can only be run from " + PluginType); } const double module_length(const object& Value) { extract vector3(Value); if(vector3.check()) return k3d::length(vector3()); throw std::invalid_argument("can't calculate length for this type"); } void module_log_critical(const string_t& Message) { throw std::runtime_error("k3d.log_critical() has been removed, use k3d.log.critical() instead."); } void module_log_debug(const string_t& Message) { throw std::runtime_error("k3d.log_debug() has been removed, use k3d.log.debug() instead."); } void module_log_error(const string_t& Message) { throw std::runtime_error("k3d.log_error() has been removed, use k3d.log.error() instead."); } void module_log_info(const string_t& Message) { throw std::runtime_error("k3d.log_info() has been removed, use k3d.log.info() instead."); } void module_log_warning(const string_t& Message) { throw std::runtime_error("k3d.log_warning() has been removed, use k3d.log.warning() instead."); } const list module_plugins() { throw std::runtime_error("k3d.plugins() has been removed, use k3d.plugin.factory.lookup() instead."); } static const k3d::matrix4 rotate3_a(const k3d::angle_axis& Value) { return k3d::rotate3(Value); } static const k3d::matrix4 rotate3_b(const k3d::euler_angles& Value) { return k3d::rotate3(k3d::quaternion(Value)); } static const k3d::matrix4 scale3_a(const double_t X, const double_t Y, const double_t Z) { return k3d::scale3(X, Y, Z); } static const k3d::matrix4 scale3_b(const double_t S) { return k3d::scale3(S); } static const k3d::matrix4 translate3_a(const k3d::vector3& Offset) { return k3d::translate3(Offset); } static const k3d::matrix4 translate3_b(const double_t X, const double_t Y, const double_t Z) { return k3d::translate3(X, Y, Z); } static const k3d::matrix4 translate3_c(const boost::python::tuple& Tuple) { if(len(Tuple) != 3) throw std::invalid_argument("3-tuple required."); return k3d::translate3(extract(Tuple[0]), extract(Tuple[1]), extract(Tuple[2])); } object module_ui() { return wrap_unknown(k3d::user_interface()); } void module_exit() { k3d::application().exit(); } object module_new_document() { return wrap(k3d::application().create_document()); } list module_documents() { list results; const k3d::iapplication::document_collection_t documents = k3d::application().documents(); for(k3d::iapplication::document_collection_t::const_iterator document = documents.begin(); document != documents.end(); ++document) results.append(wrap(*document)); return results; } void module_close_document(idocument_wrapper& Document) { k3d::application().close_document(Document.wrapped()); } object module_open_document(const k3d::filesystem::path& Path) { boost::scoped_ptr importer(k3d::plugin::create(k3d::classes::DocumentImporter())); if(!importer) throw std::runtime_error("no importer plugin available"); k3d::idocument* const document = k3d::application().create_document(); if(!document) throw std::runtime_error("couldn't create empty document"); if(!importer->read_file(Path, *document)) throw std::runtime_error("error loading document"); return wrap(document); } const k3d::vector3 module_to_vector3(const k3d::point3& v) { return k3d::to_vector(v); } const k3d::point3 module_world_position(iunknown_wrapper& Node) { return k3d::world_position(Node.wrapped()); } object module_get_time(idocument_wrapper& Document) { return wrap_unknown(k3d::get_time(Document.wrapped())); } //////////////////////////////////////////////////////////////////////////////////// // k3d module BOOST_PYTHON_MODULE(k3d) { define_typed_array_classes(); define_const_typed_array_classes(); define_class_angle_axis(); #ifdef K3D_BUILD_NGUI_MODULE define_class_atk_object(); #endif // K3D_BUILD_NGUI_MODULE define_class_table(); define_class_bitmap(); define_class_bounding_box3(); define_class_color(); define_class_const_table(); define_class_const_bitmap(); define_class_const_named_arrays(); define_class_const_named_tables(); define_class_euler_angles(); define_class_file_change_receiver(); define_class_file_signal(); define_class_idocument(); define_class_iunknown(); define_class_matrix4(); define_class_mesh(); define_class_const_mesh(); define_class_named_arrays(); define_class_named_tables(); define_class_normal3(); define_class_point2(); define_class_point3(); define_class_point4(); define_class_texture3(); define_class_uuid(); define_class_vector2(); define_class_vector3(); define_class_vector4(); define_namespace_bezier_triangle_patch(); define_namespace_bicubic_patch(); define_namespace_bilinear_patch(); define_namespace_blobby(); define_namespace_cone(); define_namespace_cubic_curve(); define_namespace_cylinder(); define_namespace_difference(); define_namespace_disk(); define_namespace_euler(); define_namespace_filesystem(); define_namespace_geometry(); define_namespace_hyperboloid(); define_namespace_linear_curve(); define_namespace_log(); define_namespace_mime(); define_namespace_node(); define_namespace_nurbs_curve(); define_namespace_nurbs_patch(); define_namespace_paraboloid(); define_namespace_parallel(); define_namespace_plugin(); define_namespace_particle(); define_namespace_polyhedron(); define_namespace_property(); define_namespace_resource(); define_namespace_ri(); define_namespace_script(); define_namespace_selection(); define_namespace_sphere(); define_namespace_teapot(); define_namespace_torus(); def("batch_mode", k3d::batch_mode, "Returns True if batch (no user intervention) mode is enabled for the user interface.\n" "@note: Well-behaved scripts should not prompt the user for input if batch mode is enabled."); def("check_node_environment", module_check_node_environment, "Checks to see whether the current script is running from within the given node type."); def("close_document", module_close_document, "Closes an open document."); def("create_plugin", module_create_plugin, "Creates an application plugin instance by name (fails if there is no application plugin factory with the given name)."); def("documents", module_documents, "Returns a list containing all open documents."); def("exit", module_exit, "Request program exit (may be overridden by user input)."); def("identity3", k3d::identity3, "Returns a L{matrix4} containing a three-dimensional identity matrix."); def("intersect_lines", k3d::intersect_lines, "Find the point at which two infinite lines intersect."); def("inverse", k3d::inverse, "Computes the inverse of a matrix."); def("length", module_length, "Returns the length of a L{vector3}."); def("log_critical", module_log_critical, "Sends a critical message to the K-3D log."); def("log_debug", module_log_debug, "Sends a debug message to the K-3D log."); def("log_error", module_log_error, "Sends an error message to the K-3D log."); def("log_info", module_log_info, "Sends an informational message to the K-3D log."); def("log_warning", module_log_warning, "Sends a warning message to the K-3D log."); def("new_document", module_new_document, "Returns a new (completely empty) document."); def("open_document", module_open_document, "Opens an existing document stored on disk."); def("plugins", module_plugins, "Returns a list containing the set of all plugin factories."); def("rotate3", rotate3_a, "Returns a L{matrix4} containing a three-dimensional rotation matrix."); def("rotate3", rotate3_b, "Returns a L{matrix4} containing a three-dimensional rotation matrix."); def("scale3", scale3_a, "Returns a L{matrix4} containing a three-dimensional scaling matrix."); def("scale3", scale3_b, "Returns a L{matrix4} containing a three-dimensional scaling matrix."); def("share_path", k3d::share_path, "Returns the runtime path to shared data."); def("to_vector3", module_to_vector3, "Explicit conversion from point3 to vector3"); def("translate3", translate3_a, "Returns a L{matrix4} containing a three-dimensional translation matrix."); def("translate3", translate3_b, "Returns a L{matrix4} containing a three-dimensional translation matrix."); def("translate3", translate3_c, "Returns a L{matrix4} containing a three-dimensional translation matrix."); def("ui", module_ui, "Returns the singleton runtime user interface plugin instance."); def("world_position", module_world_position, "Returns a node's position in world coordinates (returns the origin for non-transformable nodes)"); def("get_time", module_get_time, "Returns the time property for a document (could return NULL)"); scope().attr("__doc__") = "Provides access to the K-3D API"; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/object_model_python.h ================================================ #ifndef K3DSDK_PYTHON_OBJECT_MODEL_PYTHON_H #define K3DSDK_PYTHON_OBJECT_MODEL_PYTHON_H // K-3D // Copyright (c) 1995-2010, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ extern "C" { void initk3d(); } #endif // !K3DSDK_PYTHON_OBJECT_MODEL_PYTHON_H ================================================ FILE: k3dsdk/python/offscreen_context_factory_gl_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { static void create(iunknown_wrapper& Self, const uint_t Width, const uint_t Height) { delete Self.wrapped().create(Width, Height); } void define_methods_offscreen_context_factory_gl(k3d::iunknown& Interface, boost::python::object& Instance) { if(!dynamic_cast(&Interface)) return; utility::add_method(utility::make_function(&create, "Creates an OpenGL context."), "create", Instance); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/offscreen_context_factory_gl_python.h ================================================ #ifndef K3DSDK_PYTHON_OFFSCREEN_CONTEXT_FACTORY_GL_PYTHON_H #define K3DSDK_PYTHON_OFFSCREEN_CONTEXT_FACTORY_GL_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include namespace k3d { class iunknown; namespace python { void define_methods_offscreen_context_factory_gl(iunknown& Interface, boost::python::object& Instance); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_OFFSCREEN_CONTEXT_FACTORY_GL_PYTHON_H ================================================ FILE: k3dsdk/python/owned_instance_wrapper_python.h ================================================ #ifndef K3DSDK_PYTHON_OWNED_INSTANCE_WRAPPER_PYTHON_H #define K3DSDK_PYTHON_OWNED_INSTANCE_WRAPPER_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include namespace k3d { namespace python { //////////////////////////////////////////////////////////////////////////////////// // owned_instance_wrapper template class owned_instance_wrapper { public: typedef T wrapped_type; owned_instance_wrapper() : m_wrapped(0) { } owned_instance_wrapper(T* Wrapped) : m_wrapped(Wrapped) { } owned_instance_wrapper(T& Wrapped) : m_wrapped(&Wrapped) { } friend const bool operator==(const owned_instance_wrapper& lhs, const owned_instance_wrapper& rhs) { return lhs.m_wrapped == rhs.m_wrapped; } T& wrapped() const { if(!m_wrapped) throw std::runtime_error("wrapped interface is null"); return *m_wrapped; } T* wrapped_ptr() const { return m_wrapped; } private: boost::shared_ptr m_wrapped; }; template boost::python::object wrap_owned(T* Wrapped) { return Wrapped ? boost::python::object(owned_instance_wrapper(*Wrapped)) : boost::python::object(); } template boost::python::object wrap_owned(T& Wrapped) { return boost::python::object(owned_instance_wrapper(Wrapped)); } } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_OWNED_INSTANCE_WRAPPER_PYTHON_H ================================================ FILE: k3dsdk/python/paraboloid_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class paraboloid { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object radii(wrapper& Self) { return wrap(Self.wrapped().radii); } static object z_min(wrapper& Self) { return wrap(Self.wrapped().z_min); } static object z_max(wrapper& Self) { return wrap(Self.wrapped().z_max); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object matrices(wrapper& Self) { return wrap(Self.wrapped().matrices); } static object materials(wrapper& Self) { return wrap(Self.wrapped().materials); } static object radii(wrapper& Self) { return wrap(Self.wrapped().radii); } static object z_min(wrapper& Self) { return wrap(Self.wrapped().z_min); } static object z_max(wrapper& Self) { return wrap(Self.wrapped().z_max); } static object sweep_angles(wrapper& Self) { return wrap(Self.wrapped().sweep_angles); } static object selections(wrapper& Self) { return wrap(Self.wrapped().selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object surface_attributes(wrapper& Self) { return wrap(Self.wrapped().surface_attributes); } static object parameter_attributes(wrapper& Self) { return wrap(Self.wrapped().parameter_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::paraboloid::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::paraboloid::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::paraboloid::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_paraboloid() { scope outer = class_("paraboloid", no_init) .def("create", ¶boloid::create) .staticmethod("create") .def("validate", ¶boloid::validate) .def("validate", ¶boloid::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("matrices", ¶boloid::const_primitive::matrices) .def("materials", ¶boloid::const_primitive::materials) .def("radii", ¶boloid::const_primitive::radii) .def("z_min", ¶boloid::const_primitive::z_min) .def("z_max", ¶boloid::const_primitive::z_max) .def("sweep_angles", ¶boloid::const_primitive::sweep_angles) .def("selections", ¶boloid::const_primitive::selections) .def("constant_attributes", ¶boloid::const_primitive::constant_attributes) .def("surface_attributes", ¶boloid::const_primitive::surface_attributes) .def("parameter_attributes", ¶boloid::const_primitive::parameter_attributes) ; class_("primitive", no_init) .def("matrices", ¶boloid::primitive::matrices) .def("materials", ¶boloid::primitive::materials) .def("radii", ¶boloid::primitive::radii) .def("z_min", ¶boloid::primitive::z_min) .def("z_max", ¶boloid::primitive::z_max) .def("sweep_angles", ¶boloid::primitive::sweep_angles) .def("selections", ¶boloid::primitive::selections) .def("constant_attributes", ¶boloid::primitive::constant_attributes) .def("surface_attributes", ¶boloid::primitive::surface_attributes) .def("parameter_attributes", ¶boloid::primitive::parameter_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/paraboloid_python.h ================================================ #ifndef K3DSDK_PYTHON_PARABOLOID_PYTHON_H #define K3DSDK_PYTHON_PARABOLOID_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_paraboloid(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_PARABOLOID_PYTHON_H ================================================ FILE: k3dsdk/python/parallel_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include using namespace boost::python; namespace k3d { namespace python { class parallel { public: }; void define_namespace_parallel() { class_("parallel", no_init) .def("grain_size", k3d::parallel::grain_size, "Returns the global grain size to be used for parallel computation.") .def("set_grain_size", k3d::parallel::set_grain_size, "Sets the global grain size to be used for parallel computation.") .def("set_thread_count", k3d::parallel::set_thread_count, "Sets the number of threads to be used for parallel computation (quietly ignored if parallel computation wasn't enabled in the build.") .staticmethod("grain_size") .staticmethod("set_grain_size") .staticmethod("set_thread_count"); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/parallel_python.h ================================================ #ifndef K3DSDK_PYTHON_PARALLEL_PYTHON_H #define K3DSDK_PYTHON_PARALLEL_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_parallel(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_PARALLEL_PYTHON_H ================================================ FILE: k3dsdk/python/particle_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class particle { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object material(wrapper& Self) { return wrap(Self.wrapped().material); } static object points(wrapper& Self) { return wrap(Self.wrapped().points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object material(wrapper& Self) { return wrap(Self.wrapped().material); } static object points(wrapper& Self) { return wrap(Self.wrapped().points); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::particle::create(Mesh.wrapped())); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::particle::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::particle::validate(Mesh.wrapped(), Primitive.wrapped())); } }; void define_namespace_particle() { scope outer = class_("particle", no_init) .def("create", &particle::create) .staticmethod("create") .def("validate", &particle::validate) .def("validate", &particle::validate_const) .staticmethod("validate") ; class_("const_primitive", no_init) .def("material", &particle::const_primitive::material) .def("points", &particle::const_primitive::points) .def("constant_attributes", &particle::const_primitive::constant_attributes) .def("vertex_attributes", &particle::const_primitive::vertex_attributes) ; class_("primitive", no_init) .def("material", &particle::primitive::material) .def("points", &particle::primitive::points) .def("constant_attributes", &particle::primitive::constant_attributes) .def("vertex_attributes", &particle::primitive::vertex_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/particle_python.h ================================================ #ifndef K3DSDK_PYTHON_PARTICLE_PYTHON_H #define K3DSDK_PYTHON_PARTICLE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_particle(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_PARTICLE_PYTHON_H ================================================ FILE: k3dsdk/python/plugin_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include namespace k3d { namespace python { class plugin { public: static boost::python::list wrap_factories(const k3d::plugin::factory::collection_t& Factories) { boost::python::list python_factories; for(k3d::plugin::factory::collection_t::const_iterator factory = Factories.begin(); factory != Factories.end(); ++factory) python_factories.append(wrap_unknown(*factory)); return python_factories; } static boost::python::object create_by_uuid(const uuid& ID) { return wrap_unknown(k3d::plugin::create(ID)); } static boost::python::object create_by_name(const string_t& Type) { return wrap_unknown(k3d::plugin::create(Type)); } static boost::python::object create_by_factory(const iunknown_wrapper& Factory) { return wrap_unknown(k3d::plugin::create(dynamic_cast(Factory.wrapped()))); } static boost::python::object document_create_by_uuid(const uuid& ID, const idocument_wrapper& Document) { return wrap_unknown(k3d::plugin::create(ID, Document.wrapped())); } static boost::python::object document_create_by_name(const string_t& Type, const idocument_wrapper& Document) { return wrap_unknown(k3d::plugin::create(Type, Document.wrapped())); } static boost::python::object document_create_by_factory(const iunknown_wrapper& Factory, const idocument_wrapper& Document) { return wrap_unknown(k3d::plugin::create(dynamic_cast(Factory.wrapped()), Document.wrapped())); } class factory { public: static boost::python::list lookup() { return wrap_factories(k3d::plugin::factory::lookup()); } static boost::python::object lookup_by_uuid(const uuid& ID) { return wrap_unknown(k3d::plugin::factory::lookup(ID)); } static boost::python::object lookup_by_name(const string_t& Name) { return wrap_unknown(k3d::plugin::factory::lookup(Name)); } static boost::python::list lookup_by_metadata(const string_t& MetadataName, const string_t& MetadataValue) { return wrap_factories(k3d::plugin::factory::lookup(MetadataName, MetadataValue)); } static boost::python::list lookup_by_mime_type(const k3d::mime::type& Type) { return wrap_factories(k3d::plugin::factory::lookup(Type)); } }; }; void define_namespace_plugin() { boost::python::scope outer = boost::python::class_("plugin", boost::python::no_init) .def("create", plugin::create_by_name, "Returns a new application plugin instance, or None.") .def("create", plugin::create_by_uuid, "Returns a new application plugin instance, or None.") .def("create", plugin::create_by_factory, "Returns a new application plugin instance, or None.") .def("create", plugin::document_create_by_name, "Returns a new document plugin instance, or None.") .def("create", plugin::document_create_by_uuid, "Returns a new document plugin instance, or None.") .def("create", plugin::document_create_by_factory, "Returns a new document plugin instance, or None.") .staticmethod("create"); boost::python::class_("factory", boost::python::no_init) .def("lookup", plugin::factory::lookup, "Returns a list containing all available plugin factories.") .def("lookup", plugin::factory::lookup_by_uuid, "Returns the plugin factory that matches the given id, or None.") .def("lookup", plugin::factory::lookup_by_name, "Returns the plugin factory that matches the given name, or None.") .def("lookup", plugin::factory::lookup_by_metadata, "Returns a list containing all plugin factories that match the given metadata name and value.") .def("lookup", plugin::factory::lookup_by_mime_type, "Returns a list containing all plugin factories that match the given MIME type.") .staticmethod("lookup"); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/plugin_python.h ================================================ #ifndef K3DSDK_PYTHON_PLUGIN_PYTHON_H #define K3DSDK_PYTHON_PLUGIN_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_plugin(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_PLUGIN_PYTHON_H ================================================ FILE: k3dsdk/python/point2_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { void define_class_point2() { class_("point2", "Stores a position in two-dimensional space", no_init) .def(init()) .def(init()) .def("__len__", &utility::constant_len_len) .def("__getitem__", &utility::constant_len_get_item) .def("__setitem__", &utility::constant_len_set_item) .def(self == self) .def(self != self) .def(self + self) .def(self - self) .def(self * double()) .def(double() * self) .def(self *= double()) .def(self /= double()) .def(self += k3d::vector2()) .def(self -= k3d::vector2()) .def(self_ns::str(self)); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/point2_python.h ================================================ #ifndef K3DSDK_PYTHON_POINT2_PYTHON_H #define K3DSDK_PYTHON_POINT2_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_point2(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_POINT2_PYTHON_H ================================================ FILE: k3dsdk/python/point3_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include #include using namespace boost::python; namespace k3d { namespace python { void define_class_point3() { class_("point3", "Stores a position in three-dimensional space", no_init) .def(init()) .def(init()) .def("__len__", &utility::constant_len_len) .def("__getitem__", &utility::constant_len_get_item) .def("__setitem__", &utility::constant_len_set_item) .def(self == self) .def(self != self) .def(self + self) .def(self - self) .def(self * double_t()) .def(double_t() * self) .def(self *= double_t()) .def(self /= double_t()) .def(self += k3d::vector3()) .def(self -= k3d::vector3()) .def(self_ns::str(self)); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/point3_python.h ================================================ #ifndef K3DSDK_PYTHON_POINT3_PYTHON_H #define K3DSDK_PYTHON_POINT3_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_point3(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_POINT3_PYTHON_H ================================================ FILE: k3dsdk/python/point4_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include #include using namespace boost::python; namespace k3d { namespace python { void define_class_point4() { class_("point4", "Stores a position in four-dimensional space", no_init) .def(init()) .def(init()) .def("__len__", &utility::constant_len_len) .def("__getitem__", &utility::constant_len_get_item) .def("__setitem__", &utility::constant_len_set_item) .def(self == self) .def(self != self) .def(self + self) .def(self - self) .def(self * double_t()) .def(double_t() * self) .def(self += k3d::vector4()) .def(self -= k3d::vector4()) .def(self *= double_t()) .def(self /= double_t()) .def(self_ns::str(self)); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/point4_python.h ================================================ #ifndef K3DSDK_PYTHON_POINT4_PYTHON_H #define K3DSDK_PYTHON_POINT4_PYTHON_H // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_class_point4(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_POINT4_PYTHON_H ================================================ FILE: k3dsdk/python/polyhedron_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include #include #include #include #include using namespace boost::python; #include namespace k3d { namespace python { class polyhedron { public: class const_primitive { public: typedef owned_instance_wrapper wrapper; static object shell_types(wrapper& Self) { return wrap(Self.wrapped().shell_types); } static object face_shells(wrapper& Self) { return wrap(Self.wrapped().face_shells); } static object face_first_loops(wrapper& Self) { return wrap(Self.wrapped().face_first_loops); } static object face_loop_counts(wrapper& Self) { return wrap(Self.wrapped().face_loop_counts); } static object face_selections(wrapper& Self) { return wrap(Self.wrapped().face_selections); } static object face_materials(wrapper& Self) { return wrap(Self.wrapped().face_materials); } static object loop_first_edges(wrapper& Self) { return wrap(Self.wrapped().loop_first_edges); } static object clockwise_edges(wrapper& Self) { return wrap(Self.wrapped().clockwise_edges); } static object edge_selections(wrapper& Self) { return wrap(Self.wrapped().edge_selections); } static object vertex_points(wrapper& Self) { return wrap(Self.wrapped().vertex_points); } static object vertex_selections(wrapper& Self) { return wrap(Self.wrapped().vertex_selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object face_attributes(wrapper& Self) { return wrap(Self.wrapped().face_attributes); } static object edge_attributes(wrapper& Self) { return wrap(Self.wrapped().edge_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; class primitive { public: typedef owned_instance_wrapper wrapper; static object shell_types(wrapper& Self) { return wrap(Self.wrapped().shell_types); } static object face_shells(wrapper& Self) { return wrap(Self.wrapped().face_shells); } static object face_first_loops(wrapper& Self) { return wrap(Self.wrapped().face_first_loops); } static object face_loop_counts(wrapper& Self) { return wrap(Self.wrapped().face_loop_counts); } static object face_selections(wrapper& Self) { return wrap(Self.wrapped().face_selections); } static object face_materials(wrapper& Self) { return wrap(Self.wrapped().face_materials); } static object loop_first_edges(wrapper& Self) { return wrap(Self.wrapped().loop_first_edges); } static object clockwise_edges(wrapper& Self) { return wrap(Self.wrapped().clockwise_edges); } static object edge_selections(wrapper& Self) { return wrap(Self.wrapped().edge_selections); } static object vertex_points(wrapper& Self) { return wrap(Self.wrapped().vertex_points); } static object vertex_selections(wrapper& Self) { return wrap(Self.wrapped().vertex_selections); } static object constant_attributes(wrapper& Self) { return wrap(Self.wrapped().constant_attributes); } static object face_attributes(wrapper& Self) { return wrap(Self.wrapped().face_attributes); } static object edge_attributes(wrapper& Self) { return wrap(Self.wrapped().edge_attributes); } static object vertex_attributes(wrapper& Self) { return wrap(Self.wrapped().vertex_attributes); } }; static object create(mesh_wrapper& Mesh) { return wrap_owned(k3d::polyhedron::create(Mesh.wrapped())); } static object create2(mesh_wrapper& Mesh, list Vertices, list VertexCounts, list VertexIndices, object Material) { k3d::mesh::points_t vertices; k3d::mesh::counts_t vertex_counts; k3d::mesh::indices_t vertex_indices; k3d::imaterial* const material = Material ? &dynamic_cast(boost::python::extract(Material)().wrapped()) : 0; utility::copy(Vertices, vertices); utility::copy(VertexCounts, vertex_counts); utility::copy(VertexIndices, vertex_indices); return wrap_owned(k3d::polyhedron::create(Mesh.wrapped(), vertices, vertex_counts, vertex_indices, material)); } static object validate(mesh_wrapper& Mesh, mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::polyhedron::validate(Mesh.wrapped(), Primitive.wrapped())); } static object validate_const(const_mesh_wrapper& Mesh, const_mesh_primitive_wrapper& Primitive) { return wrap_owned(k3d::polyhedron::validate(Mesh.wrapped(), Primitive.wrapped())); } static bool_t is_triangles(polyhedron::const_primitive::wrapper& Polyhedron) { return k3d::polyhedron::is_triangles(Polyhedron.wrapped()); } static bool_t is_triangles2(polyhedron::primitive::wrapper& Polyhedron) { return k3d::polyhedron::is_triangles(Polyhedron.wrapped()); } static bool_t is_solid(polyhedron::const_primitive::wrapper& Polyhedron) { return k3d::polyhedron::is_solid(Polyhedron.wrapped()); } static bool_t is_solid2(polyhedron::primitive::wrapper& Polyhedron) { return k3d::polyhedron::is_solid(Polyhedron.wrapped()); } }; void define_namespace_polyhedron() { scope outer = class_("polyhedron", "Provides functionality to create and manipulate polyhedron mesh primitives.", no_init) .def("create", &polyhedron::create, "Creates an empty polyhedron, returning an object that can be used to access all of its arrays.") .def("create", &polyhedron::create2, "Creates a polyhedron, populating it from a list of vertices, a list of per-face vertex counts, a list of per-face vertices, and an optional material node.") .staticmethod("create") .def("validate", &polyhedron::validate) .def("validate", &polyhedron::validate_const) .staticmethod("validate") .def("is_triangles", &polyhedron::is_triangles) .def("is_triangles", &polyhedron::is_triangles2) .staticmethod("is_triangles") .def("is_solid", &polyhedron::is_solid) .def("is_solid", &polyhedron::is_solid2) .staticmethod("is_solid") ; enum_("shell_type") .value("POLYGONS", k3d::polyhedron::POLYGONS) .value("CATMULL_CLARK", k3d::polyhedron::CATMULL_CLARK) .attr("__module__") = "k3d"; class_("const_primitive", no_init) .def("shell_types", &polyhedron::const_primitive::shell_types) .def("face_shells", &polyhedron::const_primitive::face_shells) .def("face_first_loops", &polyhedron::const_primitive::face_first_loops) .def("face_loop_counts", &polyhedron::const_primitive::face_loop_counts) .def("face_selections", &polyhedron::const_primitive::face_selections) .def("face_materials", &polyhedron::const_primitive::face_materials) .def("loop_first_edges", &polyhedron::const_primitive::loop_first_edges) .def("clockwise_edges", &polyhedron::const_primitive::clockwise_edges) .def("edge_selections", &polyhedron::const_primitive::edge_selections) .def("vertex_points", &polyhedron::const_primitive::vertex_points) .def("vertex_selections", &polyhedron::const_primitive::vertex_selections) .def("constant_attributes", &polyhedron::const_primitive::constant_attributes) .def("face_attributes", &polyhedron::const_primitive::face_attributes) .def("edge_attributes", &polyhedron::const_primitive::edge_attributes) .def("vertex_attributes", &polyhedron::const_primitive::vertex_attributes) ; class_("primitive", no_init) .def("shell_types", &polyhedron::primitive::shell_types) .def("face_shells", &polyhedron::primitive::face_shells) .def("face_first_loops", &polyhedron::primitive::face_first_loops) .def("face_loop_counts", &polyhedron::primitive::face_loop_counts) .def("face_selections", &polyhedron::primitive::face_selections) .def("face_materials", &polyhedron::primitive::face_materials) .def("loop_first_edges", &polyhedron::primitive::loop_first_edges) .def("clockwise_edges", &polyhedron::primitive::clockwise_edges) .def("edge_selections", &polyhedron::primitive::edge_selections) .def("vertex_points", &polyhedron::primitive::vertex_points) .def("vertex_selections", &polyhedron::primitive::vertex_selections) .def("constant_attributes", &polyhedron::primitive::constant_attributes) .def("face_attributes", &polyhedron::primitive::face_attributes) .def("edge_attributes", &polyhedron::primitive::edge_attributes) .def("vertex_attributes", &polyhedron::primitive::vertex_attributes) ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/polyhedron_python.h ================================================ #ifndef K3DSDK_PYTHON_POLYHEDRON_PYTHON_H #define K3DSDK_PYTHON_POLYHEDRON_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_polyhedron(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_POLYHEDRON_PYTHON_H ================================================ FILE: k3dsdk/python/property_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include #include namespace k3d { namespace python { class property { public: static void connect(idocument_wrapper& Document, iunknown_wrapper& From, iunknown_wrapper& To) { k3d::iproperty* const from = From.wrapped_ptr(); if(!from) throw std::invalid_argument("From argument must be a valid property object."); k3d::iproperty* const to = To.wrapped_ptr(); if(!to) throw std::invalid_argument("To argument must be a valid property object."); k3d::property::connect(Document.wrapped(), *from, *to); } static boost::python::object connection(idocument_wrapper& Document, iunknown_wrapper& Property) { k3d::iproperty* const property = Property.wrapped_ptr(); if(!property) throw std::invalid_argument("Argument must be a valid property."); return wrap_unknown(k3d::property::connection(Document.wrapped(), *property)); } static void disconnect(idocument_wrapper& Document, iunknown_wrapper& Property) { k3d::iproperty* const property = Property.wrapped_ptr(); if(!property) throw std::invalid_argument("Argument must be a valid property."); k3d::property::disconnect(Document.wrapped(), *property); } static boost::python::object create(iunknown_wrapper& Self, const string_t& Type, const string_t& Name, const string_t& Label, const string_t& Description) { k3d::inode* const node = Self.wrapped_ptr(); if(!node) throw std::runtime_error("missing node"); k3d::iproperty* const result = k3d::property::create(*node, Type, Name, Label, Description); if(!result) throw std::invalid_argument("unknown user property type: " + Type); return wrap_unknown(result); } class ri { public: static boost::python::object create_attribute(iunknown_wrapper& Self, const string_t& Type, const string_t& AttributeName, const string_t& Name, const string_t& Label, const string_t& Description) { k3d::inode* const node = Self.wrapped_ptr(); if(!node) throw std::runtime_error("missing node"); k3d::iproperty* const result = k3d::property::ri::create_attribute(*node, Type, AttributeName, Name, Label, Description); if(!result) throw std::invalid_argument("unknown attribute type: " + Type); return wrap_unknown(result); } static boost::python::object create_option(iunknown_wrapper& Self, const string_t& Type, const string_t& OptionName, const string_t& Name, const string_t& Label, const string_t& Description) { k3d::inode* const node = Self.wrapped_ptr(); if(!node) throw std::runtime_error("missing node"); k3d::iproperty* const result = k3d::property::ri::create_option(*node, Type, OptionName, Name, Label, Description); if(!result) throw std::invalid_argument("unknown option type: " + Type); return wrap_unknown(result); } }; }; void define_namespace_property() { boost::python::scope outer = boost::python::class_("property", boost::python::no_init) .def("connect", property::connect, "Makes a pipeline connection between two properties.") .staticmethod("connect") .def("connection", property::connection, "Returns the connection (if any) coming into the given property.") .staticmethod("connection") .def("disconnect", property::disconnect, "Breaks the pipeline connection (if any) to the given property.") .staticmethod("disconnect") .def("create", property::create, "Adds a new property to an existing node.") .staticmethod("create") ; boost::python::class_("ri", boost::python::no_init) .def("create_attribute", property::ri::create_attribute, "Adds a new RenderMan attribute property to an existing node.") .staticmethod("create_attribute") .def("create_option", property::ri::create_option, "Adds a new RenderMan option property to an existing node.") .staticmethod("create_option") ; } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/property_python.h ================================================ #ifndef K3DSDK_PYTHON_PROPERTY_PYTHON_H #define K3DSDK_PYTHON_PROPERTY_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_property(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_PROPERTY_PYTHON_H ================================================ FILE: k3dsdk/python/resource_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include using namespace boost::python; namespace k3d { namespace python { class resource { public: static const list keys() { list python_keys; const k3d::resource::keys_t& keys = k3d::resource::keys(); for(k3d::resource::keys_t::const_iterator key = keys.begin(); key != keys.end(); ++key) python_keys.append(*key); return python_keys; } }; void define_namespace_resource() { class_("resource", no_init) .def("keys", resource::keys, "Returns a list containing the set of all resources.") .def("get_string", k3d::resource::get_string, "Returns a resource as a string, or empty string if the resource does not exist.") .staticmethod("keys") .staticmethod("get_string"); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/resource_python.h ================================================ #ifndef K3DSDK_PYTHON_RESOURCE_PYTHON_H #define K3DSDK_PYTHON_RESOURCE_PYTHON_H // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ namespace k3d { namespace python { void define_namespace_resource(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_RESOURCE_PYTHON_H ================================================ FILE: k3dsdk/python/ri_python.cpp ================================================ // K-3D // Copyright (c) 1995-2006, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include #include using namespace boost::python; namespace k3d { namespace python { class ri { }; static void use_shader(ri_render_state_wrapper& Self, const filesystem::path& Shader) { Self.wrapped().shaders.use_shader(Shader); } void define_namespace_ri() { scope outer = class_("ri", no_init); class_("render_state", "Used to pass RenderMan state from the render engine to an object being rendered.", no_init) .def("use_shader", &use_shader, "Inform the render engine that an object will be using the given shader (so the render system can compile the shader on-demand)."); } } // namespace python } // namespace k3d ================================================ FILE: k3dsdk/python/ri_python.h ================================================ #ifndef K3DSDK_PYTHON_RI_PYTHON_H #define K3DSDK_PYTHON_RI_PYTHON_H // K-3D // Copyright (c) 1995-2007, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** \file \author Timothy M. Shead (tshead@k-3d.com) */ #include #include namespace k3d { namespace python { typedef instance_wrapper ri_render_state_wrapper; void define_namespace_ri(); } // namespace python } // namespace k3d #endif // !K3DSDK_PYTHON_RI_PYTHON_H ================================================ FILE: k3dsdk/python/script_python.cpp ================================================ // K-3D // Copyright (c) 1995-2008, Timothy M. Shead // // Contact: tshead@k-3d.com // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include #include #include namespace k3d { namespace python { class script { public: static void execute_with_context(const string_t& Script, const boost::python::dict& PythonContext) { k3d::iscript_engine::context context; boost::python::dict python_context = PythonContext; while(len(python_context)) { boost::python::tuple python_item = python_context.popitem(); boost::python::object python_key = python_item[0]; boost::python::object python_value = python_item[1]; const string_t key = PyString_AsString(python_key.ptr()); boost::any value = python_to_any(python_value); context.insert(std::make_pair(key, value)); } bool recognized = false; bool executed = false; k3d::script::execute(k3d::script::code(Script), "Python Text", context, recognized, executed); if(!recognized) throw std::invalid_argument("Unrecognized scripting language"); if(!executed) throw std::runtime_error("Error executing script"); } static void execute(const string_t& Script) { execute_with_context(Script, boost::python::dict()); } }; static int context_len(const k3d::iscript_engine::context& Self) { return Self.size(); } static boost::python::object context_get_item(const k3d::iscript_engine::context& Self, const k3d::string_t& Key) { k3d::iscript_engine::context::const_iterator item = Self.find(Key); if(item == Self.end()) throw std::out_of_range("unknown key"); return any_to_python(item->second); } static void context_set_item(k3d::iscript_engine::context& Self, const k3d::string_t& Key, const boost::python::object& Value) { Self[Key] = python_to_any(Value); } static void context_del_item(k3d::iscript_engine::context& Self, const k3d::string_t& Key) { k3d::iscript_engine::context::iterator item = Self.find(Key); if(item == Self.end()) throw std::out_of_range("unknown key"); Self.erase(item); } static bool_t context_has_key(const k3d::iscript_engine::context& Self, const k3d::string_t& Key) { return Self.count(Key); } static boost::python::list context_keys(const k3d::iscript_engine::context& Self) { boost::python::list results; for(k3d::iscript_engine::context::const_iterator pair = Self.begin(); pair != Self.end(); ++pair) results.append(pair->first); return results; } static boost::python::list context_values(const k3d::iscript_engine::context& Self) { boost::python::list results; for(k3d::iscript_engine::context::const_iterator pair = Self.begin(); pair != Self.end(); ++pair) results.append(any_to_python(pair->second)); return results; } void define_namespace_script() { boost::python::scope outer = boost::python::class_ ================================================ FILE: web/developer/dashboard.html ================================================ K-3D Dashboard ================================================ FILE: web/developer/developer.css ================================================ #nav { height: 70px; } dt { position: relative; width: 15em; height: 1em; padding: 0.25em 0 0 0; } dd { margin: 0 0 0 16em; margin-left: 16em; border-left: 1px solid #cccccc; padding-left: 1em; padding-top: 0.25em; padding-bottom: 0.25em; } pre { padding-bottom: 1em; } ================================================ FILE: web/developer/documentation.html ================================================ K-3D Developer Documentation <%include file="navigation.html"/>

Whitepapers

Universal Relational Storage for Geometric Primitives provides a detailed discussion of how K-3D flexibly stores geometric data, and what this flexibility means for researchers and developers.

Overviews

The K-3D Developers' Wiki covers a broad range of how-tos, design discussions, and architectural information.

Reference

The C++ Reference Documentation covers namespaces, classes, methods, and members, and is automatically generated using Doxygen.

The Python Reference Documentation is automatically generated using Epydoc.

================================================ FILE: web/developer/index.html ================================================ K-3D Developer <%include file="navigation.html"/>

Use The Source!

K-3D is Free Software. The source code is licensed using the GNU General Public License.

K-3D is written in C++ with platform independence in mind. As a result, K-3D can be built on GNU/Linux, MacOS X, FreeBSD, Microsoft Windows, and other platforms.

We use Git for source-code management, CMake for our build system, and gtkmm for our user interface toolkit. Required dependencies include Boost, OpenGL, and libsigc++.

K-3D can be optionally built with integration for Collada, DBus, GLX, Gnome VFS, GTS, ImageMagick, ODE, OpenEXR, and more ...

================================================ FILE: web/developer/navigation.html ================================================ ================================================ FILE: web/developer/tracker/issue.html ================================================ K-3D Issue - ${issue["title"] | h} <% import datetime keywords = { ":unstarted":"Unstarted", ":closed":"Closed", ":bugfix":"Bugfix", ":task":"Task", ":feature":"Feature" } %> <%include file="navigation.html"/>

Issue - ${issue["title"] | h}

${issue["desc"] | h}

Details

Id:
${issue["id"] | h}
Type:
${keywords[issue["type"]] | h}
Creation Time:
${issue["creation_time"].strftime("%Y-%m-%d %H:%M UTC") | h}
Reporter:
${issue["reporter"] | h}
Release:
% if release:
${issue["release"] | h}
% else:
None
% endif
Status:
${keywords[issue["status"]] | h}

Issue Log

% for event in issue["log_events"]: % endfor
${event[0].strftime("%Y-%m-%d %H:%M UTC") | h}${event[1] | h}${event[2] | h}${event[3] | h}
================================================ FILE: web/developer/tracker/navigation.html ================================================ ================================================ FILE: web/developer/tracker/project.html ================================================ K-3D Issue Tracker <% import datetime %> <%include file="navigation.html"/>

Issue Tracker

Upcoming Releases

<% upcoming_releases = filter(lambda release: release["status"] == ":unreleased", project["releases"]) %> % if len(upcoming_releases):
    % for release in upcoming_releases: <% release_issues = filter(lambda issue: issue["release"] == release["name"], issues) closed_issues = filter(lambda issue: issue["status"] == ":closed", release_issues) open_issues = filter(lambda issue: issue["status"] != ":closed", release_issues) issue_count = len(release_issues) closed_count = len(closed_issues) open_count = len(open_issues) closed_percent = closed_count * 100 / issue_count open_percent = open_count * 100 / issue_count %>
  • ${release['name'] | h}
    ${" " * closed_percent}${" " * open_percent}${closed_count} / ${issue_count | h} (${closed_percent | h}%)
  • % endfor
% else:

No upcoming releases.

% endif

Past Releases

<% past_releases = filter(lambda release: release["status"] != ":unreleased", project["releases"]) %> % if len(past_releases):
    % for release in past_releases:
  • ${release['name'] | h}
    ${release["release_time"].strftime("Released %B %d, %Y") | h}
  • % endfor
% else:

No past releases.

% endif

Unassigned Issues

<% unassigned_issues = filter(lambda issue: issue["release"] == None, issues) %> % if len(unassigned_issues): % for issue in sorted(unassigned_issues, lambda lhs, rhs: cmp(lhs["creation_time"], rhs["creation_time"]), reverse=True): % endfor
${issue['creation_time'].date() | h}${issue['title'] | h}
% else:

No unassigned issues.

% endif
================================================ FILE: web/developer/tracker/release.html ================================================ K-3D Release ${release["name"] | h} <% import datetime %> <%include file="navigation.html"/>

Release ${release["name"] | h}

<% closed_issues = filter(lambda issue: issue["status"] == ":closed", issues) open_issues = filter(lambda issue: issue["status"] != ":closed", issues) issue_count = len(issues) closed_count = len(closed_issues) open_count = len(open_issues) closed_percent = closed_count * 100 / issue_count if issue_count else 100 open_percent = open_count * 100 / issue_count if issue_count else 100 keywords = { ":released":"Released", ":unreleased":"Unreleased" } %>

Details

Status:
${keywords[release["status"]] | h}
Progress:
% if release["status"] != ":released":
${" " * closed_percent}${" " * open_percent}${closed_count} / ${issue_count | h} (${closed_percent | h}%)
% else:
${release["release_time"].strftime("Released %B %d, %Y") | h}
% endif

Open Issues

% if len(open_issues): % for issue in sorted(open_issues, lambda lhs, rhs: cmp(lhs["creation_time"], rhs["creation_time"]), reverse=True): % endfor
${issue['creation_time'].date() | h}${issue['title'] | h}
% else:

No open issues.

% endif

Closed Issues

% if len(closed_issues): % for issue in sorted(closed_issues, lambda lhs, rhs: cmp(lhs["creation_time"], rhs["creation_time"]), reverse=True): % endfor
${issue['creation_time'].date() | h}${issue['title'] | h}
% else:

No closed issues.

% endif

Release Log

% for event in release["log_events"]: % endfor
${event[0].strftime("%Y-%m-%d %H:%M UTC") | h}${event[1] | h}${event[2] | h}
================================================ FILE: web/developer/tracker/tracker ================================================ #!/usr/bin/python import glob from mako.template import Template from mako.lookup import TemplateLookup import optparse import sys import yaml parser = optparse.OptionParser() parser.add_option("--project", help="Ditz project directory containing project.yaml.", dest="project_directory", default=".") parser.add_option("--templates", help="Directory containing HTML template files.", dest="template_directory", default=".") parser.add_option("--output", help="HTML output directory.", dest="output_directory", default=".") parser.add_option("--html-index", help="HTML index filename.", dest="html_index", default="index.html") (options, args) = parser.parse_args() def generic_constructor(loader, node): return loader.construct_mapping(node) yaml.add_constructor("!ditz.rubyforge.org,2008-03-06/project", generic_constructor) yaml.add_constructor("!ditz.rubyforge.org,2008-03-06/component", generic_constructor) yaml.add_constructor("!ditz.rubyforge.org,2008-03-06/release", generic_constructor) yaml.add_constructor("!ditz.rubyforge.org,2008-03-06/issue", generic_constructor) project = yaml.load(file(options.project_directory + "/project.yaml", "r")) project["filename"] = options.html_index for release in project["releases"]: release["filename"] = "release-" + release["name"] + ".html" issues = [] for issue in glob.glob(options.project_directory + "/issue-*.yaml"): issue = yaml.load(file(issue, "r")) issue["filename"] = "issue-" + issue["id"] + ".html" issues.append(issue) lookup = TemplateLookup(directories=[options.template_directory]) project_template = Template(filename="project.html", output_encoding='utf-8', lookup=lookup) file(options.output_directory + "/" + options.html_index, "w").write(project_template.render(project=project, issues=issues)) release_template = Template(filename="release.html", output_encoding='utf-8', lookup=lookup) for release in project["releases"]: release_issues = [] for issue in issues: if issue["release"] == release["name"]: release_issues.append(issue) file(options.output_directory + "/" + release["filename"], "w").write(release_template.render(project=project, release=release, issues=release_issues)) issue_template = Template(filename="issue.html", output_encoding='utf-8', lookup=lookup) for issue in issues: issue_release = None for release in project["releases"]: if issue["release"] == release["name"]: issue_release = release file(options.output_directory + "/" + issue["filename"], "w").write(issue_template.render(project=project, release=issue_release, issue=issue)) ================================================ FILE: web/developer/tracker/tracker.css ================================================ .tracker ul { list-style: none; margin-left: 12px; } .progress-closed-issues { background-color: #0c0; } .progress-open-issues { background-color: #ddd; margin-right: 12px; } ================================================ FILE: web/k3d.css ================================================ body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td { margin: 0; padding: 0; font-size: 100%; } html { overflow-y: scroll; } body { font-family: Georgia, Palatino, serif; width: 900px; margin: 0 auto; } h1, h2, h3, h4, h5, h6 { font-family: Arial, Helvetica, sans-serif; } h1 { font-size: 170%; } h2 { font-size: 150%; padding: 8px 0 8px 0; } h3 { font-size: 120%; } p { margin-bottom: 12px; } caption { background-color: darkred; color: white; font-family: Arial, Helvetica, sans-serif; font-size: 110%; font-weight: bold; text-align: center; padding: 3px; } table { margin-top: 4px; margin-bottom: 16px; } th { padding: 10px 0 10px 10px; } td { border-bottom: 1px solid #dddddd; padding: 5px 0 5px 10px; } dt { float: left; width: 10em; text-align: right; font-weight: bold; margin-right: 16px; } dd { margin-top: 8px; margin-bottom: 8px; } a { color: DarkRed; font-weight: bold; text-decoration: none; } a:hover { text-decoration: underline; } .generated { font-size: 90%; color: #aaaaaa; } .highlighted { background-color: DarkRed; color: White; padding: 4px 8px; } .special-message { background-color: #eeeeee; border: 1px solid #aaaaaa; font-size: 105%; margin: 2em; padding: 1em; text-align: center; vertical-align: middle; } .special-message h2 { margin: 0 0 0.5em 0; } #nav { float: left; width: 100%; height: 200px; padding-top: 6px; background: transparent url("resources/banner") no-repeat top; } #nav #logo { float: left; width: 130px; height: 55px; background: transparent url("logo.png") no-repeat; } #nav #logo h1 { display: none; } #nav ul { float: left; list-style: none; padding-top: 9px; padding-bottom: 2px; border-bottom: 2px solid #dddddd; } #nav li { display: inline; padding: 0 20px 0 0; font-family: Arial, Helvetica, sans-serif; font-weight: bold; } #main { clear: both; } #top { padding-bottom: 40px; border-bottom: 1px solid #ccc; margin-bottom: 10px; } #top #description { float: left; width: 500px; } #top #downloads { margin-left: 550px; text-align: center; } #left { float: left; width: 500px; } #right { margin-left: 550px; } #footer { clear: both; margin-top: 24px; } div#videos { float: left; width: 150px; margin-top: 4em; } div#player { float: left; width: 750px; margin-top: 1em; } img.thumbnail { background: darkred; padding: 1px; margin: 2px; } img.thumbnail:hover { background: darkred; padding: 3px; margin: 0px; } ================================================ FILE: web/planet/index.html ================================================ Planet K-3D <% import datetime import time def entry_date(entry): return datetime.date(entry.updated_parsed.tm_year, entry.updated_parsed.tm_mon, entry.updated_parsed.tm_mday) %> <%def name="generate_feeds(entries)"> <% last_date = None last_source = None %> % for i in range(len(entries)): <% entry = entries[i] date = entry_date(entry) source = entry.source %> % if date != last_date:

${date.strftime("%B %d, %Y") | h}

% endif % if source != last_source or date != last_date:

Feed: ${source["custom_title"]}

% endif

${entry.title | h}

% if source["feed_type"] not in ["wiki", "commit"]:

${entry.content[0].value if entry.has_key("content") else entry.summary}

% endif
<% last_source = source last_date = date next_entry = entries[i+1] if i+1 < len(entries) else None next_date = entry_date(next_entry) if next_entry else None next_source = next_entry.source if next_entry else None %> % if source != next_source or date != next_date:
% endif % if date != next_date:
% endif % endfor
${generate_feeds(filter(lambda entry: entry["source"]["feed_type"] != "commit", entries))}
================================================ FILE: web/planet/planet ================================================ #!/usr/bin/python import feedparser import mako.template import optparse import sys parser = optparse.OptionParser() parser.add_option("--templates", help="Directory containing HTML template files.", dest="template_directory", default=".") parser.add_option("--output", help="HTML output directory.", dest="output_directory", default=".") parser.add_option("--html-index", help="HTML index filename.", dest="html_index", default="index.html") (options, args) = parser.parse_args() def define_feed(feed, type, title): result = feedparser.parse(feed) result["feed_type"] = type result["custom_title"] = title return result sources = [] sources.append(define_feed("http://k-3d.org/blogs/feed", "blog", "K-3D Blogs")) sources.append(define_feed("http://k-3d.org/blogs/barche/feed", "blog", "Bart Janssens' Blog")) sources.append(define_feed("http://k-3d.org/blogs/dsmatthews/feed", "blog", "Dan Matthews' Blog")) sources.append(define_feed("http://k-3d.org/blogs/joetainment/feed", "blog", "Joe Crawford's Blog")) sources.append(define_feed("http://k-3d.org/blogs/tshead/feed", "blog", "Tim Shead's Blog")) sources.append(define_feed("http://www.k-3d.org/forums/rss/topics", "forum", "K-3D Forums")) sources.append(define_feed("http://www.k-3d.org/k3d_wiki/index.php?title=News&feed=atom", "wiki", "K-3D Wiki")) sources.append(define_feed("http://k3d.hg.sf.net/hgweb/k3d/k3d/rss-log", "commit", "K-3D Repository")) sources.append(define_feed("http://code.google.com/feeds/p/k3d-bart/hgchanges/basic", "commit", "Bart Janssens' Repository")) sources.append(define_feed("http://bitbucket.org/tshead/k3d-sandbox/rss/", "commit", "Tim Shead's Sandbox Repository")) entries = [] for source in sources: for entry in source.entries: entry["source"] = source entries.append(entry) entries.sort(lambda lhs, rhs: cmp(lhs.updated_parsed, rhs.updated_parsed), reverse=True) index_template = mako.template.Template(filename=options.template_directory + "/index.html", output_encoding='utf-8') file(options.output_directory + "/" + options.html_index, "w").write(index_template.render(sources=sources, entries=entries)) ================================================ FILE: web/planet/planet.css ================================================ #nav { height: 70px; } .feeds div.date { padding-bottom: 0.8em; border-bottom: 1px solid #cccccc; margin-bottom: 0.4em; } .feeds div.date h2 { margin-bottom: 0.5em; } .feeds div.channel { padding-left: 10px; } .feeds a.feed_link { float: left; background: transparent url("feed-icon-10x10.png") no-repeat; width: 10px; height: 10px; color: blue; margin-top: 6px; margin-right: 8px; } .feeds a.feed_link span { display: none; } .feeds div.blog_channel { border-left: 10px solid #ff8888; } .feeds div.forum_channel { border-left: 10px solid #88ff88; } .feeds div.wiki_channel { border-left: 10px solid #8888ff; } .feeds div.commit_channel { border-left: 10px solid #ffff88; } .feeds div.entry { margin-top: 2em; } .feeds .content ul { margin-left: 1em; } ================================================ FILE: web/www/donations.html ================================================ K-3D Donations <%include file="navigation.html"/>

Donations

K-3D is a member of the nonprofit Software Freedom Conservancy. Thanks to the Conservancy, donations to support K-3D development are convenient, and may be tax-exempt in many jursidictions. The K-3D project uses donations to further our goal of providing quality Free Software for professionals. Thanks in advance for your interest in supporting K-3D!

PayPal Donations

Please note: PayPal fees are relatively high, please consider sending a check or wire to maximize the benefits of your donation.

Check Donations

K-3D can accept check donations drawn in USD from banks in the USA. (Donations from banks outside of the US or not in USD should be handled by wire; see Wire Donations).

Donors should make their check payable to:

Software Freedom Conservancy, Inc.
				

and place

Directed donation: K-3D
				

in the memo field. Checks should then be mailed to:

Software Freedom Conservancy
1995 BROADWAY FL 17
NEW YORK NY 10023-5882  USA
				
================================================ FILE: web/www/downloads.html ================================================ K-3D Downloads <%include file="navigation.html"/>

Getting started

K-3D is written in C++ with platform independence in mind. As a result, K-3D is available for GNU/Linux, MacOS X, FreeBSD, Microsoft Windows, and others.

You can either download a binary package for the system of your choice or build K-3D from sources.

Packages for common Linux distributions can be installed using the system specific package managers.

================================================ FILE: web/www/index.html ================================================ K-3D <%include file="navigation.html"/>

Seven Degrees of Freedom

K-3D is free-as-in-freedom 3D modeling and animation software. It combines flexible plugins with a visualization pipeline architecture, making K-3D a versatile and powerful tool for artists.

K-3D 0.8 was released on April 20, 2010. See the Release Notes for details.

Download K-3D 0.8 Now!

Easy

K-3D's interface uses your platform's look-and-feel, and it's consistent with the applications you already know. New artists will find K-3D easy to understand, and professionals feel right at home. K-3D is intuitive, consistent, and discoverable.

Powerful

K-3D features procedural and parametric workflows. Properties can be adjusted interactively and results appear immediately. The powerful, node-based visualization pipeline allows more possibilities than traditional modifier stacks or histories. Selection flows from one modifier to the next.

An advanced undo/redo system ensures you can always go back, and the pioneering undo tree means you can always go forward, even where other programs lose the ability to redo.

Industrial-strength standards form the foundation on which K-3D builds - including native RenderMan(TM) support that integrates tightly with the K-3D user interface.

================================================ FILE: web/www/maintenance.html ================================================ K-3D

www.k-3d.org is undergoing maintenance

You may still access K-3D downloads, mailing lists, and more via SourceForge K-3D
================================================ FILE: web/www/navigation.html ================================================ ================================================ FILE: web/www/resources/banner ================================================ #!/usr/bin/python #import cgitb; cgitb.enable() import mimetypes import os import random image = random.choice(os.listdir("banners")) print "Content-Type: %s" % mimetypes.guess_type(image)[0] print "Cache-Control: max-age=300" print "" print file("banners/" + image, "rb").read() ================================================ FILE: web/www/video.html ================================================ K-3D <%include file="navigation.html"/>