This patch will fix the world GLSL (mist, background, ambient) update for the BGE.
Details
Diff Detail
Event Timeline
Looks good, just some minor comments.
| source/blender/editors/space_view3d/view3d_draw.c | ||
|---|---|---|
| 3254–3260 | Can you only do this in case GLSL drawing is enabled? There is a check for it before calling gpu_update_lamps_shadows a bit earlier in this function. | |
| source/blender/gpu/intern/gpu_material.c | ||
| 78–87 | Can you make this static and rename gpuworld to GPUCurrentWorld or something like that? There isn't really a convention for this but global variables are not typically lowercase. | |
| 1423–1425 | can use copy_v3_v3 here and in other places. | |
Ketsji really shouldn't have any OpenGL or bf_gpu code in it. I know it currently does, but I've been working to address that, and adding more bf_gpu code to KX_KetsjiEngine doesn't help. You could at least move things to one of the world classes. The actual rendering code can then be moved to the rasterizer at a later date.
@Mitchell Stokes (moguri). This will be done by the BGE Code clean up for world D152.
| source/blender/gpu/GPU_material.h | ||
|---|---|---|
| 64 | I will remove the struct GPUWorldand and typedef struct GPUWorld GPUWorld. I don't use the structure in the header or somewhere else, so the definition is not necessary. | |
| source/blender/gpu/intern/gpu_material.c | ||
| 78–87 | I seems that the structure name and the variable name is always the same. I will rename the variable gpuworld to GPUWorld. | |
Looks good, just noticed one more problem.
| source/blender/editors/space_view3d/view3d_draw.c | ||
|---|---|---|
| 12–20 | I just noticed that ED_view3d_draw_offscreen_init actually needs these world settings as well for OpenGL render. Can you move these 4 lines into gpu_update_lamps_shadows so they are handled in both cases? The function could be renamed to gpu_update_lamps_shadows_world. | |
This will be fine if it's also committed with D152, which cleans up the GPU_* calls in KX_KetsjiEngine.
@Thomas Szepe (hg1) Why you don't call GPU_mist_update_* in a function in RAS_OpenGLRasterizer ?
Maybe it's better to past uniform blocks to the shader than many uniform.
Why you don't call GPU_mist_update_* in a function in RAS_OpenGLRasterizer ?
- It don’t see any improvement by moving it into RAS_OpenGLRasterizer.
- In D154 I have done the color conversion for the color management in BlenderWolrdInfo. For GLSL this is not necessary (done in the shader). So simply RAS_OpenGLRasterizer will hold the wrong colors.
Maybe it's better to past uniform blocks to the shader than many uniform.
- Uniform Buffer Objects (or UBO in short) have been introduced with OpenGL 3.1 (GL_ARB_uniform_buffer_object). Older graphic cards don’t support it.
- We don’t reuse the mist uniforms for another shader program. So there is no speed improvement by using UBO’s.
- There is no method in Blender for binding UBO’s.
- The shader export function actually accepts only single uniforms.
This patch is a fix to get the mist working in the BGE. It should not mixed with cleanups or new features like UBO.