BGE Dome: BlenderPlayer Console arguments: warpdata working now (only with absolute...
authorDalai Felinto <dfelinto@gmail.com>
Thu, 25 Feb 2010 06:05:56 +0000 (06:05 +0000)
committerDalai Felinto <dfelinto@gmail.com>
Thu, 25 Feb 2010 06:05:56 +0000 (06:05 +0000)
I forgot to say in the last commit that those arguments are only for the BlenderPlayer.
we can now set external warpdata files.

2Do:
(1) convert relative to absolute paths for warpdata files
(2) investigate weird bug on lack of light in blenderplayer with warpmesh

... [old 2Do]

(3) documentation
(4) preserve scene settings (at least scene->gm.dome) even if you load a new file inside the game (e.g. Yo Frankie loading new levels)

source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

index ce80036de8f63c8db3f8269c33c2dc6d9a7da56f..95370beeeb33fff5dc4d700073f27ccedecad746 100644 (file)
@@ -65,6 +65,7 @@ extern "C"
 #include "BLO_readfile.h"
 #include "BLO_readblenfile.h"
 #include "IMB_imbuf.h"
+#include "BKE_text.h"
        
        int GHOST_HACK_getFirstFile(char buf[]);
        
@@ -197,9 +198,9 @@ void usage(const char* program)
        printf("                             depending on the type of stereo you want\n\n");
        printf("  -D: start player in dome mode\n");
        printf("       --Optional parameters--\n");
-       printf("       angle = field of view in degrees\n");
-       printf("       tilt = tilt angle in degrees\n");
-       printf("       warpdata = a file to use for warping the image\n");      
+       printf("       angle    = field of view in degrees\n");
+       printf("       tilt     = tilt angle in degrees\n");
+       printf("       warpdata = a file to use for warping the image (absolute path)\n");      
        printf("       mode: fisheye                (Fisheye)\n");
        printf("             truncatedfront         (Front-Truncated)\n");
        printf("             truncatedrear          (Rear-Truncated)\n");
@@ -326,6 +327,7 @@ int main(int argc, char** argv)
        int domeTilt = -200;
        int domeMode = 0;
        char* domeWarp = NULL;
+       Text *domeText  = NULL;
        int windowLeft = 100;
        int windowTop = 100;
        int windowWidth = 640;
@@ -615,7 +617,7 @@ int main(int argc, char** argv)
                                }
                                break;
                        default:
-                               printf("Unkown argument: %s\n", argv[i++]);
+                               printf("Unknown argument: %s\n", argv[i++]);
                                break;
                        }
                }
@@ -786,8 +788,12 @@ int main(int argc, char** argv)
                                                                scene->gm.dome.mode = domeMode;
                                                        if (domeWarp)
                                                        {
-                                                               printf("using external file as dome warping. Not implemented yet");
-                                                               //scene->gm.dome.warptext
+                                                               //XXX to do: convert relative to absolute path
+                                                               domeText= add_text(domeWarp, "");
+                                                               if(!domeText)
+                                                                       printf("error: invalid warpdata text file - %s\n", domeWarp);
+                                                               else
+                                                                       scene->gm.dome.warptext = domeText;
                                                        }
                                                }