Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _late_init(self, task):
""" Gets called after the pipeline initialized, this extracts the
exposure texture from the stage manager """
stage_mgr = self._pipeline.stage_mgr
if not stage_mgr.has_pipe("Exposure"):
self.debug("Disabling exposure widget, could not find the exposure data.")
self._node.remove_node()
return
self._node.show()
exposure_tex = stage_mgr.get_pipe("Exposure")
self._cshader = Shader.load_compute(Shader.SL_GLSL, "Shader/GUI/VisualizeExposure.compute.glsl")
self._cshader_np.set_shader(self._cshader)
self._cshader_np.set_shader_input("DestTex", self._storage_tex)
self._cshader_np.set_shader_input("ExposureTex", exposure_tex)
from panda3d.core import PNMImage, load_prc_file_data, Texture, NodePath
from panda3d.core import Shader, ShaderAttrib
import shutil
import os
load_prc_file_data("", "textures-power-2 none")
# load_prc_file_data("", "window-type offscreen")
load_prc_file_data("", "win-size 100 100")
load_prc_file_data("", "notify-level-display error")
import direct.directbase.DirectStart
compute_shader = Shader.make_compute(Shader.SL_GLSL, """
#version 430
layout (local_size_x = 16, local_size_y = 16) in;
uniform writeonly image2D DestTex;
uniform samplerCube SourceCubemap;
uniform int size;
uniform int blurSize;
uniform int effectiveSize;
uniform int faceIndex;
vec3 transform_cubemap_coordinates(vec3 coord) {
return normalize(coord.xzy * vec3(1,-1,1));
}
vec3 get_transformed_coord(vec2 coord) {
self.textureMapper.addTexture(self.tex4)
self.textureMapper.addRegionToTex(Vec4(self.indexToHeight(0.72), 9999.0, -0.001, 1.001))
logging.info( "intializing terrain shader generator...")
file = 'shaders/terrain.sha'
if SAVED_TEXTURE_MAPS:
self.shaderGenerator = BakedTerrainShaderGenerator(self.terrain, self, self.textureMapper)
file = 'shaders/bakedTerrain.sha'
else:
self.shaderGenerator = FullTerrainShaderGenerator(self.terrain, self, self.textureMapper)
file = 'shaders/fullTerrain.sha'
logging.info( "terrain shader generator initialized...")
if RUNTYPE == 'python':
self.shaderGenerator.saveShader(file)
self.shader = Shader.load(file, Shader.SLCg)
else:
self.shader = Shader.make(self.shaderGenerator.createShader(), Shader.SLCg);
self.terrain.setShaderInput("normalMap", self.normalMap)
self.terrain.setShaderInput("displacementMap", self.displacementMap)
self.terrain.setShaderInput("detailTex", self.detailTex)
self.terrain.setShaderInput('tscale', self.texScale)
self.terrain.setShaderInput("fogColor", Vec4(1.0, 1.0, 1.0, 1.0))
self.terrain.setShaderInput("camPos", base.camera.getPos())
def setShaders(self):
shader = Shader.load(Shader.SLGLSL,
"Shader/DefaultPostProcess.vertex",
"Shader/ComputeGI.fragment")
self.target.setShader(shader)
return [shader]
def setShaders(self):
shader = Shader.load(Shader.SLGLSL,
"Shader/DefaultPostProcess.vertex",
"Shader/FinalPostprocessPass.fragment")
self.target.setShader(shader)
return [shader]
def setShaders(self):
shader = Shader.load(Shader.SLGLSL,
"Shader/TransparencyShade/vertex.glsl",
"Shader/TransparencyShade/fragment.glsl",
"Shader/TransparencyShade/geometry.glsl",
)
self.target.setShader(shader)
return [shader]
def setShaders(self):
shader = Shader.load(Shader.SLGLSL,
"Shader/DefaultPostProcess.vertex",
"Shader/RenderClouds.fragment")
self.target.setShader(shader)
shaderV = Shader.load(Shader.SLGLSL,
"Shader/DefaultPostProcess.vertex",
"Shader/CloudBlurV.fragment")
self.targetV.setShader(shaderV)
shaderH = Shader.load(Shader.SLGLSL,
"Shader/DefaultPostProcess.vertex",
"Shader/CloudBlurH.fragment")
self.targetH.setShader(shaderH)
return [shader]
"Shader/Antialiasing/SMAA/EdgeDetection.fragment")
self._edgesBuffer.setShader(edgeShader)
weightsShader = Shader.load(Shader.SLGLSL,
"Shader/Antialiasing/SMAA/BlendingWeights.vertex",
"Shader/Antialiasing/SMAA/BlendingWeights.fragment")
self._blendBuffer.setShader(weightsShader)
neighborShader = Shader.load(Shader.SLGLSL,
"Shader/Antialiasing/SMAA/Neighbors.vertex",
"Shader/Antialiasing/SMAA/Neighbors.fragment")
for buff in self._neighborBuffers:
buff.setShader(neighborShader)
resolveShader = Shader.load(Shader.SLGLSL,
"Shader/Antialiasing/SMAA/Resolve.vertex",
"Shader/Antialiasing/SMAA/Resolve.fragment")
self._resolveBuffer.setShader(resolveShader)
return [edgeShader, weightsShader, neighborShader, resolveShader]
def setShaders(self):
shader = Shader.load(Shader.SLGLSL,
"Shader/DefaultPostProcess.vertex",
"Shader/SceneFinishPass.fragment")
self.target.setShader(shader)
return [shader]