Reference shader in draw_quad.

This commit is contained in:
Lubos Lenco 2016-04-15 00:02:32 +02:00
parent 757191e3a7
commit 5e029b0a83
15 changed files with 73 additions and 247 deletions

View file

@ -1,16 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [
],
"id": "bloom_pass"
}
],
"id": "bloom_material",
"shader": "bloom_pass/bloom_pass"
}
]
}

View file

@ -1,42 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [
{
"id": "dir",
"vec2": [
1.0,
0.0
]
}
],
"bind_textures": [],
"id": "blur_pass"
}
],
"id": "blur_material_hor",
"shader": "blur_pass/blur_pass"
},
{
"contexts": [
{
"bind_constants": [
{
"id": "dir",
"vec2": [
0.0,
1.0
]
}
],
"bind_textures": [],
"id": "blur_pass"
}
],
"id": "blur_material_ver",
"shader": "blur_pass/blur_pass"
}
]
}

View file

@ -1,15 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [],
"id": "combine_pass"
}
],
"id": "combine_material",
"shader": "combine_pass/combine_pass"
}
]
}

View file

@ -1,42 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [
{
"id": "senvmapIrradiance",
"name": "envmap_irradiance"
},
{
"id": "senvmapRadiance",
"mipmap_filter": "linear",
"mipmaps": [
"envmap_radiance_0",
"envmap_radiance_1",
"envmap_radiance_2",
"envmap_radiance_3",
"envmap_radiance_4",
"envmap_radiance_5",
"envmap_radiance_6",
"envmap_radiance_7",
"envmap_radiance_8",
"envmap_radiance_9",
"envmap_radiance_10"
],
"name": "envmap_radiance"
},
{
"id": "senvmapBrdf",
"name": "envmap_brdf"
}
],
"id": "deferred_light"
}
],
"id": "deferred_material",
"shader": "deferred_light/deferred_light"
}
]
}

View file

@ -1,16 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [
],
"id": "dof_pass"
}
],
"id": "dof_material",
"shader": "dof_pass/dof_pass"
}
]
}

View file

@ -1,16 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [
],
"id": "fisheye_pass"
}
],
"id": "fisheye_material",
"shader": "fisheye_pass/fisheye_pass"
}
]
}

View file

@ -1,16 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [
],
"id": "fxaa_pass"
}
],
"id": "fxaa_material",
"shader": "fxaa_pass/fxaa_pass"
}
]
}

View file

@ -1,16 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [
],
"id": "motion_blur_pass"
}
],
"id": "motion_blur_material",
"shader": "motion_blur_pass/motion_blur_pass"
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

View file

@ -1,26 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [],
"id": "pt_trace_pass"
}
],
"id": "pt_trace_material",
"shader": "pt_trace_pass/pt_trace_pass"
},
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [],
"id": "pt_final_pass"
}
],
"id": "pt_final_material",
"shader": "pt_final_pass/pt_final_pass"
}
]
}

View file

@ -1,20 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [
{
"id": "snoise",
"name": "noise8"
}
],
"id": "ssao_pass"
}
],
"id": "ssao_material",
"shader": "ssao_pass/ssao_pass"
}
]
}

View file

@ -1,16 +0,0 @@
{
"material_resources": [
{
"contexts": [
{
"bind_constants": [],
"bind_textures": [
],
"id": "ssr_pass"
}
],
"id": "ssr_material",
"shader": "ssr_pass/ssr_pass"
}
]
}

View file

@ -132,6 +132,24 @@ class BindTargetNode(Node, CGPipelineTreeNode):
def free(self):
print("Removing node ", self, ", Goodbye!")
class DrawMaterialQuadNode(Node, CGPipelineTreeNode):
'''A custom node'''
bl_idname = 'DrawMaterialQuadNodeType'
bl_label = 'Draw Material Quad'
bl_icon = 'SOUND'
def init(self, context):
self.inputs.new('NodeSocketShader', "Stage")
self.inputs.new('NodeSocketString', "Material Context")
self.outputs.new('NodeSocketShader', "Stage")
def copy(self, node):
print("Copying from node ", node)
def free(self):
print("Removing node ", self, ", Goodbye!")
class DrawQuadNode(Node, CGPipelineTreeNode):
'''A custom node'''
bl_idname = 'DrawQuadNodeType'
@ -140,7 +158,7 @@ class DrawQuadNode(Node, CGPipelineTreeNode):
def init(self, context):
self.inputs.new('NodeSocketShader', "Stage")
self.inputs.new('NodeSocketString', "Material Context")
self.inputs.new('NodeSocketString', "Shader Context")
self.outputs.new('NodeSocketShader', "Stage")
@ -186,6 +204,7 @@ node_categories = [
NodeItem("ClearTargetNodeType"),
NodeItem("SetTargetNodeType"),
NodeItem("BindTargetNodeType"),
NodeItem("DrawMaterialQuadNodeType"),
NodeItem("DrawQuadNodeType"),
NodeItem("DrawWorldNodeType"),
NodeItem("TargetNodeType"),
@ -319,17 +338,26 @@ def buildNode(res, node, node_group, last_bind_target, shader_references, asset_
stage.params.append(targetId)
stage.params.append(node.inputs[2].default_value)
elif node.bl_idname == 'DrawQuadNodeType':
stage.command = 'draw_quad'
elif node.bl_idname == 'DrawMaterialQuadNodeType':
stage.command = 'draw_material_quad'
material_context = node.inputs[1].default_value
stage.params.append(material_context)
# Include resource and shaders
res_name = material_context.rsplit('/', 1)[1]
asset_references.append('compiled/ShaderResources/' + res_name + '/' + res_name + '.json')
shader_references.append('compiled/Shaders/' + res_name + '/' + res_name)
elif node.bl_idname == 'DrawQuadNodeType':
stage.command = 'draw_shader_quad'
shader_context = node.inputs[1].default_value
stage.params.append(shader_context)
# Include resource and shaders
res_name = shader_context.split('/', 1)[0]
asset_references.append('compiled/ShaderResources/' + res_name + '/' + res_name + '.json')
shader_references.append('compiled/Shaders/' + res_name + '/' + res_name)
elif node.bl_idname == 'DrawWorldNodeType':
stage.command = 'draw_quad'
stage.command = 'draw_material_quad'
wname = bpy.data.worlds[0].name
stage.params.append(wname + '_material/' + wname + '_material/env_map') # Only one world for now

View file

@ -1,7 +1,7 @@
{
"contexts": [
{
"id": "blur_pass",
"id": "blur_pass_x",
"params": [
{
"id": "depth_write",
@ -16,7 +16,42 @@
"value": "none"
}
],
"links": [],
"links": [
{
"id": "dir",
"link": "_vec2x"
}
],
"texture_params": [],
"vertex_shader": "blur_pass.vert.glsl",
"fragment_shader": "blur_pass.frag.glsl"
},
{
"id": "blur_pass_y",
"params": [
{
"id": "depth_write",
"value": "true"
},
{
"id": "compare_mode",
"value": "always"
},
{
"id": "cull_mode",
"value": "none"
},
{
"id": "dir",
"link": "_vec2y"
}
],
"links": [
{
"id": "dir",
"link": "_vec2y"
}
],
"texture_params": [],
"vertex_shader": "blur_pass.vert.glsl",
"fragment_shader": "blur_pass.frag.glsl"

View file

@ -17,6 +17,10 @@
}
],
"links": [
{
"id": "snoise",
"link": "_noise8"
}
],
"texture_params": [],
"vertex_shader": "ssao_pass.vert.glsl",