#NEWLINE# @ classmethod #NEWLINE# def _build_fragment_shader( cls , texture , view_width , view_height ) : #NEWLINE# #INDENT# ' Internal method to build a fragment shader displaying the texture ' #NEWLINE# ( sampling_code , sampler_type ) = cls . _generate_sampling_code ( texture , view_width , view_height ) #NEWLINE# built = ( ( ( ( ( ( ( ( '\n            #version 400\n            #pragma include "render_pipeline_base.inc.glsl"\n            in vec2 texcoord;\n            out vec3 result;\n            uniform int mipmap;\n            uniform int slice;\n            uniform float brightness;\n            uniform bool tonemap;\n            uniform ' + sampler_type ) + ' p3d_Texture0;\n            void main() {\n                int view_width = ' ) + str ( view_height ) ) + ';\n                int view_height = ' ) + str ( view_height ) ) + ';\n                ivec2 display_coord = ivec2(texcoord * vec2(view_width, view_height));\n                int int_index = display_coord.x + display_coord.y * view_width;\n                ' ) + sampling_code ) + '\n                result *= brightness;\n                if (tonemap)\n                    result = result / (1 + result);\n            }\n        ' ) #NEWLINE# built = '\n' . join ( [ i . strip ( ) for i in built . split ( '\n' ) ] ) #NEWLINE# return built