コード例 #1
0
ファイル: SceneLighting.py プロジェクト: bnpr/Malt
 def __init__(self, pipeline):
     PipelineNode.__init__(self, pipeline)
     self.lights_buffer = Lighting.get_lights_buffer()
     self.light_groups_buffer = NPR_Lighting.NPR_LightsGroupsBuffer()
     self.shadowmaps_opaque = NPR_Lighting.NPR_ShadowMaps()
     self.shadowmaps_transparent = NPR_Lighting.NPR_TransparentShadowMaps()
     self.common_buffer = Common.CommonBuffer()
コード例 #2
0
    def setup_resources(self):
        self.common_buffer = Common.CommonBuffer()
        positions = [
            1.0,
            1.0,
            0.0,
            1.0,
            -1.0,
            0.0,
            -1.0,
            -1.0,
            0.0,
            -1.0,
            1.0,
            0.0,
        ]
        indices = [
            0,
            1,
            3,
            1,
            2,
            3,
        ]
        self.quad = Mesh(positions, indices)

        if Pipeline.BLEND_SHADER is None:
            source = '''#include "Passes/BlendTexture.glsl"'''
            Pipeline.BLEND_SHADER = self.compile_shader_from_source(source)
        self.blend_shader = Pipeline.BLEND_SHADER

        if Pipeline.COPY_SHADER is None:
            source = '''#include "Passes/CopyTextures.glsl"'''
            Pipeline.COPY_SHADER = self.compile_shader_from_source(source)
        self.copy_shader = Pipeline.COPY_SHADER
コード例 #3
0
    def __init__(self):
        super().__init__()

        self.sampling_grid_size = 2

        self.parameters.world['Background Color'] = GLUniform(
            -1, GL_FLOAT_VEC4, (0.5, 0.5, 0.5, 1))
        self.parameters.scene['Line Width Max'] = GLUniform(-1, GL.GL_INT, 10)
        self.parameters.scene['Samples Grid Size Preview'] = GLUniform(
            -1, GL.GL_INT, 4)
        self.parameters.scene['Samples Grid Size Render'] = GLUniform(
            -1, GL.GL_INT, 8)
        self.parameters.scene['Samples Width'] = GLUniform(
            -1, GL.GL_FLOAT, 1.5)
        self.parameters.scene[
            'Shadow Cascades Distribution Exponent'] = GLUniform(
                -1, GL.GL_INT, 21)
        self.parameters.scene['ShadowMaps Spot Resolution'] = GLUniform(
            -1, GL.GL_INT, 2048)
        self.parameters.scene['ShadowMaps Sun Resolution'] = GLUniform(
            -1, GL.GL_INT, 2048)
        self.parameters.scene['ShadowMaps Point Resolution'] = GLUniform(
            -1, GL.GL_INT, 2048)

        self.common_buffer = Common.CommonBuffer()
        self.lights_buffer = Lighting.LightsBuffer()

        self.line_rendering = Line.LineRendering()

        self.composite_depth = DepthToCompositeDepth.CompositeDepth()
コード例 #4
0
    def __init__(self):
        super().__init__()

        self.parameters.world['Background Color'] = Parameter(
            (0.5, 0.5, 0.5, 1), Type.FLOAT, 4)

        self.common_buffer = Common.CommonBuffer()

        if MiniPipeline.DEFAULT_SHADER is None:
            source = '''
            #include "Common.glsl"

            #ifdef VERTEX_SHADER
            void main()
            {
                DEFAULT_VERTEX_SHADER();
            }
            #endif

            #ifdef PIXEL_SHADER
            layout (location = 0) out vec4 RESULT;
            void main()
            {
                RESULT = vec4(1);
            }
            #endif
            '''
            MiniPipeline.DEFAULT_SHADER = self.compile_material_from_source(
                'mesh', source)

        self.default_shader = MiniPipeline.DEFAULT_SHADER
