28 Commits
v0.2 ... master

Author SHA1 Message Date
  Milang 0c22d2d016 configure gitignore, and temp build with liblog 2 years ago
  Milang c614be0580 rebuild 2 years ago
  Milang 2fb71410a3 edit gitignore 2 years ago
  Milang 4fe9fb0aa1 Merge remote-tracking branch 'origin/master' 2 years ago
  Milang 9136335774 big update (not stable) before rewriting project 2 years ago
  Milang a91fe5f0de add sample menu img 2 years ago
  milang 061b900bb3 testing view options 2 years ago
  milang 4d281516db
testing fxengine --> bug found, not corrected yet ! 2 years ago
  milang 9e755bd4fb
us fxengine as functionnal lib 2 years ago
  milang 01f0d7186a
complete gitignore again 2 years ago
  milang b335bdd8e0
complete gitignore to ignore build files 2 years ago
  milang b575e88ab8
some minor changes 2 years ago
  milang 0e7d807521
rebuild with new fxengine lib 2 years ago
  milang d47d8f037c currently setting fxengine as lib 2 years ago
  milang 0913b3da3a reform project and separe fxengine 2 years ago
  milang 558dd5670b Merge branch 'master' of https://gitea.planet-casio.com/Milang/1v13d 2 years ago
  milang 625dcb6a8d ajout de la gestion évènementielle du clavier avec callbacks 2 years ago
  Milang 1cce870987 test experimental perspective correction feature 2 years ago
  Milang 9f401b35b8 oops int32_t, not uint32_t >_< 2 years ago
  Milang 1a19b5c98a add comments and replace int by int32_t 2 years ago
  Milang f50ed857ec and other spaces 2 years ago
  Milang 44d30dea77 add a few spaces 2 years ago
  Milang d9e37667f2 change inclusions 2 years ago
  Milang 8450087c83 comments 2 years ago
  Milang 0c85e41ff1 ajout commentaires 2 years ago
  Milang 9ac6860700 mise en forme plus propre 2 years ago
  Milang ec7e682296 added doc for texture source and header 2 years ago
  milang 3e210cb232 added creative commons license 2 years ago
77 changed files with 1258 additions and 1556 deletions
Split View
  1. +6
    -0
      .gitignore
  2. +0
    -0
      1v13D.dlr
  3. +0
    -0
      1v13D.dlw
  4. BIN
      1v13D.g1a
  5. +0
    -0
      1v13D.g1w
  6. +0
    -0
      AddinInfo.txt
  7. +0
    -0
      Debug/Addin.mak
  8. +0
    -0
      FXSH_Build.bat
  9. BIN
      INIT/CasioRAM.mem
  10. +0
    -0
      INIT/CasioRAMCPU.mem
  11. +228
    -0
      LICENSE
  12. +24
    -12
      Makefile
  13. +0
    -0
      README.md
  14. +0
    -0
      assets-cg/icon-cg-sel.png
  15. +0
    -0
      assets-cg/icon-cg-uns.png
  16. +0
    -0
      assets-fx/fonts/FxEngine.png
  17. +0
    -0
      assets-fx/icon-fx.png
  18. +0
    -0
      assets-fx/img/fps.png
  19. BIN
      assets-fx/img/menu.png
  20. +0
    -0
      build-fx/assets/fonts/FxEngine.png.o
  21. +0
    -0
      build-fx/assets/img/fps.png.o
  22. +682
    -733
      build-fx/map
  23. BIN
      build-fx/src/1v13D.bin
  24. +0
    -0
      build-fx/src/FxEngine/FxEngine.d
  25. +0
    -0
      build-fx/src/FxEngine/FxEngine.o
  26. +0
    -0
      build-fx/src/FxEngine/coord.d
  27. +0
    -0
      build-fx/src/FxEngine/coord.o
  28. +0
    -0
      build-fx/src/FxEngine/face.d
  29. +0
    -0
      build-fx/src/FxEngine/face.o
  30. +0
    -0
      build-fx/src/FxEngine/functions.d
  31. +0
    -0
      build-fx/src/FxEngine/functions.o
  32. +4
    -0
      build-fx/src/FxEngine/keyboard.d
  33. BIN
      build-fx/src/FxEngine/keyboard.o
  34. +4
    -0
      build-fx/src/FxEngine/keyboard/keyboard.d
  35. BIN
      build-fx/src/FxEngine/keyboard/keyboard.o
  36. +0
    -0
      build-fx/src/FxEngine/libprof.d
  37. +0
    -0
      build-fx/src/FxEngine/libprof.o
  38. +0
    -0
      build-fx/src/FxEngine/math/coord.d
  39. +1
    -0
      build-fx/src/FxEngine/render/bitmap.d
  40. BIN
      build-fx/src/FxEngine/render/bitmap.o
  41. +4
    -0
      build-fx/src/FxEngine/render/parameters.d
  42. BIN
      build-fx/src/FxEngine/render/parameters.o
  43. +6
    -0
      build-fx/src/FxEngine/render/translate.d
  44. BIN
      build-fx/src/FxEngine/render/translate.o
  45. +6
    -0
      build-fx/src/FxEngine/render/zbuffer.d
  46. BIN
      build-fx/src/FxEngine/render/zbuffer.o
  47. +0
    -0
      build-fx/src/FxEngine/texture.d
  48. +0
    -0
      build-fx/src/FxEngine/texture.o
  49. +0
    -0
      build-fx/src/FxEngine/zbuffer.d
  50. +0
    -0
      build-fx/src/FxEngine/zbuffer.o
  51. +0
    -0
      build-fx/src/FxEngine/zbuffer/zbuffer.d
  52. +0
    -0
      build-fx/src/FxEngine/zbuffer/zbuffer.o
  53. +0
    -0
      build-fx/src/controls.d
  54. +0
    -0
      build-fx/src/controls.o
  55. +1
    -15
      build-fx/src/main.d
  56. BIN
      build-fx/src/main.o
  57. +0
    -0
      pc/v1/Capture du 2019-07-27 17-30-03.png
  58. +0
    -0
      pc/v1/Capture du 2019-08-02 10-40-48.png
  59. +0
    -0
      pc/v1/Capture du 2019-08-02 10-46-33.png
  60. +0
    -0
      pc/v1/topic.txt
  61. +2
    -2
      project.cfg
  62. +0
    -120
      src/FxEngine/FxEngine.c
  63. +0
    -46
      src/FxEngine/FxEngine.h
  64. +0
    -118
      src/FxEngine/coord.c
  65. +0
    -30
      src/FxEngine/coord.h
  66. +0
    -160
      src/FxEngine/face.c
  67. +0
    -17
      src/FxEngine/face.h
  68. +0
    -73
      src/FxEngine/libprof.c
  69. +0
    -75
      src/FxEngine/libprof.h
  70. +0
    -13
      src/FxEngine/texture.c
  71. +0
    -15
      src/FxEngine/texture.h
  72. +0
    -41
      src/FxEngine/zbuffer.c
  73. +0
    -13
      src/FxEngine/zbuffer.h
  74. +0
    -25
      src/controls.c
  75. +0
    -11
      src/controls.h
  76. +0
    -8
      src/credits.h
  77. +290
    -29
      src/main.c

