Giter Site home page Giter Site logo

theziz / sparrow3d Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 9.0 14.79 MB

a software renderer for different open handhelds like the gp2x, wiz, caanoo and pandora

License: GNU Lesser General Public License v2.1

Shell 0.18% C 97.42% C++ 1.04% Makefile 1.36%

sparrow3d's Introduction

Sparrow3D

  1. About Sparrow3D
  2. Licence
  3. Documentation
  4. Compiling Sparrow3D
  5. Author

  1. About Sparrow3D ==================

Sparrow3D is an application framework with software renderer especially for open handhelds. The goal is to just write an application once and to compile it e.g. for:

  • GP2X F100 / F200
  • GP2X WIZ
  • GP2X Caanoo
  • Dingux
  • Pandora
  • GCW Zero
  • RG-350
  • PC (Linux / Windows) (mainly for testing...)

That are the systems, which are supported at the moment or which hopefully will be supported in the near future. :) To see, what is possible with this engine take a look at

  • Puzzletube
  • Snowman
  • Schwerkaft

  1. Licence ==========

Not much to say: Just (L)GPL. If you want another Licence (e.g. some kind of BSD licence) feel free to contact me. ;-)


  1. Documentation ==========

You can find the documentation [here][docu] and furthermore some first steps and examples in the [github wiki][wiki]. [docu]: http://ziz.gp2x.de/documentation [wiki]: https://github.com/theZiz/sparrow3d/wiki


  1. Compiling Sparrow3D ======================

For compiling for PC just type make Thats all. Their is no possibility to install or such a thing ^^ For handhelds type make targets to get the targets and make TARGET=target to compile for the target "target". Every target has a .mk file in the folder targets. Change the paths in these files to your paths. Keep in mind, this engine and the games using this engines are mode for (hopefully) open handhelds! Their is no need to install anything... If you want to test the testsparrow-application on your handheld / PC use the ./testsparrow.sh file. If the file doesn't work on your system or you just don't want to use it, keep sure, that the application finds the libsparrow3d.whatever (e.g. .so on linux system or .dll on windows machines)

Here is a list of compile-switches used throughout sparrow (use with -D...):

BUILDING_DLL

  • Windows only, changes dllimport to dllexport, if you are running into errors during linking, compile with this define

CORE_DEBUG

  • Print out verbose debug text

UNSAFE_MAGIC

  • could crash, uses possibly memory (just reading) Try always to have some border pixels to your textures if using!

BLACK_MAGIC

  • Uses fancy lookup table magic to improve speed, but may look worse. Just try.

FAST_MULTIPLICATION

  • looks good at small resolutions

FAST_DIVISION

  • looks good at small resolutions

SDL_INCLUDE_SUBDIR

  • Changes the include path for every SDL*.h file to SDL/SDL*.h

Target platforms (defines, use with -D...):

GP2X

  • Second and third generation of GPH devices, use with one of the following switches: F100, WIZ

CAANOO

  • GPH Caanoo

DINGUX

  • Dingoo with dingux Linux

GCW

  • GCW Zero

RG350

  • RG-350

PANDORA

  • Pandora

  1. Author =========

Alexander Matthes aka Ziz

I think you read, that I am not an Englisch native speaker. So ignore the bad grammar or give me corrections. I always try to get better. :)

sparrow3d's People

Contributors

bzar avatar foxblock avatar pmprog avatar theziz avatar zear avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sparrow3d's Issues

warning: this decimal constant is unsigned only in ISO C90

Will this be critical?
Using: sbox-arm-none-linux-gnueabi-gcc (Linaro GCC 4.7-2012.07) 4.7.2 20120701 (prerelease)

sparrowPrimitives.c: In function 'spSetAlphaPattern4x4':
sparrowPrimitives.c:5786:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5793:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5800:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5807:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5814:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5821:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5828:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5835:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5842:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5849:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5856:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
sparrowPrimitives.c:5862:4: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]

spEllipseBorder Bug - draws uniformly circle with a little line at the bottom

The following call:
spEllipseBorder( pos.x, pos.y, -1, radius, radius, bx, by, colour );
results in the following circles to be drawn where bx and by are
1, 1 | 5, 5 | 5, 1 | 1, 5 (radius is 20 for the small circle and 32 for the big one)
http://imgur.com/cRlmM

As you can see choosing the same value for bx and by results in a small line at the bottom.
This also is the case for some ellipses where rx and ry are only marginally different.

Does not build