コード例 #5
0
ファイル: PipelineTest.py プロジェクト: ManuSharma552/BEER
    def __init__(self):
        super().__init__()

        self.sampling_grid_size = 2

        self.parameters.world['Background Color'] = GLUniform(
            -1, GL_FLOAT_VEC4, (0.5, 0.5, 0.5, 1))
        self.parameters.scene['Line Width Max'] = GLUniform(-1, GL.GL_INT, 10)
        self.parameters.scene['Samples Grid Size Preview'] = GLUniform(
            -1, GL.GL_INT, 4)
        self.parameters.scene['Samples Grid Size Render'] = GLUniform(
            -1, GL.GL_INT, 8)
        self.parameters.scene['Samples Width'] = GLUniform(
            -1, GL.GL_FLOAT, 1.5)
        self.parameters.scene[
            'Shadow Cascades Distribution Exponent'] = GLUniform(
                -1, GL.GL_INT, 21)

        self.composite_depth_shader = self.compile_shader_from_source(
            _obj_composite_depth)

        self.common_buffer = Common.CommonBuffer()
        self.lights_buffer = Lighting.LightsBuffer()

        self.line_rendering = Line.LineRendering()
コード例 #6
0
    def __init__(self):
        super().__init__()

        self.sampling_grid_size = 2

        self.parameters.world['Background Color'] = Parameter(
            (0.5, 0.5, 0.5, 1), Type.FLOAT, 4)
        self.parameters.scene['Line Width Max'] = Parameter(10, Type.INT)
        self.parameters.scene['Samples Grid Size Preview'] = Parameter(
            4, Type.INT)
        self.parameters.scene['Samples Grid Size Render'] = Parameter(
            8, Type.INT)
        self.parameters.scene['Samples Width'] = Parameter(1.5, Type.FLOAT)
        self.parameters.scene[
            'Shadow Cascades Distribution Exponent'] = Parameter(21, Type.INT)
        self.parameters.scene['ShadowMaps Spot Resolution'] = Parameter(
            2048, Type.INT)
        self.parameters.scene['ShadowMaps Sun Resolution'] = Parameter(
            2048, Type.INT)
        self.parameters.scene['ShadowMaps Point Resolution'] = Parameter(
            2048, Type.INT)
        self.parameters.scene['Transparency Layers'] = Parameter(4, Type.INT)

        self.parameters.light['Shader'] = MaterialParameter('', 'light')

        global _DEFAULT_SHADER
        if _DEFAULT_SHADER is None:
            _DEFAULT_SHADER = self.compile_material_from_source(
                'mesh', _DEFAULT_SHADER_SRC)
        self.default_shader = _DEFAULT_SHADER

        global _BLEND_TRANSPARENCY_SHADER
        if _BLEND_TRANSPARENCY_SHADER is None:
            _BLEND_TRANSPARENCY_SHADER = self.compile_shader_from_source(
                _BLEND_TRANSPARENCY_SHADER_SRC)
        self.blend_transparency_shader = _BLEND_TRANSPARENCY_SHADER

        self.common_buffer = Common.CommonBuffer()
        self.lights_buffer = Lighting.get_lights_buffer()
        self.shadowmaps_opaque, self.shadowmaps_transparent = NPR_Lighting.get_shadow_maps(
        )
        self.custom_light_shading = NPR_Lighting.NPR_LightShaders()

        self.line_rendering = Line.LineRendering()

        self.composite_depth = DepthToCompositeDepth.CompositeDepth()
コード例 #7
0
ファイル: PipelineTest.py プロジェクト: iRi-E/BEER
    def __init__(self):
        super().__init__()

        self.sampling_grid_size = 2

        self.parameters.scene['Preview Samples'] = GLUniform(-1, GL.GL_INT, 4)
        self.parameters.scene['Render Samples'] = GLUniform(-1, GL.GL_INT, 8)
        self.parameters.scene['Line Width Max'] = GLUniform(-1, GL.GL_INT, 10)
        self.parameters.world['Background Color'] = GLUniform(
            -1, GL_FLOAT_VEC4, (0.5, 0.5, 0.5, 1))

        self.default_shader = self.compile_material_from_source(
            '')  #Empty source will force defaults

        self.composite_depth_shader = self.compile_shader_from_source(
            _obj_composite_depth)

        self.common_buffer = Common.CommonBuffer()
        self.lights_buffer = Lighting.LightsBuffer()

        self.line_rendering = Line.LineRendering()
