From 9a9d118bbf7786b1c5c412bef651885e33709553 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 20 Jul 2009 20:28:29 +0000 Subject: BGE panels: wip Logic Panel: - world settings (moved from world) ... that includes physic engine selection + gravity - game player (from gamesettings, it wasn't wrapped) - stereo/dome (from gamesettings, it wasn't wrapped) ... separated stereom into stereoflag and stereomode - properties ... (didn't touch it) Buttons Game Panel: (wip panel) - Physics (moved from Logic Panel) ... it will be a datablock in the future (right Campbell ?) - Material Physics (not currently implemented) ... a datablock link to the materials of an object + the dynamic physic variables * NOTE: in readfile.c::do_version I couldn't do if(scene->world). There is something wrong with scenes with an unlinked world. So so far we are ignoring the old values.... --- source/blender/blenkernel/intern/scene.c | 35 ++-- source/blender/blenkernel/intern/world.c | 8 - source/blender/blenloader/intern/readfile.c | 68 ++++++- .../editors/space_buttons/buttons_context.c | 34 +++- .../blender/editors/space_buttons/buttons_header.c | 3 +- .../blender/editors/space_buttons/space_buttons.c | 2 + source/blender/makesdna/DNA_scene_types.h | 88 +++++++-- source/blender/makesdna/DNA_world_types.h | 20 +- source/blender/makesrna/RNA_access.h | 1 + source/blender/makesrna/intern/rna_scene.c | 217 +++++++++++++++++++++ source/blender/makesrna/intern/rna_space.c | 1 + source/blender/makesrna/intern/rna_world.c | 45 +---- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 12 +- .../Converter/BL_BlenderDataConversion.cpp | 28 ++- .../GamePlayer/ghost/GPG_Application.cpp | 4 +- .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 6 +- 16 files changed, 451 insertions(+), 121 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 2ab67ed6151..20ed7c1b7eb 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -230,23 +230,11 @@ Scene *add_scene(char *name) sce->r.bake_osa= 5; sce->r.bake_flag= R_BAKE_CLEAR; sce->r.bake_normal_space= R_BAKE_SPACE_TANGENT; - - sce->r.xplay= 640; - sce->r.yplay= 480; - sce->r.freqplay= 60; - sce->r.depth= 32; sce->r.scemode= R_DOCOMP|R_DOSEQ|R_EXTENSION; sce->r.stamp= R_STAMP_TIME|R_STAMP_FRAME|R_STAMP_DATE|R_STAMP_SCENE|R_STAMP_CAMERA; sce->r.threads= 1; - - sce->r.stereomode = 1; // no stereo - sce->r.domeangle = 180; - sce->r.domemode = 1; - sce->r.domeres = 4; - sce->r.domeresbuf = 1.0f; - sce->r.dometilt = 0; sce->r.simplify_subsurf= 6; sce->r.simplify_particles= 1.0f; @@ -322,6 +310,29 @@ Scene *add_scene(char *name) /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */ scene_add_render_layer(sce); + /* game data */ + sce->gm.stereoflag = STEREO_NOSTEREO; + sce->gm.stereomode = STEREO_ANAGLYPH; + sce->gm.dome.angle = 180; + sce->gm.dome.mode = DOME_FISHEYE; + sce->gm.dome.res = 4; + sce->gm.dome.resbuf = 1.0f; + sce->gm.dome.tilt = 0; + + sce->gm.xplay= 800; + sce->gm.yplay= 600; + sce->gm.freqplay= 60; + sce->gm.depth= 32; + + sce->gm.gravity= 9.8f; + sce->gm.physicsEngine= WOPHY_BULLET; + sce->gm.mode = 32; //XXX ugly harcoding, still not sure we should drop mode. 32 == 1 << 5 == use_occlusion_culling + sce->gm.occlusionRes = 128; + sce->gm.ticrate = 60; + sce->gm.maxlogicstep = 5; + sce->gm.physubstep = 1; + sce->gm.maxphystep = 5; + return sce; } diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 7fe129ed6fc..c84c54b17ee 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -94,7 +94,6 @@ World *add_world(char *name) wrld->skytype= WO_SKYBLEND; wrld->stardist= 15.0f; wrld->starsize= 2.0f; - wrld->gravity= 9.8f; wrld->exp= 0.0f; wrld->exposure=wrld->range= 1.0f; @@ -106,14 +105,7 @@ World *add_world(char *name) wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY; wrld->ao_approx_error= 0.25f; - wrld->physicsEngine= WOPHY_BULLET;//WOPHY_SUMO; Bullet by default - wrld->mode = WO_DBVT_CULLING; // DBVT culling by default - wrld->occlusionRes = 128; wrld->preview = NULL; - wrld->ticrate = 60; - wrld->maxlogicstep = 5; - wrld->physubstep = 1; - wrld->maxphystep = 5; return wrld; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 8a5f915c849..46db4109440 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3995,7 +3995,8 @@ static void lib_link_scene(FileData *fd, Main *main) srl->light_override= newlibadr_us(fd, sce->id.lib, srl->light_override); } /*Game Settings: Dome Warp Text*/ - sce->r.dometext= newlibadr_us(fd, sce->id.lib, sce->r.dometext); +// sce->r.dometext= newlibadr_us(fd, sce->id.lib, sce->r.dometext); // XXX deprecated since 2.5 + sce->gm.dome.warptext= newlibadr_us(fd, sce->id.lib, sce->gm.dome.warptext); sce->id.flag -= LIB_NEEDLINK; } @@ -9314,6 +9315,69 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ts->uv_selectmode= UV_SELECT_VERTEX; ts->vgroup_weight= 1.0f; } + + /* Game Settings */ + //Dome + sce->gm.dome.angle = sce->r.domeangle; + sce->gm.dome.mode = sce->r.domemode; + sce->gm.dome.res = sce->r.domeres; + sce->gm.dome.resbuf = sce->r.domeresbuf; + sce->gm.dome.tilt = sce->r.dometilt; + sce->gm.dome.warptext = sce->r.dometext; + + //Stand Alone + sce->gm.fullscreen = sce->r.fullscreen; + sce->gm.xplay = sce->r.xplay; + sce->gm.yplay = sce->r.yplay; + sce->gm.freqplay = sce->r.freqplay; + sce->gm.depth = sce->r.depth; + sce->gm.attrib = sce->r.attrib; + + //Stereo + sce->gm.xsch = sce->r.xsch; + sce->gm.ysch = sce->r.ysch; + sce->gm.stereomode = sce->r.stereomode; + /* reassigning stereomode NO_STEREO and DOME to a separeted flag*/ + if (sce->gm.stereomode == 1){ //1 = STEREO_NOSTEREO + sce->gm.stereoflag = STEREO_NOSTEREO; + sce->gm.stereomode = STEREO_ANAGLYPH; + } + else if(sce->gm.stereomode == 8){ //8 = STEREO_DOME + sce->gm.stereoflag = STEREO_DOME; + sce->gm.stereomode = STEREO_ANAGLYPH; + } + else + sce->gm.stereoflag = STEREO_ENABLE; + + //Framing + sce->gm.framing = sce->framing; + sce->gm.xplay = sce->r.xplay; + sce->gm.yplay = sce->r.yplay; + sce->gm.freqplay= sce->r.freqplay; + sce->gm.depth= sce->r.depth; + + //Physic (previously stored in world) + if (0){ +// if (sce->world){ // XXX I think we need to run lib_link_all() before do_version() + sce->gm.gravity = sce->world->gravity; + sce->gm.physicsEngine= sce->world->physicsEngine; + sce->gm.mode = sce->world->mode; + sce->gm.occlusionRes = sce->world->occlusionRes; + sce->gm.ticrate = sce->world->ticrate; + sce->gm.maxlogicstep = sce->world->maxlogicstep; + sce->gm.physubstep = sce->world->physubstep; + sce->gm.maxphystep = sce->world->maxphystep; + } + else{ + sce->gm.gravity =9.8f; + sce->gm.physicsEngine= WOPHY_BULLET;// Bullet by default + sce->gm.mode = WO_DBVT_CULLING; // DBVT culling by default + sce->gm.occlusionRes = 128; + sce->gm.ticrate = 60; + sce->gm.maxlogicstep = 5; + sce->gm.physubstep = 1; + sce->gm.maxphystep = 5; + } } } @@ -10225,7 +10289,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) } if(sce->r.dometext) - expand_doit(fd, mainvar, sce->r.dometext); + expand_doit(fd, mainvar, sce->gm.dome.warptext); } static void expand_camera(FileData *fd, Main *mainvar, Camera *ca) diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index b7e2a3325cb..9048565b01f 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -360,6 +360,32 @@ static int buttons_context_path_texture(ButsContextPath *path) return 0; } +static int buttons_context_path_game(ButsContextPath *path) +{ + /* XXX temporary context. Using material slot instead of ob->game_data */ + Object *ob; + PointerRNA *ptr= &path->ptr[path->len-1]; + Material *ma; + + /* if we already have a (pinned) material, we're done */ + if(RNA_struct_is_a(ptr->type, &RNA_Material)) { + return 1; + } + /* if we have an object, use the object material slot */ + else if(buttons_context_path_object(path)) { + ob= path->ptr[path->len-1].data; + + if(ob && ob->type && (ob->typeactcol); + RNA_id_pointer_create(&ma->id, &path->ptr[path->len]); + path->len++; + return 1; + } + } + + /* no path to a material possible */ + return 0; +} static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int worldtex) { SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); @@ -404,6 +430,9 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma case BCONTEXT_DATA: found= buttons_context_path_data(path, -1); break; + case BCONTEXT_GAME: + found= buttons_context_path_game(path); + break; case BCONTEXT_PARTICLE: found= buttons_context_path_particle(path); break; @@ -496,8 +525,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r /* here we handle context, getting data from precomputed path */ if(CTX_data_dir(member)) { static const char *dir[] = { - "world", "object", "meshe", "armature", "lattice", "curve", - "meta_ball", "lamp", "camera", "material", "material_slot", + "world", "object", "mesh", "armature", "lattice", "curve", + "meta_ball", "lamp", "camera", "material", "material_slot", "game", "texture", "texture_slot", "bone", "edit_bone", "particle_system", "cloth", "soft_body", "fluid", "collision", NULL}; @@ -736,4 +765,3 @@ void buttons_context_register(ARegionType *art) pt->flag= PNL_NO_HEADER; BLI_addtail(&art->paneltypes, pt); } - diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index ff906b7f539..e569ed324cd 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -187,7 +187,8 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PARTICLES, xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)BCONTEXT_PARTICLE, 0, 0, "Particles"); if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_PHYSICS, 0, 0, "Physics"); - + if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_GAME, 0, 0, "Game"); xco+= XIC; uiBlockEndAlign(block); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 4a741f85d85..0c1f735451a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -172,6 +172,8 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, vertical, "modifier"); else if (sbuts->mainb == BCONTEXT_CONSTRAINT) ED_region_panels(C, ar, vertical, "constraint"); + else if (sbuts->mainb == BCONTEXT_GAME) + ED_region_panels(C, ar, vertical, "game"); sbuts->re_align= 0; sbuts->mainbo= sbuts->mainb; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 572913f10d0..31d7a63b31b 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -183,10 +183,10 @@ typedef struct RenderData { /** For UR edge rendering: give the edges this color */ float edgeR, edgeG, edgeB; - short fullscreen, xplay, yplay, freqplay; /* standalone player */ - short depth, attrib, rt1, rt2; /* standalone player */ + short fullscreen, xplay, yplay, freqplay; /* standalone player */ // XXX deprecated since 2.5 + short depth, attrib, rt1, rt2; /* standalone player */ // XXX deprecated since 2.5 - short stereomode; /* standalone player stereo settings */ + short stereomode; /* standalone player stereo settings */ // XXX deprecated since 2.5 short dimensionspreset; /* for the dimensions presets menu */ @@ -327,12 +327,12 @@ typedef struct RenderData { short jp2_preset, jp2_depth; int rpad3; - /* Dome variables */ - short domeres, domemode; - short domeangle, dometilt; - float domeresbuf; - float pad2; - struct Text *dometext; + /* Dome variables */ // XXX deprecated since 2.5 + short domeres, domemode; // XXX deprecated since 2.5 + short domeangle, dometilt; // XXX deprecated since 2.5 + float domeresbuf; // XXX deprecated since 2.5 + float pad2; // XXX deprecated since 2.5 + struct Text *dometext; // XXX deprecated since 2.5 } RenderData; @@ -350,6 +350,20 @@ typedef struct RenderProfile { } RenderProfile; +typedef struct GameDome { + short res, mode; + short angle, tilt; + float resbuf, pad2; + struct Text *warptext; +} GameDome; + +#define DOME_FISHEYE 1 +#define DOME_TRUNCATED_FRONT 2 +#define DOME_TRUNCATED_REAR 3 +#define DOME_ENVMAP 4 +#define DOME_PANORAM_SPH 5 +#define DOME_NUM_MODES 6 + typedef struct GameFraming { float col[3]; char type, pad1, pad2, pad3; @@ -359,6 +373,56 @@ typedef struct GameFraming { #define SCE_GAMEFRAMING_EXTEND 1 #define SCE_GAMEFRAMING_SCALE 2 +typedef struct GameData { + + /* physics (it was in world)*/ + float gravity; /*Gravitation constant for the game world*/ + + /* + * Radius of the activity bubble, in Manhattan length. Objects + * outside the box are activity-culled. */ + float activityBoxRadius; //it's not being used ANYWHERE !!!!!!!!!!!!!! + /* + * bit 3: (gameengine): Activity culling is enabled. + * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling + */ + short mode, pad11; + short occlusionRes; /* resolution of occlusion Z buffer in pixel */ + short physicsEngine; + short ticrate, maxlogicstep, physubstep, maxphystep; + + /* standalone player */ + struct GameFraming framing; + short pad9, pad10; + short fullscreen, xplay, yplay, freqplay; + short depth, attrib, rt1, rt2; + + /* stereo/dome mode */ + struct GameDome dome; + short stereoflag, stereomode, xsch, ysch; //xsch and ysch can be deleted !!! + float pad12; +} GameData; +#define STEREO_NOSTEREO 1 +#define STEREO_ENABLE 2 +#define STEREO_DOME 3 + +//#define STEREO_NOSTEREO 1 +#define STEREO_QUADBUFFERED 2 +#define STEREO_ABOVEBELOW 3 +#define STEREO_INTERLACED 4 +#define STEREO_ANAGLYPH 5 +#define STEREO_SIDEBYSIDE 6 +#define STEREO_VINTERLACE 7 +//#define STEREO_DOME 8 + +/* physicsEngine */ +#define WOPHY_NONE 0 +#define WOPHY_ENJI 1 +#define WOPHY_SUMO 2 +#define WOPHY_DYNAMO 3 +#define WOPHY_ODE 4 +#define WOPHY_BULLET 5 + typedef struct TimeMarker { struct TimeMarker *next, *prev; int frame; @@ -588,8 +652,6 @@ typedef struct Scene { struct Editing *ed; /* sequence editor data is allocated here */ - struct GameFraming framing; - struct ToolSettings *toolsettings; /* default allocated now */ struct SceneStats *stats; /* default allocated now */ @@ -617,6 +679,10 @@ typedef struct Scene { /* User-Defined KeyingSets */ int active_keyingset; /* index of the active KeyingSet. first KeyingSet has index 1, 'none' active is 0, 'add new' is -1 */ ListBase keyingsets; /* KeyingSets for the given frame */ + + /* Game Settings */ + struct GameFraming framing; // XXX deprecated since 2.5 + struct GameData gm; } Scene; diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index 608a4ca982e..b6e387fbede 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -72,12 +72,12 @@ typedef struct World { /** * Gravitation constant for the game world */ - float gravity; + float gravity; // moved to scene->gamedata in 2.5 /** * Radius of the activity bubble, in Manhattan length. Objects * outside the box are activity-culled. */ - float activityBoxRadius; + float activityBoxRadius; // moved to scene->gamedata in 2.5 short skytype; /** @@ -89,10 +89,10 @@ typedef struct World { * bit 4: ambient occlusion * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling */ - short mode; - short occlusionRes; /* resolution of occlusion Z buffer in pixel */ - short physicsEngine; /* here it's aligned */ - short ticrate, maxlogicstep, physubstep, maxphystep; + short mode; // partially moved to scene->gamedata in 2.5 + short occlusionRes; /* resolution of occlusion Z buffer in pixel */ // moved to scene->gamedata in 2.5 + short physicsEngine; /* here it's aligned */ // moved to scene->gamedata in 2.5 + short ticrate, maxlogicstep, physubstep, maxphystep; // moved to scene->gamedata in 2.5 float misi, miststa, mistdist, misthi; @@ -181,14 +181,6 @@ typedef struct World { #define WOMAP_ZENDOWN 8 #define WOMAP_MIST 16 -/* physicsEngine */ -#define WOPHY_NONE 0 -#define WOPHY_ENJI 1 -#define WOPHY_SUMO 2 -#define WOPHY_DYNAMO 3 -#define WOPHY_ODE 4 -#define WOPHY_BULLET 5 - /* flag */ #define WO_DS_EXPAND (1<<0) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 9ad71f4e1d7..90270483adb 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -320,6 +320,7 @@ extern StructRNA RNA_RaySensor; extern StructRNA RNA_Region; extern StructRNA RNA_RigidBodyJointConstraint; extern StructRNA RNA_Scene; +extern StructRNA RNA_SceneGameData; extern StructRNA RNA_SceneRenderData; extern StructRNA RNA_SceneSequence; extern StructRNA RNA_Screen; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d1ef9dbbef3..a41bff8431c 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -554,6 +554,216 @@ void rna_def_scene_render_layer(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update"); } +void rna_def_scene_game_data(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem framing_types_items[] ={ + {SCE_GAMEFRAMING_BARS, "BARS", 0, "Stretch", ""}, + {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", ""}, + {SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem dome_modes_items[] ={ + {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""}, + {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""}, + {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""}, + {DOME_ENVMAP, "ENVMAP", 0, "Cube Map", ""}, + {DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem stereo_modes_items[] ={ +// {STEREO_NOSTEREO, "NO_STEREO", 0, "No Stereo", ""}, + {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""}, + {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""}, + {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""}, + {STEREO_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", ""}, + {STEREO_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-side", ""}, + {STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""}, +// {STEREO_DOME, "DOME", 0, "Dome", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem stereo_items[] ={ + {STEREO_NOSTEREO, "NO_STEREO", 0, "No Stereo", ""}, + {STEREO_ENABLE, "STEREO", 0, "Stereo", ""}, + {STEREO_DOME, "DOME", 0, "Dome", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem physics_engine_items[] = { + {WOPHY_NONE, "NONE", 0, "None", ""}, + //{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, + //{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, + //{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, + //{WOPHY_ODE, "ODE", 0, "ODE", ""}, + {WOPHY_BULLET, "BULLET", 0, "Bullet", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "SceneGameData", NULL); + RNA_def_struct_sdna(srna, "GameData"); + RNA_def_struct_nested(brna, srna, "Scene"); + RNA_def_struct_ui_text(srna, "Game Data", "Game data for a Scene datablock."); + + prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "xplay"); + RNA_def_property_range(prop, 4, 10000); + RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "yplay"); + RNA_def_property_range(prop, 4, 10000); + RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "depth"); + RNA_def_property_range(prop, 8, 32); + RNA_def_property_ui_text(prop, "Bits", "Displays bit depth of full screen display."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + // Do we need it here ? (since we already have it in World + prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "freqplay"); + RNA_def_property_range(prop, 4, 2000); + RNA_def_property_ui_text(prop, "Freq", "Displays clock frequency of fullscreen display."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "fullscreen", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "fullscreen", 1.0); + RNA_def_property_ui_text(prop, "Fullscreen", "Starts player in a new fullscreen display"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + /* Framing */ + prop= RNA_def_property(srna, "framing_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "framing.type"); + RNA_def_property_enum_items(prop, framing_types_items); + RNA_def_property_ui_text(prop, "Framing Types", "Select the type of Framing you want."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "framing_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "framing.col"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "", ""); + RNA_def_property_update(prop, NC_SCENE, NULL); + + /* Stereo */ + prop= RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "stereoflag"); + RNA_def_property_enum_items(prop, stereo_items); + RNA_def_property_ui_text(prop, "Stereo Options", ""); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "stereomode"); + RNA_def_property_enum_items(prop, stereo_modes_items); + RNA_def_property_ui_text(prop, "Stereo Mode", ""); + RNA_def_property_update(prop, NC_SCENE, NULL); + + /* Dome */ + prop= RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "dome.mode"); + RNA_def_property_enum_items(prop, dome_modes_items); + RNA_def_property_ui_text(prop, "Dome Mode", ""); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "dome_tesselation", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "dome.res"); + RNA_def_property_ui_range(prop, 1, 8, 1, 1); + RNA_def_property_ui_text(prop, "Tesselation", "Tesselation level - check the generated mesh in wireframe mode"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "dome.resbuf"); + RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 0.1); + RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "dome.angle"); + RNA_def_property_ui_range(prop, 90, 250, 1, 1); + RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "dome.tilt"); + RNA_def_property_ui_range(prop, -180, 180, 1, 1); + RNA_def_property_ui_text(prop, "Tilt", "Camera rotation in horizontal axis"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "dome.warptext"); + RNA_def_property_struct_type(prop, "Text"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Warp Data", "Custom Warp Mesh data file"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + /* physics */ + prop= RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "physicsEngine"); + RNA_def_property_enum_items(prop, physics_engine_items); + RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "gravity"); + RNA_def_property_range(prop, 0.0, 25.0); + RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "occlusion_culling_resolution", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "occlusionRes"); + RNA_def_property_range(prop, 128.0, 1024.0); + RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precsion (slower)"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "ticrate"); + RNA_def_property_ui_range(prop, 1, 60, 1, 1); + RNA_def_property_range(prop, 1, 250); + RNA_def_property_ui_text(prop, "Frames Per Second", "The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); + RNA_def_property_ui_range(prop, 1, 5, 1, 1); + RNA_def_property_range(prop, 1, 5); + RNA_def_property_ui_text(prop, "Max Logic Steps", "Sets the maximum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "maxphystep"); + RNA_def_property_ui_range(prop, 1, 5, 1, 1); + RNA_def_property_range(prop, 1, 5); + RNA_def_property_ui_text(prop, "Max Physics Steps", "Sets the maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "physubstep"); + RNA_def_property_ui_range(prop, 1, 5, 1, 1); + RNA_def_property_range(prop, 1, 5); + RNA_def_property_ui_text(prop, "Physics Sub Steps", "Sets the number of simulation substep per physic timestep, higher value give better physics precision"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + /* mode */ + prop= RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 5)); //XXX mode hardcoded // WO_DBVT_CULLING + RNA_def_property_ui_text(prop, "DBVT culling", "Use optimized Bullet DBVT tree for view frustrum and occlusion culling"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + // not used // deprecated !!!!!!!!!!!!! + prop= RNA_def_property(srna, "activity_culling", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 3)); //XXX mode hardcoded + RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + // not used // deprecated !!!!!!!!!!!!! + prop= RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius"); + RNA_def_property_range(prop, 0.0, 1000.0); + RNA_def_property_ui_text(prop, "box radius", "Radius of the activity bubble, in Manhattan length. Objects outside the box are activity-culled"); + RNA_def_property_update(prop, NC_SCENE, NULL); +} void rna_def_scene_render_data(BlenderRNA *brna) { StructRNA *srna; @@ -1360,8 +1570,15 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_struct_type(prop, "TimelineMarker"); RNA_def_property_ui_text(prop, "Timeline Markers", "Markers used in all timelines for the current scene."); + /* Game Settings */ + prop= RNA_def_property(srna, "game_data", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "gm"); + RNA_def_property_struct_type(prop, "SceneGameData"); + RNA_def_property_ui_text(prop, "Game Data", ""); + rna_def_tool_settings(brna); rna_def_scene_render_data(brna); + rna_def_scene_game_data(brna); rna_def_scene_render_layer(brna); } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index ba8f4ce9024..d959c26a49a 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -658,6 +658,7 @@ static void rna_def_space_buttons(BlenderRNA *brna) {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, {BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"}, {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, + {BCONTEXT_GAME, "GAME", ICON_GAME, "Game", "Game"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem panel_alignment_items[] = { diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 773037176de..b40f3de43ef 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -361,6 +361,7 @@ void RNA_def_world(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; +/* static EnumPropertyItem physics_engine_items[] = { {WOPHY_NONE, "NONE", 0, "None", ""}, //{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, @@ -369,6 +370,7 @@ void RNA_def_world(BlenderRNA *brna) //{WOPHY_ODE, "ODE", 0, "ODE", ""}, {WOPHY_BULLET, "BULLET", 0, "Bullet", ""}, {0, NULL, 0, NULL, NULL}}; +*/ srna= RNA_def_struct(brna, "World", "ID"); RNA_def_struct_ui_text(srna, "World", "World datablock describing the environment and ambient lighting of a scene."); @@ -422,49 +424,6 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Real Sky", "Render background with a real horizon, relative to the camera angle."); RNA_def_property_update(prop, NC_WORLD, NULL); - /* game settings */ - /* should go in a fake substruct however not sure if they move about */ - prop= RNA_def_property(srna, "game_fps", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "ticrate"); - RNA_def_property_range(prop, 1, 120); - RNA_def_property_ui_text(prop, "Frames Per Second", "The nominal number of game frames per second. Physics fixed timestep = 1/fps, independently of actual frame rate."); - - prop= RNA_def_property(srna, "game_logic_step_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxlogicstep"); - RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Max Logic Steps", "The maxmimum number of logic frame per game frame if graphics slows down the game, higher value allows better synchronization with physics."); - - prop= RNA_def_property(srna, "game_physics_substep", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "physubstep"); - RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Physics Sub Steps", "The maximum number of physics step per game frame if graphics slows down the game, higher value allows physics to keep up with realtime."); - - prop= RNA_def_property(srna, "game_physics_step_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxphystep"); - RNA_def_property_range(prop, 1, 5); - RNA_def_property_ui_text(prop, "Max Physics Steps", "The number of simulation substep per physic timestep, higher value give better physics precision."); - - prop= RNA_def_property(srna, "game_use_occlusion_culling", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_DBVT_CULLING); - RNA_def_property_ui_text(prop, "Enabled", "Use optimized Bullet DBVT tree for view frustrum and occlusion culling"); - - prop= RNA_def_property(srna, "game_occlusion_culling_resolution", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); - RNA_def_property_range(prop, 128, 1024); - RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precsion (slower)."); - - - /* physics */ - prop= RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "physicsEngine"); - RNA_def_property_enum_items(prop, physics_engine_items); - RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine."); - - prop= RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "gravity"); - RNA_def_property_range(prop, 0.0, 25.0); - RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine."); - /* nested structs */ prop= RNA_def_property(srna, "ambient_occlusion", PROP_POINTER, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "WorldAmbientOcclusion"); diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index fb222b419c3..b62667627a1 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -332,8 +332,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami ketsjiengine->SetGame2IpoMode(game2ipo,startFrame); // Quad buffered needs a special window. - if (blscene->r.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) - rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->r.stereomode); + if (blscene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) + rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->gm.stereomode); } if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME) @@ -396,8 +396,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_frami #endif //initialize Dome Settings - if(blscene->r.stereomode == RAS_IRasterizer::RAS_STEREO_DOME) - ketsjiengine->InitDome(blscene->r.domeres, blscene->r.domemode, blscene->r.domeangle, blscene->r.domeresbuf, blscene->r.dometilt, blscene->r.dometext); + if(blscene->gm.stereoflag == STEREO_DOME) + ketsjiengine->InitDome(blscene->gm.dome.res, blscene->gm.dome.mode, blscene->gm.dome.angle, blscene->gm.dome.resbuf, blscene->gm.dome.tilt, blscene->gm.dome.warptext); if (sceneconverter) { @@ -672,8 +672,8 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win, } // Quad buffered needs a special window. - if (blscene->r.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) - rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->r.stereomode); + if (blscene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) + rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) blscene->gm.stereomode); if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME) { diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 177f261e40b..072889a530f 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1931,39 +1931,35 @@ void BL_ConvertBlenderObjects(struct Main* maggie, aspect_width = canvas->GetWidth(); aspect_height = canvas->GetHeight(); } else { - if (blenderscene->framing.type == SCE_GAMEFRAMING_BARS) { + if (blenderscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { frame_type = RAS_FrameSettings::e_frame_bars; - } else if (blenderscene->framing.type == SCE_GAMEFRAMING_EXTEND) { + } else if (blenderscene->gm.framing.type == SCE_GAMEFRAMING_EXTEND) { frame_type = RAS_FrameSettings::e_frame_extend; } else { frame_type = RAS_FrameSettings::e_frame_scale; } - aspect_width = blenderscene->r.xsch; - aspect_height = blenderscene->r.ysch; + aspect_width = blenderscene->gm.xsch; + aspect_height = blenderscene->gm.ysch; } RAS_FrameSettings frame_settings( frame_type, - blenderscene->framing.col[0], - blenderscene->framing.col[1], - blenderscene->framing.col[2], + blenderscene->gm.framing.col[0], + blenderscene->gm.framing.col[1], + blenderscene->gm.framing.col[2], aspect_width, aspect_height ); kxscene->SetFramingType(frame_settings); - kxscene->SetGravity(MT_Vector3(0,0,(blenderscene->world != NULL) ? -blenderscene->world->gravity : -9.8)); + kxscene->SetGravity(MT_Vector3(0,0, -blenderscene->gm.gravity)); /* set activity culling parameters */ - if (blenderscene->world) { - kxscene->SetActivityCulling( (blenderscene->world->mode & WO_ACTIVITY_CULLING) != 0); - kxscene->SetActivityCullingRadius(blenderscene->world->activityBoxRadius); - kxscene->SetDbvtCulling((blenderscene->world->mode & WO_DBVT_CULLING) != 0); - } else { - kxscene->SetActivityCulling(false); - kxscene->SetDbvtCulling(false); - } + kxscene->SetActivityCulling( (blenderscene->gm.mode & WO_ACTIVITY_CULLING) != 0); + kxscene->SetActivityCullingRadius(blenderscene->gm.activityBoxRadius); + kxscene->SetDbvtCulling((blenderscene->gm.mode & WO_DBVT_CULLING) != 0); + // no occlusion culling by default kxscene->SetDbvtOcclusionRes(0); diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index e5932180fe1..a3805bd4317 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -700,8 +700,8 @@ bool GPG_Application::startEngine(void) #endif //initialize Dome Settings - if(m_startScene->r.stereomode == RAS_IRasterizer::RAS_STEREO_DOME) - m_ketsjiengine->InitDome(m_startScene->r.domeres, m_startScene->r.domemode, m_startScene->r.domeangle, m_startScene->r.domeresbuf, m_startScene->r.dometilt, m_startScene->r.dometext); + if(m_startScene->gm.stereoflag == STEREO_DOME) + m_ketsjiengine->InitDome(m_startScene->gm.dome.res, m_startScene->gm.dome.mode, m_startScene->gm.dome.angle, m_startScene->gm.dome.resbuf, m_startScene->gm.dome.tilt, m_startScene->gm.dome.warptext); // Set the GameLogic.globalDict from marshal'd data, so we can // load new blend files and keep data in GameLogic.globalDict diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 83ba2778ad6..d16348defb2 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -451,10 +451,10 @@ RAS_IRasterizer::StereoMode RAS_OpenGLRasterizer::GetStereoMode() bool RAS_OpenGLRasterizer::Stereo() { - if(m_stereomode == RAS_STEREO_NOSTEREO || m_stereomode == RAS_STEREO_DOME) - return false; - else + if(m_stereomode > RAS_STEREO_NOSTEREO) // > 0 return true; + else + return false; } bool RAS_OpenGLRasterizer::InterlacedStereo() -- cgit v1.2.3