From: Svjatoslav Agejenko Date: Wed, 22 Feb 2023 19:16:52 +0000 (+0200) Subject: Improved code readability X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=316a696bf9db6e8eddf90ef3df5e1119481c0192;hp=baec470ef7405d5d839c1cc662694a61744addd1;p=sixth-3d.git Improved code readability --- diff --git a/.gitignore b/.gitignore index eab3745..16b071f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ /.project /.settings/ /doc/graphs/ -/sixth-3d.iml \ No newline at end of file +/doc/apidocs/ +/*.iml \ No newline at end of file diff --git a/COPYING b/COPYING index 65c5ca8..0e259d4 100644 --- a/COPYING +++ b/COPYING @@ -1,165 +1,121 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/doc/index.html b/doc/index.html index 39d59e4..7a3cc94 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,258 +1,296 @@ - - + + + + + + Sixth 3D - 3D engine - - - - - - - -" - - - + + + + + -
-

Sixth 3D - 3D engine

-
-
  • It is fast enough thanks to:
      -
    • Java virtual machine just-in-time compiler. -
    • -
    • Growing CPU cores count. -
    • -
    -
  • +
  • Java virtual machine just-in-time compiler.
  • +
  • Growing CPU cores count.
  • +
  • As a result it is easy to run on various hardware platforms and -operating systems. -
  • +operating systems.
    -
    -

    2 TODO API documentation

    -
    +
    +

    3. API documentation

    +
    + +

    -Documentation currently missing for the lack of time. +Note: due to a lack of time, there is still big room for improvement +on documentation.

    So far best resource is to download and explore source code for:

    -
    -

    3 Instructions to embed Sixth-3D in your project

    -
    +
    +

    4. Instructions to embed Sixth-3D in your project

    +

    -Maven *pom.xml* file snippet: +Maven pom.xml file snippet:

    - -
    <dependencies>
    +
    <dependencies>
         ...
    -    <dependency>
    -        <groupId>eu.svjatoslav</groupId>
    -        <artifactId>sixth-3d</artifactId>
    -        <version>1.1</version>
    -    </dependency>
    +    <dependency>
    +        <groupId>eu.svjatoslav</groupId>
    +        <artifactId>sixth-3d</artifactId>
    +        <version>1.2</version>
    +    </dependency>
         ...
    -</dependencies>
    +</dependencies>
     
    -<repositories>
    +<repositories>
         ...
    -    <repository>
    -        <id>svjatoslav.eu</id>
    -        <name>Svjatoslav repository</name>
    -        <url>http://www2.svjatoslav.eu/maven/</url>
    -    </repository>
    +    <repository>
    +        <id>svjatoslav.eu</id>
    +        <name>Svjatoslav repository</name>
    +        <url>http://www3.svjatoslav.eu/maven/</url>
    +    </repository>
         ...
    -</repositories>
    +</repositories>
     

    -For API usage examples, see demos. +For API usage examples, see demos.

    -
    -

    4 TODO features to add

    -
    +
    +

    5. TODO features to add

    +
      +
    • read this as example, and apply improvements/fixes where applicable: +http://blog.rogach.org/2015/08/how-to-create-your-own-simple-3d-render.html
    • + +
    • Improve triangulation. Read: https://ianthehenry.com/posts/delaunay/
    • +
    • Partial region/frame repaint: when only one small object changed on -the scene, it would be faster to re-render that specific area. -
    • +the scene, it would be faster to re-render that specific area.
    • Once partial rendering works, in would be easy to add multi-core rendering support. So that each core renders it's own region of the -screen. -
    • +screen.
    • Antialiazing. Would improve text readability. If antialiazing is too expensive for every frame, it could be used only for last frame -before animations become still and waiting for user input starts. -
    • - -
    • Render only visible polygons. +before animations become still and waiting for user input starts.
    • +
    +
    +
    +

    5.1. Render only visible polygons

    +
      -
    • This would significantly reduce RAM <-> CPU traffic. -
    • +
    • This would significantly reduce RAM <-> CPU traffic.
    • General algorithm description:
      • For each horizontal scanline:
          -
        • sort polygon edges from left to right -
        • +
        • sort polygon edges from left to right
        • while iterating and drawing pixels over screen X axis (left to right) track next appearing/disappearing polygons.
            -
          • For each polygon edge update Z sorted active polygons list. -
          • +
          • For each polygon edge update Z sorted active polygons list.
          • Only draw pixel from the top-most polygon.
            • Only if polygon area is transparent/half-transparent add -colors from the polygons below. -
            • -
            -
          • -
          -
        • -
        -
      • -
      -
    • +colors from the polygons below. +
    + + +
  • As a bonus, this would allow to track which polygons are really visible in the final scene for each frame. @@ -432,47 +456,24 @@ visible in the final scene for each frame.
  • Dynamic geometry simplification:
    • Dynamically detect and replace invisible objects from the -scene with simplified bounding box. -
    • +scene with simplified bounding box.
    • Dynamically replace boudnig box with actual object once it -becomes visible. -
    • -
    -
  • +becomes visible. + -
  • Dynamically unload unused textures from RAM. -
  • - - - - - - +
  • Dynamically unload unused textures from RAM.
  • + +
    -
    -
    -

    Author: Svjatoslav Agejenko

    -

    Created: 2018-06-22 Fri 02:26

    -

    Emacs 25.1.1 (Org-mode 8.2.10)

    -
    +
    +

    Author: Svjatoslav Agejenko

    +

    Created: 2022-07-13 Wed 04:16

    +

    Validate

    +
    diff --git a/doc/index.org b/doc/index.org index bb9967d..8582945 100644 --- a/doc/index.org +++ b/doc/index.org @@ -1,41 +1,42 @@ #+TITLE: Sixth 3D - 3D engine ------ -- This is a subproject of [[http://www3.svjatoslav.eu/projects/sixth/][Sixth]] - -- Clone GIT repository using command: - : git clone http://www2.svjatoslav.eu/git/sixth-3d.git - -- [[http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]] +* (document settings) :noexport: +** use dark style for TWBS-HTML exporter +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: -+ This program is free software: you can redistribute it and/or modify - it under the terms of the [[https://www.gnu.org/licenses/lgpl.html][GNU Lesser General Public License]] as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. +* General +- This program is free software: released under Creative Commons Zero + (CC0) license - Program author: - Svjatoslav Agejenko - - Homepage: http://svjatoslav.eu + - Homepage: https://svjatoslav.eu - Email: mailto://svjatoslav@svjatoslav.eu -- [[http://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]] +- [[https://www.svjatoslav.eu/projects/][Other software projects hosted at svjatoslav.eu]] -* (document settings) :noexport: -** use dark style for TWBS-HTML exporter -#+HTML_HEAD: -#+HTML_HEAD: -#+HTML_HEAD: " -#+HTML_HEAD: +** Source code +- [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=snapshot;h=HEAD;sf=tgz][Download latest snapshot in TAR GZ format]] + +- [[https://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=summary][Browse Git repository online]] + +- Clone Git repository using command: + : git clone https://www2.svjatoslav.eu/git/sixth-3d.git + +- See [[https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/][JavaDoc]]. * Project description -+ See: [[http://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos of current 3D engine capabilities]] ++ See: [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos of current 3D engine capabilities]] [[id:d03013e5-931b-40ca-bc4b-e4b3f23b9a4e][In software]], [[id:a11f7150-1b25-4ca4-a3c3-8c8bd1352bd4][pure Java]] realtime 3D rendering engine. With the final goal of becoming a platform for buildng 3D user interfaces and -interactive data visualization for [[http://www3.svjatoslav.eu/projects/sixth/][project Sixth]]. +interactive data visualization for [[https://www3.svjatoslav.eu/projects/sixth/][project Sixth]]. Sixth 3D can be also used as standalone [[id:08f71987-90af-40dc-bb65-bac87db9e652][3D engine in your project]]. @@ -80,12 +81,15 @@ pixel. - As a result it is easy to run on various hardware platforms and operating systems. -* TODO API documentation -Documentation currently missing for the lack of time. +* API documentation +- See [[https://www3.svjatoslav.eu/projects/sixth-3d/apidocs/][JavaDoc]]. + +Note: due to a lack of time, there is still big room for improvement +on documentation. So far best resource is to download and explore source code for: -+ 3D engine ([[http://www3.svjatoslav.eu/projects/sixth-3d/graphs/][generated code graphs]] (generated using [[http://www3.svjatoslav.eu/projects/javainspect/][JavaInspect]])) -+ For API usage examples, see [[http://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]] ++ 3D engine ([[https://www3.svjatoslav.eu/projects/sixth-3d/graphs/][generated code graphs]] (generated using [[https://www3.svjatoslav.eu/projects/javainspect/][JavaInspect]])) ++ For API usage examples, see [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]] * Instructions to embed Sixth-3D in your project :PROPERTIES: :ID: 08f71987-90af-40dc-bb65-bac87db9e652 @@ -97,7 +101,7 @@ Maven *pom.xml* file snippet: eu.svjatoslav sixth-3d - 1.1 + 1.2 ... @@ -107,14 +111,19 @@ Maven *pom.xml* file snippet: svjatoslav.eu Svjatoslav repository - http://www2.svjatoslav.eu/maven/ + http://www3.svjatoslav.eu/maven/ ... #+END_SRC -For API usage examples, see [[http://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]]. +For API usage examples, see [[https://www3.svjatoslav.eu/projects/sixth-3d-demos/][demos]]. * TODO features to add ++ read this as example, and apply improvements/fixes where applicable: + http://blog.rogach.org/2015/08/how-to-create-your-own-simple-3d-render.html + ++ Improve triangulation. Read: https://ianthehenry.com/posts/delaunay/ + + Partial region/frame repaint: when only one small object changed on the scene, it would be faster to re-render that specific area. @@ -125,30 +134,29 @@ For API usage examples, see [[http://www3.svjatoslav.eu/projects/sixth-3d-demos/ + Antialiazing. Would improve text readability. If antialiazing is too expensive for every frame, it could be used only for last frame before animations become still and waiting for user input starts. +** Render only visible polygons ++ This would significantly reduce RAM <-> CPU traffic. -+ Render only visible polygons. - + This would significantly reduce RAM <-> CPU traffic. - - + General algorithm description: - + For each horizontal scanline: - + sort polygon edges from left to right - + while iterating and drawing pixels over screen X axis (left to - right) track next appearing/disappearing polygons. - + For each polygon edge update Z sorted active polygons list. - + Only draw pixel from the top-most polygon. - + Only if polygon area is transparent/half-transparent add - colors from the polygons below. ++ General algorithm description: + + For each horizontal scanline: + + sort polygon edges from left to right + + while iterating and drawing pixels over screen X axis (left to + right) track next appearing/disappearing polygons. + + For each polygon edge update Z sorted active polygons list. + + Only draw pixel from the top-most polygon. + + Only if polygon area is transparent/half-transparent add + colors from the polygons below. - + As a bonus, this would allow to track which polygons are really - visible in the final scene for each frame. ++ As a bonus, this would allow to track which polygons are really + visible in the final scene for each frame. - + Such information allows further optimizations: + + Such information allows further optimizations: - + Dynamic geometry simplification: - + Dynamically detect and replace invisible objects from the - scene with simplified bounding box. + + Dynamic geometry simplification: + + Dynamically detect and replace invisible objects from the + scene with simplified bounding box. - + Dynamically replace boudnig box with actual object once it - becomes visible. + + Dynamically replace boudnig box with actual object once it + becomes visible. - + Dynamically unload unused textures from RAM. + + Dynamically unload unused textures from RAM. diff --git a/pom.xml b/pom.xml index 639fe38..4853085 100644 --- a/pom.xml +++ b/pom.xml @@ -1,36 +1,32 @@ - + 4.0.0 eu.svjatoslav sixth-3d - 1.2-SNAPSHOT + 1.3-SNAPSHOT Sixth 3D 3D engine + 1.8 + 1.8 + 1.8 UTF-8 UTF-8 svjatoslav.eu - http://svjatoslav.eu + https://svjatoslav.eu junit junit - 4.8.1 + 4.12 test - - eu.svjatoslav - javainspect - 1.5 - test - @@ -38,10 +34,10 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 3.8.1 - 1.8 - 1.8 + 8 + 8 true UTF-8 @@ -64,7 +60,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9 + 2.10.4 attach-javadocs @@ -73,6 +69,17 @@ + + + + + foo + bar + + + + ${java.home}/bin/javadoc + @@ -112,12 +119,12 @@ svjatoslav.eu svjatoslav.eu - scpexe://svjatoslav.eu/var/www/svjatoslav.eu/maven + scpexe://svjatoslav.eu:10006/srv/maven svjatoslav.eu svjatoslav.eu - scpexe://svjatoslav.eu/var/www/svjatoslav.eu/maven + scpexe://svjatoslav.eu:10006/srv/maven @@ -125,14 +132,14 @@ svjatoslav.eu Svjatoslav repository - http://www2.svjatoslav.eu/maven/ + https://www3.svjatoslav.eu/maven/ - scm:git:ssh://git@svjatoslav.eu/home/git/repositories/sixth-3d.git - scm:git:ssh://git@svjatoslav.eu/home/git/repositories/sixth-3d.git + scm:git:ssh://n0@svjatoslav.eu:10006/home/n0/git/sixth-3d.git + scm:git:ssh://n0@svjatoslav.eu:10006/home/n0/git/sixth-3d.git HEAD - \ No newline at end of file + diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Box.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Box.java index 8757c83..6e3b1d7 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Box.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Box.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.geometry; /** diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Circle.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Circle.java index 4c8110c..36dd69c 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Circle.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Circle.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.geometry; public class Circle { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java index d650a9e..a82382f 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.geometry; import static java.lang.Math.sqrt; @@ -23,14 +18,19 @@ public class Point2D implements Cloneable { this.y = y; } - public Point2D(final Point2D source) { - x = source.x; - y = source.y; + public Point2D(final Point2D parent) { + x = parent.x; + y = parent.y; } - public Point2D add(final Point2D direction) { - x += direction.x; - y += direction.y; + /** + * Add other point to current point. + * + * @return current point. + */ + public Point2D add(final Point2D otherPoint) { + x += otherPoint.x; + y += otherPoint.y; return this; } @@ -43,9 +43,9 @@ public class Point2D implements Cloneable { return new Point2D(this); } - public void clone(final Point2D source) { - x = source.x; - y = source.y; + public void clone(final Point2D parent) { + x = parent.x; + y = parent.y; } public Point2D getMiddle(final Point2D p1, final Point2D p2) { @@ -83,9 +83,14 @@ public class Point2D implements Cloneable { y = (int) y; } - public Point2D subtract(final Point2D point) { - x -= point.x; - y -= point.y; + /** + * Subtract other point from current point. + * + * @return current point. + */ + public Point2D subtract(final Point2D otherPoint) { + x -= otherPoint.x; + y -= otherPoint.y; return this; } @@ -99,4 +104,11 @@ public class Point2D implements Cloneable { return this; } + @Override + public String toString() { + return "Point2D{" + + "x=" + x + + ", y=" + y + + '}'; + } } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java index 4cae6ae..e2c9868 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.geometry; import static java.lang.Math.*; @@ -15,9 +10,9 @@ import static java.lang.Math.*; * Used to represent point in a 3D space or vector. */ -public class Point3D extends Point2D implements Cloneable { +public class Point3D implements Cloneable { - public double z; + public double x, y, z; public Point3D() { } @@ -40,27 +35,35 @@ public class Point3D extends Point2D implements Cloneable { this.z = z; } - public Point3D(final Point3D parentPoint) { - x = parentPoint.x; - y = parentPoint.y; - z = parentPoint.z; + /** + * Creates new current point by cloning coordinates from parent point. + */ + public Point3D(final Point3D parent) { + x = parent.x; + y = parent.y; + z = parent.z; } - public Point3D add(final Point3D direction) { - super.add(direction); - z += direction.z; + /** + * Add other point to current point. + * + * @return current point. + */ + public Point3D add(final Point3D otherPoint) { + x += otherPoint.x; + y += otherPoint.y; + z += otherPoint.z; return this; } - @Override public Point3D clone() { return new Point3D(this); } - public Point3D clone(final Point3D source) { - x = source.x; - y = source.y; - z = source.z; + public Point3D clone(final Point3D parent) { + x = parent.x; + y = parent.y; + z = parent.z; return this; } @@ -71,7 +74,6 @@ public class Point3D extends Point2D implements Cloneable { return this; } - @Override public boolean isZero() { return (x == 0) && (y == 0) && (z == 0); } @@ -84,6 +86,10 @@ public class Point3D extends Point2D implements Cloneable { return Math.atan2(y - anotherPoint.y, z - anotherPoint.z); } + public double getAngleXY(final Point3D anotherPoint) { + return Math.atan2(x - anotherPoint.x, y - anotherPoint.y); + } + /** * Compute distance to another point. */ @@ -95,12 +101,10 @@ public class Point3D extends Point2D implements Cloneable { return sqrt(((xDelta * xDelta) + (yDelta * yDelta) + (zDelta * zDelta))); } - @Override public double getVectorLength() { return sqrt(((x * x) + (y * y) + (z * z))); } - @Override public Point3D invert() { x = -x; y = -y; @@ -131,7 +135,6 @@ public class Point3D extends Point2D implements Cloneable { z = z2 + center.z; } - @Override public void roundToInteger() { x = (int) x; y = (int) y; @@ -158,9 +161,15 @@ public class Point3D extends Point2D implements Cloneable { this.z = z; } - public Point3D subtract(final Point3D direction) { - super.subtract(direction); - z -= direction.z; + /** + * Subtract other point from current point. + * + * @return current point. + */ + public Point3D subtract(final Point3D otherPoint) { + x -= otherPoint.x; + y -= otherPoint.y; + z -= otherPoint.z; return this; } @@ -169,36 +178,48 @@ public class Point3D extends Point2D implements Cloneable { return "x:" + x + " y:" + y + " z:" + z; } + /** + * @return current point. + */ public Point3D translateX(final double xIncrement) { x += xIncrement; return this; } + /** + * @return current point. + */ public Point3D translateY(final double yIncrement) { y += yIncrement; return this; } + /** + * @return current point. + */ public Point3D translateZ(final double zIncrement) { z += zIncrement; return this; } + /** + * Here we assume that Z coordinate is distance to the viewer. + * If Z is positive, then point is in front of the viewer, and therefore it is visible. + * + * @return point visibility status. + */ public boolean isVisible() { - - if (z > 0) - return true; - - // if ((z > 0) && (x > -1000) && (y > -1000) && (x < 2000) && (y < - // 2000)) - // return true; - - return false; + return z > 0; } - @Override + /** + * Resets point to 0 coordinate in X, Y and Z axis. + * + * @return current point. + */ public Point3D zero() { - super.zero(); + x = 0; + y = 0; z = 0; return this; } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java index 4a70101..9b96e5b 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.geometry; public class Polygon { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java index 24cfaf4..af40655 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java @@ -1,13 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - - package eu.svjatoslav.sixth.e3d.geometry; public class Rectangle { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java index 852dc97..9876589 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/Avatar.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/GuiComponent.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/GuiComponent.java index 62e8eaf..0fc1f11 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/GuiComponent.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/GuiComponent.java @@ -1,19 +1,14 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui; import eu.svjatoslav.sixth.e3d.geometry.Box; import eu.svjatoslav.sixth.e3d.geometry.Point3D; import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController; -import eu.svjatoslav.sixth.e3d.gui.humaninput.UserInputHandler; -import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.KeyboardHelper; +import eu.svjatoslav.sixth.e3d.gui.humaninput.KeyboardInputHandler; +import eu.svjatoslav.sixth.e3d.gui.humaninput.KeyboardHelper; import eu.svjatoslav.sixth.e3d.math.Transform; import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance; import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape; @@ -22,7 +17,7 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe.Wirefr import java.awt.event.KeyEvent; public class GuiComponent extends AbstractCompositeShape implements - UserInputHandler, MouseInteractionController { + KeyboardInputHandler, MouseInteractionController { private static final String GROUP_GUI_FOCUS = "gui.focus"; public final ViewPanel viewPanel; @@ -38,12 +33,6 @@ public class GuiComponent extends AbstractCompositeShape implements setDimensions(size); } - @Override - public boolean beforeRender(final ViewPanel viewPanel, - final int millisecondsSinceLastFrame) { - return false; - } - private WireframeBox createBorder() { final LineAppearance appearance = new LineAppearance(10, new eu.svjatoslav.sixth.e3d.renderer.raster.Color(255, 0, 0, 100)); diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java index 2603c11..3641bc9 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/RenderingContext.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui; import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseEvent; @@ -31,14 +26,41 @@ public class RenderingContext { public int frameNumber = 0; /** - * Mouse click. During rendering we can detect which item user clicked on. + * UI component that mouse is currently hovering over. */ - public MouseEvent mouseEvent; + private MouseInteractionController currentMouseOverComponent; + + public void prepareForNewFrameRendering(){ + mouseEvent = null; + objectUnderMouse = null; + } + + /** + * Mouse click event that needs to be processed. + */ + private MouseEvent mouseEvent; + + public void setMouseEvent(MouseEvent mouseEvent) { + this.mouseEvent = mouseEvent; + } + + public MouseEvent getMouseEvent() { + return mouseEvent; + } /** * Item that user clicked on. */ - public MouseInteractionController objectUnderMouse; + private MouseInteractionController objectUnderMouse; + + /** + * Called when given object was detected under mouse cursor, while processing {@link #mouseEvent}. + * Because objects are rendered back to front. The last method caller will set the top-most object, if + * there are multiple objects under mouse cursor. + */ + public void setObjectUnderMouse(MouseInteractionController objectUnderMouse) { + this.objectUnderMouse = objectUnderMouse; + } public RenderingContext(final int width, final int height) { this.width = width; @@ -60,4 +82,31 @@ public class RenderingContext { graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } + /** + * @return true if view repaint is needed. + */ + public boolean handleDetectedComponentMouseEvents() { + if (objectUnderMouse != null) { + if (mouseEvent.button == 0) { + // mouse over + if (currentMouseOverComponent == null) { + currentMouseOverComponent = objectUnderMouse; + return currentMouseOverComponent.mouseEntered(); + } else if (currentMouseOverComponent != objectUnderMouse) { + boolean viewRepaintNeeded = currentMouseOverComponent.mouseExited(); + currentMouseOverComponent = objectUnderMouse; + return viewRepaintNeeded | currentMouseOverComponent.mouseEntered(); + } + } else { + // mouse click + return objectUnderMouse.mouseClicked(); + } + } else if (currentMouseOverComponent != null) { + boolean viewRepaintNeeded = currentMouseOverComponent.mouseExited(); + currentMouseOverComponent = null; + return viewRepaintNeeded; + } + return false; + } + } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java index 3dc7201..8ba9f9f 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/TextPointer.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui; public class TextPointer implements Comparable { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/UserRelativityTracker.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/UserRelativityTracker.java index 8708398..69a2947 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/UserRelativityTracker.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/UserRelativityTracker.java @@ -1,13 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - - package eu.svjatoslav.sixth.e3d.gui; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewFrame.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewFrame.java index 1383c72..29cf98f 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewFrame.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewFrame.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui; import javax.swing.*; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewPanel.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewPanel.java index 84d4529..7f9b7eb 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewPanel.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewPanel.java @@ -1,17 +1,11 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui; import eu.svjatoslav.sixth.e3d.gui.humaninput.HIDInputTracker; import eu.svjatoslav.sixth.e3d.gui.humaninput.KeyboardFocusStack; -import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController; import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection; import javax.swing.*; @@ -40,20 +34,19 @@ public class ViewPanel extends JPanel implements ComponentListener { private Timer canvasUpdateTimer; private ViewUpdateTimerTask canvasUpdateTimerTask; private RenderingContext renderingContext = null; + /** - * UI component that mouse is currently hovering over. - */ - private MouseInteractionController currentMouseOverComponent; - /** - * Currently target FPS for this view. It can be changed at runtime. Also when nothing - * changes in the view, then frames are not really repainted. + * Currently target frames per second rate for this view. Target FPS can be changed at runtime. + * 3D engine tries to be smart and only repaints screen when there are visible changes. */ - private int targetFPS = 30; + private int targetFPS = 60; + /** * Set to true if it is known than next frame reeds to be painted. Flag is cleared * immediately after frame got updated. */ private boolean viewRepaintNeeded = true; + public ViewPanel() { viewRenderListeners.add(avatar); viewRenderListeners.add(HIDInputTracker); @@ -126,28 +119,6 @@ public class ViewPanel extends JPanel implements ComponentListener { return renderingContext; } - private void handleDetectedComponentMouseEvents() { - if (renderingContext.objectUnderMouse != null) { - if (renderingContext.mouseEvent.button == 0) { - // mouse over - if (currentMouseOverComponent == null) { - currentMouseOverComponent = renderingContext.objectUnderMouse; - viewRepaintNeeded |= currentMouseOverComponent.mouseEntered(); - } else if (currentMouseOverComponent != renderingContext.objectUnderMouse) { - viewRepaintNeeded |= currentMouseOverComponent.mouseExited(); - currentMouseOverComponent = renderingContext.objectUnderMouse; - viewRepaintNeeded |= currentMouseOverComponent.mouseEntered(); - } - } else { - // mouse click - viewRepaintNeeded |= renderingContext.objectUnderMouse.mouseClicked(); - } - } else if (currentMouseOverComponent != null) { - viewRepaintNeeded |= currentMouseOverComponent.mouseExited(); - currentMouseOverComponent = null; - } - } - private void initializePanelLayout() { setFocusCycleRoot(true); setOpaque(true); @@ -158,7 +129,6 @@ public class ViewPanel extends JPanel implements ComponentListener { } private void renderFrame() { - // paint root geometry collection to the offscreen render buffer clearCanvas(); rootShapeCollection.paint(this, renderingContext); @@ -236,7 +206,7 @@ public class ViewPanel extends JPanel implements ComponentListener { // abort rendering if window size is invalid if ((getWidth() > 0) && (getHeight() > 0) && renderFrame) { renderFrame(); - handleDetectedComponentMouseEvents(); + viewRepaintNeeded = renderingContext.handleDetectedComponentMouseEvents(); } } @@ -256,8 +226,7 @@ public class ViewPanel extends JPanel implements ComponentListener { renderingContext = new RenderingContext(panelWidth, panelHeight); } - renderingContext.mouseEvent = null; - renderingContext.objectUnderMouse = null; + renderingContext.prepareForNewFrameRendering(); } private boolean notifyViewRenderListeners(int millisecondsPassedSinceLastUpdate) { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewRenderListener.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewRenderListener.java index a36b77b..30e73d2 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewRenderListener.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewRenderListener.java @@ -1,24 +1,20 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui; public interface ViewRenderListener { /** - * Notifies that it is about time to render next frame and + * Notifies that it is about time (to keep constant framerate) to render next frame and * allows listener to do any related processing that it needs to. *

    * Each {@link ViewRenderListener} will be notified exactly once before every frame is rendered. *

    * {@link ViewRenderListener} can determine if frame repaint is actually * needed from its perspective. Frame will be rendered only if at least one listener says yes. + * This mechanism allows to save computing power and energy by skipping frame rendering when possible. * * @return true if underlying view shall be re-rendered. If at least one of the view update listeners * returns true, view is re-rendered. diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewUpdateTimerTask.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewUpdateTimerTask.java index 27e8e86..cb7bac4 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewUpdateTimerTask.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewUpdateTimerTask.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui; public class ViewUpdateTimerTask extends java.util.TimerTask { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/HIDInputTracker.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/HIDInputTracker.java index 5bf7927..af0ae31 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/HIDInputTracker.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/HIDInputTracker.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.humaninput; import eu.svjatoslav.sixth.e3d.geometry.Point2D; @@ -21,6 +16,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +/** + * Human input device input tracker. + *

    + * Idea is to capture all keyboard and mouse inputs from underlying operating system in this class + * and forward those as needed to subsequent virtual components. + */ public class HIDInputTracker implements MouseMotionListener, KeyListener, MouseListener, MouseWheelListener, ViewRenderListener { @@ -74,7 +75,7 @@ public class HIDInputTracker implements * @return true if view needs to be repainted. */ private boolean handleKeyboardEvents() { - final UserInputHandler currentFocusOwner = viewPanel.getKeyboardFocusStack().getCurrentFocusOwner(); + final KeyboardInputHandler currentFocusOwner = viewPanel.getKeyboardFocusStack().getCurrentFocusOwner(); ArrayList unprocessedKeyboardEvents = getUnprocessedKeyboardEvents(); return currentFocusOwner != null @@ -93,7 +94,7 @@ public class HIDInputTracker implements * @return true if view update is needed. */ private boolean forwardKeyboardEventsToFocusOwner( - UserInputHandler currentFocusOwner, ArrayList keyEvents) { + KeyboardInputHandler currentFocusOwner, ArrayList keyEvents) { boolean viewUpdateNeeded = false; for (KeyEvent keyEvent : keyEvents) @@ -102,7 +103,7 @@ public class HIDInputTracker implements return viewUpdateNeeded; } - private boolean processKeyEvent(UserInputHandler currentFocusOwner, KeyEvent keyEvent) { + private boolean processKeyEvent(KeyboardInputHandler currentFocusOwner, KeyEvent keyEvent) { switch (keyEvent.getID()) { case KeyEvent.KEY_PRESSED: return currentFocusOwner.keyPressed(keyEvent, viewPanel); @@ -117,21 +118,30 @@ public class HIDInputTracker implements * @return true if view needs to be repainted. */ private synchronized boolean handleMouseClicksAndHover(final ViewPanel viewPanel) { - MouseEvent mouseEventAndLocationToTrace = getMouseEventAndLocationToTrace(viewPanel); - if (mouseEventAndLocationToTrace != null) - { - viewPanel.getRenderingContext().mouseEvent = mouseEventAndLocationToTrace; - return true; + boolean rerenderNeeded = false; + MouseEvent event = findClickLocationToTrace(); + if (event != null) { + // process mouse clicks as a first priority + rerenderNeeded = true; + } else { + // when there are no mouse clicks, process mouse hovering + + if (mouseMoved) { + mouseMoved = false; + // we would like to re-render frame when user moved mouse, to see what objects mouse is hovering over + rerenderNeeded = true; + } + + if (currentMouseLocation != null) { + // mouse click with button 0 amounts to mouse hovering event + event = new MouseEvent(currentMouseLocation, 0); + } } - return false; - } - private MouseEvent getMouseEventAndLocationToTrace(ViewPanel viewPanel) { - MouseEvent unprocessedMouseEvent = findClickLocationToTrace(); - if (unprocessedMouseEvent != null) { - return unprocessedMouseEvent; - } else - return getHoverLocationToTrace(viewPanel); + if (viewPanel.getRenderingContext() != null) + viewPanel.getRenderingContext().setMouseEvent(event); + + return rerenderNeeded; } private MouseEvent findClickLocationToTrace() { @@ -143,17 +153,6 @@ public class HIDInputTracker implements } } - private MouseEvent getHoverLocationToTrace(ViewPanel viewPanel) { - if (mouseMoved) { - mouseMoved = false; - if (currentMouseLocation != null) { - return new MouseEvent(currentMouseLocation, 0); - // mouse click with button 0 amounts to mouse hovering event - } - } - return null; - } - boolean isKeyPressed(final int keyCode) { return pressedKeysToPressedTimeMap.containsKey(keyCode); } @@ -247,7 +246,8 @@ public class HIDInputTracker implements * @return true if view needs to be repainted. */ private boolean handleMouseDragging() { - // TODO: need to detect whether user moved mouse or touch screen + // TODO: It would be nice here to detect somehow whether user moved mouse or touch screen. + // in case of touch screen, we would like to reverse movement along X and Y axis. final Avatar avatar = viewPanel.getAvatar(); // for mouse diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardFocusStack.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardFocusStack.java index 7690bab..9a1cd6d 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardFocusStack.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardFocusStack.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.humaninput; import eu.svjatoslav.sixth.e3d.gui.ViewPanel; @@ -17,15 +12,15 @@ public class KeyboardFocusStack { private final ViewPanel viewPanel; private WorldNavigationUserInputTracker defaultInputHandler = new WorldNavigationUserInputTracker(); - private Stack inputHandlers = new Stack<>(); - private UserInputHandler currentUserInputHandler; + private Stack inputHandlers = new Stack<>(); + private KeyboardInputHandler currentUserInputHandler; public KeyboardFocusStack(final ViewPanel viewPanel) { this.viewPanel = viewPanel; pushFocusOwner(defaultInputHandler); } - public UserInputHandler getCurrentFocusOwner() { + public KeyboardInputHandler getCurrentFocusOwner() { return currentUserInputHandler; } @@ -40,7 +35,7 @@ public class KeyboardFocusStack { currentUserInputHandler.focusReceived(viewPanel); } - public boolean pushFocusOwner(final UserInputHandler newInputHandler) { + public boolean pushFocusOwner(final KeyboardInputHandler newInputHandler) { boolean updateNeeded = false; if (currentUserInputHandler == newInputHandler) diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardHelper.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardHelper.java new file mode 100644 index 0000000..44b861e --- /dev/null +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardHelper.java @@ -0,0 +1,57 @@ +/* + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. + */ +package eu.svjatoslav.sixth.e3d.gui.humaninput; + +import java.awt.event.InputEvent; +import java.util.HashSet; +import java.util.Set; + +public class KeyboardHelper { + + public static final int TAB = 9; + public static final int DOWN = 40; + public static final int UP = 38; + public static final int RIGHT = 39; + public static final int LEFT = 37; + public static final int PGDOWN = 34; + public static final int PGUP = 33; + public static final int HOME = 36; + public static final int END = 35; + public static final int DEL = 127; + public static final int ENTER = 10; + public static final int BACKSPACE = 8; + public static final int ESC = 27; + public static final int SHIFT = 16; + + private static final Set nonText; + + static { + nonText = new HashSet<>(); + nonText.add(DOWN); + nonText.add(UP); + nonText.add(LEFT); + nonText.add(RIGHT); + + nonText.add(SHIFT); + nonText.add(ESC); + } + + public static boolean isAltPressed(final int modifiersEx) { + return (modifiersEx | InputEvent.ALT_DOWN_MASK) == modifiersEx; + } + + public static boolean isCtrlPressed(final int modifiersEx) { + return (modifiersEx | InputEvent.CTRL_DOWN_MASK) == modifiersEx; + } + + public static boolean isShiftPressed(final int modifiersEx) { + return (modifiersEx | InputEvent.SHIFT_DOWN_MASK) == modifiersEx; + } + + public static boolean isText(final int keyCode) { + return !nonText.contains(keyCode); + } + +} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardInputHandler.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardInputHandler.java new file mode 100644 index 0000000..3f26cdf --- /dev/null +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/KeyboardInputHandler.java @@ -0,0 +1,40 @@ +/* + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. + */ +package eu.svjatoslav.sixth.e3d.gui.humaninput; + +import eu.svjatoslav.sixth.e3d.gui.ViewPanel; + +import java.awt.event.KeyEvent; + +/** + * This is the process: + * + * 1. Component receives focus, perhaps because user clicked on it with the mouse. + * 2. Now component will receive user key press and release events from the keyboard. + * 3. Component loses focus. Perhaps user chose another component to interact with. + */ +public interface KeyboardInputHandler { + + /** + * @return true if view needs to be re-rendered. + */ + boolean focusLost(ViewPanel viewPanel); + + /** + * @return true if view needs to be re-rendered. + */ + boolean focusReceived(ViewPanel viewPanel); + + /** + * @return true if view needs to be re-rendered. + */ + boolean keyPressed(KeyEvent event, ViewPanel viewPanel); + + /** + * @return true if view needs to be re-rendered. + */ + boolean keyReleased(KeyEvent event, ViewPanel viewPanel); + +} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseEvent.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseEvent.java index 6589ac7..8582cc0 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseEvent.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseEvent.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.humaninput; import eu.svjatoslav.sixth.e3d.geometry.Point2D; @@ -21,13 +16,20 @@ public class MouseEvent { */ public int button; - public MouseEvent(final int x, final int y, final int button) { + MouseEvent(final int x, final int y, final int button) { this(new Point2D(x, y), button); } - public MouseEvent(final Point2D coordinate, final int button) { + MouseEvent(final Point2D coordinate, final int button) { this.coordinate = coordinate; this.button = button; } + @Override + public String toString() { + return "MouseEvent{" + + "coordinate=" + coordinate + + ", button=" + button + + '}'; + } } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java index 75abbaf..9ae1f43 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java @@ -1,31 +1,26 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.humaninput; public interface MouseInteractionController { /** - * Called when mouse is clicked on component - * @return true if view update is needed. + * Called when mouse is clicked on component. + * @return true if view update is needed as a consequence of this mouse click. */ boolean mouseClicked(); /** * Called when mouse gets over given component. - * @return true if view update is needed. + * @return true if view update is needed as a consequence of this mouse enter. */ boolean mouseEntered(); /** * Called when mouse leaves screen area occupied by component. - * @return true if view update is needed. + * @return true if view update is needed as a consequence of this mouse exit. */ boolean mouseExited(); diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputHandler.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputHandler.java deleted file mode 100644 index dcfef5e..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/UserInputHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * - */ - -package eu.svjatoslav.sixth.e3d.gui.humaninput; - -import eu.svjatoslav.sixth.e3d.gui.ViewPanel; -import eu.svjatoslav.sixth.e3d.gui.ViewRenderListener; - -import java.awt.event.KeyEvent; - -public interface UserInputHandler extends ViewRenderListener { - - /** - * @return true if view update is needed. - */ - boolean focusLost(ViewPanel viewPanel); - - /** - * @return true if view update is needed. - */ - boolean focusReceived(ViewPanel viewPanel); - - /** - * @return true if view update is needed. - */ - boolean keyPressed(KeyEvent event, ViewPanel viewPanel); - - /** - * @return true if view update is needed. - */ - boolean keyReleased(KeyEvent event, ViewPanel viewPanel); - -} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationUserInputTracker.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationUserInputTracker.java index de51857..8a66a3e 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationUserInputTracker.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/WorldNavigationUserInputTracker.java @@ -1,21 +1,16 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.humaninput; import eu.svjatoslav.sixth.e3d.gui.Avatar; import eu.svjatoslav.sixth.e3d.gui.ViewPanel; -import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.KeyboardHelper; +import eu.svjatoslav.sixth.e3d.gui.ViewRenderListener; import java.awt.event.KeyEvent; -public class WorldNavigationUserInputTracker implements UserInputHandler { +public class WorldNavigationUserInputTracker implements KeyboardInputHandler, ViewRenderListener { @Override public boolean beforeRender(final ViewPanel viewPanel, diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/Character.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/Character.java index b7d96af..74632b5 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/Character.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/Character.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.textEditorComponent; public class Character { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/ColorConfig.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/ColorConfig.java deleted file mode 100644 index 188a874..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/ColorConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * - */ - -package eu.svjatoslav.sixth.e3d.gui.textEditorComponent; - -import eu.svjatoslav.sixth.e3d.renderer.raster.Color; - -public class ColorConfig { - - public Color normalText = new Color(255, 255, 255); - public Color normalBack = new Color(20, 20, 20, 255); - - public Color tabulatorBack = new Color(25, 25, 25, 255); - - public Color cursorText = new Color(255, 255, 255); - public Color cursorBack = new Color(255, 0, 0); - - public Color selectedText = new Color(255, 255, 255); - public Color selectedBack = new Color(0, 80, 80); - - public Color pageEnd = new Color(70, 70, 0); - -} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/KeyboardHelper.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/KeyboardHelper.java deleted file mode 100644 index c2746bd..0000000 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/KeyboardHelper.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * - */ - -package eu.svjatoslav.sixth.e3d.gui.textEditorComponent; - -import java.util.HashSet; -import java.util.Set; - -public class KeyboardHelper { - - public static final int TAB = 9; - public static final int DOWN = 40; - public static final int UP = 38; - public static final int RIGHT = 39; - public static final int LEFT = 37; - public static final int PGDOWN = 34; - public static final int PGUP = 33; - public static final int HOME = 36; - public static final int END = 35; - public static final int DEL = 127; - public static final int ENTER = 10; - public static final int BACKSPACE = 8; - public static final int ESC = 27; - public static final int SHIFT = 16; - - private static final Set nonText; - - static { - nonText = new HashSet<>(); - nonText.add(DOWN); - nonText.add(UP); - nonText.add(LEFT); - nonText.add(RIGHT); - - nonText.add(SHIFT); - nonText.add(ESC); - } - - public static boolean isAlt(final int modifiers) { - return (modifiers | 8) == modifiers; - } - - public static boolean isCtrl(final int modifiers) { - return (modifiers | 2) == modifiers; - } - - public static boolean isShift(final int modifiers) { - return (modifiers | 1) == modifiers; - } - - public static boolean isText(final int keyCode) { - return !nonText.contains(keyCode); - } - -} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/LookAndFeel.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/LookAndFeel.java new file mode 100644 index 0000000..a7bff24 --- /dev/null +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/LookAndFeel.java @@ -0,0 +1,22 @@ +/* + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. + */ +package eu.svjatoslav.sixth.e3d.gui.textEditorComponent; + +import eu.svjatoslav.sixth.e3d.renderer.raster.Color; + +public class LookAndFeel { + + public Color foreground = new Color(255, 255, 255); + public Color background = new Color(20, 20, 20, 255); + + public Color tabStopBackground = new Color(25, 25, 25, 255); + + public Color cursorForeground = new Color(255, 255, 255); + public Color cursorBackground = new Color(255, 0, 0); + + public Color selectionForeground = new Color(255, 255, 255); + public Color selectionBackground = new Color(0, 80, 80); + +} diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/Page.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/Page.java index a3ac767..c52fbd7 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/Page.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/Page.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.textEditorComponent; import java.util.ArrayList; @@ -14,40 +9,40 @@ import java.util.List; public class Page { - public List lines = new ArrayList<>(); + public List rows = new ArrayList<>(); public void ensureMaxTextLine(final int row) { - while (lines.size() <= row) - lines.add(new TextLine()); + while (rows.size() <= row) + rows.add(new TextLine()); } public char getChar(final int row, final int column) { - if (lines.size() <= row) + if (rows.size() <= row) return ' '; - return lines.get(row).getCharForLocation(column); + return rows.get(row).getCharForLocation(column); } public TextLine getLine(final int row) { ensureMaxTextLine(row); - return lines.get(row); + return rows.get(row); } public int getLineLength(final int row) { - if (lines.size() <= row) + if (rows.size() <= row) return 0; - return lines.get(row).getLength(); + return rows.get(row).getLength(); } public int getLinesCount() { pack(); - return lines.size(); + return rows.size(); } public String getText() { pack(); final StringBuilder result = new StringBuilder(); - for (final TextLine textLine : lines) { + for (final TextLine textLine : rows) { if (result.length() > 0) result.append("\n"); result.append(textLine.toString()); @@ -60,34 +55,34 @@ public class Page { } public void insertLine(final int row, final TextLine textLine) { - lines.add(row, textLine); + rows.add(row, textLine); } private void pack() { int newLength = 0; - for (int i = lines.size() - 1; i >= 0; i--) - if (!lines.get(i).isEmpty()) { + for (int i = rows.size() - 1; i >= 0; i--) + if (!rows.get(i).isEmpty()) { newLength = i + 1; break; } - if (newLength == lines.size()) + if (newLength == rows.size()) return; - lines = lines.subList(0, newLength); + rows = rows.subList(0, newLength); } public void removeCharacter(final int row, final int col) { - if (lines.size() <= row) + if (rows.size() <= row) return; getLine(row).removeCharacter(col); } public void removeLine(final int row) { - if (lines.size() <= row) + if (rows.size() <= row) return; - lines.remove(row); + rows.remove(row); } } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextEditComponent.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextEditComponent.java index 7262d21..93c0535 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextEditComponent.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextEditComponent.java @@ -1,20 +1,15 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.textEditorComponent; import eu.svjatoslav.sixth.e3d.geometry.Point2D; import eu.svjatoslav.sixth.e3d.gui.GuiComponent; import eu.svjatoslav.sixth.e3d.gui.TextPointer; import eu.svjatoslav.sixth.e3d.gui.ViewPanel; +import eu.svjatoslav.sixth.e3d.gui.humaninput.KeyboardHelper; import eu.svjatoslav.sixth.e3d.math.Transform; -import eu.svjatoslav.sixth.e3d.renderer.raster.Color; import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas.TextCanvas; import java.awt.*; @@ -27,31 +22,36 @@ import java.util.Set; public class TextEditComponent extends GuiComponent implements ClipboardOwner { private static final long serialVersionUID = -7118833957783600630L; - // lines that need to be repainted + + /** + * Text rows that need to be repainted. + */ private final Set dirtyRows = new HashSet<>(); + private final TextCanvas textCanvas; public int scrolledCharacters = 0, scrolledLines = 0; public boolean selecting = false; public TextPointer selectionStart = new TextPointer(0, 0); public TextPointer selectionEnd = new TextPointer(0, 0); - public TextPointer cursorLocation; + public TextPointer cursorLocation = new TextPointer(0, 0); Page page = new Page(); - ColorConfig colorConfig = new ColorConfig(); + LookAndFeel lookAndFeel; boolean repaintPage = false; public TextEditComponent(final Transform transform, - final ViewPanel viewPanel, final Point2D size) { - super(transform, viewPanel, size.to3D()); + final ViewPanel viewPanel, + final Point2D sizeInWorldCoordinates, + LookAndFeel lookAndFeel) { + super(transform, viewPanel, sizeInWorldCoordinates.to3D()); - cursorLocation = new TextPointer(0, 0); + this.lookAndFeel = lookAndFeel; + final int columns = (int) (sizeInWorldCoordinates.x / TextCanvas.FONT_CHAR_WIDTH); + final int rows = (int) (sizeInWorldCoordinates.y / TextCanvas.FONT_CHAR_HEIGHT); - // initialize visual panel - - final int columns = (int) (size.x / TextCanvas.FONT_CHAR_WIDTH); - final int rows = (int) (size.y / TextCanvas.FONT_CHAR_HEIGHT); - - textCanvas = new TextCanvas(new Transform(), new TextPointer(rows, - columns), Color.WHITE, colorConfig.normalBack); + textCanvas = new TextCanvas( + new Transform(), + new TextPointer(rows, columns), + lookAndFeel.foreground, lookAndFeel.background); textCanvas.setMouseInteractionController(this); @@ -398,17 +398,16 @@ public class TextEditComponent extends GuiComponent implements ClipboardOwner { } private void processKeyEvent(final KeyEvent event) { - final int modifiers = event.getModifiers(); - + final int modifiers = event.getModifiersEx(); final int keyCode = event.getKeyCode(); final char keyChar = event.getKeyChar(); // System.out.println("Keycode:" + keyCode s+ ", keychar:" + keyChar); - if (KeyboardHelper.isAlt(modifiers)) + if (KeyboardHelper.isAltPressed(modifiers)) return; - if (KeyboardHelper.isCtrl(modifiers)) { + if (KeyboardHelper.isCtrlPressed(modifiers)) { processCtrlCombinations(keyCode); return; } @@ -425,10 +424,7 @@ public class TextEditComponent extends GuiComponent implements ClipboardOwner { return; } - // System.out.println("Co:" + String.valueOf(code) + " Ch:" + - // String.valueOf(keyChar)); - - if (KeyboardHelper.isShift(modifiers)) { + if (KeyboardHelper.isShiftPressed(modifiers)) { if (!selecting) attemptSelectionStart:{ @@ -439,9 +435,6 @@ public class TextEditComponent extends GuiComponent implements ClipboardOwner { | (keyChar == 8) | (keyChar == 9)) break attemptSelectionStart; - // System.out.println("Selection started:" + keyChar + " " - // + keyCode); - selectionStart = new TextPointer(cursorLocation); selectionEnd = selectionStart; selecting = true; @@ -497,14 +490,14 @@ public class TextEditComponent extends GuiComponent implements ClipboardOwner { } private void processTab(final int modifiers) { - if (KeyboardHelper.isShift(modifiers)) { + if (KeyboardHelper.isShiftPressed(modifiers)) { if (selectionStart.compareTo(selectionEnd) != 0) { // dedent multiple lines ensureSelectionOrder(); identSelection: { - // check that identation is possible + // check that indentation is possible for (int y = selectionStart.row; y < selectionEnd.row; y++) { final TextLine textLine = page.getLine(y); @@ -544,44 +537,44 @@ public class TextEditComponent extends GuiComponent implements ClipboardOwner { public void repaintPage() { - final int chXe = textCanvas.getSize().column + 2; - final int chYe = textCanvas.getSize().row + 2; + final int columnCount = textCanvas.getSize().column + 2; + final int rowCount = textCanvas.getSize().row + 2; - for (int cy = 0; cy < chYe; cy++) - for (int cx = 0; cx < chXe; cx++) { - final boolean isTabMargin = ((cx + scrolledCharacters) % 4) == 0; + for (int row = 0; row < rowCount; row++) + for (int column = 0; column < columnCount; column++) { + final boolean isTabMargin = ((column + scrolledCharacters) % 4) == 0; - if ((cx == (cursorLocation.column - scrolledCharacters)) - & (cy == (cursorLocation.row - scrolledLines))) { + if ((column == (cursorLocation.column - scrolledCharacters)) + & (row == (cursorLocation.row - scrolledLines))) { // cursor - textCanvas.setBackgroundColor(colorConfig.cursorBack); - textCanvas.setForegroundColor(colorConfig.cursorText); - } else if (new TextPointer(cy + scrolledLines, cx).isBetween( + textCanvas.setBackgroundColor(lookAndFeel.cursorBackground); + textCanvas.setForegroundColor(lookAndFeel.cursorForeground); + } else if (new TextPointer(row + scrolledLines, column).isBetween( selectionStart, selectionEnd)) { // selected text - textCanvas.setBackgroundColor(colorConfig.selectedBack); - textCanvas.setForegroundColor(colorConfig.selectedText); + textCanvas.setBackgroundColor(lookAndFeel.selectionBackground); + textCanvas.setForegroundColor(lookAndFeel.selectionForeground); } else { // normal text - textCanvas.setBackgroundColor(colorConfig.normalBack); - textCanvas.setForegroundColor(colorConfig.normalText); + textCanvas.setBackgroundColor(lookAndFeel.background); + textCanvas.setForegroundColor(lookAndFeel.foreground); if (isTabMargin) textCanvas - .setBackgroundColor(colorConfig.tabulatorBack); + .setBackgroundColor(lookAndFeel.tabStopBackground); } - final char charUnderCursor = page.getChar(cy + scrolledLines, - cx + scrolledCharacters); + final char charUnderCursor = page.getChar(row + scrolledLines, + column + scrolledCharacters); - textCanvas.putChar(cy, cx, charUnderCursor); + textCanvas.putChar(row, column, charUnderCursor); } } public void repaintRow(final int rowNumber) { - // TODO: fix this + // TODO: Optimize this. No need to repaint entire page. repaintPage(); } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextLine.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextLine.java index a8f2129..aa7d4e2 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextLine.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextLine.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.gui.textEditorComponent; import java.util.ArrayList; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/io/Connexion3D.java b/src/main/java/eu/svjatoslav/sixth/e3d/io/Connexion3D.java index e72a935..40fad83 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/io/Connexion3D.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/io/Connexion3D.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.io; import java.io.BufferedReader; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/GeometryCoordinate.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/GeometryCoordinate.java index d95717c..e159295 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/math/GeometryCoordinate.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/GeometryCoordinate.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.math; import eu.svjatoslav.sixth.e3d.geometry.Point2D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java index 958286a..714b781 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java @@ -1,13 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - - package eu.svjatoslav.sixth.e3d.math; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java index 059ba39..48bf284 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.math; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/math/TransformPipe.java b/src/main/java/eu/svjatoslav/sixth/e3d/math/TransformPipe.java index b554953..5b766a2 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/math/TransformPipe.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/math/TransformPipe.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.math; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/OctreeVolume.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/OctreeVolume.java index d176f93..87c42c7 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/OctreeVolume.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/OctreeVolume.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.octree; import eu.svjatoslav.sixth.e3d.renderer.octree.raytracer.Ray; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/package-info.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/package-info.java index 4ee1b48..c4c5d9b 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/package-info.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/package-info.java @@ -1,10 +1,8 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. * +* * Realtime voxel renderer (in software). * Uses octree for data compression. */ diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Camera.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Camera.java index 84fbb6a..f205ebf 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Camera.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Camera.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/CameraView.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/CameraView.java index cf34293..f143249 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/CameraView.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/CameraView.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/LightSource.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/LightSource.java index 109b037..0efe65b 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/LightSource.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/LightSource.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Ray.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Ray.java index d2d1809..b0dec82 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Ray.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/Ray.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer; public class Ray { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/RayHit.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/RayHit.java index a72f075..b65fdf9 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/RayHit.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/RayHit.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer; public class RayHit { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/RayTracer.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/RayTracer.java index 79ae21c..fa43446 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/RayTracer.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/RayTracer.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.octree.raytracer; import eu.svjatoslav.sixth.e3d.gui.ViewPanel; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/package-info.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/package-info.java index 6dd7832..431f7c0 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/package-info.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/octree/raytracer/package-info.java @@ -1,10 +1,8 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. * +* * Raytracer through voxel data. */ diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/package-info.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/package-info.java index 284685d..98b9af4 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/package-info.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/package-info.java @@ -1,10 +1,8 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. * +* * Various 3D renderers utilizing different rendering approaches. */ diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/Color.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/Color.java index 9175bf4..9c51f1e 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/Color.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/Color.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.raster; public final class Color { diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/RenderAggregator.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/RenderAggregator.java index 3384351..dca0066 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/RenderAggregator.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/RenderAggregator.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.raster; import eu.svjatoslav.sixth.e3d.gui.RenderingContext; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/ShapeCollection.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/ShapeCollection.java index 5210515..ea14935 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/ShapeCollection.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/ShapeCollection.java @@ -1,12 +1,7 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. - * + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. */ - package eu.svjatoslav.sixth.e3d.renderer.raster; import eu.svjatoslav.sixth.e3d.geometry.Point3D; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/package-info.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/package-info.java index 0af46f7..deaf60d 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/package-info.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/package-info.java @@ -1,10 +1,8 @@ /* - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 3 of the GNU Lesser General Public License - * or later as published by the Free Software Foundation. + * Sixth 3D engine. Author: Svjatoslav Agejenko. + * This project is released under Creative Commons Zero (CC0) license. * +* *

      * Realtime renderer (in software) using traditional approaches:
      *      Wireframe
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java
    index 4e36d2e..30384e6 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractCoordinateShape.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    @@ -19,7 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger;
     
     public abstract class AbstractCoordinateShape extends AbstractShape {
     
    -    public static final AtomicInteger lastShapeId = new AtomicInteger();
    +    private static final AtomicInteger lastShapeId = new AtomicInteger();
         public final int shapeId;
         public final GeometryCoordinate[] coordinates;
         public double onScreenZ;
    @@ -32,11 +27,11 @@ public abstract class AbstractCoordinateShape extends AbstractShape {
             shapeId = lastShapeId.getAndIncrement();
         }
     
    -    public AbstractCoordinateShape(final Point3D... locationPoints) {
    -        coordinates = new GeometryCoordinate[locationPoints.length];
    +    public AbstractCoordinateShape(final Point3D... vertexes) {
    +        coordinates = new GeometryCoordinate[vertexes.length];
     
    -        for (int i = 0; i < locationPoints.length; i++)
    -            coordinates[i] = new GeometryCoordinate(locationPoints[i]);
    +        for (int i = 0; i < vertexes.length; i++)
    +            coordinates[i] = new GeometryCoordinate(vertexes[i]);
     
             shapeId = lastShapeId.getAndIncrement();
         }
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractShape.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractShape.java
    index fe44afc..4f17cd3 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractShape.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/AbstractShape.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes;
     
     import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/ForwardOrientedTexture.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/ForwardOrientedTexture.java
    index 8cec310..9467e92 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/ForwardOrientedTexture.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/ForwardOrientedTexture.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/GlowingPoint.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/GlowingPoint.java
    index e96426a..a7b4784 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/GlowingPoint.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/GlowingPoint.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/Line.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/Line.java
    index b06699d..6a4bf2d 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/Line.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/Line.java
    @@ -1,13 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/LineAppearance.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/LineAppearance.java
    index 48893db..0e99f35 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/LineAppearance.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/LineAppearance.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/LineInterpolator.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/LineInterpolator.java
    index a5ec483..12b698c 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/LineInterpolator.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/line/LineInterpolator.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line;
     
     public class LineInterpolator {
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/LineInterpolator.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/LineInterpolator.java
    index 18058d8..93545f0 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/LineInterpolator.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/LineInterpolator.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.solidpolygon;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java
    index e45a991..bc10857 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/solidpolygon/SolidPolygon.java
    @@ -1,22 +1,18 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.solidpolygon;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    -import eu.svjatoslav.sixth.e3d.geometry.Polygon;
     import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
     import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController;
     import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
     import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractCoordinateShape;
     
    +import static eu.svjatoslav.sixth.e3d.geometry.Polygon.pointWithinPolygon;
    +
     public class SolidPolygon extends AbstractCoordinateShape {
     
         private final static LineInterpolator polygonBoundary1 = new LineInterpolator();
    @@ -103,10 +99,10 @@ public class SolidPolygon extends AbstractCoordinateShape {
             onScreenPoint3.roundToInteger();
     
             if (mouseInteractionController != null)
    -            if (context.mouseEvent != null)
    -                if (Polygon.pointWithinPolygon(context.mouseEvent.coordinate,
    +            if (context.getMouseEvent() != null)
    +                if (pointWithinPolygon(context.getMouseEvent().coordinate,
                             onScreenPoint1, onScreenPoint2, onScreenPoint3))
    -                    context.objectUnderMouse = mouseInteractionController;
    +                    context.setObjectUnderMouse(mouseInteractionController);
     
             if (color.isTransparent())
                 return;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/PolygonBorderInterpolator.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/PolygonBorderInterpolator.java
    index 070ebaa..1300e3a 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/PolygonBorderInterpolator.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/PolygonBorderInterpolator.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.texturedpolygon;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/TexturedPolygon.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/TexturedPolygon.java
    index cafcbbf..889acda 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/TexturedPolygon.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/basic/texturedpolygon/TexturedPolygon.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.texturedpolygon;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    @@ -141,11 +136,11 @@ public class TexturedPolygon extends AbstractCoordinateShape {
             projectedPoint3.roundToInteger();
     
             if (mouseInteractionController != null)
    -            if (renderBuffer.mouseEvent != null)
    +            if (renderBuffer.getMouseEvent() != null)
                     if (pointWithinPolygon(
    -                        renderBuffer.mouseEvent.coordinate, projectedPoint1,
    +                        renderBuffer.getMouseEvent().coordinate, projectedPoint1,
                             projectedPoint2, projectedPoint3))
    -                    renderBuffer.objectUnderMouse = mouseInteractionController;
    +                    renderBuffer.setObjectUnderMouse(mouseInteractionController);
     
             // Show polygon boundaries (for debugging)
             if (showBorders)
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/ForwardOrientedTextBlock.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/ForwardOrientedTextBlock.java
    index 836e80b..30e92bc 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/ForwardOrientedTextBlock.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/ForwardOrientedTextBlock.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    @@ -28,7 +23,7 @@ public class ForwardOrientedTextBlock extends ForwardOrientedTexture {
                                          final eu.svjatoslav.sixth.e3d.renderer.raster.Color textColor) {
     
             final Texture texture = new Texture(text.length()
    -                * TextCanvas.FONT_CHAR_WIDTH, TextCanvas.FONT_CHAR_HEIGHT,
    +                * TextCanvas.FONT_CHAR_WIDTH_TEXTURE_PIXELS, TextCanvas.FONT_CHAR_HEIGHT_TEXTURE_PIXELS,
                     maxUpscaleFactor);
     
             // texture.graphics.setColor(Color.BLUE);
    @@ -40,8 +35,8 @@ public class ForwardOrientedTextBlock extends ForwardOrientedTexture {
     
             for (int c = 0; c < text.length(); c++)
                 texture.graphics.drawChars(new char[]{text.charAt(c),}, 0, 1,
    -                    (c * TextCanvas.FONT_CHAR_WIDTH) - 0,
    -                    (0 * TextCanvas.FONT_CHAR_HEIGHT) + 11);
    +                    (c * TextCanvas.FONT_CHAR_WIDTH_TEXTURE_PIXELS),
    +                    (int) (TextCanvas.FONT_CHAR_HEIGHT_TEXTURE_PIXELS / 1.45));
     
             return texture;
         }
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Galaxy.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Galaxy.java
    index 3aed0cb..5aedf45 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Galaxy.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Galaxy.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Graph.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Graph.java
    index 2c38a9a..e605823 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Graph.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/Graph.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/LightSourceMarker.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/LightSourceMarker.java
    index 820092d..3b0b9cc 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/LightSourceMarker.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/LightSourceMarker.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko.
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/TexturedRectangle.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/TexturedRectangle.java
    index ea23bfc..776c41d 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/TexturedRectangle.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/TexturedRectangle.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    @@ -85,9 +80,9 @@ public class TexturedRectangle extends AbstractCompositeShape {
             addShape(texturedPolygon2);
         }
     
    -    public void initialize(final int width, final int height,
    -                           final int maxTextureUpscale) {
    -        initialize(width, height, width, height, maxTextureUpscale);
    -    }
    +//    public void initialize(final int width, final int height,
    +//                           final int maxTextureUpscale) {
    +//        initialize(width, height, width, height, maxTextureUpscale);
    +//    }
     
     }
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java
    index aa7c30e..f952a4a 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/AbstractCompositeShape.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/SubShape.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/SubShape.java
    index 7978488..9860b1c 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/SubShape.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/base/SubShape.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base;
     
     import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonCube.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonCube.java
    index ba6821a..6f70729 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonCube.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonCube.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.solid;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonRectangularBox.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonRectangularBox.java
    index 06989bb..21a1b79 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonRectangularBox.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/solid/SolidPolygonRectangularBox.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.solid;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/CanvasCharacter.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/CanvasCharacter.java
    index dc12fb6..c66d5b5 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/CanvasCharacter.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/CanvasCharacter.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    @@ -19,7 +14,6 @@ import java.awt.*;
     
     public class CanvasCharacter extends AbstractCoordinateShape {
     
    -    public static final double SIZE_MULTIPLIER = 0.005;
         private static final int MAX_FONT_SIZE = 500;
         private static final Font[] fonts = new Font[MAX_FONT_SIZE];
         private String value;
    @@ -131,9 +125,10 @@ public class CanvasCharacter extends AbstractCoordinateShape {
     
             renderingContext.graphics.setFont(getFont(size));
             renderingContext.graphics.setColor(foregroundAwtColor);
    -        renderingContext.graphics.drawString(value, (int) onScreenLocation.x
    -                - (int) (size / 3.2), (int) onScreenLocation.y
    -                + (int) (size / 2.5));
    +        renderingContext.graphics.drawString(
    +                value,
    +                (int) onScreenLocation.x - (int) (size / 3.2),
    +                (int) onScreenLocation.y + (int) (size / 2.5));
     
         }
     
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/RenderMode.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/RenderMode.java
    index 197eb4d..eb2f64e 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/RenderMode.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/RenderMode.java
    @@ -1,14 +1,10 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas;
     
     public enum RenderMode {
    -    TEXTURE, CHARACTERS
    +    TEXTURE, // Text is rendered on textured polygon
    +    CHARACTERS // Text is rendered as high quality, anti-aliazed tiles
     }
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
    index 737a5b8..7945a54 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/textcanvas/TextCanvas.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    @@ -22,20 +17,29 @@ import java.io.BufferedReader;
     import java.io.IOException;
     import java.io.StringReader;
     
    +import static eu.svjatoslav.sixth.e3d.renderer.raster.Color.BLACK;
    +import static eu.svjatoslav.sixth.e3d.renderer.raster.Color.WHITE;
    +
     public class TextCanvas extends TexturedRectangle {
     
    +    // character size in world coordiates
         public static final int FONT_CHAR_WIDTH = 8;
         public static final int FONT_CHAR_HEIGHT = 16;
    -    public static final Font FONT = CanvasCharacter.getFont(15);
    +
    +    // character size on texture
    +    public static final int FONT_CHAR_WIDTH_TEXTURE_PIXELS = 16;
    +    public static final int FONT_CHAR_HEIGHT_TEXTURE_PIXELS = 32;
    +
    +
    +    public static final Font FONT = CanvasCharacter.getFont((int)(FONT_CHAR_HEIGHT_TEXTURE_PIXELS / 1.066));
         private static final String GROUP_TEXTURE = "texture";
         private static final String GROUP_CHARACTERS = "characters";
         private final TextPointer size;
         private final TextPointer cursorLocation = new TextPointer();
         CanvasCharacter lines[][];
         private RenderMode renderMode = null;
    -    private Color backgroundColor = Color.BLACK;
    -
    -    private Color foregroundColor = Color.WHITE;
    +    private Color backgroundColor = BLACK;
    +    private Color foregroundColor = WHITE;
     
         public TextCanvas(final Transform location, final String text,
                           final Color foregroundColor, final Color backgroundColor) {
    @@ -57,7 +61,12 @@ public class TextCanvas extends TexturedRectangle {
             this.foregroundColor = foregroundColor;
     
             // initialize underlying textured rectangle
    -        initialize(columns * FONT_CHAR_WIDTH, rows * FONT_CHAR_HEIGHT, 0);
    +        initialize(
    +                columns * FONT_CHAR_WIDTH,
    +                rows * FONT_CHAR_HEIGHT,
    +                columns * FONT_CHAR_WIDTH_TEXTURE_PIXELS,
    +                rows * FONT_CHAR_HEIGHT_TEXTURE_PIXELS,
    +                0);
     
             getTexture().primaryBitmap.fillColor(backgroundColor);
             getTexture().resetResampledBitmapCache();
    @@ -153,15 +162,19 @@ public class TextCanvas extends TexturedRectangle {
                                        final char character, final Color foreground) {
             final Graphics2D graphics = getTexture().graphics;
     
    -        getTexture().primaryBitmap.drawRectangle(column * FONT_CHAR_WIDTH, row
    -                        * FONT_CHAR_HEIGHT, (column * FONT_CHAR_WIDTH)
    -                        + FONT_CHAR_WIDTH, (row * FONT_CHAR_HEIGHT) + FONT_CHAR_HEIGHT,
    +        getTexture().primaryBitmap.drawRectangle(
    +                column * FONT_CHAR_WIDTH_TEXTURE_PIXELS,
    +                row * FONT_CHAR_HEIGHT_TEXTURE_PIXELS,
    +                (column * FONT_CHAR_WIDTH_TEXTURE_PIXELS) + FONT_CHAR_WIDTH_TEXTURE_PIXELS,
    +                (row * FONT_CHAR_HEIGHT_TEXTURE_PIXELS) + FONT_CHAR_HEIGHT_TEXTURE_PIXELS,
                     backgroundColor);
     
             graphics.setFont(FONT);
             graphics.setColor(foreground.toAwtColor());
    -        graphics.drawChars(new char[]{character,}, 0, 1,
    -                (column * FONT_CHAR_WIDTH) - 0, (row * FONT_CHAR_HEIGHT) + 13);
    +        graphics.drawChars(
    +                new char[]{character,}, 0, 1,
    +                (column * FONT_CHAR_WIDTH_TEXTURE_PIXELS) - 0,
    +                (row * FONT_CHAR_HEIGHT_TEXTURE_PIXELS) + (int)(FONT_CHAR_HEIGHT_TEXTURE_PIXELS / 1.23f));
     
             getTexture().resetResampledBitmapCache();
         }
    @@ -170,7 +183,7 @@ public class TextCanvas extends TexturedRectangle {
             final Point3D coordinate = topLeft.clone();
     
             coordinate.translateY((row * FONT_CHAR_HEIGHT)
    -                + ((FONT_CHAR_HEIGHT / 2) - 3));
    +                + (FONT_CHAR_HEIGHT / 3.2));
     
             coordinate.translateX((column * FONT_CHAR_WIDTH)
                     + (FONT_CHAR_WIDTH / 2));
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid2D.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid2D.java
    index 0156db2..cd4f4a2 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid2D.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid2D.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    @@ -17,29 +12,36 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCom
     
     public class Grid2D extends AbstractCompositeShape {
     
    +    /**
    +     * @param transform Grid location
    +     * @param rectangle Grid dimensions
    +     * @param xDivisionCount Division count along X axis
    +     * @param yDivisionCount Division count along Y axis
    +     * @param appearance Grid lines appearance
    +     */
         public Grid2D(final Transform transform, final Rectangle rectangle,
    -                  final int divisionsX, final int divisionsY,
    +                  final int xDivisionCount, final int yDivisionCount,
                       final LineAppearance appearance) {
     
             super(transform);
     
    -        final double stepY = rectangle.getHeight() / divisionsY;
    -        final double stepX = rectangle.getWidth() / divisionsX;
    +        final double stepY = rectangle.getHeight() / yDivisionCount;
    +        final double stepX = rectangle.getWidth() / xDivisionCount;
     
    -        for (int yslice = 0; yslice <= divisionsY; yslice++) {
    -            final double y = (yslice * stepY) + rectangle.getLowerY();
    +        for (int ySlice = 0; ySlice <= yDivisionCount; ySlice++) {
    +            final double y = (ySlice * stepY) + rectangle.getLowerY();
     
    -            for (int xslice = 0; xslice <= divisionsX; xslice++) {
    -                final double x = (xslice * stepX) + rectangle.getLowerX();
    +            for (int xSlice = 0; xSlice <= xDivisionCount; xSlice++) {
    +                final double x = (xSlice * stepX) + rectangle.getLowerX();
     
                     final Point3D p1 = new Point3D(x, y, 0);
                     final Point3D p2 = new Point3D(x + stepX, y, 0);
                     final Point3D p3 = new Point3D(x, y + stepY, 0);
     
    -                if (xslice < divisionsX)
    +                if (xSlice < xDivisionCount)
                         addShape(appearance.getLine(p1, p2));
     
    -                if (yslice < divisionsY)
    +                if (ySlice < yDivisionCount)
                         addShape(appearance.getLine(p1, p3));
                 }
     
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid3D.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid3D.java
    index 4e82100..d918ce9 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid3D.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/Grid3D.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeBox.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeBox.java
    index d19f739..20c3fc3 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeBox.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeBox.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko.
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
     
     import eu.svjatoslav.sixth.e3d.geometry.Box;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeCube.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeCube.java
    index af54c3c..d91c49c 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeCube.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeCube.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeDrawing.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeDrawing.java
    index 8d87b05..d78d729 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeDrawing.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeDrawing.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeSphere.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeSphere.java
    index f095567..572623d 100755
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeSphere.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/shapes/composite/wireframe/WireframeSphere.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point3D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/BorderLine.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/BorderLine.java
    index 2d4c661..ebf741a 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/BorderLine.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/BorderLine.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.slicer;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/PolygonCoordinate.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/PolygonCoordinate.java
    index 8ead72c..539892e 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/PolygonCoordinate.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/PolygonCoordinate.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.slicer;
     
     import eu.svjatoslav.sixth.e3d.geometry.Point2D;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/Slicer.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/Slicer.java
    index 448a319..29abe41 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/Slicer.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/slicer/Slicer.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.slicer;
     
     import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.texturedpolygon.TexturedPolygon;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/texture/Texture.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/texture/Texture.java
    index 50182f0..0a677bd 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/texture/Texture.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/texture/Texture.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.texture;
     
     import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
    diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/texture/TextureBitmap.java b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/texture/TextureBitmap.java
    index 53e0c61..00d0625 100644
    --- a/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/texture/TextureBitmap.java
    +++ b/src/main/java/eu/svjatoslav/sixth/e3d/renderer/raster/texture/TextureBitmap.java
    @@ -1,12 +1,7 @@
     /*
    - * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    - *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - *
    + * Sixth 3D engine. Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      */
    -
     package eu.svjatoslav.sixth.e3d.renderer.raster.texture;
     
     import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
    diff --git a/src/test/java/eu/svjatoslav/sixth/e3d/VisualizeCode.java b/src/test/java/eu/svjatoslav/sixth/e3d/VisualizeCode.java
    deleted file mode 100644
    index bd96a75..0000000
    --- a/src/test/java/eu/svjatoslav/sixth/e3d/VisualizeCode.java
    +++ /dev/null
    @@ -1,26 +0,0 @@
    -package eu.svjatoslav.sixth.e3d;
    -
    -import eu.svjatoslav.inspector.java.structure.ClassGraph;
    -
    -public class VisualizeCode {
    -
    -    public static void main(String[] args) {
    -        renderGui();
    -        renderRasterGrphicsEngine();
    -    }
    -
    -    private static void renderGui() {
    -        final ClassGraph graph = new ClassGraph();
    -        graph.addProject("./src/main/");
    -        graph.whitelistClassPattern("eu.svjatoslav.sixth.e3d.gui.*");
    -        graph.generateGraph("gui");
    -    }
    -
    -    private static void renderRasterGrphicsEngine() {
    -        final ClassGraph graph = new ClassGraph();
    -        graph.addProject("./src/main/");
    -        graph.whitelistClassPattern("eu.svjatoslav.sixth.e3d.renderer.raster.*");
    -        graph.generateGraph("raster engine");
    -    }
    -
    -}
    diff --git a/src/test/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextLineTest.java b/src/test/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextLineTest.java
    index f811ea0..d4c3069 100644
    --- a/src/test/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextLineTest.java
    +++ b/src/test/java/eu/svjatoslav/sixth/e3d/gui/textEditorComponent/TextLineTest.java
    @@ -1,11 +1,9 @@
     /*
      * Sixth - System for data storage, computation, exploration and interaction.
    - * Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
    + * Author: Svjatoslav Agejenko. 
    + * This project is released under Creative Commons Zero (CC0) license.
      *
    - * This program is free software; you can redistribute it and/or
    - * modify it under the terms of version 3 of the GNU Lesser General Public License
    - * or later as published by the Free Software Foundation.
    - */
    +*/
     
     package eu.svjatoslav.sixth.e3d.gui.textEditorComponent;
     
    diff --git a/tools/open with IntelliJ IDEA b/tools/open with IntelliJ IDEA
    index 1f82875..de9bae5 100755
    --- a/tools/open with IntelliJ IDEA	
    +++ b/tools/open with IntelliJ IDEA	
    @@ -1,6 +1,18 @@
     #!/bin/bash
     
    -cd "${0%/*}"
    +#
    +# This is a helper bash script that starts IntelliJ with the current project.
    +# Script is written is such a way that you can simply click on it in file
    +# navigator to run it.
    +#
    +#
    +# Script assumes:
    +#
    +#    + GNU operating system
    +#    + IntelliJ is installed and commandline launcher "idea" is enabled.
    +#
     
    +cd "${0%/*}"
     cd ..
    -idea .
    +
    +setsid idea . &>/dev/null
    diff --git a/tools/update web site b/tools/update web site
    index c210d82..5ba0222 100755
    --- a/tools/update web site	
    +++ b/tools/update web site	
    @@ -8,12 +8,15 @@ mvn clean package
     rm -rf doc/graphs/
     mkdir -p doc/graphs/
     
    -javainspect -j target/sixth-3d-*-SNAPSHOT.jar -d doc/graphs/ -n "all classes" -t png -h
    -javainspect -j target/sixth-3d-*-SNAPSHOT.jar -d doc/graphs/ -n "GUI" -t png -w "eu.svjatoslav.sixth.e3d.gui.*" -h
    -javainspect -j target/sixth-3d-*-SNAPSHOT.jar -d doc/graphs/ -n "raster engine" -t png -w "eu.svjatoslav.sixth.e3d.renderer.raster.*" -h
    +javainspect -j target/sixth-3d-*-SNAPSHOT.jar -d doc/graphs/ -n "all classes" -t png -ho
    +javainspect -j target/sixth-3d-*-SNAPSHOT.jar -d doc/graphs/ -n "GUI" -t png -w "eu.svjatoslav.sixth.e3d.gui.*" -ho
    +javainspect -j target/sixth-3d-*-SNAPSHOT.jar -d doc/graphs/ -n "raster engine" -t png -w "eu.svjatoslav.sixth.e3d.renderer.raster.*" -ho
     
     meviz index -w doc/graphs/ -t "Sixth 3D classes"
     
    +rm -rf doc/apidocs/
    +cp -r target/apidocs/ doc/
    +
     rsync -avz --delete  -e 'ssh -p 10006' doc/ n0@www3.svjatoslav.eu:/mnt/big/projects/sixth-3d/
     
     echo ""