+ 6
- 0
.gitignore View File

@ -0,0 +1,6 @@
*.bin
*.elf
*.mak
build-fx/*
build-fx/map
build-fx/src/main.o

+ 0
- 0
1v13D.dlr View File


+ 0
- 0
1v13D.dlw View File


BIN
1v13D.g1a View File


+ 0
- 0
1v13D.g1w View File


+ 0
- 0
AddinInfo.txt View File


+ 0
- 0
Debug/Addin.mak View File


+ 0
- 0
FXSH_Build.bat View File


BIN
INIT/CasioRAM.mem View File


+ 0
- 0
INIT/CasioRAMCPU.mem View File


+ 228
- 0
LICENSE View File

@ -0,0 +1,228 @@
Creative Commons Attribution-NonCommercial 2.0 CREATIVE COMMONS CORPORATION
IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS
LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS
PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING
FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS
PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR
OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS
LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO
BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
a. "Collective Work" means a work, such as a periodical issue, anthology or
encyclopedia, in which the Work in its entirety in unmodified form, along
with a number of other contributions, constituting separate and independent
works in themselves, are assembled into a collective whole. A work that constitutes
a Collective Work will not be considered a Derivative Work (as defined below)
for the purposes of this License.
b. "Derivative Work" means a work based upon the Work or upon the Work and
other pre-existing works, such as a translation, musical arrangement, dramatization,
fictionalization, motion picture version, sound recording, art reproduction,
abridgment, condensation, or any other form in which the Work may be recast,
transformed, or adapted, except that a work that constitutes a Collective
Work will not be considered a Derivative Work for the purpose of this License.
For the avoidance of doubt, where the Work is a musical composition or sound
recording, the synchronization of the Work in timed-relation with a moving
image ("synching") will be considered a Derivative Work for the purpose of
this License.
c. "Licensor" means the individual or entity that offers the Work under the
terms of this License.
d. "Original Author" means the individual or entity who created the Work.
e. "Work" means the copyrightable work of authorship offered under the terms
of this License.
f. "You" means an individual or entity exercising rights under this License
who has not previously violated the terms of this License with respect to
the Work, or who has received express permission from the Licensor to exercise
rights under this License despite a previous violation.
2. Fair Use Rights. Nothing in this license is intended to reduce, limit,
or restrict any rights arising from fair use, first sale or other limitations
on the exclusive rights of the copyright owner under copyright law or other
applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor
hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for
the duration of the applicable copyright) license to exercise the rights in
the Work as stated below:
a. to reproduce the Work, to incorporate the Work into one or more Collective
Works, and to reproduce the Work as incorporated in the Collective Works;
b. to create and reproduce Derivative Works;
c. to distribute copies or phonorecords of, display publicly, perform publicly,
and perform publicly by means of a digital audio transmission the Work including
as incorporated in Collective Works;
d. to distribute copies or phonorecords of, display publicly, perform publicly,
and perform publicly by means of a digital audio transmission Derivative Works;
The above rights may be exercised in all media and formats whether now known
or hereafter devised. The above rights include the right to make such modifications
as are technically necessary to exercise the rights in other media and formats.
All rights not expressly granted by Licensor are hereby reserved, including
but not limited to the rights set forth in Sections 4(d) and 4(e).
4. Restrictions.The license granted in Section 3 above is expressly made subject
to and limited by the following restrictions:
a. You may distribute, publicly display, publicly perform, or publicly digitally
perform the Work only under the terms of this License, and You must include
a copy of, or the Uniform Resource Identifier for, this License with every
copy or phonorecord of the Work You distribute, publicly display, publicly
perform, or publicly digitally perform. You may not offer or impose any terms
on the Work that alter or restrict the terms of this License or the recipients'
exercise of the rights granted hereunder. You may not sublicense the Work.
You must keep intact all notices that refer to this License and to the disclaimer
of warranties. You may not distribute, publicly display, publicly perform,
or publicly digitally perform the Work with any technological measures that
control access or use of the Work in a manner inconsistent with the terms
of this License Agreement. The above applies to the Work as incorporated in
a Collective Work, but this does not require the Collective Work apart from
the Work itself to be made subject to the terms of this License. If You create
a Collective Work, upon notice from any Licensor You must, to the extent practicable,
remove from the Collective Work any reference to such Licensor or the Original
Author, as requested. If You create a Derivative Work, upon notice from any
Licensor You must, to the extent practicable, remove from the Derivative Work
any reference to such Licensor or the Original Author, as requested.
b. You may not exercise any of the rights granted to You in Section 3 above
in any manner that is primarily intended for or directed toward commercial
advantage or private monetary compensation. The exchange of the Work for other
copyrighted works by means of digital file-sharing or otherwise shall not
be considered to be intended for or directed toward commercial advantage or
private monetary compensation, provided there is no payment of any monetary
compensation in connection with the exchange of copyrighted works.
c. If you distribute, publicly display, publicly perform, or publicly digitally
perform the Work or any Derivative Works or Collective Works, You must keep
intact all copyright notices for the Work and give the Original Author credit
reasonable to the medium or means You are utilizing by conveying the name
(or pseudonym if applicable) of the Original Author if supplied; the title
of the Work if supplied; to the extent reasonably practicable, the Uniform
Resource Identifier, if any, that Licensor specifies to be associated with
the Work, unless such URI does not refer to the copyright notice or licensing
information for the Work; and in the case of a Derivative Work, a credit identifying
the use of the Work in the Derivative Work (e.g., "French translation of the
Work by Original Author," or "Screenplay based on original Work by Original
Author"). Such credit may be implemented in any reasonable manner; provided,
however, that in the case of a Derivative Work or Collective Work, at a minimum
such credit will appear where any other comparable authorship credit appears
and in a manner at least as prominent as such other comparable authorship
credit.
d. For the avoidance of doubt, where the Work is a musical composition:
i. Performance Royalties Under Blanket Licenses. Licensor reserves the exclusive
right to collect, whether individually or via a performance rights society
(e.g. ASCAP, BMI, SESAC), royalties for the public performance or public digital
performance (e.g. webcast) of the Work if that performance is primarily intended
for or directed toward commercial advantage or private monetary compensation.
ii. Mechanical Rights and Statutory Royalties. Licensor reserves the exclusive
right to collect, whether individually or via a music rights agency or designated
agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from
the Work ("cover version") and distribute, subject to the compulsory license
created by 17 USC Section 115 of the US Copyright Act (or the equivalent in
other jurisdictions), if Your distribution of such cover version is primarily
intended for or directed toward commercial advantage or private monetary compensation.
Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where
the Work is a sound recording, Licensor reserves the exclusive right to collect,
whether individually or via a performance-rights society (e.g. SoundExchange),
royalties for the public digital performance (e.g. webcast) of the Work, subject
to the compulsory license created by 17 USC Section 114 of the US Copyright
Act (or the equivalent in other jurisdictions), if Your public digital performance
is primarily intended for or directed toward commercial advantage or private
monetary compensation.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS
THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING
THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT,
OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE
OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW,
IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS
LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
7. Termination
a. This License and the rights granted hereunder will terminate automatically
upon any breach by You of the terms of this License. Individuals or entities
who have received Derivative Works or Collective Works from You under this
License, however, will not have their licenses terminated provided such individuals
or entities remain in full compliance with those licenses. Sections 1, 2,
5, 6, 7, and 8 will survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here is
perpetual (for the duration of the applicable copyright in the Work). Notwithstanding
the above, Licensor reserves the right to release the Work under different
license terms or to stop distributing the Work at any time; provided, however
that any such election will not serve to withdraw this License (or any other
license that has been, or is required to be, granted under the terms of this
License), and this License will continue in full force and effect unless terminated
as stated above.
8. Miscellaneous
a. Each time You distribute or publicly digitally perform the Work or a Collective
Work, the Licensor offers to the recipient a license to the Work on the same
terms and conditions as the license granted to You under this License.
b. Each time You distribute or publicly digitally perform a Derivative Work,
Licensor offers to the recipient a license to the original Work on the same
terms and conditions as the license granted to You under this License.
c. If any provision of this License is invalid or unenforceable under applicable
law, it shall not affect the validity or enforceability of the remainder of
the terms of this License, and without further action by the parties to this
agreement, such provision shall be reformed to the minimum extent necessary
to make such provision valid and enforceable.
d. No term or provision of this License shall be deemed waived and no breach
consented to unless such waiver or consent shall be in writing and signed
by the party to be charged with such waiver or consent.
e. This License constitutes the entire agreement between the parties with
respect to the Work licensed here. There are no understandings, agreements
or representations with respect to the Work not specified here. Licensor shall
not be bound by any additional provisions that may appear in any communication
from You. This License may not be modified without the mutual written agreement
of the Licensor and You.
Creative Commons is not a party to this License, and makes no warranty whatsoever
in connection with the Work. Creative Commons will not be liable to You or
any party on any legal theory for any damages whatsoever, including without
limitation any general, special, incidental or consequential damages arising
in connection to this license. Notwithstanding the foregoing two (2) sentences,
if Creative Commons has expressly identified itself as the Licensor hereunder,
it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the Work is
licensed under the CCPL, neither party will use the trademark "Creative Commons"
or any related trademark or logo of Creative Commons without the prior written
consent of Creative Commons. Any permitted use will be in compliance with
Creative Commons' then-current trademark usage guidelines, as may be published
on its website or otherwise made available upon request from time to time.
Creative Commons may be contacted at http://creativecommons.org/.

+ 24
- 12
Makefile View File

@ -16,8 +16,8 @@ cf-fx := $(cf) -m3 -DFX9860G
cf-cg := $(cf) -m4-nofpu -DFXCG50
# Linker flags
lf-fx := $(LDFLAGS) -Tfx9860g.ld -lgint-fx -lgcc -Wl,-Map=build-fx/map
lf-cg := $(LDFLAGS) -Tfxcg50.ld -lgint-cg -lgcc -Wl,-Map=build-cg/map
lf-fx := -Tfx9860g.ld -lgint-fx $(LDFLAGS) -lgcc -Wl,-Map=build-fx/map
lf-cg := -Tfxcg50.ld -lgint-cg $(LDFLAGS) -lgcc -Wl,-Map=build-cg/map
dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
cpflags := -R .bss -R .gint_bss
@ -38,10 +38,10 @@ target-fx := $(filename).g1a
target-cg := $(filename).g3a
# Source files
src := $(shell find src -name '*.c')
#assets-fx := $(shell find assets-fx/*/)
#assets-cg := $(shell find assets-cg/*/)
assets-fx := $(wildcard assets-fx/img/*) $(wildcard assets-fx/fonts/*)
src := $(wildcard src/*.[csS] src/*/*.[csS] src/*/*/*.[csS] \
src/*/*/*/*.[csS])
assets-fx := $(wildcard assets-fx/*/*)
assets-cg := $(wildcard assets-cg/*/*)
# Object files
obj-fx := $(src:%.c=build-fx/%.o) $(assets-fx:assets-fx/%=build-fx/assets/%.o)
@ -89,16 +89,28 @@ build-cg/%.o: %.c
@ mkdir -p $(dir $@)
sh4eb-elf-gcc -c $< -o $@ $(cf-cg) $(dflags)
# Assembler sources
build-fx/%.o: %.s
@ mkdir -p $(dir $@)
sh3eb-elf-gcc -c $< -o $@
build-fx/%.o: %.S
@ mkdir -p $(dir $@)
sh3eb-elf-gcc -c $< -o $@ $(sflags)
build-cg/%.o: %.s
@ mkdir -p $(dir $@)
sh4eb-elf-gcc -c $< -o $@
build-cg/%.o: %.S
@ mkdir -p $(dir $@)
sh4eb-elf-gcc -c $< -o $@ $(sflags)
# Images
build-fx/assets/img/%.o: assets-fx/img/%
@ mkdir -p $(dir $@)
fxconv -i $< -o $@ name:img_$(basename $*)
fxconv -i $< -o $@ --fx name:img_$(basename $*)
build-cg/assets/img/%.o: assets-cg/img/%
@ echo -ne "\e[31;1mWARNING: image conversion for fxcg50 is not "
@ echo -ne "supported yet\e[0m"
@ mkdir -p $(dir $@)
fxconv -i $< -o $@ name:img_$(basename $*)
fxconv -i $< -o $@ --cg name:img_$(basename $*)
# Fonts
build-fx/assets/fonts/%.o: assets-fx/fonts/%
@ -127,8 +139,8 @@ distclean: clean
install-fx: $(target-fx)
p7 send -f $<
install-cg: $(target-cg)
@ while [[ ! -h /dev/Prizm1 ]]; do sleep 1; done
@ mount /dev/Prizm1
@ while [[ ! -h /dev/Prizm1 ]]; do sleep 0.25; done
@ while ! mount /dev/Prizm1; do sleep 0.25; done
@ rm -f /mnt/prizm/$<
@ cp $< /mnt/prizm
@ umount /dev/Prizm1


+ 0
- 0
README.md View File


+ 0
- 0
assets-cg/icon-cg-sel.png View File

Before After
Width: 92  |  Height: 64  |  Size: 8.2 KiB Width: 92  |  Height: 64  |  Size: 8.2 KiB

+ 0
- 0
assets-cg/icon-cg-uns.png View File

Before After
Width: 92  |  Height: 64  |  Size: 4.5 KiB Width: 92  |  Height: 64  |  Size: 4.5 KiB

+ 0
- 0
assets-fx/fonts/FxEngine.png View File

Before After
Width: 80  |  Height: 42  |  Size: 812 B Width: 80  |  Height: 42  |  Size: 812 B

+ 0
- 0
assets-fx/icon-fx.png View File

Before After
Width: 30  |  Height: 19  |  Size: 245 B Width: 30  |  Height: 19  |  Size: 245 B

+ 0
- 0
assets-fx/img/fps.png View File

Before After
Width: 24  |  Height: 8  |  Size: 152 B Width: 24  |  Height: 8  |  Size: 152 B

BIN
assets-fx/img/menu.png View File

Before After
Width: 128  |  Height: 64  |  Size: 974 B

+ 0
- 0
build-fx/assets/fonts/FxEngine.png.o View File


+ 0
- 0
build-fx/assets/img/fps.png.o View File


+ 682
- 733
build-fx/map
File diff suppressed because it is too large
View File


BIN
build-fx/src/1v13D.bin View File


+ 0
- 0
build-fx/src/FxEngine/FxEngine.d View File


+ 0
- 0
build-fx/src/FxEngine/FxEngine.o View File


+ 0
- 0
build-fx/src/FxEngine/coord.d View File


+ 0
- 0
build-fx/src/FxEngine/coord.o View File


+ 0
- 0
build-fx/src/FxEngine/face.d View File


+ 0
- 0
build-fx/src/FxEngine/face.o View File


+ 0
- 0
build-fx/src/FxEngine/functions.d View File


+ 0
- 0
build-fx/src/FxEngine/functions.o View File


+ 4
- 0
build-fx/src/FxEngine/keyboard.d View File

@ -0,0 +1,4 @@
build-fx/src/FxEngine/keyboard.o: src/FxEngine/keyboard.c \
src/FxEngine/keyboard.h
src/FxEngine/keyboard.h:

BIN
build-fx/src/FxEngine/keyboard.o View File


+ 4
- 0
build-fx/src/FxEngine/keyboard/keyboard.d View File

@ -0,0 +1,4 @@
build-fx/src/FxEngine/keyboard/keyboard.o: \
src/FxEngine/keyboard/keyboard.c src/FxEngine/keyboard/keyboard.h
src/FxEngine/keyboard/keyboard.h:

BIN
build-fx/src/FxEngine/keyboard/keyboard.o View File


+ 0
- 0
build-fx/src/FxEngine/libprof.d View File


+ 0
- 0
build-fx/src/FxEngine/libprof.o View File


+ 0
- 0
build-fx/src/FxEngine/math/coord.d View File


+ 1
- 0
build-fx/src/FxEngine/render/bitmap.d View File

@ -0,0 +1 @@
build-fx/src/FxEngine/render/bitmap.o: src/FxEngine/render/bitmap.c

BIN
build-fx/src/FxEngine/render/bitmap.o View File


+ 4
- 0
build-fx/src/FxEngine/render/parameters.d View File

@ -0,0 +1,4 @@
build-fx/src/FxEngine/render/parameters.o: \
src/FxEngine/render/parameters.c src/FxEngine/render/parameters.h
src/FxEngine/render/parameters.h:

BIN
build-fx/src/FxEngine/render/parameters.o View File


+ 6
- 0
build-fx/src/FxEngine/render/translate.d View File

@ -0,0 +1,6 @@
build-fx/src/FxEngine/render/translate.o: src/FxEngine/render/translate.c \
src/FxEngine/render/translate.h src/FxEngine/render/parameters.h
src/FxEngine/render/translate.h:
src/FxEngine/render/parameters.h:

BIN
build-fx/src/FxEngine/render/translate.o View File


+ 6
- 0
build-fx/src/FxEngine/render/zbuffer.d View File

@ -0,0 +1,6 @@
build-fx/src/FxEngine/render/zbuffer.o: src/FxEngine/render/zbuffer.c \
src/FxEngine/render/zbuffer.h src/FxEngine/render/parameters.h
src/FxEngine/render/zbuffer.h:
src/FxEngine/render/parameters.h:

BIN
build-fx/src/FxEngine/render/zbuffer.o View File


+ 0
- 0
build-fx/src/FxEngine/texture.d View File


+ 0
- 0
build-fx/src/FxEngine/texture.o View File


+ 0
- 0
build-fx/src/FxEngine/zbuffer.d View File


+ 0
- 0
build-fx/src/FxEngine/zbuffer.o View File


+ 0
- 0
build-fx/src/FxEngine/zbuffer/zbuffer.d View File


+ 0
- 0
build-fx/src/FxEngine/zbuffer/zbuffer.o View File


+ 0
- 0
build-fx/src/controls.d View File


+ 0
- 0
build-fx/src/controls.o View File


+ 1
- 15
build-fx/src/main.d View File

@ -1,15 +1 @@
build-fx/src/main.o: src/main.c src/FxEngine/FxEngine.h \
src/FxEngine/coord.h src/FxEngine/zbuffer.h src/FxEngine/face.h \
src/FxEngine/FxEngine.h src/controls.h
src/FxEngine/FxEngine.h:
src/FxEngine/coord.h:
src/FxEngine/zbuffer.h:
src/FxEngine/face.h:
src/FxEngine/FxEngine.h:
src/controls.h:
build-fx/src/main.o: src/main.c

BIN
build-fx/src/main.o View File


pc/Capture du 2019-07-27 17-30-03.png → pc/v1/Capture du 2019-07-27 17-30-03.png View File


pc/Capture du 2019-08-02 10-40-48.png → pc/v1/Capture du 2019-08-02 10-40-48.png View File


pc/Capture du 2019-08-02 10-46-33.png → pc/v1/Capture du 2019-08-02 10-46-33.png View File


pc/topic.txt → pc/v1/topic.txt View File


+ 2
- 2
project.cfg View File

@ -16,7 +16,7 @@ ICON_CG_SEL = assets-cg/icon-cg-sel.png
# Additional compiler flags
CFLAGS = -std=c11 -Os
# Additional linker flags
LDFLAGS =
LDFLAGS = -lfxengine -llog-fx -lgint-fx -lprof
# FxEngine font
FONT.FxEngine.png = charset:print grid.size:3x5 grid.padding:1 proportional:true
# FONT.FxEngine.png = charset:print grid.size:3x5 grid.padding:1 proportional:true

+ 0
- 120
src/FxEngine/FxEngine.c View File

@ -1,120 +0,0 @@
#include "FxEngine.h"
#include <libprof.h>
#include "coord.h"
#include <stdbool.h>
#include <gint/keyboard.h>
#include <gint/clock.h>
#include <gint/display.h>
FE_position FE_user={0,0,0};
double FE_dh,FE_dv,FE_roulis;
static double px,py,pz;
static uint32_t frame_interval=0, frame_interval_min=1000001, frame_interval_max=1; // in milliseconds
static bool loaded_before=false;
static double dh_vel=0.05;
static double dv_vel=0.05;
static double roulis_vel=0.05;
static void FE_move() // call at each frame
{
key_event_t event;
while (true)
{
event=pollevent();
if (event.type&KEYEV_DOWN)
{
if (event.key==KEY_LEFT)
FE_dh-=dh_vel;
if (event.key==KEY_RIGHT)
FE_dh+=dh_vel;
if (event.key==KEY_UP)
FE_dv+=dv_vel;
if (event.key==KEY_DOWN)
FE_dv-=dv_vel;
if (event.key==KEY_PLUS)
FE_roulis+=roulis_vel;
FE_dh=FE_modulo_2pi(FE_dh);
FE_dv=FE_modulo_2pi(FE_dv);
FE_roulis=FE_modulo_2pi(FE_roulis);
if (event.key==KEY_8)
{
py+=FE_cos(FE_dh);
px+=FE_sin(FE_dh);
}
if (event.key==KEY_5)
{
py+=FE_cos(FE_dh+pi);
px+=FE_sin(FE_dh+pi);
}
if (event.key==KEY_4)
{
py+=FE_cos(FE_dh-pi_sur2);
px+=FE_sin(FE_dh-pi_sur2);
}
if (event.key==KEY_6)
{
py+=FE_cos(FE_dh+pi_sur2);
px+=FE_sin(FE_dh+pi_sur2);
}
}
if (event.type==KEYEV_NONE)
break;
}
FE_user.x=px;
FE_user.y=py;
FE_user.z=pz;
}
void FE_new_frame(void)
{
if (loaded_before)
{
prof_leave(0);
frame_interval=prof_time(0);
if (frame_interval<frame_interval_min)
frame_interval_min=frame_interval;
if (frame_interval>frame_interval_max)
frame_interval_max=frame_interval;
}
else
{
prof_init(1,0);
loaded_before=true;
}
prof_clear(0);
prof_enter(0);
FE_move(); // Not implemented yet !
FE_set_matrice();
FE_zbuffer_clear();
dupdate();
dclear(C_WHITE);
}
static char fps_history[15];
char* FE_get_fps_history()
{
sprintf(fps_history,"%d/%d/%d",FE_get_fps_min(),FE_get_fps_current(),FE_get_fps_max());
return fps_history;
}
static const uint32_t unite=1000000;
unsigned int FE_get_fps_current(void)
{return unite/frame_interval;}
unsigned int FE_get_fps_min(void)
{return unite/frame_interval_max;}
unsigned int FE_get_fps_max(void)
{return unite/frame_interval_min;}

+ 0
- 46
src/FxEngine/FxEngine.h View File

@ -1,46 +0,0 @@
#ifndef FENG_H
#define FENG_H
#include "coord.h"
#include "zbuffer.h"
extern double FE_dh,FE_dv,FE_roulis;
extern FE_position FE_user;
/*** FE_new_frame()
* This function displays las frame content and prepares the next frame
* Then, you have to use this in that order :
* while (1) {
* FE_new_frame()
* calculating...
* displaying model
* post rendering functions
* }
**/
void FE_new_frame(void); // calls move function
/** FE_get_fps_current()
* return a fps number based on the last frame
**/
unsigned int FE_get_fps_current(void);
/** FE_get_fps_min()
* return minimal fps number since the addin started
**/
unsigned int FE_get_fps_min(void);
/** FE_get_fps_max()
* return maximal fps number since the addin started
**/
unsigned int FE_get_fps_max(void);
/** FE_get_fps_history()
* returns minimal, current and maximal fps number since the addin started
* the type is a char* and the fps are set using its format : min/current/max
**/
char* FE_get_fps_history(void);
#endif

+ 0
- 118
src/FxEngine/coord.c View File

@ -1,118 +0,0 @@
#include "coord.h"
#include "FxEngine.h"
/* Cosinus and sinus implementation */
/// Math values
const double pi=3.141592653589793238462643383279;
const double pi2=pi*2;
const double pi_sur2=pi/2;
/// Internal Use
// cos function with 0<a<pi/2
static const int precision=15;
static double reducted_cos(const double a)
{
double u=1.0; const double a2=a*a;
// precision%2=1 && precision>1
for(int p=precision;p>=1;p-=2)
u=1-a2/(p*p+p)*u;
return u;
}
// return a with -pi<=a<pi
double FE_modulo_2pi(double a)
{
while (a<=-pi) a+=pi2;
while (a>pi) a-=pi2;
return a;
}
static double cos_recursive(double angle)
{
if (angle<0)
return cos_recursive(-angle);
if (angle>=pi_sur2)
return -reducted_cos(angle-pi);
return reducted_cos(angle); // OK
}
/// External functions
// Official FE_cos function
double FE_cos(double angle)
{
angle=FE_modulo_2pi(angle);
return cos_recursive(angle);
}
// Official FE_sin function
double FE_sin(double angle)
{return FE_cos(angle-pi_sur2);}
#define sgn(x) (x>=0?x:-x)
static double matrice[3][3]=
{
{0,0,0},
{0,0,0},
{0,0,0}
};
void FE_calc(FE_point* point)
{
static FE_position temp;
temp.x = point->real.x - FE_user.x;
temp.y = point->real.y - FE_user.y;
temp.z = point->real.z - FE_user.z;
point->rotated.x = (double)(matrice[0][0]*(double)temp.x + matrice[0][1]*(double)temp.y + matrice[0][2]*(double)temp.z);
point->rotated.z = (double)(matrice[1][0]*(double)temp.x + matrice[1][1]*(double)temp.y + matrice[1][2]*(double)temp.z);
point->rotated.y = (double)(matrice[2][0]*(double)temp.x + matrice[2][1]*(double)temp.y + matrice[2][2]*(double)temp.z);
//point->translated.x*=10;
//point->translated.y*=10;
point->rotated.x*=64;
point->rotated.y*=64;
point->translated.z=point->rotated.z;
if (point->translated.z>0)
{
point->translated.x=point->rotated.x/point->translated.z;
point->translated.y=point->rotated.y/point->translated.z;
}
else
{
point->translated.x=point->rotated.x*10000*sgn(point->translated.z);
point->translated.y=point->rotated.y*10000*sgn(point->translated.z);
}
(point->translated.x*1000)/point->translated.z;
(point->translated.y*1000)/point->translated.z;
point->translated.x+=63;
point->translated.y+=31;
}
// FIABLE
void FE_set_matrice(void)
{
const double A=FE_cos(FE_dv), B=FE_sin(FE_dv);
const double C=FE_cos(FE_roulis), D=FE_sin(FE_roulis);
const double E=FE_cos(FE_dh), F=FE_sin(FE_dh);
const double AD=A*D, BD=B*D;
matrice[0][0]=C*E;
matrice[0][1]=-C*F;
matrice[0][2]=D;
matrice[1][0]=BD*E+A*F;
matrice[1][1]=-BD*F+A*E;
matrice[1][2]=-B*C;
matrice[2][0]=-AD*E+B*F;
matrice[2][1]=AD*F+B*E;
matrice[2][2]=A*C;
}

+ 0
- 30
src/FxEngine/coord.h View File

@ -1,30 +0,0 @@
#ifndef FE_COORD_H
#define FE_COORD_H
typedef struct FE_position FE_position;
struct FE_position
{int x,y,z;};
typedef struct FE_point FE_point;
struct FE_point
{FE_position real,translated,rotated};
void FE_calc(FE_point* point);
// sets rotation matrice
void FE_set_matrice(void);
// Maths
extern const double pi;
extern const double pi2;
extern const double pi_sur2;
double FE_modulo_2pi(double a);
double FE_cos(double angle);
double FE_sin(double angle);
#endif

+ 0
- 160
src/FxEngine/face.c View File

@ -1,160 +0,0 @@
#include "face.h"
#include "texture.h"
#include "zbuffer.h"
#include <stdbool.h>
#include <gint/display.h>
#define min(x,y) (x<y?x:y)
#define max(x,y) (x>y?x:y)
#define abs(x) (x>0?x:-x)
static bool sens_horaire(FE_face const * face)
{
int area = 0;
area+=face->s1->translated.x*face->s2->translated.y;
area-=face->s2->translated.x*face->s1->translated.y;
area+=face->s2->translated.x*face->s3->translated.y;
area-=face->s3->translated.x*face->s2->translated.y;
area+=face->s3->translated.x*face->s1->translated.y;
area-=face->s1->translated.x*face->s3->translated.y;
return (area < 0);
}
// gestion des lignes
typedef struct line line;
struct line
{
int x,y,z;
int dx,dy,dz;
bool no_line; // si les deux points sont confondus
};
static void set_line(line* segment,FE_point const * s1, FE_point const * s2)
{
segment->x=s1->translated.x;
segment->y=s1->translated.y;
segment->z=s1->translated.z;
segment->dx=s2->translated.x-s1->translated.x;
segment->dy=s2->translated.y-s1->translated.y;
segment->dz=s2->translated.z-s1->translated.z;
segment->no_line=(segment->dx==0&&segment->dy==0);
}
static bool get_x(int y, line const * segment, int * x)
{
y-=segment->y;
if (y<0 && segment->dy>0)
return false;
if (y>0 && segment->dy<0)
return false;
if (abs(y)>abs(segment->dy))
return false;
if (segment->dy!=0)
*x=segment->x+(y*segment->dx)/segment->dy;
else if (y==0)
*x=segment->x+segment->dx;
else
return false;
return true;
}
void FE_draw_face(FE_face const * face)
{
if (sens_horaire(face)!=face->visible)
return;
if (face->s1->translated.x<0 && face->s2->translated.x<0 && face->s3->translated.x<0)
return;
if (face->s1->translated.x>127 && face->s2->translated.x>127 && face->s3->translated.x>127)
return;
if (face->s1->translated.y<0 && face->s2->translated.y<0 && face->s3->translated.y<0)
return;
if (face->s1->translated.y>63 && face->s2->translated.y>63 && face->s3->translated.y>63)
return;
if (face->s1->translated.z<=0 && face->s2->translated.z<=0 && face->s3->translated.z<=0)
return;
line cotes[3];
set_line(&cotes[0],face->s1,face->s2);
set_line(&cotes[1],face->s1,face->s3);
set_line(&cotes[2],face->s2,face->s3);
if (cotes[0].no_line||cotes[1].no_line||cotes[2].no_line)
return;
const int ymin=max(min(face->s1->translated.y,min(face->s2->translated.y,face->s3->translated.y)),0);
const int ymax=min(max(face->s1->translated.y,max(face->s2->translated.y,face->s3->translated.y)),63);
const int xAB=face->s2->translated.x-face->s1->translated.x, yAB=face->s2->translated.y-face->s1->translated.y, zAB=face->s2->translated.z-face->s1->translated.z;
const int xAC=face->s3->translated.x-face->s1->translated.x, yAC=face->s3->translated.y-face->s1->translated.y, zAC=face->s3->translated.z-face->s1->translated.z;
const int diviseur_commun=(xAB*yAC-yAB*xAC); //(multiplier par 10000)
const int fact_1=(10000*yAC)/diviseur_commun, fact_2=(10000*xAC)/diviseur_commun;
const int fact_3=(10000*xAB)/diviseur_commun, fact_4=(10000*yAB)/diviseur_commun;
const int r_xAB=face->s2->rotated.x-face->s1->rotated.x, r_yAB=face->s2->rotated.y-face->s1->rotated.y;
const int r_xAC=face->s3->rotated.x-face->s1->rotated.x, r_yAC=face->s3->rotated.y-face->s1->rotated.y;
const int r_diviseur_commun=(r_xAB*r_yAC-r_yAB*r_xAC);
const int r_fact_1=(10000*r_yAC)/r_diviseur_commun, r_fact_2=(10000*r_xAC)/r_diviseur_commun;
const int r_fact_3=(10000*r_xAB)/r_diviseur_commun, r_fact_4=(10000*r_yAB)/r_diviseur_commun;
for (int y=ymin; y<=ymax; y++)
{
// détermination du xmin et du xmax de la ligne
int tx1,tx2;
for (int t=0;t<3;t++)
{if (get_x(y,&cotes[t],&tx1)) break;}
for (int t=0;t<3;t++)
{if (get_x(y,&cotes[t],&tx2)&&tx1!=tx2) break;}
const int txmin=max(min(tx1,tx2),0), txmax=min(max(tx1,tx2),127);
for (int x=txmin; x<=txmax; x++)
{
int xcalc,ycalc,vx,vy,vz,z,rx,ry;
// initialisation des variables temporaires au calcul de vx, vy
xcalc=x-face->s1->translated.x;
ycalc=y-face->s1->translated.y;
// calcul de vx,vy, et vz sans la déformation
vx=(xcalc*fact_1-ycalc*fact_2); // 0 <vx< 10_000
vy=(ycalc*fact_3-xcalc*fact_4); // idem
vz=face->s1->translated.z + (vx*zAB+vy*zAC)/10000;
// transformation
rx=x-63; // on determine le centre de l'écran comme le point X(63,31)
ry=y-31;
rx*=vz; // on annule la perspective
ry*=vz;
// deuxieme processus de calcul (avec déformation)
xcalc=rx-face->s1->rotated.x;
ycalc=ry-face->s1->rotated.y;
vx=(xcalc*r_fact_1-ycalc*r_fact_2);
vy=(ycalc*r_fact_3-xcalc*r_fact_4);
z=face->s1->translated.z + (vx*zAB+vy*zAC)/10000;
// Affichage du point
if (FE_zbuffer_set_dist(x,y,z))
dpixel(x, y, 3*FE_get_pixel(face->texturenum,vx/1250,vy/1250)); // 3* means cast to black and white, and vx,and vy casted between 0 and 7
}
}
// x=Det(AM,AC)/det(AB,AC)
// y=det(AM,AB)/det(AC,AB)
// x=(xAM*yAC-yAM*xAC)/(xAB*yAC-yAB*xAC)
// y=(xAM*yAB-yAM*xAB)/(xAC*yAB-yAC*xAB)
// soit diviseur_commun = (xAB*yAC-yAB*xAC)
// x=xAM*yAC/diviseur_commun-yAM*xAC/diviseur_commun
// y=yAM*xAB/diviseur_commun-xAM*yAB/diciseur_commun
}

+ 0
- 17
src/FxEngine/face.h View File

@ -1,17 +0,0 @@
#ifndef FE_FACE_H
#define FE_FACE_H
#include "coord.h"
#include "FxEngine.h"
typedef struct FE_face FE_face;
struct FE_face
{
FE_point *s1,*s2,*s3;
bool visible; // true => clockwised
int texturenum;
};
void FE_draw_face(FE_face const * face);
#endif

+ 0
- 73
src/FxEngine/libprof.c View File

@ -1,73 +0,0 @@
#include <gint/timer.h>
#include <gint/clock.h>
#include <gint/mpu/tmu.h>
#include <gint/std/stdlib.h>
#include <gint/hardware.h>
#include <libprof.h>
/* Recursion depth of each function currently being executed */
uint8_t *prof_rec = NULL;
/* Time that has elapsed within each function; the value for a given function
is only relevant when it is not executing, due to optimizations */
uint32_t *prof_elapsed = NULL;
/* Timer counter */
uint32_t volatile *prof_tcnt = NULL;
/* Timer ID */
static int prof_timer;
/* prof_init(): Initialize the profiler's data and timer */
int prof_init(int n, int timer)
{
if((unsigned)timer >= 3) return 1;
prof_rec = malloc(n * sizeof *prof_rec);
prof_elapsed = malloc(n * sizeof *prof_elapsed);
int status = timer_setup(timer, 0xffffffff, timer_Po_4, NULL, NULL);
if(!prof_rec || !prof_elapsed || status < 0)
{
prof_quit();
return 1;
}
/* Fix the configuration done by gint by disabling the interrupt */
if(isSH3())
{
SH7705_TMU.TMU[timer].TCR.UNIE = 0;
prof_tcnt = &SH7705_TMU.TMU[timer].TCNT;
}
else
{
SH7305_TMU.TMU[timer].TCR.UNIE = 0;
prof_tcnt = &SH7305_TMU.TMU[timer].TCNT;
}
timer_start(timer);
prof_timer = timer;
return 0;
}
/* prof_quit(): Free the profiler's data and timer */
void prof_quit(void)
{
timer_stop(prof_timer);
free(prof_rec);
free(prof_time);
}
//---
// Post-measurement analysis
//---
/* prof_time(): Time spent in a given context, in microseconds */
uint32_t prof_time(int ctx)
{
int Pphi = clock_freq()->Pphi_f;
uint64_t time = prof_elapsed[ctx];
return (time * 4 * 1000000) / Pphi;
}

+ 0
- 75
src/FxEngine/libprof.h View File

@ -1,75 +0,0 @@
//---
// libprof: A manual profiling library for gint
//---
#ifndef LIBPROF_LIBPROF
#define LIBPROF_LIBPROF
#include <stdint.h>
//---
// Initialization
//---
/* prof_init(): Initialize the profiler's data and timer
Initializes [prof_rec] and [prof_time] (see below) with enough elements to
hold all the context IDs. Context IDs should be numbered from 0 to [n-1];
due to speed requirements array bounds are not checked so be careful.
Also starts a timer to count time. The timer ID must be set to 0, 1 or 2 as
the standard TMU is the most tweakable and precise. libprof automatically
selects an accurate timer configuration.
@n Number of different contexts (functions) that will be measured
@timer Timer ID, see <gint/timer.h> to select one
Returns non-zero if a setup error occurs. */
int prof_init(int n, int timer);
/* prof_quit(): Free the profiler's data and timer */
void prof_quit(void);
//---
// Runtime time measurement
//---
/* Recursion depth of each function currently being executed */
extern uint8_t *prof_rec;
/* Time that has elapsed within each function; the value for a given function
is only relevant when it is not executing, due to optimizations */
extern uint32_t *prof_elapsed;
/* Timer counter */
extern uint32_t volatile *prof_tcnt;
/* prof_enter(): Start counting time for a function
This macro should be called at the start of the context scope. If the
function was already executing then the deepest instance in the stack is
used instead of creating a new counter. */
#define prof_enter(ctx) { \
if(!prof_rec[ctx]++) prof_elapsed[ctx] += *prof_tcnt; \
}
/* prof_leave(): Stop counting time for a function
This should be called at the end of the context scope; it only actually
stops if there is no deeper instance of the context in the stack. If there
are not as exactly as many prof_leave()'s as prof_enter()'s then the
resulting time measure will not be relevant at all. */
#define prof_leave(ctx) { \
if(!--prof_rec[ctx]) prof_elapsed[ctx] -= *prof_tcnt; \
}
/* prof_clear(): Clear a context's counter
This operation is defined only if the context is not being profiled. */
#define prof_clear(ctx) { \
prof_elapsed[ctx] = 0; \
}
//---
// Post-measurement analysis
//---
/* prof_time(): Time spent in a given context, in microseconds
Should only be called when the context is not currently executing. */
uint32_t prof_time(int ctx);
#endif /* LIBPROF_LIBPROF */

