├── .github └── FUNDING.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── NOTICE ├── README.md ├── banner.png ├── licenses ├── apache-2.txt ├── commons-math.txt ├── gpl-3.txt └── oidnjni.txt ├── pom.xml └── src └── main ├── java └── de │ └── lemaik │ └── chunkymap │ ├── ChunkyMapPlugin.java │ ├── dynmap │ ├── ChunkyMap.java │ ├── ChunkyMapTile.java │ └── DynmapCameraAdapter.java │ ├── rendering │ ├── FileBufferRenderContext.java │ ├── RenderException.java │ ├── Renderer.java │ ├── SilentTaskTracker.java │ ├── local │ │ └── ChunkyRenderer.java │ └── rs │ │ ├── ApiClient.java │ │ └── RenderJob.java │ └── util │ └── MinecraftDownloader.java └── resources ├── plugin.yml └── rs-map-icon.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | ko_fi: leMaik 3 | github: [leMaik] 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | target 3 | *.iml 4 | *.jar 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/chunky"] 2 | path = vendor/chunky 3 | url = https://github.com/leMaik/chunky 4 | [submodule "."] 5 | branch = remove-static-registries 6 | [submodule "vendor/chunky-denoiser"] 7 | path = vendor/chunky-denoiser 8 | url = https://github.com/chunky-dev/chunky-denoiser 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | ChunkyMap uses the following third-party libraries: 2 | * Chunky by Jesper Öqvist 3 | Chunky is covered by the GNU General Public License, Version 3. See the license file in licenses/gpl-3.txt 4 | * Commons Math by the Apache Software Foundation 5 | Commons Math is covered by The Apache Software License, Version 2.0. See the license file in licenses/commons-math.txt 6 | * DynmapCore by mikeprimm 7 | DynmapCore is covered by The Apache Software License, Version 2.0. See the license file in licenses/apache-2.txt 8 | * Gson by Google 9 | Gson is covered by The Apache Software License, Version 2.0. See the license file in licenses/apache-2.txt 10 | * OkHttp by Square 11 | OkHttp is covered by The Apache Software License, Version 2.0. See the license file in licenses/apache-2.txt 12 | * oidnjni by time4tea 13 | OkHttp is covered by teh MIT License. See the license file in licenses/oidnjni.txt 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ChunkyMap 2 | 3 | ChunkyMap is a map renderer for [Dynmap][dynmap] that uses [Chunky][chunky] to render the map tiles. This combines photorealistic rendering with the convenience and automatic updates of Dynmap. ChunkyMap is implemented as a drop-in replacement for the `HDMap` that comes with Dynmap. 4 | 5 | ![banner](banner.png) 6 | 7 | ## Installation 8 | 9 | 1. Download the latest jar from [the releases page][latest-release] and put it in your plugins directory. 10 | 2. Edit `plugins/dynmap/worlds.txt` and change the `class` option from `org.dynmap.hdmap.HDMap` to `de.lemaik.chunkymap.dynmap.ChunkyMap` for all maps that you want to render with Chunky. 11 | You can use any perspective and resolution for those maps ([list of available perspectives][dynmap-perspectives]). 12 | 13 | This example `worlds.txt` for a single map of a world called `world` might help you: 14 | 15 | ```yml 16 | worlds: 17 | - name: world 18 | maps: 19 | - class: de.lemaik.chunkymap.dynmap.ChunkyMap 20 | name: chunky 21 | title: World 22 | perspective: iso_SE_30_hires 23 | ``` 24 | 25 | 3. Restart your server (_restart_ not reload). 26 | 4. Re-render the worlds you enabled the new renderer for by running the following command from the server console: `dynmap fullrender world` (replace `world` with the actual world name). 27 | 5. Wait for it… :hourglass: 28 | 6. Wait for it… :hourglass: (Sorry, rendering with Chunky takes a while, but it's worth it!) 29 | 7. Take a look at your new, shiny maps! :sparkles: 30 | 31 | ## Configuration 32 | 33 | The maps can be configured by adding options to the map's section in the `world.txt` file. 34 | 35 | | Option | Description | Default | 36 | | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | 37 | | `samplesPerPixel` | Samples per pixel that Chunky should render. More SPP improves the render quality but also increases render time. | 100 | 38 | | `chunkyThreads` | Number of threads per Chunky instance. More threads will decrease render time but increase the CPU load of your server. | 2 | 39 | | `chunkyCpuLoad` | Percentage of CPU time to use, per Chunky thread. Note that this only throttles the CPU usage during rendering, not during scene loading or post processing. | 100 | 40 | | `texturepack` | Texturepack path, relative to `plugins/dynmap`. Use this option to specify a texturepack for a map. The texturepack in Dynmap's `configuration.txt` is ignored by ChunkyMap. | _None_ | 41 | | `chunkPadding` | Radius of additional chunks to be loaded around each chunk that is required to render a tile of the map. This can be used to reduce artifacts caused by shadows and reflections. | 0 | 42 | | `templateScene` | Path to a Chunky scene file (JSON), relative to `plugins/dynmap`. Use this option to customize the scene that is used for rendering the tiles, e.g. to change the water color. | _None_ | 43 | | `texturepackVersion` | The Minecraft version that should be used as fallback textures | 1.16.2 | 44 | | `denoiser.enabled` | Enable denoising using [Intel Open Image Denoise](https://openimagedenoise.github.io/). Only works on Linux | false | 45 | | `denoiser.albedoSamplesPerPixel` | Samples per pixel for the albedo map. Setting this to 0 will disable the albedo and normal map. | 4 | 46 | | `denoiser.normalSamplesPerPixel` | Samples per pixel for the normal map. Setting this to 0 will disable the normal map. | 4 | 47 | 48 | ## Example configurations 49 | 50 | ### Simple map rendered with ChunkyMap 51 | 52 | `plugins/dynmap/worlds.txt`: 53 | 54 | ```yml 55 | worlds: 56 | - name: world 57 | maps: 58 | - class: de.lemaik.chunkymap.dynmap.ChunkyMap 59 | name: chunky 60 | title: Chunky 61 | perspective: iso_SE_30_hires 62 | chunkyThreads: 2 63 | samplesPerPixel: 20 64 | denoiser: 65 | enabled: true 66 | albedoSamplesPerPixel: 4 67 | normalSamplesPerPixel: 4 68 | ``` 69 | 70 | ### Custom perspectives 71 | 72 | Like the default dynmap renderer, ChunkyMap supports custom perspectives. As a starting point, you can use the built-in perspectives from `perspectives.txt` and customize them. More information on how to define custom perspectives can be found [in the corresponding Dynmap wiki article](https://github.com/webbukkit/dynmap/wiki/Defining-custom-perspectives). 73 | 74 | The following example adds a maximum height to the nether world so that the dynmap doesn't only show the bedrock layer on top of it. 75 | 76 | `plugins/dynmap/worlds.txt`: 77 | 78 | ```yml 79 | worlds: 80 | - name: world_nether 81 | maps: 82 | - class: de.lemaik.chunkymap.dynmap.ChunkyMap 83 | name: chunky_nether 84 | title: Nether 85 | perspective: iso_SE_30_hires_nether 86 | chunkyThreads: 2 87 | samplesPerPixel: 20 88 | ``` 89 | 90 | `plugins/dynmap/custom-perspectives.txt`: 91 | 92 | ```yml 93 | perspectives: 94 | - class: org.dynmap.hdmap.IsoHDPerspective 95 | name: iso_SE_30_hires_nether 96 | azimuth: 135 97 | inclination: 30 98 | scale: 16 99 | maximumheight: 100 # the bedrock layer is at 127 100 | ``` 101 | 102 | ### Customizing the look of a map with template scenes 103 | 104 | You can change how the map looks by providing a template scene. That can be any Chunky scene (`.json`) file or a partial scene file (i.e. a `.json` file that only contains the values that should be changed). ChunkyMap will import many scene options from the template scene, including the sun position, fog and water configuration. 105 | 106 | The following example changes the default gray water color to blue. 107 | 108 | `plugins/dynmap/worlds.txt`: 109 | 110 | ```yml 111 | worlds: 112 | - name: world 113 | maps: 114 | - class: de.lemaik.chunkymap.dynmap.ChunkyMap 115 | name: chunky 116 | title: Chunky 117 | perspective: iso_SE_30_hires 118 | chunkyThreads: 2 119 | samplesPerPixel: 20 120 | templateScene: blueWater.json 121 | ``` 122 | 123 | `plugins/dynmap/blueWater.json`: 124 | 125 | ```json 126 | { 127 | "useCustomWaterColor": true, 128 | "waterColor": { 129 | "red": 0.029, 130 | "green": 0.031, 131 | "blue": 0.16 132 | } 133 | } 134 | ``` 135 | 136 | ## Ceveats 137 | 138 | - Rendering is pretty slow, but I'll improve this by rendering multiple tiles as one image in the future. 139 | - ChunkyMap only works with Bukkit/Spigot at the moment. Supporting more servers would be awesome, though! 140 | 141 | ## Dynmaps that use this plugin 142 | 143 | - Craften Server: [Lobby Dynmap](https://play.craften.de/maps/index.html?worldname=world&mapname=rs&zoom=5&x=594&y=64&z=-420) 144 | - Greenfield City Minecraft: [Greenfield Dynmap](http://map.greenfieldmc.net/?worldname=world&mapname=chunky&zoom=5) 145 | - BoilerCraft: [Purdue University](https://map.boilercraft.com/purdue/) 146 | - ChunghwaMC: [map](https://chunghwamc.com/map/) 147 | - _Using ChunkyMap on your server? Submit a PR to get it on this list._ 148 | 149 | ## Building ChunkyMap 150 | 151 | 1. Get the latest version of [Chunky 2][chunky]. After updating, you'll find the jar file in `~/.chunky/lib` (Linux/Mac) or `%APPDATA%\.chunky\lib` (Windows). Copy the `chunky-core-.jar` file into the root directory of this repository and rename it to `chunky.jar`. 152 | 2. Run `mvn install` to install all other dependencies. Chunky 2 can't be installed this way because it's not yet in the Maven repository. 153 | 3. Run `mvn clean package`, the plugin jar will be in the `target` directory. 154 | 155 | Note: To fix some concurrency issues that don't occur when using Chunky in standalone mode and aren't yet merged into Chunky, this plugin is built against [this Chunky branch](https://github.com/leMaik/chunky/tree/remove-static-registries) instead. 156 | 157 | ## Copyright & License 158 | 159 | ChunkyMap is Copyright 2016–2020 Maik Marschner (leMaik) 160 | 161 | Permission to modify and redistribute is granted under the terms of the GNU General Public License, Version 3. See the `LICENSE` file for the full license. 162 | 163 | ChunkyMap uses the following third-party libraries: 164 | 165 | - **Chunky by Jesper Öqvist** 166 | Chunky is covered by the GNU General Public License, Version 3. See the license file in `licenses/gpl-3.txt`. 167 | - **Commons Math by the Apache Software Foundation** 168 | Commons Math is covered by The Apache Software License, Version 2.0. See the license file in `licenses/commons-math.txt`. 169 | - **DynmapCore by mikeprimm** 170 | DynmapCore is covered by The Apache Software License, Version 2.0. See the license file in `licenses/apache-2.txt`. 171 | - **Gson by Google** 172 | Gson is covered by The Apache Software License, Version 2.0. See the license file in `licenses/apache-2.txt`. 173 | - **OkHttp by Square** 174 | OkHttp is covered by The Apache Software License, Version 2.0. See the license file in `licenses/apache-2.txt`. 175 | 176 | ## Trivia 177 | 178 | Originally, ChunkyMap was created as a demo for the [RenderService][rs3]. This service allows rendering the tiles on a distributed network of renderers, which is often faster than rendering the tiles locally. 179 | 180 | Ironically, I then implemented support for local tile rendering and removed support for using the RenderService. It will come back in the future. 181 | 182 | [dynmap]: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1286593-dynmap 183 | [chunky]: https://chunky.lemaik.de/ 184 | [latest-release]: https://github.com/leMaik/ChunkyMap/releases/latest 185 | [rs3]: https://bitbucket.org/account/user/wertarbyte/projects/RS 186 | [dynmap-perspectives]: https://github.com/webbukkit/dynmap/wiki/Full-list-of-predefined-perspectives 187 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leMaik/ChunkyMap/e5c998922906e371925a372cb071fc67df607798/banner.png -------------------------------------------------------------------------------- /licenses/apache-2.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | 204 | 205 | APACHE COMMONS MATH DERIVATIVE WORKS: 206 | 207 | The Apache commons-math library includes a number of subcomponents 208 | whose implementation is derived from original sources written 209 | in C or Fortran. License terms of the original sources 210 | are reproduced below. 211 | 212 | =============================================================================== 213 | For the lmder, lmpar and qrsolv Fortran routine from minpack and translated in 214 | the LevenbergMarquardtOptimizer class in package 215 | org.apache.commons.math3.optimization.general 216 | Original source copyright and license statement: 217 | 218 | Minpack Copyright Notice (1999) University of Chicago. All rights reserved 219 | 220 | Redistribution and use in source and binary forms, with or 221 | without modification, are permitted provided that the 222 | following conditions are met: 223 | 224 | 1. Redistributions of source code must retain the above 225 | copyright notice, this list of conditions and the following 226 | disclaimer. 227 | 228 | 2. Redistributions in binary form must reproduce the above 229 | copyright notice, this list of conditions and the following 230 | disclaimer in the documentation and/or other materials 231 | provided with the distribution. 232 | 233 | 3. The end-user documentation included with the 234 | redistribution, if any, must include the following 235 | acknowledgment: 236 | 237 | "This product includes software developed by the 238 | University of Chicago, as Operator of Argonne National 239 | Laboratory. 240 | 241 | Alternately, this acknowledgment may appear in the software 242 | itself, if and wherever such third-party acknowledgments 243 | normally appear. 244 | 245 | 4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" 246 | WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE 247 | UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND 248 | THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR 249 | IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES 250 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE 251 | OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY 252 | OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR 253 | USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF 254 | THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) 255 | DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION 256 | UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL 257 | BE CORRECTED. 258 | 259 | 5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT 260 | HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF 261 | ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, 262 | INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF 263 | ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF 264 | PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER 265 | SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT 266 | (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, 267 | EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE 268 | POSSIBILITY OF SUCH LOSS OR DAMAGES. 269 | =============================================================================== 270 | 271 | Copyright and license statement for the odex Fortran routine developed by 272 | E. Hairer and G. Wanner and translated in GraggBulirschStoerIntegrator class 273 | in package org.apache.commons.math3.ode.nonstiff: 274 | 275 | 276 | Copyright (c) 2004, Ernst Hairer 277 | 278 | Redistribution and use in source and binary forms, with or without 279 | modification, are permitted provided that the following conditions are 280 | met: 281 | 282 | - Redistributions of source code must retain the above copyright 283 | notice, this list of conditions and the following disclaimer. 284 | 285 | - Redistributions in binary form must reproduce the above copyright 286 | notice, this list of conditions and the following disclaimer in the 287 | documentation and/or other materials provided with the distribution. 288 | 289 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 290 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 291 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 292 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 293 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 294 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 295 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 296 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 297 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 298 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 299 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 300 | =============================================================================== 301 | 302 | Copyright and license statement for the original lapack fortran routines 303 | translated in EigenDecompositionImpl class in package 304 | org.apache.commons.math3.linear: 305 | 306 | Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. 307 | 308 | $COPYRIGHT$ 309 | 310 | Additional copyrights may follow 311 | 312 | $HEADER$ 313 | 314 | Redistribution and use in source and binary forms, with or without 315 | modification, are permitted provided that the following conditions are 316 | met: 317 | 318 | - Redistributions of source code must retain the above copyright 319 | notice, this list of conditions and the following disclaimer. 320 | 321 | - Redistributions in binary form must reproduce the above copyright 322 | notice, this list of conditions and the following disclaimer listed 323 | in this license in the documentation and/or other materials 324 | provided with the distribution. 325 | 326 | - Neither the name of the copyright holders nor the names of its 327 | contributors may be used to endorse or promote products derived from 328 | this software without specific prior written permission. 329 | 330 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 331 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 332 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 333 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 334 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 335 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 336 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 337 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 338 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 339 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 340 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 341 | =============================================================================== 342 | 343 | Copyright and license statement for the original Mersenne twister C 344 | routines translated in MersenneTwister class in package 345 | org.apache.commons.math3.random: 346 | 347 | Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, 348 | All rights reserved. 349 | 350 | Redistribution and use in source and binary forms, with or without 351 | modification, are permitted provided that the following conditions 352 | are met: 353 | 354 | 1. Redistributions of source code must retain the above copyright 355 | notice, this list of conditions and the following disclaimer. 356 | 357 | 2. Redistributions in binary form must reproduce the above copyright 358 | notice, this list of conditions and the following disclaimer in the 359 | documentation and/or other materials provided with the distribution. 360 | 361 | 3. The names of its contributors may not be used to endorse or promote 362 | products derived from this software without specific prior written 363 | permission. 364 | 365 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 366 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 367 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 368 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 369 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 370 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 371 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 372 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 373 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 374 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 375 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 376 | 377 | =============================================================================== 378 | 379 | The class "org.apache.commons.math3.exception.util.LocalizedFormatsTest" is 380 | an adapted version of "OrekitMessagesTest" test class for the Orekit library 381 | The "org.apache.commons.math3.analysis.interpolation.HermiteInterpolator" 382 | has been imported from the Orekit space flight dynamics library. 383 | 384 | Th Orekit library is described at: 385 | https://www.orekit.org/forge/projects/orekit 386 | The original files are distributed under the terms of the Apache 2 license 387 | which is: Copyright 2010 CS Communication & Systèmes -------------------------------------------------------------------------------- /licenses/commons-math.txt: -------------------------------------------------------------------------------- 1 | Apache Commons Math 2 | Copyright 2001-2013 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | =============================================================================== 8 | 9 | The inverse error function implementation in the Erf class is based on CUDA 10 | code developed by Mike Giles, Oxford-Man Institute of Quantitative Finance, 11 | and published in GPU Computing Gems, volume 2, 2010. 12 | =============================================================================== 13 | 14 | The BracketFinder (package org.apache.commons.math3.optimization.univariate) 15 | and PowellOptimizer (package org.apache.commons.math3.optimization.general) 16 | classes are based on the Python code in module "optimize.py" (version 0.5) 17 | developed by Travis E. Oliphant for the SciPy library (http://www.scipy.org/) 18 | Copyright © 2003-2009 SciPy Developers. 19 | =============================================================================== 20 | 21 | The LinearConstraint, LinearObjectiveFunction, LinearOptimizer, 22 | RelationShip, SimplexSolver and SimplexTableau classes in package 23 | org.apache.commons.math3.optimization.linear include software developed by 24 | Benjamin McCann (http://www.benmccann.com) and distributed with 25 | the following copyright: Copyright 2009 Google Inc. 26 | =============================================================================== 27 | 28 | This product includes software developed by the 29 | University of Chicago, as Operator of Argonne National 30 | Laboratory. 31 | The LevenbergMarquardtOptimizer class in package 32 | org.apache.commons.math3.optimization.general includes software 33 | translated from the lmder, lmpar and qrsolv Fortran routines 34 | from the Minpack package 35 | Minpack Copyright Notice (1999) University of Chicago. All rights reserved 36 | =============================================================================== 37 | 38 | The GraggBulirschStoerIntegrator class in package 39 | org.apache.commons.math3.ode.nonstiff includes software translated 40 | from the odex Fortran routine developed by E. Hairer and G. Wanner. 41 | Original source copyright: 42 | Copyright (c) 2004, Ernst Hairer 43 | =============================================================================== 44 | 45 | The EigenDecompositionImpl class in package 46 | org.apache.commons.math3.linear includes software translated 47 | from some LAPACK Fortran routines. Original source copyright: 48 | Copyright (c) 1992-2008 The University of Tennessee. All rights reserved. 49 | =============================================================================== 50 | 51 | The MersenneTwister class in package org.apache.commons.math3.random 52 | includes software translated from the 2002-01-26 version of 53 | the Mersenne-Twister generator written in C by Makoto Matsumoto and Takuji 54 | Nishimura. Original source copyright: 55 | Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, 56 | All rights reserved 57 | =============================================================================== 58 | 59 | The LocalizedFormatsTest class in the unit tests is an adapted version of 60 | the OrekitMessagesTest class from the orekit library distributed under the 61 | terms of the Apache 2 licence. Original source copyright: 62 | Copyright 2010 CS Systèmes d'Information 63 | =============================================================================== 64 | 65 | The HermiteInterpolator class and its corresponding test have been imported from 66 | the orekit library distributed under the terms of the Apache 2 licence. Original 67 | source copyright: 68 | Copyright 2010-2012 CS Systèmes d'Information 69 | =============================================================================== 70 | 71 | The creation of the package "o.a.c.m.analysis.integration.gauss" was inspired 72 | by an original code donated by Sébastien Brisard. 73 | =============================================================================== 74 | 75 | 76 | The complete text of licenses and disclaimers associated with the the original 77 | sources enumerated above at the time of code translation are in the LICENSE.txt 78 | file. -------------------------------------------------------------------------------- /licenses/gpl-3.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /licenses/oidnjni.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 James Richardson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | de.lemaik.chunkymap 8 | ChunkyMap 9 | 2.5.2 10 | 11 | 12 | 13 | GPL v3 14 | https://www.gnu.org/licenses/gpl-3.0.txt 15 | 16 | 17 | 18 | 19 | 1.8 20 | UTF-8 21 | UTF-8 22 | 2.3.0-30-g82f6ab17 23 | 24 | 25 | 26 | 27 | sonatype-oss-releases 28 | https://oss.sonatype.org/content/repositories/releases 29 | 30 | 31 | spigot-repo 32 | https://hub.spigotmc.org/nexus/content/groups/public/ 33 | 34 | 35 | dynmap-repo 36 | http://repo.mikeprimm.com/ 37 | 38 | 39 | wertarbyte-repo 40 | https://repo.wertarbyte.com 41 | 42 | 43 | local-libs 44 | file://${basedir}/lib 45 | 46 | 47 | 48 | 49 | 50 | org.bukkit 51 | bukkit 52 | 1.16.1-R0.1-SNAPSHOT 53 | provided 54 | 55 | 56 | se.llbit 57 | chunky-core 58 | ${chunky.version} 59 | 60 | 61 | 62 | org.apache.commons 63 | commons-math3 64 | 3.2 65 | 66 | 67 | 68 | us.dynmap 69 | DynmapCore 70 | 2.3 71 | provided 72 | 73 | 74 | com.squareup.okhttp3 75 | okhttp 76 | 3.4.1 77 | 78 | 79 | com.google.code.gson 80 | gson 81 | 2.7 82 | 83 | 84 | net.time4tea 85 | oidnjni 86 | 0.1.04 87 | 88 | 89 | 90 | org.jetbrains.kotlin 91 | kotlin-stdlib 92 | 1.3.72 93 | 94 | 95 | de.lemaik 96 | chunky-denoiser 97 | 0.1.3-SNAPSHOT 98 | 99 | 100 | 101 | 102 | 103 | 104 | org.apache.maven.plugins 105 | maven-compiler-plugin 106 | 3.5.1 107 | 108 | 1.8 109 | 1.8 110 | 111 | 112 | 113 | org.apache.maven.plugins 114 | maven-assembly-plugin 115 | 2.6 116 | 117 | 118 | package 119 | 120 | single 121 | 122 | 123 | 124 | 125 | 126 | jar-with-dependencies 127 | 128 | 129 | 130 | 131 | org.apache.maven.plugins 132 | maven-install-plugin 133 | 2.5.2 134 | 135 | 136 | install-chunky 137 | clean 138 | 139 | ${basedir}/vendor/chunky/build/chunky-core-${chunky.version}.jar 140 | default 141 | se.llbit 142 | chunky-core 143 | ${chunky.version} 144 | jar 145 | true 146 | 147 | 148 | install-file 149 | 150 | 151 | 152 | install-chunky-denoiser 153 | clean 154 | 155 | ${basedir}/vendor/chunky-denoiser/build/libs/chunky-denoiser-chunky2.jar 156 | default 157 | de.lemaik 158 | chunky-denoiser 159 | 0.1.3-SNAPSHOT 160 | jar 161 | true 162 | 163 | 164 | install-file 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | src/main/resources 173 | true 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/ChunkyMapPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Wertarbyte 3 | * 4 | * This file is part of the RenderService. 5 | * 6 | * Wertarbyte RenderService is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Wertarbyte RenderService is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Wertarbyte RenderService. If not, see . 18 | */ 19 | 20 | package de.lemaik.chunkymap; 21 | 22 | import java.io.IOException; 23 | import java.io.InputStream; 24 | import java.nio.file.Files; 25 | import java.nio.file.Path; 26 | import java.nio.file.Paths; 27 | import java.util.logging.Level; 28 | import org.bukkit.plugin.Plugin; 29 | import org.bukkit.plugin.java.JavaPlugin; 30 | 31 | /** 32 | * The main class. 33 | */ 34 | public class ChunkyMapPlugin extends JavaPlugin { 35 | 36 | @Override 37 | public void onEnable() { 38 | Plugin dynmap = getServer().getPluginManager().getPlugin("dynmap"); 39 | try (InputStream mapIcon = getResource("rs-map-icon.png")) { 40 | Path iconPath = Paths 41 | .get(dynmap.getDataFolder().getAbsolutePath(), "web", "images", "block_chunky.png"); 42 | if (!iconPath.toFile().exists()) { 43 | Files.copy(mapIcon, iconPath); 44 | } 45 | } catch (IOException e) { 46 | getLogger().log(Level.WARNING, "Could not write chunky map icon", e); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/dynmap/ChunkyMap.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.dynmap; 2 | 3 | import de.lemaik.chunkymap.ChunkyMapPlugin; 4 | import de.lemaik.chunkymap.rendering.Renderer; 5 | import de.lemaik.chunkymap.rendering.local.ChunkyRenderer; 6 | import de.lemaik.chunkymap.util.MinecraftDownloader; 7 | import java.io.File; 8 | import java.io.FileInputStream; 9 | import java.io.IOException; 10 | import java.io.InputStream; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.concurrent.ExecutionException; 14 | import java.util.logging.Level; 15 | import java.util.stream.Collectors; 16 | import okhttp3.Response; 17 | import okio.BufferedSink; 18 | import okio.Okio; 19 | import org.bukkit.Bukkit; 20 | import org.dynmap.ConfigurationNode; 21 | import org.dynmap.DynmapChunk; 22 | import org.dynmap.DynmapCore; 23 | import org.dynmap.DynmapWorld; 24 | import org.dynmap.MapTile; 25 | import org.dynmap.MapType; 26 | import org.dynmap.hdmap.HDMap; 27 | import org.dynmap.hdmap.IsoHDPerspective; 28 | import org.dynmap.utils.TileFlags; 29 | import se.llbit.chunky.renderer.scene.Scene; 30 | import se.llbit.json.JsonNumber; 31 | import se.llbit.json.JsonObject; 32 | import se.llbit.json.JsonParser; 33 | 34 | /** 35 | * A map that uses the RenderService for rendering the tiles. 36 | */ 37 | public class ChunkyMap extends HDMap { 38 | 39 | private static final String DEFAULT_TEXTUREPACK_VERSION = "1.16.2"; 40 | public final DynmapCameraAdapter cameraAdapter; 41 | private final Renderer renderer; 42 | private File defaultTexturepackPath; 43 | private File texturepackPath; 44 | private JsonObject templateScene; 45 | private int chunkPadding; 46 | 47 | public ChunkyMap(DynmapCore dynmap, ConfigurationNode config) { 48 | super(dynmap, config); 49 | cameraAdapter = new DynmapCameraAdapter((IsoHDPerspective) getPerspective()); 50 | renderer = new ChunkyRenderer( 51 | config.getInteger("samplesPerPixel", 100), 52 | config.getBoolean("denoiser/enabled", false), 53 | config.getInteger("denoiser/albedoSamplesPerPixel", 16), 54 | config.getInteger("denoiser/normalSamplesPerPixel", 16), 55 | config.getInteger("chunkyThreads", 2), 56 | Math.min(100, Math.max(0, config.getInteger("chunkyCpuLoad", 100))) 57 | ); 58 | chunkPadding = config.getInteger("chunkPadding", 0); 59 | 60 | String texturepackVersion = config.getString("texturepackVersion", DEFAULT_TEXTUREPACK_VERSION); 61 | File texturepackPath = new File( 62 | ChunkyMapPlugin.getPlugin(ChunkyMapPlugin.class).getDataFolder(), 63 | texturepackVersion + ".jar"); 64 | if (!texturepackPath.exists()) { 65 | ChunkyMapPlugin.getPlugin(ChunkyMapPlugin.class).getLogger() 66 | .info("Downloading additional textures for Minecraft " + texturepackVersion); 67 | try (Response response = MinecraftDownloader.downloadMinecraft(texturepackVersion).get()) { 68 | try (BufferedSink sink = Okio.buffer(Okio.sink(texturepackPath))) { 69 | sink.writeAll(response.body().source()); 70 | } 71 | defaultTexturepackPath = texturepackPath; 72 | } catch (IOException | ExecutionException | InterruptedException e) { 73 | ChunkyMapPlugin.getPlugin(ChunkyMapPlugin.class).getLogger() 74 | .log(Level.SEVERE, 75 | "Downloading the textures failed, your Chunky dynmap might look bad!", e); 76 | } 77 | } 78 | 79 | if (config.containsKey("texturepack")) { 80 | texturepackPath = Bukkit.getPluginManager().getPlugin("dynmap").getDataFolder().toPath() 81 | .resolve(config.getString("texturepack")) 82 | .toFile(); 83 | } else { 84 | ChunkyMapPlugin.getPlugin(ChunkyMapPlugin.class).getLogger() 85 | .warning("You didn't specify a texturepack for a map that is rendered with Chunky. " + 86 | "The Minecraft " + texturepackVersion + " textures will be used."); 87 | } 88 | 89 | if (config.containsKey("templateScene")) { 90 | try (InputStream inputStream = new FileInputStream( 91 | Bukkit.getPluginManager().getPlugin("dynmap").getDataFolder().toPath() 92 | .resolve(config.getString("templateScene")) 93 | .toFile())) { 94 | templateScene = new JsonParser(inputStream).parse().asObject(); 95 | templateScene.remove("world"); 96 | templateScene.set("spp", new JsonNumber(0)); 97 | templateScene.set("renderTime", new JsonNumber(0)); 98 | templateScene.remove("chunkList"); 99 | templateScene.remove("entities"); 100 | templateScene.remove("actors"); 101 | } catch (IOException | JsonParser.SyntaxError e) { 102 | ChunkyMapPlugin.getPlugin(ChunkyMapPlugin.class).getLogger() 103 | .log(Level.SEVERE, "Could not read the template scene.", e); 104 | } 105 | } 106 | 107 | // texturepacks in chunky are static, so only load them once 108 | if (defaultTexturepackPath != null) { 109 | ChunkyRenderer.loadDefaultTexturepack(defaultTexturepackPath); 110 | } 111 | if (texturepackPath != null) { 112 | ChunkyRenderer.loadTexturepack(texturepackPath); 113 | } 114 | } 115 | 116 | @Override 117 | public void addMapTiles(List list, DynmapWorld world, int tx, int ty) { 118 | list.add(new ChunkyMapTile(world, getPerspective(), this, tx, ty)); 119 | } 120 | 121 | public List getTileCoords(DynmapWorld world, int x, int y, int z) { 122 | return getPerspective().getTileCoords(world, x, y, z); 123 | } 124 | 125 | public List getTileCoords(DynmapWorld world, int minx, int miny, int minz, 126 | int maxx, int maxy, int maxz) { 127 | return getPerspective().getTileCoords(world, minx, miny, minz, maxx, maxy, maxz); 128 | } 129 | 130 | @Override 131 | public MapTile[] getAdjecentTiles(MapTile tile) { 132 | ChunkyMapTile t = (ChunkyMapTile) tile; 133 | DynmapWorld w = t.getDynmapWorld(); 134 | int x = t.tileOrdinalX(); 135 | int y = t.tileOrdinalY(); 136 | 137 | return new MapTile[]{ 138 | new ChunkyMapTile(w, getPerspective(), this, x - 1, y - 1), 139 | new ChunkyMapTile(w, getPerspective(), this, x - 1, y + 1), 140 | new ChunkyMapTile(w, getPerspective(), this, x + 1, y - 1), 141 | new ChunkyMapTile(w, getPerspective(), this, x + 1, y + 1), 142 | new ChunkyMapTile(w, getPerspective(), this, x, y - 1), 143 | new ChunkyMapTile(w, getPerspective(), this, x + 1, y), 144 | new ChunkyMapTile(w, getPerspective(), this, x, y + 1), 145 | new ChunkyMapTile(w, getPerspective(), this, x - 1, y)}; 146 | } 147 | 148 | @Override 149 | public List getRequiredChunks(MapTile mapTile) { 150 | return getPerspective().getRequiredChunks(mapTile); 151 | } 152 | 153 | @Override 154 | public List getMapsSharingRender(DynmapWorld world) { 155 | ArrayList maps = new ArrayList<>(); 156 | for (MapType mt : world.maps) { 157 | if (mt instanceof ChunkyMap) { 158 | ChunkyMap chunkyMap = (ChunkyMap) mt; 159 | if (chunkyMap.getPerspective() == getPerspective() 160 | && chunkyMap.getBoostZoom() == getBoostZoom()) { 161 | maps.add(mt); 162 | } 163 | } 164 | } 165 | return maps; 166 | } 167 | 168 | @Override 169 | public List getMapNamesSharingRender(DynmapWorld dynmapWorld) { 170 | return getMapsSharingRender(dynmapWorld).stream().map(MapType::getName) 171 | .collect(Collectors.toList()); 172 | } 173 | 174 | Renderer getRenderer() { 175 | return renderer; 176 | } 177 | 178 | File getDefaultTexturepackPath() { 179 | return defaultTexturepackPath; 180 | } 181 | 182 | File getTexturepackPath() { 183 | return texturepackPath; 184 | } 185 | 186 | int getChunkPadding() { 187 | return chunkPadding; 188 | } 189 | 190 | void applyTemplateScene(Scene scene) { 191 | if (this.templateScene != null) { 192 | scene.importFromJson(templateScene); 193 | } 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/dynmap/ChunkyMapTile.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.dynmap; 2 | 3 | import de.lemaik.chunkymap.ChunkyMapPlugin; 4 | import de.lemaik.chunkymap.rendering.FileBufferRenderContext; 5 | import de.lemaik.chunkymap.rendering.Renderer; 6 | import de.lemaik.chunkymap.rendering.SilentTaskTracker; 7 | import java.util.ArrayList; 8 | import java.util.Collection; 9 | import java.util.List; 10 | import java.util.logging.Level; 11 | import java.util.stream.Collectors; 12 | import org.bukkit.Bukkit; 13 | import org.bukkit.World.Environment; 14 | import org.dynmap.Client; 15 | import org.dynmap.DynmapChunk; 16 | import org.dynmap.DynmapWorld; 17 | import org.dynmap.MapManager; 18 | import org.dynmap.MapTile; 19 | import org.dynmap.MapType.ImageVariant; 20 | import org.dynmap.MapTypeState; 21 | import org.dynmap.hdmap.HDMapTile; 22 | import org.dynmap.hdmap.HDPerspective; 23 | import org.dynmap.hdmap.IsoHDPerspective; 24 | import org.dynmap.markers.impl.MarkerAPIImpl; 25 | import org.dynmap.storage.MapStorage; 26 | import org.dynmap.storage.MapStorageTile; 27 | import org.dynmap.utils.MapChunkCache; 28 | import se.llbit.chunky.world.ChunkPosition; 29 | import se.llbit.chunky.world.World; 30 | import se.llbit.chunky.world.World.LoggedWarnings; 31 | 32 | public class ChunkyMapTile extends HDMapTile { 33 | 34 | private final ChunkyMap map; 35 | 36 | public ChunkyMapTile(DynmapWorld world, HDPerspective perspective, ChunkyMap map, int tx, 37 | int ty) { 38 | super(world, perspective, tx, ty, map.getBoostZoom()); 39 | this.map = map; 40 | } 41 | 42 | public ChunkyMapTile(DynmapWorld world, String parm) throws Exception { 43 | // Do not remove this constructor! It is used by Dynmap to de-serialize tiles from the queue. 44 | // The serialization happens in the inherited saveTileData() method. 45 | super(world, parm); 46 | map = (ChunkyMap) world.maps.stream().filter(m -> m instanceof ChunkyMap).findFirst().get(); 47 | } 48 | 49 | @Override 50 | public boolean render(MapChunkCache mapChunkCache, String s) { 51 | IsoHDPerspective perspective = (IsoHDPerspective) this.perspective; 52 | 53 | final int scaled = (boostzoom > 0 && MarkerAPIImpl 54 | .testTileForBoostMarkers(world, perspective, (double) (tx * 128), (double) (ty * 128), 55 | 128.0D)) ? boostzoom : 0; 56 | 57 | // Mark the tiles we're going to render as validated 58 | MapTypeState mts = world.getMapState(map); 59 | if (mts != null) { 60 | mts.validateTile(tx, ty); 61 | } 62 | 63 | FileBufferRenderContext context = new FileBufferRenderContext(); 64 | try { 65 | Renderer renderer = map.getRenderer(); 66 | renderer.setDefaultTexturepack(map.getDefaultTexturepackPath()); 67 | renderer.render(context, map.getTexturepackPath(), (scene) -> { 68 | org.bukkit.World bukkitWorld = Bukkit.getWorld(world.getRawName()); 69 | World chunkyWorld = World.loadWorld(bukkitWorld.getWorldFolder(), 70 | getChunkyDimension(bukkitWorld.getEnvironment()), LoggedWarnings.SILENT); 71 | // Bukkit.getScheduler().runTask(ChunkyMapPlugin.getPlugin(ChunkyMapPlugin.class), Bukkit.getWorld(world.getRawName())::save); 72 | map.applyTemplateScene(scene); 73 | scene.setName(tx + "_" + ty); 74 | scene.setCanvasSize(128 * (1 << scaled), 128 * (1 << scaled)); 75 | scene.setTransparentSky(true); 76 | scene.setYClipMin((int) perspective.minheight); 77 | if (perspective.maxheight > 0) { 78 | scene.setYClipMax((int) perspective.maxheight); 79 | } 80 | map.cameraAdapter.apply(scene.camera(), tx, ty, map.getMapZoomOutLevels(), 81 | world.getExtraZoomOutLevels()); 82 | 83 | scene.loadChunks(SilentTaskTracker.INSTANCE, chunkyWorld, 84 | perspective.getRequiredChunks(this).stream() 85 | .flatMap(c -> getChunksAround(c.x, c.z, map.getChunkPadding()).stream()) 86 | .collect(Collectors.toList())); 87 | }).thenApply((image) -> { 88 | MapStorage var52 = world.getMapStorage(); 89 | MapStorageTile mtile = var52.getTile(world, map, tx, ty, 0, ImageVariant.STANDARD); 90 | try { 91 | mtile.getWriteLock(); 92 | mtile.write(image.hashCode(), image); 93 | MapManager.mapman.pushUpdate(getDynmapWorld(), new Client.Tile(mtile.getURI())); 94 | } finally { 95 | mtile.releaseWriteLock(); 96 | MapManager.mapman.updateStatistics(this, map.getPrefix(), true, true, false); 97 | } 98 | return true; 99 | }).get(); 100 | return true; 101 | } catch (Exception e) { 102 | ChunkyMapPlugin.getPlugin(ChunkyMapPlugin.class).getLogger() 103 | .log(Level.WARNING, "Rendering tile failed", e); 104 | return false; 105 | } 106 | } 107 | 108 | private static int getChunkyDimension(Environment environment) { 109 | switch (environment) { 110 | case NETHER: 111 | return World.NETHER_DIMENSION; 112 | case THE_END: 113 | return World.END_DIMENSION; 114 | case NORMAL: 115 | default: 116 | return World.OVERWORLD_DIMENSION; 117 | } 118 | } 119 | 120 | private static Collection getChunksAround(int centerX, int centerZ, int radius) { 121 | ArrayList chunks = new ArrayList<>((radius + 1) * (radius + 1)); 122 | for (int x = -radius; x <= radius; x++) { 123 | for (int z = -radius; z <= radius; z++) { 124 | chunks.add(ChunkPosition.get(centerX + x, centerZ + z)); 125 | } 126 | } 127 | return chunks; 128 | } 129 | 130 | @Override 131 | public List getRequiredChunks() { 132 | return map.getRequiredChunks(this); 133 | } 134 | 135 | @Override 136 | public MapTile[] getAdjecentTiles() { 137 | return map.getAdjecentTiles(this); 138 | } 139 | 140 | public int hashCode() { 141 | return this.tx ^ this.ty ^ this.perspective.hashCode() ^ this.world.hashCode() ^ this.boostzoom; 142 | } 143 | 144 | public boolean equals(Object obj) { 145 | return obj instanceof ChunkyMapTile && this.equals((ChunkyMapTile) obj); 146 | } 147 | 148 | public boolean equals(ChunkyMapTile o) { 149 | return o.tx == this.tx && o.ty == this.ty && this.perspective == o.perspective 150 | && o.world == this.world && o.boostzoom == this.boostzoom; 151 | } 152 | 153 | @Override 154 | public boolean isBiomeDataNeeded() { 155 | return false; 156 | } 157 | 158 | @Override 159 | public boolean isHightestBlockYDataNeeded() { 160 | return false; 161 | } 162 | 163 | @Override 164 | public boolean isRawBiomeDataNeeded() { 165 | return false; 166 | } 167 | 168 | @Override 169 | public boolean isBlockTypeDataNeeded() { 170 | return true; 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/dynmap/DynmapCameraAdapter.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.dynmap; 2 | 3 | import org.dynmap.hdmap.IsoHDPerspective; 4 | import org.dynmap.utils.Matrix3D; 5 | import org.dynmap.utils.Vector3D; 6 | import se.llbit.chunky.renderer.projection.ProjectionMode; 7 | import se.llbit.chunky.renderer.scene.Camera; 8 | import se.llbit.math.Vector3; 9 | 10 | public class DynmapCameraAdapter { 11 | 12 | private final IsoHDPerspective perspective; 13 | private final Matrix3D transformMapToWorld; 14 | 15 | public DynmapCameraAdapter(IsoHDPerspective perspective) { 16 | this.perspective = perspective; 17 | 18 | transformMapToWorld = new Matrix3D(); 19 | transformMapToWorld.scale(1.0D / (double) perspective.getModelScale(), 20 | 1.0D / (double) perspective.getModelScale(), 21 | 1.0D / Math.sin(Math.toRadians(perspective.inclination))); 22 | transformMapToWorld.shearZ(0.0D, -Math.tan(Math.toRadians(90.0D - perspective.inclination))); 23 | transformMapToWorld.rotateYZ(-(90.0D - perspective.inclination)); 24 | transformMapToWorld.rotateXY(-180.0D + perspective.azimuth); 25 | Matrix3D coordswap = new Matrix3D(0.0D, -1.0D, 0.0D, 0.0D, 0.0D, 1.0D, -1.0D, 0.0D, 0.0D); 26 | transformMapToWorld.multiply(coordswap); 27 | } 28 | 29 | public void apply(Camera camera, int tx, int ty, int mapzoomout, int extrazoomout) { 30 | double x = tx + 0.5; 31 | double y = ty + 0.5; 32 | Vector3D v = new Vector3D(x * (1 << mapzoomout) * 64 / perspective.getScale(), 33 | y * (1 << mapzoomout) * 64 / perspective.getScale(), 65); 34 | transformMapToWorld.transform(v); 35 | 36 | camera.setProjectionMode(ProjectionMode.PARALLEL); 37 | camera.setPosition(new Vector3(v.x, v.y, v.z)); 38 | camera.setView((90 - perspective.azimuth + 90) / 180 * Math.PI, 39 | (-90 + perspective.inclination) / 180 * Math.PI, 0); 40 | camera.setFoV(128.0 / perspective.getScale()); 41 | camera.setDof(Double.POSITIVE_INFINITY); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/rendering/FileBufferRenderContext.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.rendering; 2 | 3 | 4 | import java.io.ByteArrayOutputStream; 5 | import java.io.FileNotFoundException; 6 | import java.io.IOException; 7 | import java.io.OutputStream; 8 | import se.llbit.chunky.main.Chunky; 9 | import se.llbit.chunky.main.ChunkyOptions; 10 | import se.llbit.chunky.renderer.RenderContext; 11 | 12 | /** 13 | * A mocked {@link RenderContext} for Chunky that saves scene files into buffers. Only supports 14 | * saving scenes. 15 | */ 16 | public class FileBufferRenderContext extends RenderContext { 17 | 18 | private ByteArrayOutputStream scene; 19 | private ByteArrayOutputStream grass; 20 | private ByteArrayOutputStream foliage; 21 | private ByteArrayOutputStream octree; 22 | 23 | public FileBufferRenderContext() { 24 | super(new Chunky(ChunkyOptions.getDefaults())); 25 | } 26 | 27 | @Override 28 | public OutputStream getSceneFileOutputStream(String fileName) throws FileNotFoundException { 29 | if (fileName.endsWith(".json")) { 30 | return scene = new ByteArrayOutputStream(); 31 | } else if (fileName.endsWith(".grass")) { 32 | return grass = new ByteArrayOutputStream(); 33 | } else if (fileName.endsWith(".foliage")) { 34 | return foliage = new ByteArrayOutputStream(); 35 | } else if (fileName.endsWith(".octree")) { 36 | return octree = new ByteArrayOutputStream(); 37 | } else { 38 | return new OutputStream() { 39 | @Override 40 | public void write(int b) throws IOException { 41 | // no-op 42 | } 43 | }; 44 | } 45 | } 46 | 47 | public byte[] getScene() { 48 | return scene.toByteArray(); 49 | } 50 | 51 | public byte[] getGrass() { 52 | return grass.toByteArray(); 53 | } 54 | 55 | public byte[] getFoliage() { 56 | return foliage.toByteArray(); 57 | } 58 | 59 | public byte[] getOctree() { 60 | return octree.toByteArray(); 61 | } 62 | 63 | public void setRenderThreadCount(int threads) { 64 | config.renderThreads = threads; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/rendering/RenderException.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.rendering; 2 | 3 | /** 4 | * Exception that is thrown if rendering an image fails. 5 | */ 6 | public class RenderException extends Exception { 7 | 8 | public RenderException(String message, Throwable inner) { 9 | super(message, inner); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/rendering/Renderer.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.rendering; 2 | 3 | import java.awt.image.BufferedImage; 4 | import java.io.File; 5 | import java.util.concurrent.CompletableFuture; 6 | import java.util.function.Consumer; 7 | import se.llbit.chunky.renderer.scene.Scene; 8 | 9 | /** 10 | * A renderer that can render an image of a {@link se.llbit.chunky.renderer.scene.Scene}. 11 | */ 12 | public interface Renderer { 13 | 14 | /** 15 | * Renders a scene using the given context. 16 | * 17 | * @param context render context 18 | * @param texturepack the texturepack 19 | * @param initializeScene function that initializes the scene 20 | * @return future with the rendered image 21 | */ 22 | CompletableFuture render(FileBufferRenderContext context, File texturepack, 23 | Consumer initializeScene); 24 | 25 | /** 26 | * set the default / fallback texturepack to use 27 | * 28 | * @param texturepack 29 | */ 30 | void setDefaultTexturepack(File texturepack); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/rendering/SilentTaskTracker.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.rendering; 2 | 3 | import se.llbit.util.ProgressListener; 4 | import se.llbit.util.TaskTracker; 5 | 6 | public class SilentTaskTracker extends TaskTracker { 7 | 8 | public static final TaskTracker INSTANCE = new SilentTaskTracker(); 9 | 10 | private SilentTaskTracker() { 11 | super(new ProgressListener() { 12 | @Override 13 | public void setProgress(String s, int i, int i1, int i2) { 14 | // empty 15 | } 16 | 17 | @Override 18 | public void setProgress(String s, int i, int i1, int i2, String s1) { 19 | // empty 20 | } 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/rendering/local/ChunkyRenderer.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.rendering.local; 2 | 3 | import de.lemaik.chunky.denoiser.AlbedoTracer; 4 | import de.lemaik.chunky.denoiser.CombinedRayTracer; 5 | import de.lemaik.chunky.denoiser.NormalTracer; 6 | import de.lemaik.chunkymap.ChunkyMapPlugin; 7 | import de.lemaik.chunkymap.rendering.FileBufferRenderContext; 8 | import de.lemaik.chunkymap.rendering.RenderException; 9 | import de.lemaik.chunkymap.rendering.Renderer; 10 | import de.lemaik.chunkymap.rendering.SilentTaskTracker; 11 | import java.awt.Graphics2D; 12 | import java.awt.image.BufferedImage; 13 | import java.awt.image.DataBufferInt; 14 | import java.io.File; 15 | import java.lang.reflect.Field; 16 | import java.lang.reflect.Method; 17 | import java.nio.FloatBuffer; 18 | import java.util.concurrent.CompletableFuture; 19 | import java.util.concurrent.atomic.AtomicReference; 20 | import java.util.function.Consumer; 21 | import net.time4tea.oidn.Oidn; 22 | import net.time4tea.oidn.Oidn.DeviceType; 23 | import net.time4tea.oidn.OidnDevice; 24 | import net.time4tea.oidn.OidnFilter; 25 | import net.time4tea.oidn.OidnImages; 26 | import se.llbit.chunky.PersistentSettings; 27 | import se.llbit.chunky.renderer.Postprocess; 28 | import se.llbit.chunky.renderer.RenderManager; 29 | import se.llbit.chunky.renderer.SnapshotControl; 30 | import se.llbit.chunky.renderer.scene.PathTracer; 31 | import se.llbit.chunky.renderer.scene.Scene; 32 | import se.llbit.chunky.renderer.scene.SynchronousSceneManager; 33 | import se.llbit.chunky.resources.BitmapImage; 34 | import se.llbit.chunky.resources.TexturePackLoader; 35 | import se.llbit.util.TaskTracker; 36 | 37 | /** 38 | * A renderer that uses Chunky to render scenes locally. 39 | */ 40 | public class ChunkyRenderer implements Renderer { 41 | 42 | private static File previousTexturepack; 43 | private static File previousDefaultTexturepack; 44 | private final int targetSpp; 45 | private final boolean enableDenoiser; 46 | private final int albedoTargetSpp; 47 | private final int normalTargetSpp; 48 | private final int threads; 49 | private final int cpuLoad; 50 | 51 | public ChunkyRenderer(int targetSpp, boolean enableDenoiser, int albedoTargetSpp, 52 | int normalTargetSpp, int threads, int cpuLoad) { 53 | this.targetSpp = targetSpp; 54 | this.enableDenoiser = enableDenoiser; 55 | this.albedoTargetSpp = albedoTargetSpp; 56 | this.normalTargetSpp = normalTargetSpp; 57 | this.threads = threads; 58 | this.cpuLoad = cpuLoad; 59 | 60 | PersistentSettings.changeSettingsDirectory( 61 | new File(ChunkyMapPlugin.getPlugin(ChunkyMapPlugin.class).getDataFolder(), "chunky")); 62 | PersistentSettings.setLoadPlayers(false); 63 | } 64 | 65 | @Override 66 | public void setDefaultTexturepack(File texturepack) { 67 | // no-op, textures are static in Chunky and were already loaded 68 | } 69 | 70 | public static void loadTexturepack(File texturepack) { 71 | if (!texturepack.equals(previousTexturepack)) { 72 | // this means that only one texturepack can be used for all maps, if rendering with multiple chunky instances 73 | TexturePackLoader.loadTexturePacks(texturepack.getAbsolutePath(), false); 74 | previousTexturepack = texturepack; 75 | } 76 | } 77 | 78 | public static void loadDefaultTexturepack(File texturepack) { 79 | if (!texturepack.equals(previousDefaultTexturepack)) { 80 | // this means that only one texturepack can be used for all maps, if rendering with multiple chunky instances 81 | TexturePackLoader.loadTexturePacks(texturepack.getAbsolutePath(), false); 82 | previousDefaultTexturepack = texturepack; 83 | } 84 | } 85 | 86 | @Override 87 | public CompletableFuture render(FileBufferRenderContext context, File texturepack, 88 | Consumer initializeScene) { 89 | CompletableFuture result = new CompletableFuture<>(); 90 | 91 | CombinedRayTracer combinedRayTracer = new CombinedRayTracer(); 92 | context.getChunky().setRayTracerFactory(() -> combinedRayTracer); 93 | context.setRenderThreadCount(threads); 94 | RenderManager renderer = new RenderManager(context, false); 95 | renderer.setCPULoad(cpuLoad); 96 | 97 | SynchronousSceneManager sceneManager = new SynchronousSceneManager(context, renderer); 98 | initializeScene.accept(sceneManager.getScene()); 99 | renderer.setSceneProvider(sceneManager); 100 | renderer.setSnapshotControl(new SnapshotControl() { 101 | @Override 102 | public boolean saveSnapshot(Scene scene, int nextSpp) { 103 | return false; 104 | } 105 | 106 | @Override 107 | public boolean saveRenderDump(Scene scene, int nextSpp) { 108 | return false; 109 | } 110 | }); 111 | 112 | AtomicReference albedo = new AtomicReference<>(); 113 | AtomicReference normal = new AtomicReference<>(); 114 | 115 | renderer.setOnRenderCompleted((time, sps) -> { 116 | try { 117 | if (combinedRayTracer.getRayTracer() instanceof PathTracer) { 118 | result.complete(getImage(sceneManager.getScene(), albedo.get(), normal.get())); 119 | renderer.interrupt(); 120 | } else if (combinedRayTracer.getRayTracer() instanceof AlbedoTracer) { 121 | Scene scene = renderer.getBufferedScene(); 122 | double[] samples = scene.getSampleBuffer(); 123 | FloatBuffer albedoBuffer = Oidn.Companion.allocateBuffer(sceneManager.getScene().width, 124 | sceneManager.getScene().height); 125 | for (int y = 0; y < scene.height; y++) { 126 | for (int x = 0; x < scene.width; x++) { 127 | albedoBuffer.put((y * scene.width + x) * 3, 128 | (float) Math.min(1.0, samples[(y * scene.width + x) * 3 + 0])); 129 | albedoBuffer.put((y * scene.width + x) * 3 + 1, 130 | (float) Math.min(1.0, samples[(y * scene.width + x) * 3 + 1])); 131 | albedoBuffer.put((y * scene.width + x) * 3 + 2, 132 | (float) Math.min(1.0, samples[(y * scene.width + x) * 3 + 2])); 133 | } 134 | } 135 | albedo.set(albedoBuffer); 136 | 137 | combinedRayTracer.setRayTracer(new PathTracer()); 138 | sceneManager.getScene().haltRender(); 139 | sceneManager.getScene().setTargetSpp(targetSpp); 140 | sceneManager.getScene().startHeadlessRender(); 141 | } else if (combinedRayTracer.getRayTracer() instanceof NormalTracer) { 142 | Scene scene = renderer.getBufferedScene(); 143 | double[] samples = scene.getSampleBuffer(); 144 | FloatBuffer normalBuffer = Oidn.Companion.allocateBuffer(sceneManager.getScene().width, 145 | sceneManager.getScene().height); 146 | for (int y = 0; y < scene.height; y++) { 147 | for (int x = 0; x < scene.width; x++) { 148 | normalBuffer.put((y * scene.width + x) * 3, 149 | (float) samples[(y * scene.width + x) * 3 + 0]); 150 | normalBuffer.put((y * scene.width + x) * 3 + 1, 151 | (float) samples[(y * scene.width + x) * 3 + 1]); 152 | normalBuffer.put((y * scene.width + x) * 3 + 2, 153 | (float) samples[(y * scene.width + x) * 3 + 2]); 154 | } 155 | } 156 | normal.set(normalBuffer); 157 | 158 | combinedRayTracer.setRayTracer(new AlbedoTracer()); 159 | sceneManager.getScene().haltRender(); 160 | sceneManager.getScene().setTargetSpp(albedoTargetSpp); 161 | sceneManager.getScene().startHeadlessRender(); 162 | } 163 | } catch (ReflectiveOperationException e) { 164 | result 165 | .completeExceptionally(new RenderException("Could not get final image from Chunky", e)); 166 | } 167 | }); 168 | 169 | try { 170 | if (enableDenoiser && normalTargetSpp > 0) { 171 | combinedRayTracer.setRayTracer(new NormalTracer()); 172 | sceneManager.getScene().setTargetSpp(normalTargetSpp); 173 | } else if (enableDenoiser && albedoTargetSpp > 0) { 174 | combinedRayTracer.setRayTracer(new AlbedoTracer()); 175 | sceneManager.getScene().setTargetSpp(albedoTargetSpp); 176 | } else { 177 | sceneManager.getScene().setTargetSpp(targetSpp); 178 | } 179 | 180 | sceneManager.getScene().startHeadlessRender(); 181 | renderer.start(); 182 | renderer.join(); 183 | renderer.shutdown(); 184 | } catch (InterruptedException e) { 185 | result.completeExceptionally(new RenderException("Rendering failed", e)); 186 | } finally { 187 | renderer.shutdown(); 188 | } 189 | 190 | return result; 191 | } 192 | 193 | private BufferedImage getImage(Scene scene, FloatBuffer albedo, FloatBuffer normal) 194 | throws ReflectiveOperationException { 195 | if (enableDenoiser) { 196 | double[] samples = scene.getSampleBuffer(); 197 | FloatBuffer buffer = Oidn.Companion.allocateBuffer(scene.width, scene.height); 198 | 199 | // TODO use multiple threads for post-processing 200 | for (int y = 0; y < scene.height; y++) { 201 | for (int x = 0; x < scene.width; x++) { 202 | double[] result = new double[3]; 203 | if (scene.getPostprocess() != Postprocess.NONE) { 204 | scene.postProcessPixel(x, y, result); 205 | } else { 206 | result[0] = samples[(y * scene.width + x) * 3 + 0]; 207 | result[1] = samples[(y * scene.width + x) * 3 + 1]; 208 | result[2] = samples[(y * scene.width + x) * 3 + 2]; 209 | } 210 | buffer.put((y * scene.width + x) * 3, (float) Math.min(1.0, result[0])); 211 | buffer.put((y * scene.width + x) * 3 + 1, (float) Math.min(1.0, result[1])); 212 | buffer.put((y * scene.width + x) * 3 + 2, (float) Math.min(1.0, result[2])); 213 | } 214 | } 215 | 216 | Oidn oidn = new Oidn(); 217 | try (OidnDevice device = oidn.newDevice(DeviceType.DEVICE_TYPE_DEFAULT)) { 218 | try (OidnFilter filter = device.raytraceFilter()) { 219 | filter.setFilterImage(buffer, buffer, scene.width, scene.height); 220 | if (albedo != null) { 221 | // albedo is required if normal is set 222 | filter.setAdditionalImages(albedo, normal, scene.width, scene.height); 223 | } 224 | filter.commit(); 225 | filter.execute(); 226 | } 227 | } 228 | 229 | BufferedImage renderedImage = OidnImages.Companion 230 | .newBufferedImage(scene.width, scene.height); 231 | for (int i = 0; i < buffer.capacity(); i++) { 232 | renderedImage.getRaster().getDataBuffer().setElemFloat(i, buffer.get(i)); 233 | } 234 | BufferedImage imageInIntPixelLayout = new BufferedImage(scene.width, scene.height, 235 | BufferedImage.TYPE_INT_ARGB); 236 | Graphics2D graphics = imageInIntPixelLayout.createGraphics(); 237 | graphics.drawImage(renderedImage, 0, 0, null); 238 | graphics.dispose(); 239 | 240 | return imageInIntPixelLayout; 241 | } else { 242 | Class sceneClass = Scene.class; 243 | Method computeAlpha = sceneClass 244 | .getDeclaredMethod("computeAlpha", new Class[]{TaskTracker.class, int.class}); 245 | computeAlpha.setAccessible(true); 246 | computeAlpha.invoke(scene, SilentTaskTracker.INSTANCE, threads); 247 | 248 | Field finalized = sceneClass.getDeclaredField("finalized"); 249 | finalized.setAccessible(true); 250 | if (!finalized.getBoolean(scene)) { 251 | scene.postProcessFrame(SilentTaskTracker.INSTANCE, threads); 252 | } 253 | 254 | Field backBuffer = sceneClass.getDeclaredField("backBuffer"); 255 | backBuffer.setAccessible(true); 256 | BitmapImage bitmap = (BitmapImage) backBuffer.get(scene); 257 | 258 | BufferedImage renderedImage = new BufferedImage(bitmap.width, bitmap.height, 259 | BufferedImage.TYPE_INT_ARGB); 260 | DataBufferInt dataBuffer = (DataBufferInt) renderedImage.getRaster().getDataBuffer(); 261 | int[] data = dataBuffer.getData(); 262 | System.arraycopy(bitmap.data, 0, data, 0, bitmap.width * bitmap.height); 263 | 264 | return renderedImage; 265 | } 266 | } 267 | } 268 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/rendering/rs/ApiClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Wertarbyte 3 | * 4 | * This file is part of the RenderService. 5 | * 6 | * Wertarbyte RenderService is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Wertarbyte RenderService is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Wertarbyte RenderService. If not, see . 18 | */ 19 | 20 | package de.lemaik.chunkymap.rendering.rs; 21 | 22 | import com.google.gson.Gson; 23 | import java.awt.image.BufferedImage; 24 | import java.io.File; 25 | import java.io.IOException; 26 | import java.io.InputStreamReader; 27 | import java.net.URL; 28 | import java.util.concurrent.CompletableFuture; 29 | import java.util.function.Supplier; 30 | import javax.imageio.ImageIO; 31 | import okhttp3.Call; 32 | import okhttp3.Callback; 33 | import okhttp3.MediaType; 34 | import okhttp3.MultipartBody; 35 | import okhttp3.OkHttpClient; 36 | import okhttp3.Request; 37 | import okhttp3.RequestBody; 38 | import okhttp3.Response; 39 | import okio.Buffer; 40 | import okio.BufferedSink; 41 | import okio.Okio; 42 | import okio.Source; 43 | import se.llbit.util.TaskTracker; 44 | 45 | public class ApiClient { 46 | 47 | private static final Gson gson = new Gson(); 48 | private final String baseUrl; 49 | private final OkHttpClient client; 50 | 51 | public ApiClient(String baseUrl) { 52 | this.baseUrl = baseUrl; 53 | client = new OkHttpClient.Builder().build(); 54 | } 55 | 56 | public CompletableFuture createJob(byte[] scene, byte[] octree, byte[] grass, 57 | byte[] foliage, byte[] skymap, String skymapName, TaskTracker taskTracker) { 58 | CompletableFuture result = new CompletableFuture<>(); 59 | 60 | MultipartBody.Builder multipartBuilder = new MultipartBody.Builder() 61 | .setType(MediaType.parse("multipart/form-data")) 62 | .addFormDataPart("foliage", "scene.foliage", 63 | byteBody(foliage, () -> taskTracker.task("Upload foliage..."))) 64 | .addFormDataPart("grass", "scene.grass", 65 | byteBody(grass, () -> taskTracker.task("Upload task..."))) 66 | .addFormDataPart("scene", "scene.json", 67 | byteBody(scene, () -> taskTracker.task("Upload scene..."))) 68 | .addFormDataPart("octree", "scene.octree", 69 | byteBody(octree, () -> taskTracker.task("Upload octree..."))) 70 | .addFormDataPart("targetSpp", "100"); 71 | 72 | if (skymap != null) { 73 | multipartBuilder = multipartBuilder.addFormDataPart("skymap", skymapName, 74 | byteBody(skymap, () -> taskTracker.task("Upload skymap..."))); 75 | } 76 | 77 | client.newCall(new Request.Builder() 78 | .url(baseUrl + "/jobs") 79 | .post(multipartBuilder.build()) 80 | .build()) 81 | .enqueue(new Callback() { 82 | @Override 83 | public void onFailure(Call call, IOException e) { 84 | result.completeExceptionally(e); 85 | } 86 | 87 | @Override 88 | public void onResponse(Call call, Response response) throws IOException { 89 | if (response.code() == 201) { 90 | try (InputStreamReader reader = new InputStreamReader(response.body().byteStream())) { 91 | result.complete(gson.fromJson(reader, RenderJob.class)); 92 | } catch (IOException e) { 93 | result.completeExceptionally(e); 94 | } 95 | } else { 96 | result.completeExceptionally(new IOException("The render job could not be created")); 97 | } 98 | } 99 | }); 100 | 101 | return result; 102 | } 103 | 104 | public CompletableFuture createJob(File scene, File octree, File grass, File foliage, 105 | File skymap, TaskTracker taskTracker) throws IOException { 106 | CompletableFuture result = new CompletableFuture<>(); 107 | 108 | MultipartBody.Builder multipartBuilder = new MultipartBody.Builder() 109 | .setType(MediaType.parse("multipart/form-data")) 110 | .addFormDataPart("foliage", "scene.foliage", 111 | fileBody(foliage, () -> taskTracker.task("Upload foliage..."))) 112 | .addFormDataPart("grass", "scene.grass", 113 | fileBody(grass, () -> taskTracker.task("Upload task..."))) 114 | .addFormDataPart("scene", "scene.json", 115 | fileBody(scene, () -> taskTracker.task("Upload scene..."))) 116 | .addFormDataPart("octree", "scene.octree", 117 | fileBody(octree, () -> taskTracker.task("Upload octree..."))) 118 | .addFormDataPart("targetSpp", "100"); 119 | 120 | if (skymap != null) { 121 | multipartBuilder = multipartBuilder.addFormDataPart("skymap", skymap.getName(), 122 | fileBody(skymap, () -> taskTracker.task("Upload skymap..."))); 123 | } 124 | 125 | client.newCall(new Request.Builder() 126 | .url(baseUrl + "/jobs") 127 | .post(multipartBuilder.build()) 128 | .build()) 129 | .enqueue(new Callback() { 130 | @Override 131 | public void onFailure(Call call, IOException e) { 132 | result.completeExceptionally(e); 133 | } 134 | 135 | @Override 136 | public void onResponse(Call call, Response response) throws IOException { 137 | if (response.code() == 201) { 138 | try (InputStreamReader reader = new InputStreamReader(response.body().byteStream())) { 139 | result.complete(gson.fromJson(reader, RenderJob.class)); 140 | } catch (IOException e) { 141 | result.completeExceptionally(e); 142 | } 143 | } else { 144 | result.completeExceptionally(new IOException("The render job could not be created")); 145 | } 146 | } 147 | }); 148 | 149 | return result; 150 | } 151 | 152 | public CompletableFuture waitForCompletion(RenderJob renderJob) { 153 | if (renderJob.getSpp() >= renderJob.getTargetSpp()) { 154 | // job is already completed 155 | return CompletableFuture.completedFuture(renderJob); 156 | } 157 | 158 | CompletableFuture completedJob = new CompletableFuture<>(); 159 | new Thread(() -> { 160 | RenderJob current = renderJob; 161 | try { 162 | while (current.getSpp() < current.getTargetSpp()) { 163 | Thread.sleep(10_000); 164 | current = getJob(current.getId()).get(); 165 | } 166 | completedJob.complete(current); 167 | } catch (Exception e) { 168 | completedJob.completeExceptionally(e); 169 | } 170 | }).start(); 171 | return completedJob; 172 | } 173 | 174 | public CompletableFuture getJob(String jobId) { 175 | CompletableFuture result = new CompletableFuture<>(); 176 | 177 | client.newCall(new Request.Builder() 178 | .url(baseUrl + "/jobs/" + jobId).get().build()) 179 | .enqueue(new Callback() { 180 | @Override 181 | public void onFailure(Call call, IOException e) { 182 | result.completeExceptionally(e); 183 | } 184 | 185 | @Override 186 | public void onResponse(Call call, Response response) { 187 | if (response.code() == 200) { 188 | try (InputStreamReader reader = new InputStreamReader(response.body().byteStream())) { 189 | result.complete(gson.fromJson(reader, RenderJob.class)); 190 | } catch (IOException e) { 191 | result.completeExceptionally(e); 192 | } 193 | } else { 194 | result.completeExceptionally(new IOException("The job could not be downloaded")); 195 | } 196 | } 197 | }); 198 | 199 | return result; 200 | } 201 | 202 | private static RequestBody fileBody(final File file, Supplier taskCreator) { 203 | TaskTracker.Task task = taskCreator.get(); 204 | return new RequestBody() { 205 | @Override 206 | public MediaType contentType() { 207 | return MediaType.parse("application/octet-stream"); 208 | } 209 | 210 | @Override 211 | public long contentLength() { 212 | return file.length(); 213 | } 214 | 215 | @Override 216 | public void writeTo(BufferedSink bufferedSink) throws IOException { 217 | Source source = null; 218 | try { 219 | source = Okio.source(file); 220 | //sink.writeAll(source); 221 | Buffer buf = new Buffer(); 222 | long read = 0; 223 | for (long readCount; (readCount = source.read(buf, 2048)) != -1; ) { 224 | bufferedSink.write(buf, readCount); 225 | read += readCount; 226 | task.update((int) contentLength(), (int) read); 227 | } 228 | } catch (Exception e) { 229 | e.printStackTrace(); 230 | } 231 | task.close(); 232 | } 233 | }; 234 | } 235 | 236 | private static RequestBody byteBody(final byte[] content, 237 | Supplier taskCreator) { 238 | TaskTracker.Task task = taskCreator.get(); 239 | return new RequestBody() { 240 | @Override 241 | public MediaType contentType() { 242 | return MediaType.parse("application/octet-stream"); 243 | } 244 | 245 | @Override 246 | public long contentLength() { 247 | return content.length; 248 | } 249 | 250 | @Override 251 | public void writeTo(BufferedSink bufferedSink) throws IOException { 252 | bufferedSink.write(content); 253 | task.close(); 254 | } 255 | }; 256 | } 257 | 258 | public BufferedImage getPicture(String id) throws IOException { 259 | return ImageIO.read(new URL(baseUrl + "/jobs/" + id + "/latest.png")); 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/rendering/rs/RenderJob.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Wertarbyte 3 | * 4 | * This file is part of the RenderService. 5 | * 6 | * Wertarbyte RenderService is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Wertarbyte RenderService is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Wertarbyte RenderService. If not, see . 18 | */ 19 | 20 | package de.lemaik.chunkymap.rendering.rs; 21 | 22 | /** 23 | * A render job. 24 | */ 25 | public class RenderJob { 26 | 27 | private String _id; 28 | private int spp; 29 | private int targetSpp; 30 | 31 | public String getId() { 32 | return _id; 33 | } 34 | 35 | public int getSpp() { 36 | return spp; 37 | } 38 | 39 | public int getTargetSpp() { 40 | return targetSpp; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/de/lemaik/chunkymap/util/MinecraftDownloader.java: -------------------------------------------------------------------------------- 1 | package de.lemaik.chunkymap.util; 2 | 3 | import com.google.gson.JsonElement; 4 | import com.google.gson.JsonObject; 5 | import com.google.gson.JsonParser; 6 | import java.io.IOException; 7 | import java.util.concurrent.CompletableFuture; 8 | import okhttp3.Call; 9 | import okhttp3.Callback; 10 | import okhttp3.OkHttpClient; 11 | import okhttp3.Request; 12 | import okhttp3.Response; 13 | 14 | /** 15 | * A utility class to download Minecraft jars. 16 | */ 17 | public class MinecraftDownloader { 18 | 19 | public static CompletableFuture downloadMinecraft(String version) { 20 | return getVersionManifestUrl(version) 21 | .thenCompose(MinecraftDownloader::getClientUrl) 22 | .thenCompose(clientUrl -> { 23 | CompletableFuture result = new CompletableFuture<>(); 24 | 25 | new OkHttpClient.Builder().build() 26 | .newCall(new Request.Builder() 27 | .url(clientUrl) 28 | .get() 29 | .build()) 30 | .enqueue(new Callback() { 31 | @Override 32 | public void onFailure(Call call, IOException e) { 33 | result.completeExceptionally(e); 34 | } 35 | 36 | @Override 37 | public void onResponse(Call call, Response response) { 38 | result.complete(response); 39 | } 40 | }); 41 | return result; 42 | }); 43 | } 44 | 45 | private static CompletableFuture getVersionManifestUrl(final String version) { 46 | CompletableFuture result = new CompletableFuture<>(); 47 | new OkHttpClient.Builder().build().newCall( 48 | new Request.Builder().url("https://launchermeta.mojang.com/mc/game/version_manifest.json") 49 | .get().build()) 50 | .enqueue(new Callback() { 51 | @Override 52 | public void onFailure(Call call, IOException e) { 53 | result.completeExceptionally(e); 54 | } 55 | 56 | @Override 57 | public void onResponse(Call call, Response response) throws IOException { 58 | JsonObject parsed = new JsonParser().parse(response.body().string()).getAsJsonObject(); 59 | for (JsonElement versionData : parsed.getAsJsonArray("versions")) { 60 | if (versionData.getAsJsonObject().get("id").getAsString().equals(version)) { 61 | result.complete(versionData.getAsJsonObject().get("url").getAsString()); 62 | return; 63 | } 64 | } 65 | result.completeExceptionally(new Exception("Version " + version + " not found")); 66 | } 67 | }); 68 | 69 | return result; 70 | } 71 | 72 | private static CompletableFuture getClientUrl(final String versionManifestUrl) { 73 | CompletableFuture result = new CompletableFuture<>(); 74 | new OkHttpClient.Builder().build() 75 | .newCall(new Request.Builder().url(versionManifestUrl).get().build()) 76 | .enqueue(new Callback() { 77 | @Override 78 | public void onFailure(Call call, IOException e) { 79 | result.completeExceptionally(e); 80 | } 81 | 82 | @Override 83 | public void onResponse(Call call, Response response) throws IOException { 84 | JsonObject parsed = new JsonParser().parse(response.body().string()).getAsJsonObject(); 85 | result.complete(parsed.getAsJsonObject("downloads").getAsJsonObject("client").get("url") 86 | .getAsString()); 87 | } 88 | }); 89 | 90 | return result; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: ChunkyMap 2 | version: ${project.version} 3 | main: de.lemaik.chunkymap.ChunkyMapPlugin 4 | loadbefore: [dynmap] 5 | -------------------------------------------------------------------------------- /src/main/resources/rs-map-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leMaik/ChunkyMap/e5c998922906e371925a372cb071fc67df607798/src/main/resources/rs-map-icon.png --------------------------------------------------------------------------------