diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-07-15 03:26:38 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-07-15 03:26:38 +0400 |
commit | 95fbf8342319baa202269d6f2674e482888761c7 (patch) | |
tree | 70fbb4fa91b2330bc33cbb57a6ef2a9fbfa67c08 /source/blender/src | |
parent | a1fea54c185527a13aad3c3e5da81786fae3e13d (diff) |
Apricot: GLSL
=============
* Added options to disable lights, shaders, shadows, ramps,
nodes and textures other than col/alpha for GLSL, in the
Game menu.
* These have python access too to switch them in game, but
it doesn't work correct yet with display lists enabled.
* Fix issue with light lagging behind, debug stats drawing in
wrong color, and a number of other small fixes.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/drawobject.c | 2 | ||||
-rw-r--r-- | source/blender/src/header_info.c | 65 | ||||
-rw-r--r-- | source/blender/src/space.c | 2 |
3 files changed, 62 insertions, 7 deletions
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 61b1e32a876..49005c32252 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -187,7 +187,7 @@ int set_gl_material_attribs(int nr, GPUVertexAttribs *attribs) Material *mat = gpumatbuf[nr]; if(mat) { - GPU_material_from_blender(mat); + GPU_material_from_blender(G.scene, mat); if(mat->gpumaterial) { GPU_material_vertex_attributes(mat->gpumaterial, attribs); diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index 725bb604737..8f460b85245 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -119,6 +119,7 @@ #include "BPY_menus.h" #include "GPU_extensions.h" +#include "GPU_material.h" #include "blendef.h" #include "interface.h" @@ -1548,12 +1549,64 @@ static uiBlock *info_addmenu(void *arg_unused) /************************** GAME *****************************/ - +void do_info_game_glslmenu(void *arg, int event) +{ + switch (event) { + case G_FILE_GLSL_NO_LIGHTS: + case G_FILE_GLSL_NO_SHADERS: + case G_FILE_GLSL_NO_SHADOWS: + case G_FILE_GLSL_NO_RAMPS: + case G_FILE_GLSL_NO_NODES: + case G_FILE_GLSL_NO_EXTRA_TEX: + G.fileflags ^= event; + GPU_materials_free(); + allqueue(REDRAWINFO, 0); + allqueue(REDRAWVIEW3D, 0); + break; + default: + break; + } +} + +static uiBlock *info_game_glslmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=160; + int check; + + block= uiNewBlock(&curarea->uiblocks, "game_glslmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); + uiBlockSetButmFunc(block, do_info_game_glslmenu, NULL); + + check = (G.fileflags & G_FILE_GLSL_NO_LIGHTS)? ICON_CHECKBOX_DEHLT: ICON_CHECKBOX_HLT; + uiDefIconTextBut(block, BUTM, 1, check, "Enable Lights", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GLSL_NO_LIGHTS, + "Enable using lights in GLSL materials."); + check = (G.fileflags & G_FILE_GLSL_NO_SHADERS)? ICON_CHECKBOX_DEHLT: ICON_CHECKBOX_HLT; + uiDefIconTextBut(block, BUTM, 1, check, "Enable Shaders", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GLSL_NO_SHADERS, + "Enable using shaders other than Lambert in GLSL materials"); + check = (G.fileflags & G_FILE_GLSL_NO_SHADOWS)? ICON_CHECKBOX_DEHLT: ICON_CHECKBOX_HLT; + uiDefIconTextBut(block, BUTM, 1, check, "Enable Shadows", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GLSL_NO_SHADOWS, + "Enable using shadows in GLSL materials"); + check = (G.fileflags & G_FILE_GLSL_NO_RAMPS)? ICON_CHECKBOX_DEHLT: ICON_CHECKBOX_HLT; + uiDefIconTextBut(block, BUTM, 1, check, "Enable Ramps", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GLSL_NO_RAMPS, + "Enable using ramps in GLSL materials"); + check = (G.fileflags & G_FILE_GLSL_NO_NODES)? ICON_CHECKBOX_DEHLT: ICON_CHECKBOX_HLT; + uiDefIconTextBut(block, BUTM, 1, check, "Enable Nodes", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GLSL_NO_NODES, + "Enable using nodes in GLSL materials."); + check = (G.fileflags & G_FILE_GLSL_NO_EXTRA_TEX)? ICON_CHECKBOX_DEHLT: ICON_CHECKBOX_HLT; + uiDefIconTextBut(block, BUTM, 1, check, "Enable Extra Textures", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GLSL_NO_EXTRA_TEX, + "Enable using texture channels other than Col and Alpha in GLSL materials."); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 50); + + return block; +} + static void do_info_gamemenu(void *arg, int event) { switch (event) { case G_FILE_ENABLE_ALL_FRAMES: - case G_FILE_DIAPLAY_LISTS: + case G_FILE_DISPLAY_LISTS: case G_FILE_SHOW_FRAMERATE: case G_FILE_SHOW_DEBUG_PROPS: case G_FILE_AUTOPLAY: @@ -1603,10 +1656,10 @@ static uiBlock *info_gamemenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Record Game Physics to IPO", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GAME_TO_IPO, ""); } else { - if(G.fileflags & G_FILE_DIAPLAY_LISTS) { - uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Generate Display Lists", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_DIAPLAY_LISTS, ""); + if(G.fileflags & G_FILE_DISPLAY_LISTS) { + uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Generate Display Lists", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_DISPLAY_LISTS, ""); } else { - uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Generate Display Lists", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_DIAPLAY_LISTS, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Generate Display Lists", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_DISPLAY_LISTS, ""); } uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Record Game Physics to IPO", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GAME_TO_IPO, ""); } @@ -1649,6 +1702,8 @@ static uiBlock *info_gamemenu(void *arg_unused) } else { uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Blender GLSL Materials", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, G_FILE_GAME_MAT_GLSL, ""); } + + uiDefIconTextBlockBut(block, info_game_glslmenu, NULL, ICON_RIGHTARROW_THIN, "GLSL Material Settings", 0, yco-=20, menuwidth, 19, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 1, 0, ""); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 6ff764b5ab3..7b447301fbd 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -416,7 +416,7 @@ void space_set_commmandline_options(void) { SYS_WriteCommandLineInt(syshandle, "blender_material", a); a=(G.fileflags & G_FILE_GAME_MAT_GLSL); SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", a); - a=(G.fileflags & G_FILE_DIAPLAY_LISTS); + a=(G.fileflags & G_FILE_DISPLAY_LISTS); SYS_WriteCommandLineInt(syshandle, "displaylists", a); |