How to use the panda3d.core.Shader.load function in Panda3D

To help you get started, we’ve selected a few Panda3D examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tobspr / RenderPipeline / Code / Effect.py View on Github external
# No program defined
                continue

            programs = {"vertex": "", "fragment": "", "geometry": "", 
                "tesscontrol": "", "tesseval": ""}
            for progName, progCode in parts.iteritems():
                fname = self._createShaderFile(stage, progName, progCode)
                programs[progName] = fname

            if programs["vertex"] == "":
                self.error("No vertex program for stage '" + stage + "' defined! Using default shader!")
                continue

            params = [programs["vertex"], programs["fragment"], programs["geometry"], 
                programs["tesscontrol"], programs["tesseval"]]
            shaderObj = Shader.load(Shader.SLGLSL, *params)
            self.shaderObjs[stage] = shaderObj
github tobspr / RenderPipeline / Code / RenderPasses / ViewSpacePass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/ViewSpacePass.fragment")
        self.target.setShader(shader)

        return [shader]
github tobspr / RenderPipeline / Code / RenderingPipeline.py View on Github external
def _setGuiShaders(self):
        """ Sets the default shaders to the gui, this is required when disabling
        the fixed function pipeline """
        shader = Shader.load(Shader.SLGLSL, "Shader/GUI/vertex.glsl", "Shader/GUI/fragment.glsl")
        for target in [self.showbase.aspect2d, self.showbase.render2d, self.showbase.pixel2d,
            self.showbase.aspect2dp, self.showbase.render2dp, self.showbase.pixel2dp]:
            target.setShader(shader, 50)
github tobspr / RenderPipeline / Code / RenderPasses / UnshadowedLightsPass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/UnshadowedLightsPass.fragment")
        self.target.setShader(shader)
        return [shader]
github tobspr / RenderPipeline / Code / RenderPasses / LightCullingPass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/PrecomputeLights.fragment")
        self.target.setShader(shader)

        return [shader]
github tobspr / RenderPipeline / Code / RenderPasses / AntialiasingFXAAPass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/Antialiasing/FXAA/FXAA3.fragment")
        self.target.setShader(shader)

        return [shader]
github cosmonium / cosmonium / cosmonium / shaders.py View on Github external
def create_shader(self):
        print("Loading shader", self.get_shader_id())
        return Shader.load(Shader.SL_GLSL,
                           vertex=self.vertex,
                           tess_control=self.tess_control,
                           tess_evaluation=self.tess_evaluation,
                           geometry=self.geometry,
                           fragment=self.fragment)
github sagost / Video_UAV_Tracker-3D / Video_UAV_Tracker / VUT_3D.py View on Github external
self.terrain_node = ShaderTerrainMesh()

        self.terrain_node.heightfield = self.loader.loadTexture(self.PngDEM)

        self.terrain_node.target_triangle_width = 100.0

        self.terrain_node.generate()


        self.terrain = self.render.attach_new_node(self.terrain_node)


        self.terrain.set_scale(self.PixelNr * self.MeterScale, self.PixelNr * self.MeterScale,
                               self.HeightRange)

        terrain_shader = Shader.load(Shader.SL_GLSL, "terrain.vert.glsl", "terrain.frag.glsl")
        self.terrain.set_shader(terrain_shader)
        self.terrain.set_shader_input("camera", self.camera)

        grass_tex = self.loader.loadTexture(self.TextureImage)
        grass_tex.set_anisotropic_degree(16)



        self.terrain.set_texture(grass_tex)

        self.terrain.setPos(0,0, self.OffsetHeight)
github tobspr / RenderPipeline / Code / RenderPasses / SSLRPass.py View on Github external
def setShaders(self):
        shader = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/SSLRPass.fragment")
        self.target.setShader(shader)

        shaderV = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/SSLRBlurV.fragment")
        self.targetV.setShader(shaderV)

        shaderH = Shader.load(Shader.SLGLSL, 
            "Shader/DefaultPostProcess.vertex",
            "Shader/SSLRBlurH.fragment")
        self.targetH.setShader(shaderH)


        return [shader, shaderV, shaderH]
github tobspr / RenderPipeline / code / util / display_shader_builder.py View on Github external
texture.get_x_size(),
            texture.get_y_size(),
            texture.get_z_size(),
            texture.get_texture_type(),
            texture.get_component_type(),
            view_width,
            view_height)

        # Only regenerate the file when there is no cache entry for it
        if not isfile(cache_key) or True:
            fragment_shader = cls._build_fragment_shader(texture, view_width, view_height)

            with open(cache_key, "w") as handle:
                handle.write(fragment_shader)

        return Shader.load(Shader.SL_GLSL, "shader/default_gui_shader.vert.glsl", cache_key)