mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
More changes to shader generator
This commit is contained in:
parent
a9dc480500
commit
383b0660ae
@ -93,6 +93,9 @@ class CommonFilters:
|
|||||||
needtexpix = True
|
needtexpix = True
|
||||||
|
|
||||||
self.finalQuad = self.manager.renderSceneInto(textures = self.textures, auxbits=auxbits)
|
self.finalQuad = self.manager.renderSceneInto(textures = self.textures, auxbits=auxbits)
|
||||||
|
if (self.finalQuad == None):
|
||||||
|
self.cleanup()
|
||||||
|
return False
|
||||||
|
|
||||||
if (configuration.has_key("Bloom")):
|
if (configuration.has_key("Bloom")):
|
||||||
bloomconf = configuration["Bloom"]
|
bloomconf = configuration["Bloom"]
|
||||||
@ -172,7 +175,6 @@ class CommonFilters:
|
|||||||
text += "o_color = 1-((1-bloom)*(1-o_color));\n"
|
text += "o_color = 1-((1-bloom)*(1-o_color));\n"
|
||||||
text += "}\n"
|
text += "}\n"
|
||||||
|
|
||||||
print "Using shader: ", text
|
|
||||||
self.finalQuad.setShader(Shader.make(text))
|
self.finalQuad.setShader(Shader.make(text))
|
||||||
for tex in self.textures:
|
for tex in self.textures:
|
||||||
self.finalQuad.setShaderInput("tx"+tex, self.textures[tex])
|
self.finalQuad.setShaderInput("tx"+tex, self.textures[tex])
|
||||||
@ -191,15 +193,18 @@ class CommonFilters:
|
|||||||
self.bloom[0].setShaderInput("desat", bloomconf.desat)
|
self.bloom[0].setShaderInput("desat", bloomconf.desat)
|
||||||
self.bloom[3].setShaderInput("intensity", intensity, intensity, intensity, intensity)
|
self.bloom[3].setShaderInput("intensity", intensity, intensity, intensity, intensity)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def setCartoonInk(self, separation=1):
|
def setCartoonInk(self, separation=1):
|
||||||
fullrebuild = (self.configuration.has_key("CartoonInk") == False)
|
fullrebuild = (self.configuration.has_key("CartoonInk") == False)
|
||||||
self.configuration["CartoonInk"] = separation
|
self.configuration["CartoonInk"] = separation
|
||||||
self.reconfigure(fullrebuild, "CartoonInk")
|
return self.reconfigure(fullrebuild, "CartoonInk")
|
||||||
|
|
||||||
def delCartoonInk(self):
|
def delCartoonInk(self):
|
||||||
if (self.configuration.has_key("CartoonInk")):
|
if (self.configuration.has_key("CartoonInk")):
|
||||||
del self.configuration["CartoonInk"]
|
del self.configuration["CartoonInk"]
|
||||||
self.reconfigure(True, "CartoonInk")
|
return self.reconfigure(True, "CartoonInk")
|
||||||
|
return True
|
||||||
|
|
||||||
def setBloom(self, blend=(0.3,0.4,0.3,0.0), mintrigger=0.6, maxtrigger=1.0, desat=0.6, intensity=1.0, size="medium"):
|
def setBloom(self, blend=(0.3,0.4,0.3,0.0), mintrigger=0.6, maxtrigger=1.0, desat=0.6, intensity=1.0, size="medium"):
|
||||||
if (maxtrigger==None): maxtrigger=mintrigger+0.8
|
if (maxtrigger==None): maxtrigger=mintrigger+0.8
|
||||||
@ -215,29 +220,32 @@ class CommonFilters:
|
|||||||
newconfig.intensity = intensity
|
newconfig.intensity = intensity
|
||||||
newconfig.size = size
|
newconfig.size = size
|
||||||
self.configuration["Bloom"] = newconfig
|
self.configuration["Bloom"] = newconfig
|
||||||
self.reconfigure(fullrebuild, "Bloom")
|
return self.reconfigure(fullrebuild, "Bloom")
|
||||||
|
|
||||||
def delBloom(self):
|
def delBloom(self):
|
||||||
if (self.configuration.has_key("Bloom")):
|
if (self.configuration.has_key("Bloom")):
|
||||||
del self.configuration["Bloom"]
|
del self.configuration["Bloom"]
|
||||||
self.reconfigure(True, "Bloom")
|
return self.reconfigure(True, "Bloom")
|
||||||
|
return True
|
||||||
|
|
||||||
def setHalfPixelShift(self):
|
def setHalfPixelShift(self):
|
||||||
fullrebuild = (self.configuration.has_key("HalfPixelShift") == False)
|
fullrebuild = (self.configuration.has_key("HalfPixelShift") == False)
|
||||||
self.configuration["HalfPixelShift"] = 1
|
self.configuration["HalfPixelShift"] = 1
|
||||||
self.reconfigure(fullrebuild, "HalfPixelShift")
|
return self.reconfigure(fullrebuild, "HalfPixelShift")
|
||||||
|
|
||||||
def delHalfPixelShift(self):
|
def delHalfPixelShift(self):
|
||||||
if (self.configuration.has_key("HalfPixelShift")):
|
if (self.configuration.has_key("HalfPixelShift")):
|
||||||
del self.configuration["HalfPixelShift"]
|
del self.configuration["HalfPixelShift"]
|
||||||
self.reconfigure(True, "HalfPixelShift")
|
return self.reconfigure(True, "HalfPixelShift")
|
||||||
|
return True
|
||||||
|
|
||||||
def setFSBloom(self):
|
def setFSBloom(self):
|
||||||
fullrebuild = (self.configuration.has_key("FSBloom") == False)
|
fullrebuild = (self.configuration.has_key("FSBloom") == False)
|
||||||
self.configuration["FSBloom"] = 1
|
self.configuration["FSBloom"] = 1
|
||||||
self.reconfigure(fullrebuild, "FSBloom")
|
return self.reconfigure(fullrebuild, "FSBloom")
|
||||||
|
|
||||||
def delFSBloom(self):
|
def delFSBloom(self):
|
||||||
if (self.configuration.has_key("FSBloom")):
|
if (self.configuration.has_key("FSBloom")):
|
||||||
del self.configuration["FSBloom"]
|
del self.configuration["FSBloom"]
|
||||||
self.reconfigure(True, "FSBloom")
|
return self.reconfigure(True, "FSBloom")
|
||||||
|
return True
|
||||||
|
@ -188,7 +188,7 @@ class FilterManager:
|
|||||||
|
|
||||||
cs = NodePath("dummy")
|
cs = NodePath("dummy")
|
||||||
cs.setState(self.caminit)
|
cs.setState(self.caminit)
|
||||||
cs.setShaderAuto();
|
cs.setShaderAuto()
|
||||||
if (auxbits):
|
if (auxbits):
|
||||||
cs.setAttrib(AuxBitplaneAttrib.make(auxbits))
|
cs.setAttrib(AuxBitplaneAttrib.make(auxbits))
|
||||||
self.camera.node().setInitialState(cs.getState())
|
self.camera.node().setInitialState(cs.getState())
|
||||||
@ -262,7 +262,6 @@ class FilterManager:
|
|||||||
def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
|
def createBuffer(self, name, xsize, ysize, texgroup, depthbits=1):
|
||||||
""" Low-level buffer creation. Not intended for public use. """
|
""" Low-level buffer creation. Not intended for public use. """
|
||||||
|
|
||||||
print "Creating buffer: ",xsize,ysize,texgroup,depthbits
|
|
||||||
winprops = WindowProperties()
|
winprops = WindowProperties()
|
||||||
winprops.setSize(xsize, ysize)
|
winprops.setSize(xsize, ysize)
|
||||||
props = FrameBufferProperties()
|
props = FrameBufferProperties()
|
||||||
@ -277,6 +276,8 @@ class FilterManager:
|
|||||||
self.win.getPipe(), name, -1,
|
self.win.getPipe(), name, -1,
|
||||||
props, winprops, GraphicsPipe.BFRefuseWindow,
|
props, winprops, GraphicsPipe.BFRefuseWindow,
|
||||||
self.win.getGsg(), self.win)
|
self.win.getGsg(), self.win)
|
||||||
|
if (buffer == None):
|
||||||
|
return buffer
|
||||||
if (depthtex):
|
if (depthtex):
|
||||||
buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepth)
|
buffer.addRenderTexture(depthtex, GraphicsOutput.RTMBindOrCopy, GraphicsOutput.RTPDepth)
|
||||||
if (colortex):
|
if (colortex):
|
||||||
|
@ -310,7 +310,7 @@ ConfigVariableBool sync_video
|
|||||||
"this request."));
|
"this request."));
|
||||||
|
|
||||||
ConfigVariableBool basic_shaders_only
|
ConfigVariableBool basic_shaders_only
|
||||||
("basic_shaders_only", false,
|
("basic-shaders-only", false,
|
||||||
PRC_DESC("Set this to true if you aren't interested in shader model three "
|
PRC_DESC("Set this to true if you aren't interested in shader model three "
|
||||||
"and beyond. Setting this flag will cause panda to disable "
|
"and beyond. Setting this flag will cause panda to disable "
|
||||||
"bleeding-edge shader functionality which tends to be unreliable "
|
"bleeding-edge shader functionality which tends to be unreliable "
|
||||||
|
@ -67,8 +67,7 @@ PUBLISHED:
|
|||||||
ABO_glow = 1,
|
ABO_glow = 1,
|
||||||
|
|
||||||
ABO_aux_normal = 2,
|
ABO_aux_normal = 2,
|
||||||
ABO_aux_modelz = 4,
|
ABO_aux_glow = 4,
|
||||||
ABO_aux_glow = 8,
|
|
||||||
};
|
};
|
||||||
static CPT(RenderAttrib) make();
|
static CPT(RenderAttrib) make();
|
||||||
static CPT(RenderAttrib) make(int outputs);
|
static CPT(RenderAttrib) make(int outputs);
|
||||||
|
@ -148,7 +148,7 @@ analyze_renderstate(const RenderState *rs) {
|
|||||||
|
|
||||||
// Check if there's an alpha test, color blend, or transparency.
|
// Check if there's an alpha test, color blend, or transparency.
|
||||||
|
|
||||||
if ((_attribs._alpha_test->get_mode() != RenderAttrib::M_none)&&
|
if ((_attribs._alpha_test->get_mode() != RendetyrAttrib::M_none)&&
|
||||||
(_attribs._alpha_test->get_mode() != RenderAttrib::M_always)) {
|
(_attribs._alpha_test->get_mode() != RenderAttrib::M_always)) {
|
||||||
_have_alpha_test = true;
|
_have_alpha_test = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user