/home/paul/dev/rs90/buildroot/output/gcw0/host/bin/mipsel-gcw0-linux-uclibc-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -O2   -DGCW -shared -Wl,-soname,libsparrow3d.so -rdynamic -o ./libsparrow3d.so sparrowFont.o sparrowCore.o sparrowMath.o sparrowPrimitives.o sparrowMesh.o sparrowSprite.o sparrowFile.o sparrowPrimitivesAsm.o sparrowRenderer.o sparrowText.o sparrowMapping.o sparrowParticles.o -I/home/paul/dev/rs90/buildroot/output/gcw0/host/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/../../usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT   -I.   -lSDL_mixer -lSDL_ttf -lSDL_image -lSDL -lm -lSDL_net
/home/paul/dev/rs90/buildroot/output/gcw0/host/lib/gcc/mipsel-gcw0-linux-uclibc/10.2.0/../../../../mipsel-gcw0-linux-uclibc/bin/ld: sparrowMapping.o:(.bss+0xaf54): multiple definition of `__spMapDesktopHack'; sparrowCore.o:(.bss+0x4040): first defined here
/home/paul/dev/rs90/buildroot/output/gcw0/host/lib/gcc/mipsel-gcw0-linux-uclibc/10.2.0/../../../../mipsel-gcw0-linux-uclibc/bin/ld: sparrowMapping.o:(.bss+0xaa48): multiple definition of `__spMapDesktopButton'; sparrowCore.o:(.bss+0x4020): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:184: libsparrow3d.so] Error 1
make[1]: *** [package/pkg-generic.mk:250: /home/paul/dev/rs90/buildroot/output/gcw0/build/sparrow3d-14bcb69/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2

Fix:

diff --git a/sparrowCore.c b/sparrowCore.c
index 97bb802..8056f83 100644
--- a/sparrowCore.c
+++ b/sparrowCore.c
@@ -86,8 +86,8 @@ char spWindowName[512] = "";
 int spVirtualKeyboardSpaceButton = -1;
 int spVirtualKeyboardBackspaceButton = -1;
 
-int __spMapDesktopHack;
-int __spMapDesktopButton[SP_MAPPING_MAX];
+extern int __spMapDesktopHack;
+extern int __spMapDesktopButton[SP_MAPPING_MAX];
 
 typedef struct sp_cache_struct *sp_cache_pointer;
 typedef struct sp_cache_struct {

building sparrow stopped working on Jetson Nano

On jetson Nano a fresh git pull refuses to build now. But i don't yet see what commits or changes to my system might have caused this.

Devuan ceres, aarch64.

Thought i'd report it here in case someone else is interested. If i figure out what's wrong of course I'll append a comment.

☠ /pr/games/sparrow3d$ make
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowCore.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowMath.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowPrimitives.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowPrimitivesAsm.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowRenderer.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowFont.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowMesh.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowSprite.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowText.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowFile.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowMapping.c `sdl-config --cflags`   -DBUILDING_DLL -I.
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowParticles.c `sdl-config --cflags`   -DBUILDING_DLL -I.
ar rcs ./libsparrow3d.a sparrowFont.o sparrowCore.o sparrowMath.o sparrowPrimitives.o sparrowMesh.o sparrowSprite.o sparrowFile.o sparrowPrimitivesAsm.o sparrowRenderer.o sparrowText.o sparrowMapping.o sparrowParticles.o
ranlib ./libsparrow3d.a
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowNet.c `sdl-config --cflags`   -DBUILDING_DLL -I.
ar rcs ./libsparrowNet.a sparrowNet.o
ranlib ./libsparrowNet.a
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -fPIC -c sparrowSound.c `sdl-config --cflags`   -DBUILDING_DLL -I.
ar rcs ./libsparrowSound.a sparrowSound.o
ranlib ./libsparrowSound.a
cc -O3 -fsingle-precision-constant -fPIC -DFAST_DIVISION -DFAST_MULTIPLICATION  -g -ffast-math  -DDESKTOP -Wno-pointer-to-int-cast -shared -Wl,-soname,libsparrow3d.so -rdynamic -o ./libsparrow3d.so sparrowFont.o sparrowCore.o sparrowMath.o sparrowPrimitives.o sparrowMesh.o sparrowSprite.o sparrowFile.o sparrowPrimitivesAsm.o sparrowRenderer.o sparrowText.o sparrowMapping.o sparrowParticles.o `sdl-config --cflags`   -I.   -lSDL_mixer -lSDL_ttf -lSDL_image -lSDL -lm -lSDL_net
/usr/bin/ld: sparrowMapping.o:/pr/games/sparrow3d/sparrowMapping.c:29: multiple definition of `__spMapDesktopHack'; sparrowCore.o:/pr/games/sparrow3d/sparrowCore.c:89: first defined here
/usr/bin/ld: sparrowMapping.o:/pr/games/sparrow3d/sparrowMapping.c:30: multiple definition of `__spMapDesktopButton'; sparrowCore.o:/pr/games/sparrow3d/sparrowCore.c:90: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:184: libsparrow3d.so] Error 1

[EDIT}
Building on droid4 with devuan beowulf works, so this probably relates to something broken in my build environment on the nano. Closing as it's not sparrow3d's problem.

Linker fails to find SDL

Trying to build with flatpak-builder version 1.3 17630be

Running: make
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowCore.c `sdl-config --cflags`   -I.
sparrowCore.c: In function ‘sp_get_cached_surface_by_surface’:
sparrowCore.c:1335:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 1335 |   Uint32 hash = (int)surface & (SP_CACHE_SIZE-1);
      |                 ^
sparrowCore.c: In function ‘spLoadSurface’:
sparrowCore.c:1406:43: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 1406 |                         c->surface_hash = (int)c->surface & (SP_CACHE_SIZE-1);
      |                                           ^
sparrowCore.c: In function ‘spCreateSurface’:
sparrowCore.c:1469:35: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 1469 |                 c->surface_hash = (int)c->surface & (SP_CACHE_SIZE-1);
      |                                   ^
sparrowCore.c: At top level:
sparrowCore.c:511:41: warning: ‘spHandleKeyboardInput’ is static but used in inline function ‘spHandleEvent’ which is not static
  511 |                                         spHandleKeyboardInput(event.key.keysym);
      |                                         ^~~~~~~~~~~~~~~~~~~~~
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowMath.c `sdl-config --cflags`   -I.
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowPrimitives.c `sdl-config --cflags`   -I.
sparrowPrimitives.c: In function ‘spHorizentalLine’:
sparrowPrimitives.c:1307:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 1307 |         if ( ( int )pixel + ( pos << 1 ) & 2 )
      |              ^
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fsingle-precision-constant -fPIC -c sparrowPrimitivesAsm.c `sdl-config --cflags`   -I.
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowRenderer.c `sdl-config --cflags`   -I.
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowFont.c `sdl-config --cflags`   -I.
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowMesh.c `sdl-config --cflags`   -I.
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowSprite.c `sdl-config --cflags`   -I.
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowText.c `sdl-config --cflags`   -I.
sparrowText.c: In function ‘spLoadBundle’:
sparrowText.c:201:23: warning: implicit declaration of function ‘spReadOneLine’ [-Wimplicit-function-declaration]
  201 |                 end = spReadOneLine(file,line,SP_TEXT_MAX_READABLE_LINE);
      |                       ^~~~~~~~~~~~~
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -fPIC -c sparrowFile.c `sdl-config --cflags`   -I.
gcc -march=native -DX86CPU -g -ffast-math  -O2 -fsingle-precision-constant -fPIC -shared -Wl,-soname,libsparrow3d.so -rdynamic -o ./libsparrow3d.so sparrowFont.o sparrowCore.o sparrowMath.o sparrowPrimitives.o sparrowMesh.o sparrowSprite.o sparrowFile.o sparrowPrimitivesAsm.o sparrowRenderer.o sparrowText.o `sdl-config --cflags`   -I.   -lSDL_mixer -lSDL_ttf -lSDL_image -lSDL -lm
/usr/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lSDL_mixer: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lSDL_ttf: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lSDL_image: No such file or directory
/usr/lib/gcc/x86_64-unknown-linux-gnu/13.2.0/../../../../x86_64-unknown-linux-gnu/bin/ld: cannot find -lSDL: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:151: libsparrow3d.so] Error 1

https://github.com/Mailaender/flathub/blob/hase/de.gp2x.ziz.hase.yaml

Problems with large triangles

Triangles larger than the near frustum value flicker wildly in front of the "camera" when the object they belong to is moved.
Is this a known issue, or is there some part of the engine that could be causing this?

Pumping events outside of spLoop

I was wondering if it's possible to pump SDL events etc. from outside the spLoop call (or, I suppose technically inside it)

Basically, with libcurl, you call a function to start the download from the internet, but that call blocks execution. However, you can set callback functions for it for "progress", which will allow you to execute some code during the download, and in this part, I would like to process all the SDL events, and take the chance to redraw the screen.

My other option is creating a thread for the downloads, which I don't think is a major problem

PNG Alpha Channel

As far as I can tell, SDL_Image loads in PNGs with the alpha channel intact. Now that you've added some blending functionality, any chance that blitting could support this?

Cheers :)

don't suppose name of current directory (couple of tests will fail)

--- a/testfile.c
+++ b/testfile.c
@@ -6,7 +6,7 @@
  For feedback and questions about my Files and Projects please mail me,
  Alexander Matthes (Ziz) , zizsdl_at_googlemail.com
 */
-#include "../sparrow3d/sparrow3d.h"
+#include "sparrow3d.h"

 int main( int argc, char **argv )
 {
diff --git a/testtext.c b/testtext.c
index 872cc1b..13b9202 100644
--- a/testtext.c
+++ b/testtext.c
@@ -6,7 +6,7 @@
  For feedback and questions about my Files and Projects please mail me,
  Alexander Matthes (Ziz) , zizsdl_at_googlemail.com
 */
-#include "../sparrow3d/sparrow3d.h"
+#include "sparrow3d.h"

 int main( int argc, char **argv )
 {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.