+ 0
- 13
src/FxEngine/texture.c View File

@ -1,13 +0,0 @@
#include "texture.h"
// textures address
unsigned char const FE_textures[3][8]=
{
{0,0,0,0,0,0,0,0}, // full white
{255,255,255,255,255,255,255,255}, // full black
{255,193,161,145,137,133,131,255} // borders and diagonal
};
bool FE_get_pixel(int num,int x, int y)
{x%=8;y%=8;return ((1<<(7-x)) & (FE_textures[num][y]));}

+ 0
- 15
src/FxEngine/texture.h View File

@ -1,15 +0,0 @@
#ifndef FE_TEXTURE_H
#define FE_TEXTURE_H
#include <stdbool.h>
#define FE_WHITE 0
#define FE_BLACK 1
// textures : 8x8
// du bon vieux bitmap monochrome, la routine quoi ^^
extern unsigned char const FE_textures[][8];
bool FE_get_pixel(int texture_num, int x, int y);
#endif

+ 0
- 41
src/FxEngine/zbuffer.c View File

@ -1,41 +0,0 @@
#include "zbuffer.h"
#include <stdbool.h>
#include <gint/display.h>
#include <gint/std/stdio.h>
#include <gint/std/stdlib.h>
#include <gint/keyboard.h>
static const int size_uint32 = 128*64;
static const int size_octets = size_uint32*sizeof(uint32_t);
static uint32_t* address=0;
void FE_zbuffer_clear()
{
while (address==0)
{
address=malloc(size_octets);
if (address==0)
{
dclear(C_WHITE);
dtext(1,1,"Not enough RAM...",C_BLACK,C_NONE);
}
}
uint32_t indice=0;
// TODO ** ajouter le DMA pour les architectures sh4
for (indice=0; indice<size_uint32; indice++)
address[indice]=3000;
}
bool FE_zbuffer_set_dist(int x, int y, int dist)
{
x%=FE_ZB_SIZE_X;
y%=FE_ZB_SIZE_Y;
const int indice=x*64+y;
if (address[indice]>dist&&dist>0)
{
address[indice]=dist;
return true;
}
else
return false;
}