コード例 #8
0
 def __init__(self):
     self.data = C_LightsBuffer()
     self.UBO = UBO()
     self.shadowmaps = ShadowMaps()
     self.common_buffer = Common.CommonBuffer()
コード例 #9
0
    def __init__(self):
        super().__init__()

        self.sampling_grid_size = 2

        self.parameters.world['Background.Color'] = Parameter(
            (0.5, 0.5, 0.5, 1), Type.FLOAT, 4)
        self.parameters.scene['Line.Max Width'] = Parameter(10, Type.INT)
        self.parameters.scene['Samples.Grid Size'] = Parameter(8, Type.INT)
        self.parameters.scene['Samples.Grid Size @ Preview'] = Parameter(
            4, Type.INT)
        self.parameters.scene['Samples.Width'] = Parameter(1.5, Type.FLOAT)
        self.parameters.scene[
            'ShadowMaps.Sun.Cascades.Distribution Scalar'] = Parameter(
                0.9, Type.FLOAT)
        self.parameters.scene['ShadowMaps.Sun.Cascades.Count'] = Parameter(
            4, Type.INT)
        self.parameters.scene[
            'ShadowMaps.Sun.Cascades.Count @ Preview'] = Parameter(
                2, Type.INT)
        self.parameters.scene[
            'ShadowMaps.Sun.Cascades.Max Distance'] = Parameter(
                100, Type.FLOAT)
        self.parameters.scene[
            'ShadowMaps.Sun.Cascades.Max Distance @ Preview'] = Parameter(
                25, Type.FLOAT)
        self.parameters.scene['ShadowMaps.Sun.Resolution'] = Parameter(
            2048, Type.INT)
        #self.parameters.scene['ShadowMaps.Sun.Resolution @ Preview'] = Parameter(512, Type.INT)
        self.parameters.scene['ShadowMaps.Spot.Resolution'] = Parameter(
            2048, Type.INT)
        self.parameters.scene[
            'ShadowMaps.Spot.Resolution @ Preview'] = Parameter(512, Type.INT)
        self.parameters.scene['ShadowMaps.Point.Resolution'] = Parameter(
            2048, Type.INT)
        self.parameters.scene[
            'ShadowMaps.Point.Resolution @ Preview'] = Parameter(
                512, Type.INT)
        self.parameters.scene['Transparency.Layers'] = Parameter(4, Type.INT)
        self.parameters.scene['Transparency.Layers @ Preview'] = Parameter(
            1, Type.INT)

        self.parameters.world['Material Override'] = MaterialParameter(
            '', 'mesh')

        self.parameters.light['Shader'] = MaterialParameter('', 'light')
        self.parameters.light['Light Group'] = Parameter(1, Type.INT)

        self.parameters.material['Light Groups.Light'] = Parameter(
            [1, 0, 0, 0], Type.INT, 4)
        self.parameters.material['Light Groups.Shadow'] = Parameter(
            [1, 0, 0, 0], Type.INT, 4)

        global _DEFAULT_SHADER
        if _DEFAULT_SHADER is None:
            _DEFAULT_SHADER = self.compile_material_from_source(
                'mesh', _DEFAULT_SHADER_SRC)
        self.default_shader = _DEFAULT_SHADER

        global _BLEND_TRANSPARENCY_SHADER
        if _BLEND_TRANSPARENCY_SHADER is None:
            _BLEND_TRANSPARENCY_SHADER = self.compile_shader_from_source(
                _BLEND_TRANSPARENCY_SHADER_SRC)
        self.blend_transparency_shader = _BLEND_TRANSPARENCY_SHADER

        self.common_buffer = Common.CommonBuffer()
        self.lights_buffer = Lighting.get_lights_buffer()
        self.light_groups_buffer = NPR_Lighting.NPR_LightsGroupsBuffer()
        self.shadowmaps_opaque, self.shadowmaps_transparent = NPR_Lighting.get_shadow_maps(
        )
        self.custom_light_shading = NPR_Lighting.NPR_LightShaders()

        self.line_rendering = Line.LineRendering()

        self.composite_depth = DepthToCompositeDepth.CompositeDepth()