Trying to fix BGE bug #27322 bge.render bugs - Mist, Ambient and Mode sets

Hi all,

I’m trying to fix the BGE bug #27322 bge.render bugs - Mist, Ambient and Mode sets.
At this moment I have everything working (see following patch patch_mist.txt.zip (7.27 KB)) except when I’m in GLSL-Textured mode.
I found that in GLSL-Textured mode a GPU function (GPU_shaderesult_set) it is using the DNA World variables (miststa, misi, etc). But when we set the BGE python functions we can only modify the KX_World variables.
What is the better method to modify those DNA World variables? with a new GPU function? with a new BL_Shader or BL_BlenderMaterial function? will I have to reload the modified shader?

Any advice will be most welcome.

Hi.

While I’m not one of those who would be able to pinpoint something in the source code itself, I would think you can just go ahead and PM Moguri or Kupoman about the issue you’re having, because for one thing they have a bit of experience with the GPU-related code for the BGE and are always eager to help out those working with the BGE source.

The quick solution would be to save the DNA variables in the KX_World constructor, then modify the DNA values with KX_World functions. You’ll want to set the variables back in the destructor. While this has been done before, it’s kinda messy since it modifies Blender data, which is a big no-no in the BGE. The other solution I can think of is to create a GPU_world that both Blender and the BGE can edit, similar to light data.

Thank you for your advice. I will try to go for the gpu_world way.