commit bfd3dfbef70f8d697ce0bc7fc73a325a7c2c0bfa Author: Fredrick Johansson Date: Thu Aug 13 20:14:37 2020 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..259148f --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..90ae120 --- /dev/null +++ b/LICENSE @@ -0,0 +1,361 @@ +### GNU GENERAL PUBLIC LICENSE + +Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +### Preamble + +The licenses for most software are designed to take away your freedom +to share and change it. By contrast, the GNU General Public License is +intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, +we want its recipients to know that what they have is not the +original, so that any problems introduced by others will not reflect +on the original authors' reputations. + +Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at +all. + +The precise terms and conditions for copying, distribution and +modification follow. + +### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +**0.** This License applies to any program or other work which +contains a notice placed by the copyright holder saying it may be +distributed under the terms of this General Public License. The +"Program", below, refers to any such program or work, and a "work +based on the Program" means either the Program or any derivative work +under copyright law: that is to say, a work containing the Program or +a portion of it, either verbatim or with modifications and/or +translated into another language. (Hereinafter, translation is +included without limitation in the term "modification".) Each licensee +is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the Program +(independent of having been made by running the Program). Whether that +is true depends on what the Program does. + +**1.** You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a +fee. + +**2.** You may modify your copy or copies of the Program or any +portion of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + +**a)** You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + + +**b)** You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any part +thereof, to be licensed as a whole at no charge to all third parties +under the terms of this License. + + +**c)** If the modified program normally reads commands interactively +when run, you must cause it, when started running for such interactive +use in the most ordinary way, to print or display an announcement +including an appropriate copyright notice and a notice that there is +no warranty (or else, saying that you provide a warranty) and that +users may redistribute the program under these conditions, and telling +the user how to view a copy of this License. (Exception: if the +Program itself is interactive but does not normally print such an +announcement, your work based on the Program is not required to print +an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +**3.** You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + +**a)** Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections 1 +and 2 above on a medium customarily used for software interchange; or, + + +**b)** Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your cost of +physically performing source distribution, a complete machine-readable +copy of the corresponding source code, to be distributed under the +terms of Sections 1 and 2 above on a medium customarily used for +software interchange; or, + + +**c)** Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is allowed +only for noncommercial distribution and only if you received the +program in object code or executable form with such an offer, in +accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +**4.** You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt otherwise +to copy, modify, sublicense or distribute the Program is void, and +will automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + +**5.** You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +**6.** Each time you redistribute the Program (or any work based on +the Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +**7.** If, as a consequence of a court judgment or allegation of +patent infringement or for any other reason (not limited to patent +issues), conditions are imposed on you (whether by court order, +agreement or otherwise) that contradict the conditions of this +License, they do not excuse you from the conditions of this License. +If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, +then as a consequence you may not distribute the Program at all. For +example, if a patent license would not permit royalty-free +redistribution of the Program by all those who receive copies directly +or indirectly through you, then the only way you could satisfy both it +and this License would be to refrain entirely from distribution of the +Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +**8.** If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +**9.** The Free Software Foundation may publish revised and/or new +versions of the General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Program does not specify a +version number of this License, you may choose any version ever +published by the Free Software Foundation. + +**10.** If you wish to incorporate parts of the Program into other +free programs whose distribution conditions are different, write to +the author to ask for permission. For software which is copyrighted by +the Free Software Foundation, write to the Free Software Foundation; +we sometimes make exceptions for this. Our decision will be guided by +the two goals of preserving the free status of all derivatives of our +free software and of promoting the sharing and reuse of software +generally. + +**NO WARRANTY** + +**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +### END OF TERMS AND CONDITIONS + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + one line to give the program's name and an idea of what it does. + Copyright (C) yyyy name of author + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Also add information on how to contact you by electronic and paper +mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details + type `show w'. This is free software, and you are welcome + to redistribute it under certain conditions; type `show c' + for details. + +The hypothetical commands \`show w' and \`show c' should show the +appropriate parts of the General Public License. Of course, the +commands you use may be called something other than \`show w' and +\`show c'; they could even be mouse-clicks or menu items--whatever +suits your program. + +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the program, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright + interest in the program `Gnomovision' + (which makes passes at compilers) written + by James Hacker. + + signature of Ty Coon, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, +you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +[GNU Lesser General Public +License](https://www.gnu.org/licenses/lgpl.html) instead of this +License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..8b348c7 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Game jam entry + + +## For developers + +### Linux (Debian 9 Stretch) + +Please refer to the [wiki article](https://wiki.loopaware.com/index.php/Setting_up_an_ecos_project_in_Eclipse) about setting up an ecos project in Eclipse. + +...more info to come later... + +### Windows 10 + +Please refer to the [wiki article](https://wiki.loopaware.com/index.php/Setting_up_an_ecos_project_in_Eclipse) about setting up an ecos project in Eclipse. + +...more info to come later... \ No newline at end of file diff --git a/assets/fonts/Lato-Black.ttf b/assets/fonts/Lato-Black.ttf new file mode 100755 index 0000000..e2aeb6c Binary files /dev/null and b/assets/fonts/Lato-Black.ttf differ diff --git a/assets/fonts/Lato-BlackItalic.ttf b/assets/fonts/Lato-BlackItalic.ttf new file mode 100755 index 0000000..8167388 Binary files /dev/null and b/assets/fonts/Lato-BlackItalic.ttf differ diff --git a/assets/fonts/Lato-Bold.ttf b/assets/fonts/Lato-Bold.ttf new file mode 100755 index 0000000..ef5ae3b Binary files /dev/null and b/assets/fonts/Lato-Bold.ttf differ diff --git a/assets/fonts/Lato-BoldItalic.ttf b/assets/fonts/Lato-BoldItalic.ttf new file mode 100755 index 0000000..664cd02 Binary files /dev/null and b/assets/fonts/Lato-BoldItalic.ttf differ diff --git a/assets/fonts/Lato-Hairline.ttf b/assets/fonts/Lato-Hairline.ttf new file mode 100755 index 0000000..4c5a8fd Binary files /dev/null and b/assets/fonts/Lato-Hairline.ttf differ diff --git a/assets/fonts/Lato-HairlineItalic.ttf b/assets/fonts/Lato-HairlineItalic.ttf new file mode 100755 index 0000000..af5ac3d Binary files /dev/null and b/assets/fonts/Lato-HairlineItalic.ttf differ diff --git a/assets/fonts/Lato-Heavy.ttf b/assets/fonts/Lato-Heavy.ttf new file mode 100755 index 0000000..fc70ab7 Binary files /dev/null and b/assets/fonts/Lato-Heavy.ttf differ diff --git a/assets/fonts/Lato-HeavyItalic.ttf b/assets/fonts/Lato-HeavyItalic.ttf new file mode 100755 index 0000000..823188c Binary files /dev/null and b/assets/fonts/Lato-HeavyItalic.ttf differ diff --git a/assets/fonts/Lato-Italic.ttf b/assets/fonts/Lato-Italic.ttf new file mode 100755 index 0000000..b23256f Binary files /dev/null and b/assets/fonts/Lato-Italic.ttf differ diff --git a/assets/fonts/Lato-Light.ttf b/assets/fonts/Lato-Light.ttf new file mode 100755 index 0000000..0809b8e Binary files /dev/null and b/assets/fonts/Lato-Light.ttf differ diff --git a/assets/fonts/Lato-LightItalic.ttf b/assets/fonts/Lato-LightItalic.ttf new file mode 100755 index 0000000..2d03739 Binary files /dev/null and b/assets/fonts/Lato-LightItalic.ttf differ diff --git a/assets/fonts/Lato-Medium.ttf b/assets/fonts/Lato-Medium.ttf new file mode 100755 index 0000000..2c612da Binary files /dev/null and b/assets/fonts/Lato-Medium.ttf differ diff --git a/assets/fonts/Lato-MediumItalic.ttf b/assets/fonts/Lato-MediumItalic.ttf new file mode 100755 index 0000000..63ecd02 Binary files /dev/null and b/assets/fonts/Lato-MediumItalic.ttf differ diff --git a/assets/fonts/Lato-Regular.ttf b/assets/fonts/Lato-Regular.ttf new file mode 100755 index 0000000..adbfc46 Binary files /dev/null and b/assets/fonts/Lato-Regular.ttf differ diff --git a/assets/fonts/Lato-Semibold.ttf b/assets/fonts/Lato-Semibold.ttf new file mode 100755 index 0000000..60ac82d Binary files /dev/null and b/assets/fonts/Lato-Semibold.ttf differ diff --git a/assets/fonts/Lato-SemiboldItalic.ttf b/assets/fonts/Lato-SemiboldItalic.ttf new file mode 100755 index 0000000..cc23390 Binary files /dev/null and b/assets/fonts/Lato-SemiboldItalic.ttf differ diff --git a/assets/fonts/Lato-Thin.ttf b/assets/fonts/Lato-Thin.ttf new file mode 100755 index 0000000..0f84dc1 Binary files /dev/null and b/assets/fonts/Lato-Thin.ttf differ diff --git a/assets/fonts/Lato-ThinItalic.ttf b/assets/fonts/Lato-ThinItalic.ttf new file mode 100755 index 0000000..7fbca2f Binary files /dev/null and b/assets/fonts/Lato-ThinItalic.ttf differ diff --git a/assets/fonts/Lato-license.txt b/assets/fonts/Lato-license.txt new file mode 100755 index 0000000..6d2c416 --- /dev/null +++ b/assets/fonts/Lato-license.txt @@ -0,0 +1,94 @@ +Copyright (c) 2010-2015, Ɓukasz Dziedzic (dziedzic@typoland.com), +with Reserved Font Name Lato. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/assets/fonts/Lato-readme.txt b/assets/fonts/Lato-readme.txt new file mode 100755 index 0000000..272db62 --- /dev/null +++ b/assets/fonts/Lato-readme.txt @@ -0,0 +1,72 @@ + +Lato font family (Desktop version) + +================================== + +Version 2.015; Latin+Cyrillic+Greek+IPA opensource + +Created by: tyPoland Lukasz Dziedzic +Creation year: 2015 + +Copyright (c) 2010-2015 by tyPoland Lukasz Dziedzic with Reserved Font Name "Lato". Licensed under the SIL Open Font License, Version 1.1. + +Lato is a trademark of tyPoland Lukasz Dziedzic. + +Source URL: http://www.latofonts.com/ +License URL: http://scripts.sil.org/OFL + +================ + +Lato is a sanserif typeface family designed in the Summer 2010 and extended in the Summer 2013 by Warsaw-based designer Lukasz Dziedzic ("Lato" means "Summer" in Polish). It tries to carefully balance some potentially conflicting priorities: it should seem quite "transparent" when used in body text but would display some original traits when used in larger sizes. The classical proportions, particularly visible in the uppercase, give the letterforms familiar harmony and elegance. At the same time, its sleek sanserif look makes evident the fact that Lato was designed in the 2010s, even though it does not follow any current trend. The semi-rounded details of the letters give Lato a feeling of warmth, while the strong structure provides stability and seriousness. In 2013-2014, the family was greatly extended (with the help of Adam Twardoch and Botio Nikoltchev) to cover 3000+ glyphs over nine weights with italics. It now supports 100+ Latin-based languages, 50+ Cyrillic-based languages as well as Greek and IPA phonetics. The Lato fonts are available free of charge under the SIL Open Font License from http://www.latofonts.com/ + +================ + +CONTENTS: + +This folder contains 18 font files in OpenType TT (.ttf) format. You can install these fonts on your computer and use in any desktop applications (such as Word, InDesign, Illustrator, Photoshop, Keynote or Pages). + +================ + +REVISION LOG: + +# Version 2.015 (2015-08-06) +Initial implementation of mark positioning (should work for most glyphs) +Autohinted using ttfautohint 1.3. + +# Version 2.010 (2014-09-01) +Improved some contour bugs and diacritics positioning. +Improved outline quality. +Revised OTL features so that they work in browsers (ot-sanitise). +Autohinted using ttfautohint 1.1. +Interpolated the Medium weight differently so it provides more visual difference from Regular. + +# Version 2.007 (2014-02-27) +Greatly expanded character set, revised metrics, four additional weights. + +# Version 1.104 (2011-11-08) +Merged the distribution again +Autohinted with updated ttfautohint 0.4 (which no longer causes Adobe and iOS problems) +except the Hai and Lig weights which are hinted in FLS 5.1. + +# Version 1.102 (2011-10-28) +Added OpenType Layout features +Ssplit between desktop and web versions +Desktop version: all weights autohinted with FontLab Studio +Web version autohinted with ttfautohint 0.4 except the Hai and Lig weights + +# Version 1.101 (2011-09-30) +Fixed OS/2 table Unicode and codepage entries + +# Version 1.100 (2011-09-12) +Added Polish diacritics to the character set +Weights Hai and Lig autohinted with FontLab Studio +Other weights autohinted with ttfautohint 0.3 + +# Version 1.011 (2010-12-29) +Added the soft hyphen glyph + +# Version 1.010 (2010-12-13) +Initial version released under SIL Open Font License +Western character set + +================ diff --git a/assets/fonts/NotoSansCJKtc-Regular.otf b/assets/fonts/NotoSansCJKtc-Regular.otf new file mode 100755 index 0000000..62ed47d Binary files /dev/null and b/assets/fonts/NotoSansCJKtc-Regular.otf differ diff --git a/assets/fonts/OpenSans-Bold.ttf b/assets/fonts/OpenSans-Bold.ttf new file mode 100755 index 0000000..fd79d43 Binary files /dev/null and b/assets/fonts/OpenSans-Bold.ttf differ diff --git a/assets/fonts/OpenSans-BoldItalic.ttf b/assets/fonts/OpenSans-BoldItalic.ttf new file mode 100755 index 0000000..9bc8009 Binary files /dev/null and b/assets/fonts/OpenSans-BoldItalic.ttf differ diff --git a/assets/fonts/OpenSans-Cond-license.txt b/assets/fonts/OpenSans-Cond-license.txt new file mode 100755 index 0000000..989e2c5 --- /dev/null +++ b/assets/fonts/OpenSans-Cond-license.txt @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/assets/fonts/OpenSans-CondBold.ttf b/assets/fonts/OpenSans-CondBold.ttf new file mode 100755 index 0000000..83966f2 Binary files /dev/null and b/assets/fonts/OpenSans-CondBold.ttf differ diff --git a/assets/fonts/OpenSans-CondLight.ttf b/assets/fonts/OpenSans-CondLight.ttf new file mode 100755 index 0000000..97c355b Binary files /dev/null and b/assets/fonts/OpenSans-CondLight.ttf differ diff --git a/assets/fonts/OpenSans-CondLightItalic.ttf b/assets/fonts/OpenSans-CondLightItalic.ttf new file mode 100755 index 0000000..0b45898 Binary files /dev/null and b/assets/fonts/OpenSans-CondLightItalic.ttf differ diff --git a/assets/fonts/OpenSans-ExtraBold.ttf b/assets/fonts/OpenSans-ExtraBold.ttf new file mode 100755 index 0000000..21f6f84 Binary files /dev/null and b/assets/fonts/OpenSans-ExtraBold.ttf differ diff --git a/assets/fonts/OpenSans-ExtraBoldItalic.ttf b/assets/fonts/OpenSans-ExtraBoldItalic.ttf new file mode 100755 index 0000000..31cb688 Binary files /dev/null and b/assets/fonts/OpenSans-ExtraBoldItalic.ttf differ diff --git a/assets/fonts/OpenSans-Italic.ttf b/assets/fonts/OpenSans-Italic.ttf new file mode 100755 index 0000000..c90da48 Binary files /dev/null and b/assets/fonts/OpenSans-Italic.ttf differ diff --git a/assets/fonts/OpenSans-Light.ttf b/assets/fonts/OpenSans-Light.ttf new file mode 100755 index 0000000..0d38189 Binary files /dev/null and b/assets/fonts/OpenSans-Light.ttf differ diff --git a/assets/fonts/OpenSans-LightItalic.ttf b/assets/fonts/OpenSans-LightItalic.ttf new file mode 100755 index 0000000..68299c4 Binary files /dev/null and b/assets/fonts/OpenSans-LightItalic.ttf differ diff --git a/assets/fonts/OpenSans-Regular.ttf b/assets/fonts/OpenSans-Regular.ttf new file mode 100755 index 0000000..db43334 Binary files /dev/null and b/assets/fonts/OpenSans-Regular.ttf differ diff --git a/assets/fonts/OpenSans-Semibold.ttf b/assets/fonts/OpenSans-Semibold.ttf new file mode 100755 index 0000000..1a7679e Binary files /dev/null and b/assets/fonts/OpenSans-Semibold.ttf differ diff --git a/assets/fonts/OpenSans-SemiboldItalic.ttf b/assets/fonts/OpenSans-SemiboldItalic.ttf new file mode 100755 index 0000000..59b6d16 Binary files /dev/null and b/assets/fonts/OpenSans-SemiboldItalic.ttf differ diff --git a/assets/fonts/OpenSans-license.txt b/assets/fonts/OpenSans-license.txt new file mode 100755 index 0000000..989e2c5 --- /dev/null +++ b/assets/fonts/OpenSans-license.txt @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/assets/fonts/Roboto-Black.ttf b/assets/fonts/Roboto-Black.ttf new file mode 100755 index 0000000..3ecbdef Binary files /dev/null and b/assets/fonts/Roboto-Black.ttf differ diff --git a/assets/fonts/Roboto-BlackItalic.ttf b/assets/fonts/Roboto-BlackItalic.ttf new file mode 100755 index 0000000..44c086c Binary files /dev/null and b/assets/fonts/Roboto-BlackItalic.ttf differ diff --git a/assets/fonts/Roboto-Bold.ttf b/assets/fonts/Roboto-Bold.ttf new file mode 100755 index 0000000..70def3f Binary files /dev/null and b/assets/fonts/Roboto-Bold.ttf differ diff --git a/assets/fonts/Roboto-BoldItalic.ttf b/assets/fonts/Roboto-BoldItalic.ttf new file mode 100755 index 0000000..216f9ce Binary files /dev/null and b/assets/fonts/Roboto-BoldItalic.ttf differ diff --git a/assets/fonts/Roboto-Italic.ttf b/assets/fonts/Roboto-Italic.ttf new file mode 100755 index 0000000..f0f33db Binary files /dev/null and b/assets/fonts/Roboto-Italic.ttf differ diff --git a/assets/fonts/Roboto-Light.ttf b/assets/fonts/Roboto-Light.ttf new file mode 100755 index 0000000..3a03044 Binary files /dev/null and b/assets/fonts/Roboto-Light.ttf differ diff --git a/assets/fonts/Roboto-LightItalic.ttf b/assets/fonts/Roboto-LightItalic.ttf new file mode 100755 index 0000000..983381b Binary files /dev/null and b/assets/fonts/Roboto-LightItalic.ttf differ diff --git a/assets/fonts/Roboto-Medium.ttf b/assets/fonts/Roboto-Medium.ttf new file mode 100755 index 0000000..284b1ba Binary files /dev/null and b/assets/fonts/Roboto-Medium.ttf differ diff --git a/assets/fonts/Roboto-MediumItalic.ttf b/assets/fonts/Roboto-MediumItalic.ttf new file mode 100755 index 0000000..a0b10d2 Binary files /dev/null and b/assets/fonts/Roboto-MediumItalic.ttf differ diff --git a/assets/fonts/Roboto-Regular.ttf b/assets/fonts/Roboto-Regular.ttf new file mode 100755 index 0000000..500b104 Binary files /dev/null and b/assets/fonts/Roboto-Regular.ttf differ diff --git a/assets/fonts/Roboto-Thin.ttf b/assets/fonts/Roboto-Thin.ttf new file mode 100755 index 0000000..0c7d50b Binary files /dev/null and b/assets/fonts/Roboto-Thin.ttf differ diff --git a/assets/fonts/Roboto-license.txt b/assets/fonts/Roboto-license.txt new file mode 100755 index 0000000..261eeb9 --- /dev/null +++ b/assets/fonts/Roboto-license.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/assets/fonts/RobotoCondensed-Bold.ttf b/assets/fonts/RobotoCondensed-Bold.ttf new file mode 100755 index 0000000..f1de58f Binary files /dev/null and b/assets/fonts/RobotoCondensed-Bold.ttf differ diff --git a/assets/fonts/RobotoCondensed-BoldItalic.ttf b/assets/fonts/RobotoCondensed-BoldItalic.ttf new file mode 100755 index 0000000..dc0ae5d Binary files /dev/null and b/assets/fonts/RobotoCondensed-BoldItalic.ttf differ diff --git a/assets/fonts/RobotoCondensed-Italic.ttf b/assets/fonts/RobotoCondensed-Italic.ttf new file mode 100755 index 0000000..7f075cf Binary files /dev/null and b/assets/fonts/RobotoCondensed-Italic.ttf differ diff --git a/assets/fonts/RobotoCondensed-Light.ttf b/assets/fonts/RobotoCondensed-Light.ttf new file mode 100755 index 0000000..2c514ba Binary files /dev/null and b/assets/fonts/RobotoCondensed-Light.ttf differ diff --git a/assets/fonts/RobotoCondensed-LightItalic.ttf b/assets/fonts/RobotoCondensed-LightItalic.ttf new file mode 100755 index 0000000..248ffe8 Binary files /dev/null and b/assets/fonts/RobotoCondensed-LightItalic.ttf differ diff --git a/assets/fonts/RobotoCondensed-Medium.ttf b/assets/fonts/RobotoCondensed-Medium.ttf new file mode 100755 index 0000000..b3393ed Binary files /dev/null and b/assets/fonts/RobotoCondensed-Medium.ttf differ diff --git a/assets/fonts/RobotoCondensed-MediumItalic.ttf b/assets/fonts/RobotoCondensed-MediumItalic.ttf new file mode 100755 index 0000000..a8fd4f7 Binary files /dev/null and b/assets/fonts/RobotoCondensed-MediumItalic.ttf differ diff --git a/assets/fonts/RobotoCondensed-Regular.ttf b/assets/fonts/RobotoCondensed-Regular.ttf new file mode 100755 index 0000000..5ae7043 Binary files /dev/null and b/assets/fonts/RobotoCondensed-Regular.ttf differ diff --git a/assets/fonts/SourceSansPro-Black.otf b/assets/fonts/SourceSansPro-Black.otf new file mode 100755 index 0000000..0c25f3d Binary files /dev/null and b/assets/fonts/SourceSansPro-Black.otf differ diff --git a/assets/fonts/SourceSansPro-BlackIt.otf b/assets/fonts/SourceSansPro-BlackIt.otf new file mode 100755 index 0000000..da3504c Binary files /dev/null and b/assets/fonts/SourceSansPro-BlackIt.otf differ diff --git a/assets/fonts/SourceSansPro-Bold.otf b/assets/fonts/SourceSansPro-Bold.otf new file mode 100755 index 0000000..98dbee7 Binary files /dev/null and b/assets/fonts/SourceSansPro-Bold.otf differ diff --git a/assets/fonts/SourceSansPro-BoldIt.otf b/assets/fonts/SourceSansPro-BoldIt.otf new file mode 100755 index 0000000..6600c86 Binary files /dev/null and b/assets/fonts/SourceSansPro-BoldIt.otf differ diff --git a/assets/fonts/SourceSansPro-ExtraLight.otf b/assets/fonts/SourceSansPro-ExtraLight.otf new file mode 100755 index 0000000..f885ce7 Binary files /dev/null and b/assets/fonts/SourceSansPro-ExtraLight.otf differ diff --git a/assets/fonts/SourceSansPro-ExtraLightIt.otf b/assets/fonts/SourceSansPro-ExtraLightIt.otf new file mode 100755 index 0000000..f932024 Binary files /dev/null and b/assets/fonts/SourceSansPro-ExtraLightIt.otf differ diff --git a/assets/fonts/SourceSansPro-It.otf b/assets/fonts/SourceSansPro-It.otf new file mode 100755 index 0000000..2d627d9 Binary files /dev/null and b/assets/fonts/SourceSansPro-It.otf differ diff --git a/assets/fonts/SourceSansPro-Light.otf b/assets/fonts/SourceSansPro-Light.otf new file mode 100755 index 0000000..159979f Binary files /dev/null and b/assets/fonts/SourceSansPro-Light.otf differ diff --git a/assets/fonts/SourceSansPro-LightIt.otf b/assets/fonts/SourceSansPro-LightIt.otf new file mode 100755 index 0000000..e3d49b5 Binary files /dev/null and b/assets/fonts/SourceSansPro-LightIt.otf differ diff --git a/assets/fonts/SourceSansPro-Regular.otf b/assets/fonts/SourceSansPro-Regular.otf new file mode 100755 index 0000000..bdcfb27 Binary files /dev/null and b/assets/fonts/SourceSansPro-Regular.otf differ diff --git a/assets/fonts/SourceSansPro-Semibold.otf b/assets/fonts/SourceSansPro-Semibold.otf new file mode 100755 index 0000000..fffdbaf Binary files /dev/null and b/assets/fonts/SourceSansPro-Semibold.otf differ diff --git a/assets/fonts/SourceSansPro-SemiboldIt.otf b/assets/fonts/SourceSansPro-SemiboldIt.otf new file mode 100755 index 0000000..e90515b Binary files /dev/null and b/assets/fonts/SourceSansPro-SemiboldIt.otf differ diff --git a/assets/fonts/SourceSansPro-license.txt b/assets/fonts/SourceSansPro-license.txt new file mode 100755 index 0000000..87ec82c --- /dev/null +++ b/assets/fonts/SourceSansPro-license.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012, 2014 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/assets/fonts/SourceSansPro-readme.md b/assets/fonts/SourceSansPro-readme.md new file mode 100755 index 0000000..a3e1b9d --- /dev/null +++ b/assets/fonts/SourceSansPro-readme.md @@ -0,0 +1,20 @@ +# Source Sans Pro + +Source Sans Pro is a set of OpenType fonts that have been designed to work well +in user interface (UI) environments. In addition to a functional OpenType font, this open +source project provides all of the source files that were used to build this OpenType font +by using the AFDKO makeotf tool. + +## Font installation instructions + +* [Mac OS X](http://support.apple.com/kb/HT2509) +* [Windows](http://windows.microsoft.com/en-us/windows-vista/install-or-uninstall-fonts) +* [Linux/Unix-based systems](https://github.com/adobe-fonts/source-code-pro/issues/17#issuecomment-8967116) + +## Getting Involved + +Send suggestions for changes to the Source Sans OpenType font project maintainer, [Paul D. Hunt](mailto:opensourcefonts@adobe.com?subject=[GitHub] Source Sans Pro), for consideration. + +## Further information + +For information about the design and background of Source Sans, please refer to the [official font readme file](http://www.adobe.com/products/type/font-information/source-sans-pro-readme.html). diff --git a/assets/levels/level0.lvl b/assets/levels/level0.lvl new file mode 100755 index 0000000..714f257 --- /dev/null +++ b/assets/levels/level0.lvl @@ -0,0 +1,16 @@ +111011111111011110111111110111 +100000000000000000000000000001 +101101110111011110111011101101 +001000000000000000000000000100 +101011110110111111011011110101 +101010000610034050016000010101 +000010111010000000010111010000 +101010100011111111110001010101 +101010101000000000000101010101 +000010101011101101110101010000 +101010100000002000000001010101 +101010111111011110111111010101 +001600000000000000000000006100 +101101110111011110111011101101 +100000000000000000000000000001 +111011111111011110111111110111 diff --git a/assets/levels/level0.png b/assets/levels/level0.png new file mode 100755 index 0000000..b5d8532 Binary files /dev/null and b/assets/levels/level0.png differ diff --git a/assets/levels/level0.xcf b/assets/levels/level0.xcf new file mode 100755 index 0000000..052a507 Binary files /dev/null and b/assets/levels/level0.xcf differ diff --git a/assets/meshes/ball.blend b/assets/meshes/ball.blend new file mode 100644 index 0000000..5c93f7c Binary files /dev/null and b/assets/meshes/ball.blend differ diff --git a/assets/meshes/ball.f3d b/assets/meshes/ball.f3d new file mode 100644 index 0000000..e3a1968 Binary files /dev/null and b/assets/meshes/ball.f3d differ diff --git a/assets/meshes/box-1x1x1.blend b/assets/meshes/box-1x1x1.blend new file mode 100644 index 0000000..b18609a Binary files /dev/null and b/assets/meshes/box-1x1x1.blend differ diff --git a/assets/meshes/box-1x1x1.f3d b/assets/meshes/box-1x1x1.f3d new file mode 100644 index 0000000..e2d189a Binary files /dev/null and b/assets/meshes/box-1x1x1.f3d differ diff --git a/assets/meshes/floor.blend b/assets/meshes/floor.blend new file mode 100644 index 0000000..f39c33c Binary files /dev/null and b/assets/meshes/floor.blend differ diff --git a/assets/meshes/floor.f3d b/assets/meshes/floor.f3d new file mode 100644 index 0000000..9649350 Binary files /dev/null and b/assets/meshes/floor.f3d differ diff --git a/assets/meshes/light.blend b/assets/meshes/light.blend new file mode 100644 index 0000000..6769f7f Binary files /dev/null and b/assets/meshes/light.blend differ diff --git a/assets/meshes/light.f3d b/assets/meshes/light.f3d new file mode 100644 index 0000000..9bd3376 Binary files /dev/null and b/assets/meshes/light.f3d differ diff --git a/assets/meshes/sprite-quad.blend b/assets/meshes/sprite-quad.blend new file mode 100755 index 0000000..07ac206 Binary files /dev/null and b/assets/meshes/sprite-quad.blend differ diff --git a/assets/meshes/sprite-quad.f3d b/assets/meshes/sprite-quad.f3d new file mode 100755 index 0000000..b827a56 Binary files /dev/null and b/assets/meshes/sprite-quad.f3d differ diff --git a/assets/shaders/compositor-fragment.glsl b/assets/shaders/compositor-fragment.glsl new file mode 100755 index 0000000..6454ec6 --- /dev/null +++ b/assets/shaders/compositor-fragment.glsl @@ -0,0 +1,19 @@ +#version 450 + +layout (location = 0) in vec3 vPosition; +layout (location = 1) in vec2 vTexCoords; + +layout (location = 0) out vec4 outColor; + +layout (binding = 0) uniform sampler2D albedo; +layout (binding = 1) uniform sampler2D light; + +void main() { + // Texturing + vec4 albedoTexel = texture2D(albedo, vTexCoords); + vec4 lightTexel = texture2D(light, vTexCoords); + + // Final color + outColor = albedoTexel * (lightTexel); + outColor.a = albedoTexel.a; +} diff --git a/assets/shaders/compositor-vertex.glsl b/assets/shaders/compositor-vertex.glsl new file mode 100755 index 0000000..162a091 --- /dev/null +++ b/assets/shaders/compositor-vertex.glsl @@ -0,0 +1,19 @@ +#version 450 + +layout (location=0) in vec3 vPosition; + +layout (location=0) out vec3 vPosition2; +layout (location=1) out vec2 vTexCoords2; + +void main() { + // Handle texCoords + if (vPosition.x < 0) vTexCoords2.x = 0; + if (vPosition.y < 0) vTexCoords2.y = 0; + + if (vPosition.x > 0) vTexCoords2.x = 1; + if (vPosition.y > 0) vTexCoords2.y = 1; + + // Handle position + vPosition2 = vPosition; + gl_Position = vec4(vPosition, 1.0); +} diff --git a/assets/shaders/directional-light-fragment.glsl b/assets/shaders/directional-light-fragment.glsl new file mode 100644 index 0000000..a53e033 --- /dev/null +++ b/assets/shaders/directional-light-fragment.glsl @@ -0,0 +1,79 @@ +#version 450 + +layout (location = 0) in vec3 vertexViewSpacePosition; +layout (location = 1) in vec2 vertexTexCoords; + +layout (location = 0) out vec4 fragLight; + +layout (binding = 0) uniform sampler2D albedo; ///< g-buffer colors +layout (binding = 1) uniform sampler2D worldSpacePositionMap; ///< vertex position in world-space +layout (binding = 2) uniform sampler2D viewSpacePositionMap; ///< vertex position in view-space +layout (binding = 3) uniform sampler2D normalMap; ///< vertex normal in view-space +layout (binding = 4) uniform sampler2DShadow shadowMap; ///< shadow map + +uniform mat4 viewMatrix; // From world-space to camera view-space +uniform mat4 shadowMatrix; // From world-space to shadowCamera view-space + +uniform vec3 light_color; +uniform float light_intensity; +uniform vec3 light_direction; + +vec3 directionalLightADS(vec3 viewSpaceDirection, + vec3 viewSpaceNormal, + vec3 viewSpaceObjectPosition, + vec3 color, + float intensity) +{ + // Lighting + float Li = intensity; + vec3 Ka = vec3(0.2); + vec3 Kd = color; + vec3 Ks = vec3(0.5); + float shininess = 10; + + vec3 n = viewSpaceNormal; + vec3 s = viewSpaceDirection; + vec3 v = normalize(-vec3(viewSpaceObjectPosition)); + vec3 h = normalize(v + s); + + vec3 pixelLight = vec3((0.2) + Li) * + ((Kd) * max(dot(s, n), 0.0) + + (Ks) * pow(max(dot(h, n), 0.0), shininess)); + // Final color + return pixelLight; +} + +vec4 getShadow(vec3 a, vec3 ds) +{ + vec4 wp = texture(worldSpacePositionMap, vertexTexCoords); + vec4 shadowCoord = shadowMatrix * wp; + + float visibility = 1.0; + if(shadowCoord.z >= 0 ) { +// vec4 normalTexel = texture(normalMap, vertexTexCoords); +// float bias = max(0.05 * (1.0 - dot(normalTexel.xyz, light_direction)), 0.005); +// visibility = textureProj(shadowMap, vec4(shadowCoord.xy, shadowCoord.z-bias, shadowCoord.w), bias); +// shadowCoord.z -= bias; + visibility = textureProj(shadowMap, shadowCoord); + } + + return vec4(a + ds * visibility, 1.0); +} + +void main() +{ + // Get texels + vec4 positionTexel = texture(viewSpacePositionMap, vertexTexCoords); + vec4 normalTexel = texture(normalMap, vertexTexCoords); + + // Lighting calc + vec3 a = vec3(0.2); + vec3 ds = directionalLightADS(normalize(viewMatrix * vec4(light_direction, 0)).xyz, + normalTexel.xyz, + positionTexel.xyz, + light_color, + light_intensity); + + fragLight = vec4(a + ds, 1);//getShadow(a, ds); +// fragLight = getShadow(a, ds); +} diff --git a/assets/shaders/directional-light-vertex.glsl b/assets/shaders/directional-light-vertex.glsl new file mode 100644 index 0000000..8798f6e --- /dev/null +++ b/assets/shaders/directional-light-vertex.glsl @@ -0,0 +1,19 @@ +#version 450 + +layout (location = 0) in vec3 vertexPosition; + +layout (location = 0) out vec3 vertexViewSpacePosition; +layout (location = 1) out vec2 vertexTexCoords; + +void main() { + // Handle texCoords + if (vertexPosition.x < 0) vertexTexCoords.x = 0; + if (vertexPosition.y < 0) vertexTexCoords.y = 0; + + if (vertexPosition.x > 0) vertexTexCoords.x = 1; + if (vertexPosition.y > 0) vertexTexCoords.y = 1; + + // Handle position + vertexViewSpacePosition = vertexPosition; + gl_Position = vec4(vertexPosition, 1.0); +} diff --git a/assets/shaders/model-default-depth-fragment.glsl b/assets/shaders/model-default-depth-fragment.glsl new file mode 100644 index 0000000..85466b6 --- /dev/null +++ b/assets/shaders/model-default-depth-fragment.glsl @@ -0,0 +1,25 @@ +#version 450 + +layout (location = 0) in vec3 vertexViewSpacePosition; +layout (location = 1) in vec2 vertexTexCoords; + +layout (location = 0) out vec4 fragAlbedo; + +layout (binding = 0) uniform sampler2D albedoTextureID; + +uniform vec3 albedoColor; + +void main() +{ + // Texturing + vec4 texelColor = texture(albedoTextureID, vertexTexCoords); + + // Discard fragment if transparent + if (texelColor.a < 0.5f) + { + discard; + } + + // Final color + fragAlbedo = vec4(albedoColor.rgb, 1); +} diff --git a/assets/shaders/model-default-depth-vertex.glsl b/assets/shaders/model-default-depth-vertex.glsl new file mode 100644 index 0000000..dcbba35 --- /dev/null +++ b/assets/shaders/model-default-depth-vertex.glsl @@ -0,0 +1,21 @@ +#version 450 + +layout (location = 0) in vec3 vertexPosition; +layout (location = 1) in vec2 vertexTexCoords; +layout (location = 2) in vec3 vertexNormal; + +layout (location = 0) out vec3 vertexViewSpacePosition; +layout (location = 1) out vec2 vertexTexCoordsOut; + + +uniform mat4 modelViewMatrix; +uniform mat4 modelViewProjectionMatrix; + +void main() { + // Handle position + vertexViewSpacePosition = vec3((modelViewMatrix * vec4(vertexPosition, 1.0)).xyz); + gl_Position = modelViewProjectionMatrix * vec4(vertexPosition, 1.0); + + // Handle texCoords + vertexTexCoordsOut = vertexTexCoords; +} diff --git a/assets/shaders/model-default-fragment.glsl b/assets/shaders/model-default-fragment.glsl new file mode 100644 index 0000000..783fedb --- /dev/null +++ b/assets/shaders/model-default-fragment.glsl @@ -0,0 +1,34 @@ +#version 450 + +layout (location = 0) in vec3 vertexWorldSpacePosition; +layout (location = 1) in vec3 vertexViewSpacePosition; +layout (location = 2) in vec2 vertexTexCoords; +layout (location = 3) in vec3 vertexViewSpaceNormal; + +layout (location = 0) out vec4 fragAlbedo; +layout (location = 1) out vec4 fragWorldSpacePosition; +layout (location = 2) out vec4 fragViewSpacePosition; +layout (location = 3) out vec4 fragViewSpaceNormal; + +layout (binding = 0) uniform sampler2D albedoTextureID; + +uniform vec3 albedoColor; + +void main() +{ + // Texturing + vec2 flipped_texcoord = vec2(vertexTexCoords.x, 1.0 - vertexTexCoords.y); + vec4 texelColor = texture(albedoTextureID, flipped_texcoord); + + // Discard fragment if transparent + if (texelColor.a < 0.5f) + { + discard; + } + + // Final color + fragAlbedo = vec4(texelColor.rgb*albedoColor, texelColor.a); + fragWorldSpacePosition = vec4(vertexWorldSpacePosition, 1); + fragViewSpacePosition = vec4(vertexViewSpacePosition, 1); + fragViewSpaceNormal = vec4(vertexViewSpaceNormal, 1); +} diff --git a/assets/shaders/model-default-vertex.glsl b/assets/shaders/model-default-vertex.glsl new file mode 100644 index 0000000..c17cf45 --- /dev/null +++ b/assets/shaders/model-default-vertex.glsl @@ -0,0 +1,31 @@ +#version 450 + +layout (location = 0) in vec3 vertexPosition; +layout (location = 1) in vec2 vertexTexCoords; +layout (location = 2) in vec3 vertexNormal; + +layout (location = 0) out vec3 vertexWorldSpacePosition; +layout (location = 1) out vec3 vertexViewSpacePosition; +layout (location = 2) out vec2 vertexTexCoordsOut; +layout (location = 3) out vec3 vertexViewSpaceNormal; + + +//uniform mat4 modelMatrix; +//uniform mat4 viewMatrix; +uniform mat4 modelViewMatrix; +//uniform mat4 projectionMatrix; +uniform mat4 modelViewProjectionMatrix; +uniform mat3 normalMatrix; + +void main() { + // Handle position + vertexWorldSpacePosition = vertexPosition; + vertexViewSpacePosition = vec3((modelViewMatrix * vec4(vertexPosition, 1.0)).xyz); + gl_Position = modelViewProjectionMatrix * vec4(vertexPosition, 1.0); + + // Handle texCoords + vertexTexCoordsOut = vertexTexCoords; + + // Handle normal + vertexViewSpaceNormal = normalize(normalMatrix * vertexNormal); +} diff --git a/assets/shaders/point-light-fragment.glsl b/assets/shaders/point-light-fragment.glsl new file mode 100644 index 0000000..e501be8 --- /dev/null +++ b/assets/shaders/point-light-fragment.glsl @@ -0,0 +1,63 @@ +#version 450 + +layout (location = 0) in vec3 vertexViewSpacePosition; +layout (location = 1) in vec2 vertexTexCoords; + +layout (location = 0) out vec4 fragLight; + +layout (binding = 0) uniform sampler2D albedoMap; ///< g-buffer colors +layout (binding = 1) uniform sampler2D worldSpacePositionMap; ///< vertex position in world-space +layout (binding = 2) uniform sampler2D viewSpacePositionMap; ///< vertex position in view-space +layout (binding = 3) uniform sampler2D normalMap; ///< vertex normal in view-space +layout (binding = 4) uniform sampler2DShadow shadowMap; ///< shadow map + +uniform mat4 viewMatrix; // From world-space to camera view-space +uniform mat4 shadowMatrix; // From world-space to shadowCamera view-space + +uniform vec3 light_color; +uniform float light_intensity; +uniform float light_attenuation; +uniform vec3 light_position; + +vec3 pointLightADS(vec4 diffuseTexel, + vec3 positionTexel, + vec3 NormalTexel) +{ + // Light position + vec3 light_position_viewSpace = (viewMatrix * vec4(light_position, 1)).xyz; + + // Lighting + vec3 Lp = light_position_viewSpace; + float Li = light_intensity; + vec3 Ka = vec3(0.0); + vec3 Kd = light_color; + vec3 Ks = vec3(0.5); + float shininess = 10; + vec3 n = normalize(NormalTexel); + vec3 s = normalize(vec3(Lp) - positionTexel); + vec3 v = normalize(vec3(-positionTexel)); + vec3 h = normalize(v + s); + + float attentuationFactor = light_attenuation; + float distanceToLight = length(Lp.xyz - positionTexel.xyz); + float attenuation = 1.0 / (1.0 + attentuationFactor * pow(distanceToLight, 2)); + + vec3 pixelLight = vec3(Li * (Ka * diffuseTexel.rgb) + + attenuation * + ((Kd * diffuseTexel.rgb) * max(dot(s, n), 0.0) + + (Ks * diffuseTexel.rgb) * pow(max(dot(h, n), 0.0), shininess))); + + // Final color + return pixelLight; +} + +void main() +{ + // Lighting calc + vec3 a = vec3(0.0); + vec3 ds = pointLightADS(texture(albedoMap, vertexTexCoords), + texture(viewSpacePositionMap, vertexTexCoords).xyz, + texture(normalMap, vertexTexCoords).xyz); + + fragLight = vec4(a + ds, 1); +} diff --git a/assets/shaders/point-light-vertex.glsl b/assets/shaders/point-light-vertex.glsl new file mode 100644 index 0000000..8798f6e --- /dev/null +++ b/assets/shaders/point-light-vertex.glsl @@ -0,0 +1,19 @@ +#version 450 + +layout (location = 0) in vec3 vertexPosition; + +layout (location = 0) out vec3 vertexViewSpacePosition; +layout (location = 1) out vec2 vertexTexCoords; + +void main() { + // Handle texCoords + if (vertexPosition.x < 0) vertexTexCoords.x = 0; + if (vertexPosition.y < 0) vertexTexCoords.y = 0; + + if (vertexPosition.x > 0) vertexTexCoords.x = 1; + if (vertexPosition.y > 0) vertexTexCoords.y = 1; + + // Handle position + vertexViewSpacePosition = vertexPosition; + gl_Position = vec4(vertexPosition, 1.0); +} diff --git a/assets/shaders/sprite-fragment.glsl b/assets/shaders/sprite-fragment.glsl new file mode 100755 index 0000000..3d63580 --- /dev/null +++ b/assets/shaders/sprite-fragment.glsl @@ -0,0 +1,52 @@ +#version 130 + +in vec3 vPosition2; +in vec2 vTexCoords2; +in vec3 vNormal2; + +out vec4 outColor; + +uniform vec3 diffuseColor; +uniform sampler2D diffuseTextureID; + +uniform mat4 viewMatrix; + +uniform vec3 light_color; +uniform float light_intensity; +uniform vec3 light_position; +vec3 light_position_viewSpace; + + +void main() { + // Texturing + vec2 flipped_texcoord = vec2(vTexCoords2.x, 1.0 - vTexCoords2.y); + vec4 pixelColor = texture2D(diffuseTextureID, flipped_texcoord); + + light_position_viewSpace = (viewMatrix * vec4(light_position, 1)).xyz; + + // Lighting + vec3 Lp = light_position_viewSpace; + float Li = light_intensity; + vec3 Ka = vec3(0.2); + vec3 Kd = light_color; + vec3 Ks = vec3(0.6); + float shininess = 1; + vec3 n = normalize(vNormal2); + vec3 s = normalize(vec3(Lp) - vPosition2); + vec3 v = normalize(vec3(-vPosition2)); + vec3 h = normalize(v + s); + vec3 pixelLight = vec3(Li * (Ka * pixelColor.rgb) + + (Kd * pixelColor.rgb) * max(dot(s, n), 0.0) + + (Ks * pixelColor.rgb) * pow(max(dot(h, n), 0.0), shininess)); + + // Discard fragment if transparent + if (pixelColor.a < 0.5f) + { + discard; + } + + // Final color + outColor = vec4(pixelColor.rgb*diffuseColor*pixelLight, pixelColor.a); + //outColor = vec4((pixelColor.rgb), 1);//*diffuseColor*pixelLight).x, 1, 1, 1); + //outColor = vec4(1,1,1,1) + vec4(diffuseColor, 1) - vec4(diffuseColor, 1); +} diff --git a/assets/shaders/sprite-vertex.glsl b/assets/shaders/sprite-vertex.glsl new file mode 100755 index 0000000..2ec2db7 --- /dev/null +++ b/assets/shaders/sprite-vertex.glsl @@ -0,0 +1,33 @@ +#version 130 + +in vec3 vPosition; +in vec2 vTexCoords; +in vec3 vNormal; + +out vec3 vPosition2; +out vec2 vTexCoords2; +out vec3 vNormal2; + +uniform mat4 modelMatrix; +uniform mat4 viewMatrix; +uniform mat4 projectionMatrix; +uniform mat3 normalMatrix; + +mat4 modelViewMatrix; +mat4 modelViewProjectionMatrix; + +void main() { + // Handle texCoords + vTexCoords2 = vTexCoords; + + // Handle normal + vNormal2 = normalize(normalMatrix * vNormal); + + // Matrices + modelViewMatrix = viewMatrix * modelMatrix; + modelViewProjectionMatrix = projectionMatrix * modelViewMatrix; + + // Handle position + vPosition2 = vec3((modelViewMatrix * vec4(vPosition, 1.0)).xyz); + gl_Position = modelViewProjectionMatrix * vec4(vPosition, 1.0); +} diff --git a/assets/shaders/text-fragment.glsl b/assets/shaders/text-fragment.glsl new file mode 100755 index 0000000..afb26e8 --- /dev/null +++ b/assets/shaders/text-fragment.glsl @@ -0,0 +1,19 @@ +#version 130 + +in vec3 vPosition2; +in vec2 vTexCoords2; +in vec3 vNormal2; + +out vec4 outColor; + +uniform vec3 diffuseColor; +uniform sampler2D diffuseTextureID; + +void main() { + // Texturing + vec4 pixelColor = texture2D(diffuseTextureID, vTexCoords2); + + // Final color + outColor = vec4(diffuseColor.rgb, pixelColor.r); + outColor = vec4(1); +} diff --git a/assets/shaders/text-vertex.glsl b/assets/shaders/text-vertex.glsl new file mode 100755 index 0000000..35ca031 --- /dev/null +++ b/assets/shaders/text-vertex.glsl @@ -0,0 +1,21 @@ +#version 130 + +in vec3 vPosition; +in vec2 vTexCoords; +in vec3 vNormal; + +out vec3 vPosition2; +out vec2 vTexCoords2; +out vec3 vNormal2; + +void main() { + // Handle texCoords + vTexCoords2 = vTexCoords; + + // Handle normal + vNormal2 = vNormal; + + // Handle position + vPosition2 = vPosition; + gl_Position = vec4(vPosition, 1.0); +} diff --git a/assets/sounds/accept-melody.ogg b/assets/sounds/accept-melody.ogg new file mode 100755 index 0000000..bdf367e Binary files /dev/null and b/assets/sounds/accept-melody.ogg differ diff --git a/assets/sounds/accept.ogg b/assets/sounds/accept.ogg new file mode 100755 index 0000000..575e14a Binary files /dev/null and b/assets/sounds/accept.ogg differ diff --git a/assets/sounds/consume-cherry.ogg b/assets/sounds/consume-cherry.ogg new file mode 100755 index 0000000..c92bf62 Binary files /dev/null and b/assets/sounds/consume-cherry.ogg differ diff --git a/assets/sounds/consume-pellet.ogg b/assets/sounds/consume-pellet.ogg new file mode 100755 index 0000000..c92bf62 Binary files /dev/null and b/assets/sounds/consume-pellet.ogg differ diff --git a/assets/textures/ball.xcf b/assets/textures/ball.xcf new file mode 100644 index 0000000..3a713b6 Binary files /dev/null and b/assets/textures/ball.xcf differ diff --git a/assets/textures/base-ball.png b/assets/textures/base-ball.png new file mode 100644 index 0000000..ee5e40e Binary files /dev/null and b/assets/textures/base-ball.png differ diff --git a/assets/textures/blue-rubber-ball.png b/assets/textures/blue-rubber-ball.png new file mode 100644 index 0000000..94545d0 Binary files /dev/null and b/assets/textures/blue-rubber-ball.png differ diff --git a/assets/textures/box-1x1x1-albedo.png b/assets/textures/box-1x1x1-albedo.png new file mode 100644 index 0000000..1f84f35 Binary files /dev/null and b/assets/textures/box-1x1x1-albedo.png differ diff --git a/assets/textures/box-1x1x1-albedo.xcf b/assets/textures/box-1x1x1-albedo.xcf new file mode 100644 index 0000000..04e87ff Binary files /dev/null and b/assets/textures/box-1x1x1-albedo.xcf differ diff --git a/assets/textures/box-1x1x1-uv.png b/assets/textures/box-1x1x1-uv.png new file mode 100644 index 0000000..07ad8e2 Binary files /dev/null and b/assets/textures/box-1x1x1-uv.png differ diff --git a/assets/textures/floor.png b/assets/textures/floor.png new file mode 100755 index 0000000..3d7f5b6 Binary files /dev/null and b/assets/textures/floor.png differ diff --git a/assets/textures/floor.xcf b/assets/textures/floor.xcf new file mode 100644 index 0000000..36baed5 Binary files /dev/null and b/assets/textures/floor.xcf differ diff --git a/assets/textures/pink-rubber-ball.png b/assets/textures/pink-rubber-ball.png new file mode 100644 index 0000000..1b87d0e Binary files /dev/null and b/assets/textures/pink-rubber-ball.png differ diff --git a/assets/textures/red-rubber-ball.png b/assets/textures/red-rubber-ball.png new file mode 100644 index 0000000..de5720f Binary files /dev/null and b/assets/textures/red-rubber-ball.png differ diff --git a/assets/textures/tennis-ball.png b/assets/textures/tennis-ball.png new file mode 100644 index 0000000..2ddf8de Binary files /dev/null and b/assets/textures/tennis-ball.png differ diff --git a/assets/textures/white-rubber-ball.png b/assets/textures/white-rubber-ball.png new file mode 100644 index 0000000..272ea47 Binary files /dev/null and b/assets/textures/white-rubber-ball.png differ diff --git a/src/BallFactory.cpp b/src/BallFactory.cpp new file mode 100644 index 0000000..cc87e8a --- /dev/null +++ b/src/BallFactory.cpp @@ -0,0 +1,89 @@ +/* + * BallFactory.cpp + * + * Created on: Aug 9, 2019 + * Author: fredrick + */ + +#include "BallFactory.h" + +namespace JamSpook { + +BallFactory::BallFactory(weak_ptr assetSystem, + weak_ptr graphicsSystem, + weak_ptr physicsSystem, + weak_ptr renderLayer): + mAssetSystem(assetSystem), + mGraphicsSystem(graphicsSystem), + mPhysicsSystem(physicsSystem), + mRenderLayer(renderLayer) +{} + +BallFactory::~BallFactory() +{} + +shared_ptr BallFactory::createBall(const vec3 position, + const float radius, + const float mass, + const float restitution, + const string& name, + const vec3 lightColor) +{ + // Create instance + shared_ptr entity = make_shared(); + entity->setEntityTag(name + "_ball"); + SceneGraph::addEntity(entity); + mat4 transform = translate(mat4(1), position); + + // Add physics component + ColliderFactory* colliderFactory = new ColliderFactory(mPhysicsSystem); + shared_ptr physicsComponent = + make_shared( + transform, + entity, + getShared(mPhysicsSystem), + getShared(mPhysicsSystem), + getShared(mPhysicsSystem), + colliderFactory->createSphereCollider(position, + quat(vec3(0,0,0)), + radius, // radius + mass, // mass + entity, + entity->getEntityTag())); + delete colliderFactory; + // Note: Editing of rigid body params, maybe only has effect is it has been added to the world. + physicsComponent->getCollider()->getRigidBody()->setLinearFactor(btVector3(1,1,1)); // allow all positional movement movement + physicsComponent->getCollider()->getRigidBody()->setAngularFactor(btVector3(1,1,1)); // allow all rotational movement movement + physicsComponent->getCollider()->getRigidBody()->setRestitution(restitution); + entity->addComponent(physicsComponent); + + // Add graphics component + shared_ptr graphicsComponent = make_shared(transform, + entity, + getShared(mGraphicsSystem), + mRenderLayer); + graphicsComponent->setScale(vec3(radius*2)); + entity->addComponent(graphicsComponent); + + // Add the ModelRenderable of a ball + ModelRenderableFactory* modelFactory = new ModelRenderableFactory(mAssetSystem); + shared_ptr modelRenderable = modelFactory->createModel("ball.f3d", + name + "-ball.png", + name + "-model"); + delete modelFactory; + graphicsComponent->addRenderable(modelRenderable); + + // Add internal pointlight + LightSourceFactory* lightSourceFactory = new LightSourceFactory(mAssetSystem, mGraphicsSystem); + shared_ptr lightSource = lightSourceFactory->createPointLight(lightColor, + 0.02f, + 0.03f, + transform); + graphicsComponent->setLightSource(lightSource); + delete lightSourceFactory; + + // Return instance + return entity; +} + +} // namespace JamSpook diff --git a/src/BallFactory.h b/src/BallFactory.h new file mode 100644 index 0000000..fbdc88d --- /dev/null +++ b/src/BallFactory.h @@ -0,0 +1,125 @@ +/* + * BallFactory.h + * + * Created on: Aug 9, 2019 + * Author: fredrick + */ + +#ifndef BALLFACTORY_H_ +#define BALLFACTORY_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "BallPhysicsComponent.h" + +namespace JamSpook { + +using std::string; +using std::shared_ptr; +using std::make_shared; +using std::weak_ptr; +using std::dynamic_pointer_cast; +using std::function; +using std::bind; +using std::vector; +using glm::vec3; +using glm::mat4; +using glm::quat; +using glm::translate; +using ecos::utility::getShared; +using ecos::core::IDCache; +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::BroadcastObservable; +using ecos::core::Message; +using ecos::core::Entity; +using ecos::core::SceneGraph; +using ecos::core::ICCResponseComponent; +using ecos::asset::AssetSystem; +using ecos::asset::DataManagementMode; +using ecos::graphics::GraphicsSystem; +using ecos::graphics::GraphicsComponent; +using ecos::graphics::RenderLayer; +using ecos::graphics::TextureFactory; +using ecos::graphics::Texture; +using ecos::graphics::ShaderType; +using ecos::graphics::ShaderAsset; +using ecos::graphics::ShaderProgram; +using ecos::graphics::ShaderProgramFactory; +using ecos::graphics::Material; +using ecos::graphics::MaterialFactory; +using ecos::graphics::Mesh; +using ecos::graphics::MeshFactory; +using ecos::graphics::ModelRenderableFactory; +using ecos::graphics::ModelRenderable; +using ecos::graphics::lighting::LightSource; +using ecos::graphics::lighting::LightSourceFactory; +using ecos::physics::PhysicsSystem; +using ecos::physics::PhysicsComponent; +using ecos::physics::ColliderFactory; +using ecos::physics::Collider; + +class BallFactory +{ +private: + weak_ptr mAssetSystem; + weak_ptr mGraphicsSystem; + weak_ptr mPhysicsSystem; + weak_ptr mRenderLayer; + +public: + BallFactory(weak_ptr assetSystem, + weak_ptr graphicsSystem, + weak_ptr physicsSystem, + weak_ptr renderLayer); + virtual ~BallFactory(); + + shared_ptr createBall(const vec3 position, + const float radius, + const float mass, + const float restitution, + const string& ballName, + const vec3 lightColor); +}; + +} // namespace JamSpook + +#endif // BALLFACTORY_H_ diff --git a/src/BallPhysicsComponent.cpp b/src/BallPhysicsComponent.cpp new file mode 100644 index 0000000..612b6f2 --- /dev/null +++ b/src/BallPhysicsComponent.cpp @@ -0,0 +1,57 @@ +/* + * BallPhysicsComponent.cpp + * + * Created on: Aug 9, 2019 + * Author: fredrick + */ + +#include "BallPhysicsComponent.h" + +namespace JamSpook { + +BallPhysicsComponent::BallPhysicsComponent(mat4 transform, + shared_ptr > > entity, + weak_ptr > physicsSystem, + weak_ptr > > physicsCollisionSubSystem, + weak_ptr > > physicsColliderQuerySubSystem, + shared_ptr collider): + PhysicsComponent(transform, + entity, + physicsSystem, + physicsCollisionSubSystem, + physicsColliderQuerySubSystem, + collider) +{} + +BallPhysicsComponent::~BallPhysicsComponent() +{} + +void BallPhysicsComponent::update(const milliseconds dtms) +{ +// Log::write(LogLevel::trace, "CollectablePhysicsComponent - update"); + PhysicsComponent::update(dtms); + + if (getPosition().y < -100.0f) + { + setPosition(vec3(getFloatInRange(-10.0f, 10.0f), + 10, /// above the ball + getFloatInRange(-10.0f, 10.0f))); + } +} + +void BallPhysicsComponent::onICCMessage(shared_ptr message) +{ + PhysicsComponent::onICCMessage(message); +} + +void BallPhysicsComponent::onCollision(const string& tag) +{ + if (tag == "ground-plane") + { + vec3 position = getPosition(); + setPosition(vec3(position.x, 10.0f, position.z)); + ICCBroadcast(make_shared(IDCache::get("GroundContactMessage"))); + } +} + +} // namespace JamSpook diff --git a/src/BallPhysicsComponent.h b/src/BallPhysicsComponent.h new file mode 100644 index 0000000..6ff1879 --- /dev/null +++ b/src/BallPhysicsComponent.h @@ -0,0 +1,74 @@ +/* + * BallPhysicsComponent.h + * + * Created on: Aug 9, 2019 + * Author: fredrick + */ + +#ifndef BALLPHYSICSCOMPONENT_H_ +#define BALLPHYSICSCOMPONENT_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace JamSpook { + +using std::chrono::milliseconds; +using std::weak_ptr; +using std::shared_ptr; +using std::make_shared; +using std::dynamic_pointer_cast; +using std::string; +using glm::vec3; +using glm::mat4; +using glm::translate; +using glm::scale; +using ecos::utility::getFloatInRange; +using ecos::core::IDCache; +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::Message; +using ecos::core::BroadcastObservable; +using ecos::physics::PhysicsSystem; +using ecos::physics::PhysicsComponent; +using ecos::physics::Collider; +using ecos::physics::TransformChangeMessage; +using ecos::physics::CollisionStateChangeMessage; +using ecos::physics::ColliderQueryMessage; + +class BallPhysicsComponent: + public ecos::physics::PhysicsComponent +{ +public: + BallPhysicsComponent(mat4 transform, + shared_ptr > > entity, + weak_ptr > physicsSystem, + weak_ptr > > physicsCollisionSubSystem, + weak_ptr > > physicsColliderQuerySubSystem, + shared_ptr collider); + virtual ~BallPhysicsComponent(); + + virtual void update(const milliseconds dtms); + virtual void onICCMessage(shared_ptr message); + virtual void onCollision(const string& tag); +}; + +} // namespace JamSpook + +#endif // BALLPHYSICSCOMPONENT_H_ diff --git a/src/BoxFactory.cpp b/src/BoxFactory.cpp new file mode 100644 index 0000000..2615b48 --- /dev/null +++ b/src/BoxFactory.cpp @@ -0,0 +1,52 @@ +/* + * BallFactory.cpp + * + * Created on: Aug 9, 2019 + * Author: fredrick + */ + +#include "BoxFactory.h" + +namespace JamSpook { + +BoxFactory::BoxFactory(weak_ptr assetSystem, + weak_ptr graphicsSystem, + weak_ptr renderLayer): + mAssetSystem(assetSystem), + mGraphicsSystem(graphicsSystem), + mRenderLayer(renderLayer) +{} + +BoxFactory::~BoxFactory() +{} + +shared_ptr BoxFactory::createBox(const vec3 position, + const vec3 radius) +{ + // Create instance + shared_ptr entity = make_shared(); + entity->setEntityTag("rando-box"); + SceneGraph::addEntity(entity); + mat4 transform = translate(mat4(1), position); + + // Add graphics component + shared_ptr graphicsComponent = make_shared(transform, + entity, + getShared(mGraphicsSystem), + mRenderLayer); + graphicsComponent->setScale(radius * 2.0f); + entity->addComponent(graphicsComponent); + + // Add the ModelRenderable of a ball + ModelRenderableFactory* modelFactory = new ModelRenderableFactory(mAssetSystem); + shared_ptr modelRenderable = modelFactory->createModel("box-1x1x1.f3d", + "box-1x1x1-albedo.png", + "box-1x1x1-model"); + delete modelFactory; + graphicsComponent->addRenderable(modelRenderable); + + // Return instance + return entity; +} + +} // namespace JamSpook diff --git a/src/BoxFactory.h b/src/BoxFactory.h new file mode 100644 index 0000000..c13c54e --- /dev/null +++ b/src/BoxFactory.h @@ -0,0 +1,113 @@ +/* + * BallFactory.h + * + * Created on: Aug 9, 2019 + * Author: fredrick + */ + +#ifndef BOXFACTORY_H_ +#define BOXFACTORY_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace JamSpook { + +using std::string; +using std::shared_ptr; +using std::make_shared; +using std::weak_ptr; +using std::dynamic_pointer_cast; +using std::function; +using std::bind; +using std::vector; +using glm::vec3; +using glm::mat4; +using glm::quat; +using glm::translate; +using ecos::utility::getShared; +using ecos::core::IDCache; +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::BroadcastObservable; +using ecos::core::Message; +using ecos::core::Entity; +using ecos::core::SceneGraph; +using ecos::core::ICCResponseComponent; +using ecos::asset::AssetSystem; +using ecos::asset::DataManagementMode; +using ecos::graphics::GraphicsSystem; +using ecos::graphics::GraphicsComponent; +using ecos::graphics::RenderLayer; +using ecos::graphics::TextureFactory; +using ecos::graphics::Texture; +using ecos::graphics::ShaderType; +using ecos::graphics::ShaderAsset; +using ecos::graphics::ShaderProgram; +using ecos::graphics::ShaderProgramFactory; +using ecos::graphics::Material; +using ecos::graphics::MaterialFactory; +using ecos::graphics::Mesh; +using ecos::graphics::MeshFactory; +using ecos::graphics::ModelRenderableFactory; +using ecos::graphics::ModelRenderable; +using ecos::graphics::lighting::LightSource; +using ecos::graphics::lighting::LightSourceFactory; + +class BoxFactory +{ +private: + weak_ptr mAssetSystem; + weak_ptr mGraphicsSystem; + weak_ptr mRenderLayer; + +public: + BoxFactory(weak_ptr assetSystem, + weak_ptr graphicsSystem, + weak_ptr renderLayer); + virtual ~BoxFactory(); + + shared_ptr createBox(const vec3 position, + const vec3 radius); +}; + +} // namespace JamSpook + +#endif // BOXFACTORY_H_ diff --git a/src/DirectionChangeMessage.cpp b/src/DirectionChangeMessage.cpp new file mode 100755 index 0000000..95bf17e --- /dev/null +++ b/src/DirectionChangeMessage.cpp @@ -0,0 +1,39 @@ +/* + * DirectionChangeMessage.cpp + * + * Created on: Oct 20, 2018 + * Author: fredrick + */ + +#include "DirectionChangeMessage.h" + +namespace JamSpook { + +DirectionChangeMessage::DirectionChangeMessage(const vec3 position, + const vec3 oldDirection, + const vec3 newDirection): + Message(IDCache::add("DirectionChangeMessage")), + mPosition(position), + mOldDirection(oldDirection), + mNewDirection(newDirection) +{} + +DirectionChangeMessage::~DirectionChangeMessage() +{} + +const vec3 DirectionChangeMessage::getPosition() const +{ + return mPosition; +} + +const vec3 DirectionChangeMessage::getOldDirection() const +{ + return mOldDirection; +} + +const vec3 DirectionChangeMessage::getNewDirection() const +{ + return mNewDirection; +} + +} // namespace JamSpook diff --git a/src/DirectionChangeMessage.h b/src/DirectionChangeMessage.h new file mode 100755 index 0000000..811959c --- /dev/null +++ b/src/DirectionChangeMessage.h @@ -0,0 +1,44 @@ +/* + * DirectionChangeMessage.h + * + * Created on: Oct 20, 2018 + * Author: fredrick + */ + +#ifndef DIRECTIONCHANGEMESSAGE_H_ +#define DIRECTIONCHANGEMESSAGE_H_ + +#include + +#include +#include + +namespace JamSpook { + +using glm::vec3; +using ecos::core::IDCache; +using ecos::core::Message; + +// DirectionChangeMessage +class DirectionChangeMessage : + public Message +{ +private: + vec3 mPosition; ///< Where the direction change occured + vec3 mOldDirection; + vec3 mNewDirection; + +public: + DirectionChangeMessage(const vec3 position, + const vec3 oldDirection, + const vec3 newDirection); + virtual ~DirectionChangeMessage(); + + const vec3 getPosition() const; + const vec3 getOldDirection() const; + const vec3 getNewDirection() const; +}; + +} // namespace JamSpook + +#endif // DIRECTIONCHANGEMESSAGE_H_ diff --git a/src/FloorFactory.cpp b/src/FloorFactory.cpp new file mode 100644 index 0000000..162ac96 --- /dev/null +++ b/src/FloorFactory.cpp @@ -0,0 +1,139 @@ +/* + * FloorFactory.cpp + * + * Created on: Aug 12, 2019 + * Author: fredrick + */ + +#include "FloorFactory.h" + +namespace JamSpook { + +FloorFactory::FloorFactory(weak_ptr assetSystem, + weak_ptr graphicsSystem, + weak_ptr physicsSystem, + weak_ptr renderLayer): + mAssetSystem(assetSystem), + mGraphicsSystem(graphicsSystem), + mPhysicsSystem(physicsSystem), + mRenderLayer(renderLayer) +{} + +FloorFactory::~FloorFactory() +{} + +shared_ptr FloorFactory::createFloor(const vec3 position) +{ + // Create instance + shared_ptr entity = make_shared(); + entity->setEntityTag("floor"); + SceneGraph::addEntity(entity); + mat4 transform = translate(mat4(1), position); + + // Add physics component + ColliderFactory* colliderFactory = new ColliderFactory(mPhysicsSystem); + shared_ptr physicsComponent = + make_shared( + transform, + entity, + getShared(mPhysicsSystem), + getShared(mPhysicsSystem), + getShared(mPhysicsSystem), + colliderFactory->createBoxCollider(position, + quat(vec3(0,0,0)), + vec3(10,1,10), // radius + 100.0f, // mass + entity, + entity->getEntityTag())); + delete colliderFactory; + // Note: Editing of rigid body params, maybe only has effect is it has been added to the world. + physicsComponent->getCollider()->getRigidBody()->setLinearFactor(btVector3(0,1,0)); // allow all positional movement movement + physicsComponent->getCollider()->getRigidBody()->setAngularFactor(btVector3(1,1,1)); // allow all rotational movement movement + physicsComponent->getCollider()->getRigidBody()->setRestitution(1); + entity->addComponent(physicsComponent); + + + // Add graphics component + shared_ptr graphicsComponent = make_shared(transform, + entity, + getShared(mGraphicsSystem), + mRenderLayer); + entity->addComponent(graphicsComponent); + + // Add the ModelRenderable of a ball + ModelRenderableFactory* modelFactory = new ModelRenderableFactory(mAssetSystem); + shared_ptr modelRenderable = modelFactory->createModel("floor.f3d", + "floor.png", + "floor-model"); + delete modelFactory; + graphicsComponent->addRenderable(modelRenderable); + +// // Add ICC response component for the collectable system +// weak_ptr wEntity = entity; +// entity->addComponent(make_shared(entity, [this, wEntity](shared_ptr message){ +// if (message->getMessageType() == IDCache::get("CollectedMessage")) +// { +// shared_ptr entity = dynamic_pointer_cast(getShared(wEntity)); +// if (entity->getEntityTag() == "pellet") +// { +// Log::write(LogLevel::debug, "collected pellet!"); +// } +// } +// })); + + // Return instance + return entity; +} + +shared_ptr FloorFactory::createStaticFloor(const vec3 position) +{ + // Create instance + shared_ptr entity = make_shared(); + entity->setEntityTag("floor"); + SceneGraph::addEntity(entity); + mat4 transform = translate(mat4(1), position); + + // Add physics component + ColliderFactory* colliderFactory = new ColliderFactory(mPhysicsSystem); + shared_ptr physicsComponent = + make_shared( + transform, + entity, + getShared(mPhysicsSystem), + getShared(mPhysicsSystem), + getShared(mPhysicsSystem), + colliderFactory->createBoxCollider(position, + quat(vec3(0,0,0)), + vec3(10,1,10), // radius + 0.0f, // mass + entity, + entity->getEntityTag())); + delete colliderFactory; + // Note: Editing of rigid body params, maybe only has effect is it has been added to the world. + physicsComponent->getCollider()->getRigidBody()->setLinearFactor(btVector3(0,0,0)); // allow all positional movement movement + physicsComponent->getCollider()->getRigidBody()->setAngularFactor(btVector3(0,0,0)); // allow all rotational movement movement + physicsComponent->getCollider()->getRigidBody()->setRestitution(0.9f); + entity->addComponent(physicsComponent); + + + // Add graphics component +// shared_ptr graphicsComponent = make_shared(transform, +// entity, +// getShared(mGraphicsSystem), +// mRenderLayer); +// graphicsComponent->setScale(vec3(2.0f, 1.0f, 2.0f)); +// entity->addComponent(graphicsComponent); + +// // Add the ModelRenderable of a ball +// ModelFactory* modelFactory = new ModelFactory(mAssetSystem); +// shared_ptr modelRenderable = modelFactory->createModel("floor.f3d", +// "floor.png", +// "floor-model"); +// delete modelFactory; +// graphicsComponent->addRenderable(modelRenderable); + + // Return instance + return entity; +} + +} // namespace JamSpook diff --git a/src/FloorFactory.h b/src/FloorFactory.h new file mode 100644 index 0000000..22f2664 --- /dev/null +++ b/src/FloorFactory.h @@ -0,0 +1,118 @@ +/* + * FloorFactory.h + * + * Created on: Aug 12, 2019 + * Author: fredrick + */ + +#ifndef FLOORFACTORY_H_ +#define FLOORFACTORY_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "FloorPhysicsComponent.h" + +namespace JamSpook { + +using std::string; +using std::shared_ptr; +using std::make_shared; +using std::weak_ptr; +using std::dynamic_pointer_cast; +using std::function; +using std::bind; +using std::vector; +using glm::vec3; +using glm::mat4; +using glm::quat; +using glm::translate; +using glm::scale; +using ecos::utility::getShared; +using ecos::core::IDCache; +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::BroadcastObservable; +using ecos::core::Message; +using ecos::core::Entity; +using ecos::core::SceneGraph; +using ecos::core::ICCResponseComponent; +using ecos::asset::AssetSystem; +using ecos::asset::DataManagementMode; +using ecos::graphics::GraphicsSystem; +using ecos::graphics::GraphicsComponent; +using ecos::graphics::RenderLayer; +using ecos::graphics::TextureFactory; +using ecos::graphics::Texture; +using ecos::graphics::ShaderType; +using ecos::graphics::ShaderAsset; +using ecos::graphics::ShaderProgram; +using ecos::graphics::ShaderProgramFactory; +using ecos::graphics::Material; +using ecos::graphics::MaterialFactory; +using ecos::graphics::Mesh; +using ecos::graphics::MeshFactory; +using ecos::graphics::ModelRenderableFactory; +using ecos::graphics::ModelRenderable; +using ecos::physics::PhysicsSystem; +using ecos::physics::PhysicsComponent; +using ecos::physics::ColliderFactory; +using ecos::physics::Collider; + +class FloorFactory +{ +private: + weak_ptr mAssetSystem; + weak_ptr mGraphicsSystem; + weak_ptr mPhysicsSystem; + weak_ptr mRenderLayer; + +public: + FloorFactory(weak_ptr assetSystem, + weak_ptr graphicsSystem, + weak_ptr physicsSystem, + weak_ptr renderLayer); + virtual ~FloorFactory(); + + shared_ptr createFloor(const vec3 position); + shared_ptr createStaticFloor(const vec3 position); +}; + +} // namespace JamSpook + +#endif // FLOORFACTORY_H_ diff --git a/src/FloorPhysicsComponent.cpp b/src/FloorPhysicsComponent.cpp new file mode 100644 index 0000000..2100709 --- /dev/null +++ b/src/FloorPhysicsComponent.cpp @@ -0,0 +1,50 @@ +/* + * FloorPhysicsComponent.cpp + * + * Created on: Aug 12, 2019 + * Author: fredrick + */ + +#include "FloorPhysicsComponent.h" + +namespace JamSpook { + +FloorPhysicsComponent::FloorPhysicsComponent(mat4 transform, + shared_ptr > > entity, + weak_ptr > physicsSystem, + weak_ptr > > physicsCollisionSubSystem, + weak_ptr > > physicsColliderQuerySubSystem, + shared_ptr collider): + PhysicsComponent(transform, + entity, + physicsSystem, + physicsCollisionSubSystem, + physicsColliderQuerySubSystem, + collider) +{} + +FloorPhysicsComponent::~FloorPhysicsComponent() +{} + +void FloorPhysicsComponent::update(const milliseconds dtms) +{ +// Log::write(LogLevel::trace, "CollectablePhysicsComponent - update"); + PhysicsComponent::update(dtms); +} + +void FloorPhysicsComponent::onICCMessage(shared_ptr message) +{ + PhysicsComponent::onICCMessage(message); +} + +void FloorPhysicsComponent::onCollision(const string& tag) +{ +// if (tag == "ground-plane") +// { +// vec3 position = getPosition(); +// setPosition(vec3(position.x, 10.0f, position.z)); +// ICCBroadcast(make_shared(IDCache::get("GroundContactMessage"))); +// } +} + +} // namespace JamSpook diff --git a/src/FloorPhysicsComponent.h b/src/FloorPhysicsComponent.h new file mode 100644 index 0000000..69c2757 --- /dev/null +++ b/src/FloorPhysicsComponent.h @@ -0,0 +1,73 @@ +/* + * FloorPhysicsComponent.h + * + * Created on: Aug 12, 2019 + * Author: fredrick + */ + +#ifndef FLOORPHYSICSCOMPONENT_H_ +#define FLOORPHYSICSCOMPONENT_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace JamSpook { + +using std::chrono::milliseconds; +using std::weak_ptr; +using std::shared_ptr; +using std::make_shared; +using std::dynamic_pointer_cast; +using std::string; +using glm::vec3; +using glm::mat4; +using glm::translate; +using glm::scale; + +using ecos::core::IDCache; +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::Message; +using ecos::core::BroadcastObservable; +using ecos::physics::PhysicsSystem; +using ecos::physics::PhysicsComponent; +using ecos::physics::Collider; +using ecos::physics::TransformChangeMessage; +using ecos::physics::CollisionStateChangeMessage; +using ecos::physics::ColliderQueryMessage; + +class FloorPhysicsComponent: + public PhysicsComponent +{ +public: + FloorPhysicsComponent(mat4 transform, + shared_ptr > > entity, + weak_ptr > physicsSystem, + weak_ptr > > physicsCollisionSubSystem, + weak_ptr > > physicsColliderQuerySubSystem, + shared_ptr collider); + virtual ~FloorPhysicsComponent(); + + virtual void update(const milliseconds dtms); + virtual void onICCMessage(shared_ptr message); + virtual void onCollision(const string& tag); +}; + +} // namespace JamSpook + +#endif // FLOORPHYSICSCOMPONENT_H_ diff --git a/src/JamSpookGame.cpp b/src/JamSpookGame.cpp new file mode 100644 index 0000000..0616cd3 --- /dev/null +++ b/src/JamSpookGame.cpp @@ -0,0 +1,448 @@ +/* + * JamSpookGame.cpp + * + * Created on: Aug 8, 2019 + * Author: fredrick + */ + +#include "JamSpookGame.h" + +namespace JamSpook { + +JamSpookGame::JamSpookGame(): + ecos::core::Game() +{ + + + Log::write(LogLevel::info, "Game - Constructor"); + setGameState(ecos::core::GameState::Launching); + + // Create cycle regulation system, to cap cycles per second and the the computer rest if has time + shared_ptr cycleRegulationSystem = make_shared(); + addSystem(cycleRegulationSystem); + + // Create asset subssystem for file change listening + const string assetPath = getRealPath(getWorkingPath() + "/assets"); + shared_ptr assetFileSystem = make_shared(assetPath); + addSystem(assetFileSystem); + + // Create asset system + shared_ptr assetSystem = make_shared(this, assetFileSystem); + addSystem(assetSystem); + + // Create window + Log::write(LogLevel::info, "Game - Constructor - Creating window"); + mWindow = make_shared("BouncyBalls", 1024, 1024, Window::WindowMode::window); + mWindow->hide(); + + // Create renderer + mRenderer = make_shared(); + + // Create physics system + addSystem(make_shared()); + + // Create animation system + addSystem(make_shared()); + + // Create interaction system + addSystem(make_shared()); + shared_ptr interactionSystem = dynamic_pointer_cast(findSystem(IDCache::get("InteractionSystem"))); + mCallbackId = interactionSystem->ecos::core::BroadcastObservable:: + addCallback(bind(&JamSpook::JamSpookGame::onSysCall, this, std::placeholders::_1)); + mInputDeviceCallbackId = interactionSystem->ecos::core::BroadcastObservable:: + addCallback(bind(&JamSpook::JamSpookGame::onInputDeviceStateChange, this, std::placeholders::_1)); + + // Create graphics system + shared_ptr graphicsSystem = make_shared(mWindow, + dynamic_pointer_cast(mRenderer)); + addSystem(graphicsSystem); + + // Create asset subsystem for image loading + addSystem(make_shared()); + + // Add graphics related asset loaders + assetSystem->addLoader(make_shared(assetPath), "MeshLoader"); + assetSystem->addLoader(make_shared(assetPath), "ShaderLoader"); + assetSystem->addLoader(make_shared(assetPath), "ShaderProgramLoader"); + assetSystem->addLoader(make_shared(assetPath), "TextureFileLoader"); + assetSystem->addLoader(make_shared(assetPath), "TextureBlankLoader"); + + // Add render layer compositor shader + ShaderProgramFactory* shaderProgramFactory = new ShaderProgramFactory(assetSystem); + vector > compositorShaders; + compositorShaders.push_back(make_shared("compositor-vertex.glsl", "compositor-vertex-shader", DataManagementMode::LoadOnAccessAndKeep, ShaderType::VertexShader)); + assetSystem->addAsset(compositorShaders.back()); + compositorShaders.push_back(make_shared("compositor-fragment.glsl", "compositor-fragment-shader", DataManagementMode::LoadOnAccessAndKeep, ShaderType::FragmentShader)); + assetSystem->addAsset(compositorShaders.back()); + shared_ptr compositorShaderProgram = shaderProgramFactory->createShaderProgram("compositor-shaderProgram", compositorShaders); + + delete shaderProgramFactory; + graphicsSystem->setCompositorShader(compositorShaderProgram); + + // Create the main camera + CameraFactory* camFactory = new CameraFactory(); +// mCamera = camFactory->createOrthogonal(vec3(0.0f, 0.0f, 50.0f), +// vec3(0.0f, 0.0f, 0.0f), // might be looking away from center +// vec4(-(tilesX/2.0f), // Left plane +// (tilesX/2.0f), // Right plane +// (tilesY/2.0f), // Top plane, +// -(tilesY/2.0f)), // Bottom plane +// 0.01f, +// 100.0f); + + // 16.0f/9.0f, + + mCamera = camFactory->createPerspective(vec3(-20.0f, 20.0f, 20.0f), + vec3(0.0f, 0.0f, 0.0f), + vec3(0.0f, 1.0f, 0.0f), + 90.0f/2, + static_cast(mWindow->getWindowSize().x)/mWindow->getWindowSize().y, + 0.1f, + 1000.0f); + + delete camFactory; + mRenderer->setCamera(mCamera); + + // Create render layers + // Add render layers + RenderLayerFactory* renderLayerFactory = new RenderLayerFactory(assetSystem, mWindow); +// graphicsSystem->addRenderLayer(renderLayerFactory->createRenderLayer("rl-bg", mCamera)); + graphicsSystem->addRenderLayer(renderLayerFactory->createRenderLayer("rl-game", mCamera)); + graphicsSystem->addRenderLayer(renderLayerFactory->createRenderLayer("rl-gui", mCamera)); + delete renderLayerFactory; + + // Add Sound system + addSystem(make_shared(assetSystem)); + assetSystem->addLoader(make_shared(assetPath), "SoundEffectLoader"); + + // Show window + mWindow->show(); +// SDL_ShowCursor(SDL_DISABLE); + mWindow->setWindowMode(Window::WindowMode::window); +} + +JamSpookGame::~JamSpookGame() +{ + Log::write(LogLevel::info, "Game - Destructor."); + + // Hide window + mWindow->hide(); + + // Destroy all entities + SceneGraph::clear(); + + // Remove SysCall callback + dynamic_pointer_cast(findSystem(IDCache::get("InteractionSystem")))->ecos::core::BroadcastObservable::removeCallback(mCallbackId); + dynamic_pointer_cast(findSystem(IDCache::get("InteractionSystem")))->ecos::core::BroadcastObservable::removeCallback(mInputDeviceCallbackId); + + // Destroy window + mWindow.reset(); +} + +void JamSpookGame::load() +{ + Log::write(LogLevel::info, "Game - Load."); + + // Add entities + setGameState(ecos::core::GameState::Loading); + + // Preload assets + dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem")))->preload(); + + // Set game + set(); +} + +void JamSpookGame::update() +{ + Log::write(LogLevel::trace, "Game - Update."); + updateSystems(); +} + +void JamSpookGame::set() +{ + Log::write(LogLevel::info, "Game - set."); + + // Clear scene + SceneGraph::clear(); + + // Prepare scene + shared_ptr graphicsSystem = dynamic_pointer_cast(findSystem(IDCache::get("GraphicsSystem"))); + shared_ptr renderLayerGame = graphicsSystem->getRenderLayer(IDCache::get("rl-game")); + +// // Add lighting +// unique_ptr lightingFactoryGame = make_unique(dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem"))), +// graphicsSystem, +// dynamic_pointer_cast(findSystem(IDCache::get("PhysicsSystem"))), +// dynamic_pointer_cast(findSystem(IDCache::get("InteractionSystem")))); +// +// lightingFactoryGame->createPointLight(vec3(10, 10, 0), +// vec3(1.0f, 0.93f, 0.68f), +// .6f, +// renderLayerGame); +// lightingFactoryGame->createPointLight(vec3(-10, 2, 0), +// vec3(0.78f, 0.82f, 1.0f), +// .6f, +// renderLayerGame); + +// lightingFactoryGame->createSun(100.0f, +// vec3(0,0,0), +// vec3(1,0,0), +// 1.0f, +// renderLayerGame); + + +// lightingFactoryGame->createDirectionalLight(vec3(10, 10, 0), +// vec3(-90, 0, 0), +// vec3(1,0,0), +// 1.0f, +// renderLayerGame); +// lightingFactoryGame->createDirectionalLight(vec3(-10, 10, 0), +// vec3(0, 0, 0), +// vec3(0,1,0), +// 1.0f, +// renderLayerGame); +// lightingFactoryGame->createDirectionalLight(vec3(-10, 10, 0), +// vec3(0, 0, 0), +// vec3(0,0,1), +// 1.0f, +// renderLayerGame); +// +// unique_ptr lightingFactoryGUI = make_unique(dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem"))), +// graphicsSystem, +// dynamic_pointer_cast(findSystem(IDCache::get("PhysicsSystem"))), +// renderLayerGui, +// dynamic_pointer_cast(findSystem(IDCache::get("InteractionSystem")))); +// lightingFactoryGUI->createDirectionalLight(vec3(10, 10, 0), +// vec3(0, 0, 0), +// vec3(1,0,0), +// 1.0f, +// renderLayerGui); +// lightingFactoryGUI->createDirectionalLight(vec3(-10, 10, 0), +// vec3(0, 0, 0), +// vec3(0,1,0), +// 1.0f, +// renderLayerGui); + +// // Add test boxes +// unique_ptr boxFactoryGame = make_unique(dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem"))), +// graphicsSystem, +// renderLayerGame); +// +// boxFactoryGame->createBox(vec3(0, 0, 0), +// vec3(.5f, .5f, .5f)); // 1x1x1 +// +// boxFactoryGame->createBox(vec3(-2, 1, 0), +// vec3(.5f, .5f, .5f)); // 1x1x1 +// +// boxFactoryGame->createBox(vec3(2, 2, 0), +// vec3(1.0f, 1.0f, 1.0f)); // 2x2x2 +// +// boxFactoryGame->createBox(vec3(0, -1, 0), +// vec3(5.0f, .5f, 5.0f)); // 10x1x10 + +// unique_ptr boxFactoryGUI = make_unique(dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem"))), +// graphicsSystem, +// renderLayerGui); +// boxFactoryGUI->createBox(vec3(-4, 0, 0), +// vec3(.5f, .5f, .5f)); // 1x1x1 +// +// boxFactoryGUI->createBox(vec3(2, 0, 0), +// vec3(.5f, .5f, .5f)); // 1x1x1 +// +// boxFactoryGUI->createBox(vec3(0, 2, 0), +// vec3(.25f, .25f, .25f)); // 1x1x1 +// +// boxFactoryGUI->createBox(vec3(0, 0, -2), +// vec3(.5f, .5f, .5f)); // 1x1x1 +// +// boxFactoryGUI->createBox(vec3(0, 0, 2), +// vec3(.5f, .5f, .5f)); // 1x1x1 +// +// +// boxFactoryGame->createBox(vec3(0, -1, 0), +// vec3(5.0f, .5f, 5.0f)); // 10x1x10 + +// boxFactory->createBox(vec3(-100, 0, 0), +// vec3(.5f, 0.5f, .5f)); // 1x1x1 +// boxFactory->createBox(vec3(100, 0, 0), +// vec3(.5f, 0.5f, .5f)); // 1x1x1 +// boxFactory->createBox(vec3(0, 100, 0), +// vec3(.5f, 0.5f, .5f)); // 1x1x1 +// boxFactory->createBox(vec3(0, -100, 0), +// vec3(.5f, 0.5f, .5f)); // 1x1x1 +// boxFactory->createBox(vec3(0, 0, 100), +// vec3(.5f, 0.5f, .5f)); // 1x1x1 +// boxFactory->createBox(vec3(0, 0, -100), +// vec3(.5f, 0.5f, .5f)); // 1x1x1 + + + +// boxFactory->createBox(vec3(0, 1, 0), +// vec3(5.0f, 0.5f, 5.0f)); // 10x1x10 +// boxFactory->createBox(vec3(0, 1, 0), +// vec3(.5f, 0.5f, .5f)); // 10x1x10 +// +// boxFactory->createBox(vec3(0, 3, 0), +// vec3(.5f, .5f, .5f)); // 1x1x1 +// +// boxFactory->createBox(vec3(-2, 4, 0), +// vec3(.5f, .5f, .5f)); // 1x1x1 +// +// boxFactory->createBox(vec3(2, 5, 0), +// vec3(.5f, .5f, .5f)); // 1x1x1 + + +// unique_ptr ballFactory = make_unique(dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem"))), +// graphicsSystem, +// dynamic_pointer_cast(findSystem(IDCache::get("PhysicsSystem"))), +// renderLayerGame); +// +// ballFactory->createBall(vec3(0, 10, 0), +// .5f, +// 1.0f, +// 0.9f, +// "pink-rubber", +// vec3(0,1,0)); +// +// unique_ptr floorFactory = make_unique(dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem"))), +// graphicsSystem, +// dynamic_pointer_cast(findSystem(IDCache::get("PhysicsSystem"))), +// renderLayerGame); + +// floorFactory->createFloor(vec3(0,1,0)); +// floorFactory->createStaticFloor(vec3(0, 0, 0)); + + + // Add entities + FloorFactory* floorFactory = new FloorFactory(dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem"))), + graphicsSystem, + dynamic_pointer_cast(findSystem(IDCache::get("PhysicsSystem"))), + renderLayerGame); + floorFactory->createFloor(vec3(0,-5,0)); + floorFactory->createStaticFloor(vec3(0,-8,0)); + delete floorFactory; + + BallFactory* ballFactory = new BallFactory(dynamic_pointer_cast(findSystem(IDCache::get("AssetSystem"))), + graphicsSystem, + dynamic_pointer_cast(findSystem(IDCache::get("PhysicsSystem"))), + renderLayerGame); + +// ballFactory->createBall(vec3(0, 30, 0), +// 2.0f, +// 1.0f, +// 0.1f, +// "pink-rubber", +// vec3(0,1,0)); + + for (unsigned int i = 0; + i < static_cast(getFloatInRange(30,100)); + i++) + { + string ballName = ""; + float size = 0.0f; + float restitution = 1.0f; + vec3 lightColor = vec3(1); + switch (getIntInRange(0, 5)) + { + case 0: + { + ballName = "tennis"; + size = 1.1f; + restitution = 0.6f; + lightColor = vec3(0,1,0); + break; + } + case 1: + { + ballName = "base"; + size = 1.0f; + restitution = 0.4f; + lightColor = vec3(1,1,1); + break; + } + case 2: + { + ballName = "white-rubber"; + size = 0.4f; + restitution = 0.7f; + lightColor = vec3(1,1,1); + break; + } + case 3: + { + ballName = "pink-rubber"; + size = 1.5f; + restitution = 0.7f; + lightColor = vec3(1,0,0); + break; + } + case 4: + { + ballName = "blue-rubber"; + size = 0.8f; + restitution = 0.7f; + lightColor = vec3(0,0,1); + break; + } + case 5: + { + ballName = "red-rubber"; + size = 0.6f; + restitution = 0.7f; + lightColor = vec3(1,0,0); + break; + } + } + + ballFactory->createBall(vec3(getFloatInRange(-10.0f, 10.0f), + getFloatInRange(10.0f, 50.0f), + getFloatInRange(-10.0f, 10.0f)), + size, + size*2, + restitution, + ballName, + lightColor); + } + delete ballFactory; + + // Set game state + setGameState(ecos::core::GameState::InGame); +} + +void JamSpookGame::reset() +{ + // Clear scene + SceneGraph::clear(); + + // Reset data + // ...set variables + + // Prepare scene + set(); +} + +void JamSpookGame::onSysCall(const SysCall sysCall) +{ + Log::write(LogLevel::info, "Game - onSysCall()"); + switch (sysCall) + { + case SysCall::exit: + { + setGameState(ecos::core::GameState::Closing); + break; + } + } +} + +void JamSpookGame::onInputDeviceStateChange(const InputDeviceState inputDeviceState) +{ +// if (inputDeviceState.anyKey != ButtonState::neutral || +// inputDeviceState.anyMouseButton != ButtonState::neutral) +// { +// // Close the game +// setGameState(ecos::core::GameState::Closing); +// } +} + +} // namespace JamSpook diff --git a/src/JamSpookGame.h b/src/JamSpookGame.h new file mode 100644 index 0000000..53fcabe --- /dev/null +++ b/src/JamSpookGame.h @@ -0,0 +1,150 @@ +/* + * JamSpookGame.h + * + * Created on: Aug 8, 2019 + * Author: fredrick + */ + +#ifndef JAMSPOOKGAME_H_ +#define JAMSPOOKGAME_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "BallFactory.h" +#include "FloorFactory.h" +#include "BoxFactory.h" +#include "LightingFactory.h" + +namespace JamSpook { + +using std::unique_ptr; +using std::make_unique; +using std::shared_ptr; +using std::make_shared; +using std::static_pointer_cast; +using std::dynamic_pointer_cast; +using std::bind; +using std::vector; +using std::string; +using std::to_string; +using glm::ivec2; +using glm::vec2; +using glm::vec3; +using glm::vec4; +using glm::mat4; +using glm::translate; +using glm::normalize; + +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::Game; +using ecos::core::GameState; +using ecos::core::IDCache; +using ecos::core::SceneGraph; +using ecos::core::SysCall; +using ecos::core::BroadcastObservable; +using ecos::core::Window; +using ecos::core::CycleRegulationSystem; +using ecos::utility::getWorkingPath; +using ecos::utility::getRealPath; +using ecos::utility::getFloatInRange; +using ecos::utility::getIntInRange; +using ecos::asset::AssetSystem; +using ecos::asset::AssetFileSystem; +using ecos::physics::PhysicsSystem; +using ecos::animation::AnimationSystem; +using ecos::interaction::InteractionSystem; +using ecos::interaction::InputDeviceState; +using ecos::interaction::ButtonState; +using ecos::graphics::GraphicsSystem; +using ecos::graphics::RenderLayer; +using ecos::graphics::RenderLayerFactory; +using ecos::graphics::ShaderAsset; +using ecos::graphics::ShaderProgram; +using ecos::graphics::ShaderProgramFactory; +using ecos::graphics::DevILSystem; +using ecos::graphics::Renderer; +using ecos::graphics::GL4Renderer; +using ecos::graphics::Camera; +using ecos::graphics::CameraFactory; +using ecos::graphics::MeshLoader; +using ecos::graphics::ShaderLoader; +using ecos::graphics::ShaderProgramLoader; +using ecos::graphics::TextureFileLoader; +using ecos::graphics::TextureBlankLoader; +using ecos::graphics::ShaderType; +using ecos::graphics::ShaderAsset; +using ecos::graphics::ShaderProgram; +using ecos::asset::DataManagementMode; +using ecos::sound::SoundSystem; +using ecos::sound::SoundEffectLoader; + +class JamSpookGame: + public Game +{ +private: + shared_ptr mWindow; + BroadcastObservable::CallbackID mCallbackId; + BroadcastObservable::CallbackID mInputDeviceCallbackId; + shared_ptr mRenderer; + shared_ptr mCamera; + +public: + JamSpookGame(); + virtual ~JamSpookGame(); + + virtual void load(); + virtual void update(); + + void set(); + void reset(); + + void menu(); + + void onSysCall(const SysCall sysCall); + void onInputDeviceStateChange(const InputDeviceState inputDeviceState); +}; + +} // namespace JamSpook + +#endif // JAMSPOOKGAME_H_ diff --git a/src/LightInteractionComponent.cpp b/src/LightInteractionComponent.cpp new file mode 100755 index 0000000..2d15f66 --- /dev/null +++ b/src/LightInteractionComponent.cpp @@ -0,0 +1,74 @@ +/* + * LightInteractionComponent.cpp + * + * Created on: Oct 9, 2019 + * Author: fredrick + */ + +#include "LightInteractionComponent.h" + +namespace JamSpook { + +LightInteractionComponent::LightInteractionComponent(mat4 transform, + shared_ptr > > entity, + weak_ptr interactionSystem): + InteractionComponent(transform, entity, interactionSystem), + oldDirection(vec3(0)) +{} + +LightInteractionComponent::~LightInteractionComponent() +{} + +void LightInteractionComponent::onInputDeviceStateChange(const InputDeviceState inputDeviceState) +{ + Log::write(LogLevel::debug, "PlayerInteractionComponent - onInputDeviceStateChange"); + + vec3 accumulatedDirection = vec3(0); + + // Handle controls + if (inputDeviceState.left == ButtonState::pressed) + { + accumulatedDirection += vec3(-1.0f, 0, 0); + mTransform = translate(mTransform, accumulatedDirection); + } + if (inputDeviceState.right == ButtonState::pressed) + { + accumulatedDirection += vec3(1.0f, 0, 0); + mTransform = translate(mTransform, accumulatedDirection); + } + if (inputDeviceState.up == ButtonState::pressed) + { + accumulatedDirection += vec3(0, 1.0f, 0); + } + if (inputDeviceState.down == ButtonState::pressed) + { + accumulatedDirection += vec3(0, -1.0f, 0); + } + if (inputDeviceState.action == ButtonState::pressed) + { + accumulatedDirection += vec3(0, 0.0f, 1.0f); + } +// +// if (inputDeviceState.up == ButtonState::released || +// inputDeviceState.down == ButtonState::released || +// inputDeviceState.left == ButtonState::released || +// inputDeviceState.right == ButtonState::released) +// { +// accumulatedDirection = vec3(0); +// } + +// mTransform = translate(mTransform, accumulatedDirection); + ICCBroadcast(dynamic_pointer_cast(make_shared(mTransform))); + +// ICCBroadcast(dynamic_pointer_cast(make_shared(getTranslation(mTransform), +// oldDirection, +// accumulatedDirection))); +// oldDirection = accumulatedDirection; +} + +void LightInteractionComponent::onICCMessage(shared_ptr message) +{ + InteractionComponent::onICCMessage(message); +} + +} // namespace JamSpook diff --git a/src/LightInteractionComponent.h b/src/LightInteractionComponent.h new file mode 100755 index 0000000..702718c --- /dev/null +++ b/src/LightInteractionComponent.h @@ -0,0 +1,73 @@ +/* + * PlayerInteractionComponent.h + * + * Created on: Mar 1, 2019 + * Author: fredrick + */ + +#ifndef LIGHTINTERACTIONCOMPONENT_H_ +#define LIGHTINTERACTIONCOMPONENT_H_ + +#include +#include +#include + +#define GLM_FORCE_RADIANS +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "DirectionChangeMessage.h" + +namespace JamSpook { + +using std::chrono::milliseconds; +using std::shared_ptr; +using std::make_shared; +using std::weak_ptr; +using std::dynamic_pointer_cast; +using glm::vec3; +using glm::mat4; +using glm::translate; +using glm::rotate; +using glm::radians; + +using ecos::utility::getTranslation; +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::BroadcastObservable; +using ecos::core::Message; +using ecos::physics::TransformChangeMessage; +using ecos::interaction::InteractionSystem; +using ecos::interaction::InputDeviceState; +using ecos::interaction::ButtonState; +using ecos::interaction::InteractionComponent; + +/// Player interaction component +/// Player entity specific interaction system code +class LightInteractionComponent : + public InteractionComponent +{ +private: + vec3 oldDirection; ///< Used to construct the DirectionChangeMessaage + +public: + LightInteractionComponent(mat4 transform, + shared_ptr > > entity, + weak_ptr wInteractionSystem); + virtual ~LightInteractionComponent(); + + virtual void onInputDeviceStateChange(const InputDeviceState inputDeviceState); + virtual void onICCMessage(shared_ptr message); +}; + +} // namespace JamSpook + +#endif // LIGHTINTERACTIONCOMPONENT_H_ diff --git a/src/LightPhysicsComponent.cpp b/src/LightPhysicsComponent.cpp new file mode 100644 index 0000000..5a693e3 --- /dev/null +++ b/src/LightPhysicsComponent.cpp @@ -0,0 +1,62 @@ +/* + * LightPhysicsComponent.cpp + * + * Created on: Oct 9, 2019 + * Author: fredrick + */ + +#include "LightPhysicsComponent.h" + +namespace JamSpook { + +LightPhysicsComponent::LightPhysicsComponent(mat4 transform, + shared_ptr > > entity, + weak_ptr > physicsSystem, + weak_ptr > > physicsCollisionSubSystem, + weak_ptr > > physicsColliderQuerySubSystem, + shared_ptr collider): + PhysicsComponent(transform, + entity, + physicsSystem, + physicsCollisionSubSystem, + physicsColliderQuerySubSystem, + collider) +{} + +LightPhysicsComponent::~LightPhysicsComponent() +{} + +void LightPhysicsComponent::update(const milliseconds dtms) +{ +// Log::write(LogLevel::trace, "CollectablePhysicsComponent - update"); + PhysicsComponent::update(dtms); +} + +void LightPhysicsComponent::onICCMessage(shared_ptr message) +{ + PhysicsComponent::onICCMessage(message); + + // DirectionChangeMessage + if (message->getMessageType() == IDCache::get("DirectionChangeMessage")) + { + Log::write(LogLevel::debug, "PlayerPhysicsComponent - onICCMessage - DirectionChangeMessage"); + + shared_ptr msg = dynamic_pointer_cast(message); + if (msg->getNewDirection() != vec3(0,0,0)) + { + mDirection = msg->getNewDirection(); + + mCollider->setLinearVelocity(msg->getNewDirection()*4.0f); + +// Log::write(LogLevel::trace, "PlayerPhysicsComponent - onICCMessage - DirectionChangeMessage - " + glm::to_string(msg->getNewDirection()*4.0f)); +// BroadcastObservable::broadcast(msg->getPosition(), msg->getNewDirection()); + } + } +} + +void LightPhysicsComponent::onCollision(const string& tag) +{ + // nothing +} + +} // namespace JamSpook diff --git a/src/LightPhysicsComponent.h b/src/LightPhysicsComponent.h new file mode 100644 index 0000000..f6b8f3d --- /dev/null +++ b/src/LightPhysicsComponent.h @@ -0,0 +1,80 @@ +/* + * LightPhysicsComponent.h + * + * Created on: Oct 9, 2019 + * Author: fredrick + */ + +#ifndef LIGHTPHYSICSCOMPONENT_H_ +#define LIGHTPHYSICSCOMPONENT_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "DirectionChangeMessage.h" + +namespace JamSpook { + +using std::chrono::milliseconds; +using std::weak_ptr; +using std::shared_ptr; +using std::make_shared; +using std::dynamic_pointer_cast; +using std::string; +using glm::vec3; +using glm::mat4; +using glm::translate; +using glm::scale; + +using ecos::utility::getFloatInRange; +using ecos::core::IDCache; +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::Message; +using ecos::core::BroadcastObservable; +using ecos::physics::PhysicsSystem; +using ecos::physics::PhysicsComponent; +using ecos::physics::Collider; +using ecos::physics::TransformChangeMessage; +using ecos::physics::CollisionStateChangeMessage; +using ecos::physics::ColliderQueryMessage; + +class LightPhysicsComponent: + public ecos::physics::PhysicsComponent +{ +private: + vec3 mDirection; + +public: + LightPhysicsComponent(mat4 transform, + shared_ptr > > entity, + weak_ptr > physicsSystem, + weak_ptr > > physicsCollisionSubSystem, + weak_ptr > > physicsColliderQuerySubSystem, + shared_ptr collider); + virtual ~LightPhysicsComponent(); + + virtual void update(const milliseconds dtms); + virtual void onICCMessage(shared_ptr message); + virtual void onCollision(const string& tag); +}; + +} // namespace JamSpook + +#endif // LIGHTPHYSICSCOMPONENT_H_ diff --git a/src/LightingFactory.cpp b/src/LightingFactory.cpp new file mode 100644 index 0000000..9e49021 --- /dev/null +++ b/src/LightingFactory.cpp @@ -0,0 +1,185 @@ +/* + * LightingFactory.cpp + * + * Created on: Sep 26, 2019 + * Author: fredrick + */ + +#include "LightingFactory.h" + +namespace JamSpook { + +LightingFactory::LightingFactory(weak_ptr assetSystem, + weak_ptr graphicsSystem, + weak_ptr physicsSystem, + weak_ptr interactionSystem): + mAssetSystem(assetSystem), + mGraphicsSystem(graphicsSystem), + mPhysicsSystem(physicsSystem), + mInteractionSystem(interactionSystem) +{} + +LightingFactory::~LightingFactory() +{} + +shared_ptr LightingFactory::createPointLight(const vec3 position, + const vec3 color, + const float intensity, + weak_ptr renderLayer) +{ + // Create instance + shared_ptr entity = make_shared(); + entity->setEntityTag("pointLight"); + SceneGraph::addEntity(entity); + mat4 transform = translate(mat4(1), position); + + // Add graphics component + shared_ptr graphicsComponent = make_shared(transform, + entity, + getShared(mGraphicsSystem), + renderLayer); + entity->addComponent(graphicsComponent); + + // Add internal pointlight + LightSourceFactory* lightSourceFactory = new LightSourceFactory(mAssetSystem, mGraphicsSystem); + shared_ptr lightSource = lightSourceFactory->createPointLight(color, + intensity, + 0.02f, + transform); + graphicsComponent->setLightSource(lightSource); + delete lightSourceFactory; + + // Return instance + return entity; +} + +shared_ptr LightingFactory::createSun(const float distance, + const vec3 eulerRotationXYZDegrees, + const vec3 color, + const float intensity, + weak_ptr renderLayer) +{ + // Create instance + shared_ptr entity = make_shared(); + entity->setEntityTag("directionalLight"); + SceneGraph::addEntity(entity); + + mat4 rotateToCenter = eulerAngleXYZ(radians(static_cast(-90)), + radians(static_cast(0)), + radians(static_cast(0))); + + mat4 rotation = eulerAngleXYZ(radians(static_cast(eulerRotationXYZDegrees.x)), + radians(static_cast(eulerRotationXYZDegrees.y)), + radians(static_cast(eulerRotationXYZDegrees.z))); + + mat4 translation = translate(mat4(1.0f), vec3(0,distance,0)); + + + +// mat4 transform = rotation * rotateToCenter * translation; + mat4 transform = rotation * translation * rotateToCenter; + + // Add graphics component + shared_ptr graphicsComponent = make_shared(transform, + entity, + getShared(mGraphicsSystem), + renderLayer); + entity->addComponent(graphicsComponent); + + // Add light source + LightSourceFactory* lightSourceFactory = new LightSourceFactory(mAssetSystem, mGraphicsSystem); + shared_ptr lightSource = lightSourceFactory->createDirectionalLight(color, + intensity, + 0.0f, + true, + transform); + graphicsComponent->setLightSource(lightSource); + delete lightSourceFactory; + + // Return instance + return entity; +} + +shared_ptr LightingFactory::createDirectionalLight(const vec3 position, + const vec3 eulerRotationXYZDegrees, + const vec3 color, + const float intensity, + weak_ptr renderLayer) +{ + // Create instance + shared_ptr entity = make_shared(); + entity->setEntityTag("directionalLight"); + SceneGraph::addEntity(entity); +// mat4 transform = translate(mat4(1), position); +// mat4 transform = glm::lookAt(vec3(0,1,0), vec3(0,-1,0), vec3(0,0,-1)); +// mat4 transform = translate(mat4(1.0f), position) * rotate(mat4(1.0f), +// radians(-90.0f), +// vec3(1.0f, 0.0f, 0.0f)) +// ; + + mat4 transform = translate(mat4(1.0f), position) * + eulerAngleXYZ(radians(static_cast(eulerRotationXYZDegrees.x)), + radians(static_cast(eulerRotationXYZDegrees.y)), + radians(static_cast(eulerRotationXYZDegrees.z))); + + // Add graphics component + shared_ptr graphicsComponent = make_shared(transform, + entity, + getShared(mGraphicsSystem), + renderLayer); + entity->addComponent(graphicsComponent); + +// // Add the ModelRenderable of a ball +// ModelFactory* modelFactory = new ModelFactory(mAssetSystem); +// shared_ptr modelRenderable = modelFactory->createModel("light.f3d", +// "pink-rubber-ball.png", +// "light-ball-model"); +// delete modelFactory; +// graphicsComponent->addRenderable(modelRenderable); + + // Add light source + LightSourceFactory* lightSourceFactory = new LightSourceFactory(mAssetSystem, mGraphicsSystem); + shared_ptr lightSource = lightSourceFactory->createDirectionalLight(color, + intensity, + 0.0f, + false, + transform); + graphicsComponent->setLightSource(lightSource); + delete lightSourceFactory; +// +// // Add interaction component +// shared_ptr interactionComponent = +// make_shared(transform, +// entity, +// getShared(mInteractionSystem)); +// entity->addComponent(interactionComponent); + +// // Add physics component +// ColliderFactory* colliderFactory = new ColliderFactory(mPhysicsSystem); +// shared_ptr physicsComponent = +// make_shared( +// transform, +// entity, +// getShared(mPhysicsSystem), +// getShared(mPhysicsSystem), +// getShared(mPhysicsSystem), +// colliderFactory->createSphereCollider(position, +// quat(vec3(0,0,0)), +// .5f, // radius +// 0.0, // mass +// entity, +// entity->getEntityTag())); +// delete colliderFactory; +// // Note: Editing of rigid body params, maybe only has effect is it has been added to the world. +// physicsComponent->getCollider()->getRigidBody()->setLinearFactor(btVector3(1,1,1)); // allow all positional movement movement +// physicsComponent->getCollider()->getRigidBody()->setAngularFactor(btVector3(1,1,1)); // allow all rotational movement movement +//// physicsComponent->getCollider()->getRigidBody()->setRestitution(.9f); +// physicsComponent->getCollider()->getRigidBody()->setActivationState(DISABLE_DEACTIVATION); +// +// entity->addComponent(physicsComponent); + + // Return instance + return entity; +} + +} // namespace JamSpook diff --git a/src/LightingFactory.h b/src/LightingFactory.h new file mode 100644 index 0000000..4f44011 --- /dev/null +++ b/src/LightingFactory.h @@ -0,0 +1,146 @@ +/* + * LightingFactory.h + * + * Created on: Sep 26, 2019 + * Author: fredrick + */ + +#ifndef LIGHTINGFACTORY_H_ +#define LIGHTINGFACTORY_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "LightInteractionComponent.h" +#include "LightPhysicsComponent.h" + +namespace JamSpook { + +using std::string; +using std::shared_ptr; +using std::make_shared; +using std::weak_ptr; +using std::dynamic_pointer_cast; +using std::function; +using std::bind; +using std::vector; +using glm::vec3; +using glm::mat4; +using glm::quat; +using glm::translate; +using glm::rotate; +using glm::eulerAngleXYZ; +using glm::radians; + +using ecos::utility::getShared; +using ecos::core::IDCache; +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::BroadcastObservable; +using ecos::core::Message; +using ecos::core::Entity; +using ecos::core::SceneGraph; +using ecos::core::ICCResponseComponent; +using ecos::asset::AssetSystem; +using ecos::asset::DataManagementMode; +using ecos::graphics::GraphicsSystem; +using ecos::graphics::GraphicsComponent; +using ecos::graphics::RenderLayer; +using ecos::graphics::TextureFactory; +using ecos::graphics::Texture; +using ecos::graphics::ShaderType; +using ecos::graphics::ShaderAsset; +using ecos::graphics::ShaderProgram; +using ecos::graphics::ShaderProgramFactory; +using ecos::graphics::Material; +using ecos::graphics::MaterialFactory; +using ecos::graphics::Mesh; +using ecos::graphics::MeshFactory; +using ecos::graphics::ModelRenderableFactory; +using ecos::graphics::ModelRenderable; +using ecos::graphics::lighting::LightSource; +using ecos::graphics::lighting::LightSourceFactory; +using ecos::physics::PhysicsSystem; +using ecos::physics::PhysicsComponent; +using ecos::physics::ColliderFactory; +using ecos::physics::Collider; +using ecos::interaction::InteractionSystem; +using ecos::interaction::InputDeviceState; +using ecos::interaction::InteractionComponent; + +class LightingFactory +{ +private: + weak_ptr mAssetSystem; + weak_ptr mGraphicsSystem; + weak_ptr mPhysicsSystem; + weak_ptr mInteractionSystem; + +public: + LightingFactory(weak_ptr assetSystem, + weak_ptr graphicsSystem, + weak_ptr physicsSystem, + weak_ptr interactionSystem); + virtual ~LightingFactory(); + + shared_ptr createPointLight(const vec3 position, + const vec3 color, + const float intensity, + weak_ptr renderLayer); + + shared_ptr createSun(const float distance, + const vec3 eulerRotationXYZDegrees, + const vec3 color, + const float intensity, + weak_ptr renderLayer); + + shared_ptr createDirectionalLight(const vec3 position, + const vec3 eulerRotationXYZDegrees, + const vec3 color, + const float intensity, + weak_ptr renderLayer); +}; + +} // namespace JamSpook + +#endif // LIGHTINGFACTORY_H_ diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..a2482f9 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,30 @@ +/* + * main.cpp + * + * Created on: Aug 13, 2020 + * Author: fredrick + */ + +#include +#include + +#include "JamSpookGame.h" + +using ecos::core::logging::Log; +using ecos::core::logging::LogLevel; +using ecos::core::Core; +using JamSpook::JamSpookGame; + +int main(int argc, char* argv[]) +{ + Log::setLevel(LogLevel::debug); + Log::write(LogLevel::info, "main - Application opened."); + + JamSpookGame* game = new JamSpookGame(); + Core* core = new Core(game); + delete core; + + Log::write(LogLevel::info, "main - Application closed."); + + return 0; +}