+ 0
- 13
src/FxEngine/zbuffer.h View File

@ -1,13 +0,0 @@
#ifndef FE_ZBUFFER
#define FE_ZBUFFER
#include <stdbool.h>
// nouveauté ! le zbuffer occupe tout l'écran, le rendu 3d offre donc de meilleures possibilités
#define FE_ZB_SIZE_X 128
#define FE_ZB_SIZE_Y 64
void FE_zbuffer_clear(); // does not really clear the zbuffer, but changes encoding sign for the next frame ** on 1st frame, allocates data
bool FE_zbuffer_set_dist(int x, int y, int dist); // if you are allowed to draw the pixel on vram
#endif

+ 0
- 25
src/controls.c View File

@ -1,25 +0,0 @@
#include "controls.h"
#include <gint/display.h>
#include <gint/std/stdlib.h>
#include <gint/std/stdio.h>
#include <stdbool.h>
#include "FxEngine/FxEngine.h"
void init_controls()
{
dfont(&font_FxEngine);
}
static bool fps_visibility;
static char fps[10];
void reload_fps_displaying()
{
sprintf(fps,"%d",FE_get_fps_current());
}
void display_fps(int x, int y)
{
dimage(x,y,&img_fps);
dtext(x+11, y+2, fps, C_BLACK, C_NONE);
}

