| 871 | } |
| 872 | |
| 873 | void LightProbeCollection::Draw(BulletWorld& bw) { |
| 874 | PROFILER_GPU_ZONE(g_profiler_ctx, "Draw light probe collection"); |
| 875 | Shaders* shaders = Shaders::Instance(); |
| 876 | Graphics* graphics = Graphics::Instance(); |
| 877 | |
| 878 | if (show_probes) { |
| 879 | for (int i = 0; i < 2; ++i) { |
| 880 | GLState gl_state; |
| 881 | gl_state.blend = false; |
| 882 | gl_state.cull_face = true; |
| 883 | gl_state.depth_test = true; |
| 884 | gl_state.depth_write = true; |
| 885 | |
| 886 | if (i == 0 && !show_probes_through_walls) { |
| 887 | continue; |
| 888 | } |
| 889 | if (i == 0 && show_probes_through_walls) { |
| 890 | gl_state.depth_test = false; |
| 891 | gl_state.depth_write = false; |
| 892 | } |
| 893 | |
| 894 | graphics->setGLState(gl_state); |
| 895 | |
| 896 | int shader_id = shaders->returnProgram("lightprobe"); |
| 897 | if (i == 0 && show_probes_through_walls) { |
| 898 | shader_id = shaders->returnProgram("lightprobe #STIPPLE"); |
| 899 | } |
| 900 | shaders->setProgram(shader_id); |
| 901 | |
| 902 | int programHandle = shaders->programs[shader_id].gl_program; |
| 903 | GLuint blockIndex = glGetUniformBlockIndex(programHandle, "LightProbeInfo"); |
| 904 | |
| 905 | const GLchar* names[] = { |
| 906 | "center[0]", |
| 907 | "view_mat", |
| 908 | "proj_mat", |
| 909 | "cam_pos", |
| 910 | "ambient_cube_color[0]", |
| 911 | // These long names were necessary on a Mac OS 10.7 ATI card |
| 912 | "LightProbeInfo.center[0]", |
| 913 | "LightProbeInfo.view_mat", |
| 914 | "LightProbeInfo.proj_mat", |
| 915 | "LightProbeInfo.cam_pos", |
| 916 | "LightProbeInfo.ambient_cube_color[0]"}; |
| 917 | |
| 918 | GLuint indices[5] = {0}; |
| 919 | glGetUniformIndices(programHandle, 5, names, indices); |
| 920 | CHECK_GL_ERROR(); |
| 921 | |
| 922 | // Check long name if short name is not found |
| 923 | for (unsigned int index : indices) { |
| 924 | if (index == GL_INVALID_INDEX) { |
| 925 | glGetUniformIndices(programHandle, 5, &names[5], indices); |
| 926 | break; |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | for (unsigned int index : indices) { |
nothing calls this directly
no test coverage detected