+ 0
- 11
src/controls.h View File

@ -1,11 +0,0 @@
#ifndef CONTROLS_H
#define CONTROLS_H
#include <gint/display.h>
extern font_t font_FxEngine;
extern image_t img_fps;
void init_controls();
void reload_fps_displaying();
void display_fps(int x, int y);
#endif

+ 0
- 8
src/credits.h View File

@ -1,8 +0,0 @@
#ifndef CREDITS_H
#define CREDITS_H
#define AUTHOR "Milang"
#define NAME "1v1 3D"
#define VERSION "Alpha Build 1.00"
#endif

+ 290
- 29
src/main.c View File

@ -1,38 +1,299 @@
#include <gint/display.h>
#include <gint/timer.h>
#include <gint/keyboard.h>
#include <liblog.h>
#include <fxengine/model/bitmap.h>
#include <fxengine/model/vertex.h>
#include <fxengine/model/triangle.h>
#include <fxengine/model/object.h>
#include <fxengine/renderlist.h>
#include <fxengine/fxengine.h>
int callback(void)
{
fe_callback_start();
fe_draw();
dupdate();
ll_send("Rendered Image\n");
key_event_t event = pollevent();
int state=0;
while (event.type!=KEYEV_NONE)
{
if (event.key == KEY_F1)
state = 1;
event=pollevent();
}
if (state)
{
timer_pause(1);
ll_pause();
timer_start(1);
}
fe_callback_end();
return 0;
}
int main(void)
{
dclear(C_WHITE);
uint32_t color[32] =
{
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111
};
fe_bitmap * bmp = fe_bitmap_new(32, 32, color, 0, 0, 0);
fe_vertex v[3]=
{
{30,-10,-10},
{30,10,10},
{30,-10,10}
};
fe_object obj;
fe_object_init(&obj);
fe_object_set_vertex(&obj, v, 3, 0);
fe_triangle t[1]=
{
fe_object_getvx(&obj,0),
fe_object_getvx(&obj,1),
fe_object_getvx(&obj,2),
bmp, bmp,
0
};
fe_object_set_faces(&obj, t, 1, 0);
// Add object to list
fe_renderlist_add(&obj);
// Launch game timer at 40 FPS max
timer_setup(1, timer_delay(0, 25 * 1000), 0, callback, 0);
timer_start(1);
// Launch 3D renderer
fe_load();
// Free Data
return;
}
/*
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gint/std/stdio.h>
#include <gint/std/stdlib.h>
#include <gint/clock.h>
#include "FxEngine/FxEngine.h"
#include "FxEngine/face.h"
#include "controls.h"
#include <fxengine/camera.h>
#include <fxengine/object.h>
#include <fxengine/fxengine.h>
#include <liblog.h>
#include <fxengine.h>
int main(void)
{
init_controls();
dclear(C_WHITE);
FE_point point[4]={{{10,0,0},{0,0,0}},{{10,10,0},{0,0,0}},{{10,0,10},{0,0,0}},{{10,10,10},{0,0,0}}};
FE_face face={&point[0],&point[1],&point[2],1,2};
FE_face face2={&point[3],&point[1],&point[2],0,2};
while (1)
{
FE_new_frame();
reload_fps_displaying();
for (int i=0;i<4;i++)
{
FE_calc(&point[i]);
if (point[i].translated.z>0)
{
dpixel(point[i].translated.x,point[i].translated.y,C_BLACK);
}
}
FE_draw_face(&face);
FE_draw_face(&face2);
display_fps(100,56);
}
getkey();
return 1;
}
ll_set_state(0);
ll_set_panic();
ll_send("Log Beginning\n");
dclear(C_WHITE);
uint32_t color[32] =
{
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111,
0b11111111111111111111111111111111
};
fe_texture_rich * bmp = fe_texture_new_rich(32, 32, color, 0, 0, 0);
fe_ivertex v[4]=
{
{
{30,-10,-10},
{0,0,0}
},
{
{30,10,10},
{0,0,0}
},
{
{30,-10,10},
{0,0,0}
}
};
fe_triangle triangle =
{
{
fe_object_get_vertex(&object, 0),
fe_object_get_vertex(&object, 1),
fe_object_get_vertex(&object, 2),
bmp,
0,
0
}
};
fe_object object; fe_object_init(&object);
fe_object_set_points(&object, &v, 3, 0);
fe_triangle triangle =
{
{
fe_object_get_vertex(&object, 0),
fe_object_get_vertex(&object, 1),
fe_object_get_vertex(&object, 2),