editor now does fragment and vertex shaders

This commit is contained in:
Sebastian Kügler 2013-03-09 04:15:17 +01:00
parent c536aa4006
commit 91339544ab

View File

@ -37,10 +37,16 @@ PlasmaComponents.Page {
fill: parent fill: parent
margins: _s margins: _s
} }
/*
Image {
id: imageItem
anchors.fill: parent
//source: "../images/elarun-small.png"
}
ShaderEffectSource { ShaderEffectSource {
id: effectSource id: effectSource
sourceItem: editorPage sourceItem: imageItem
hideSource: hideSourceCheckbox.checked hideSource: hideSourceCheckbox.checked
} }
@ -67,7 +73,6 @@ PlasmaComponents.Page {
} }
} }
*/
PlasmaExtras.Heading { PlasmaExtras.Heading {
id: heading id: heading
@ -79,6 +84,20 @@ PlasmaComponents.Page {
} }
text: pageName text: pageName
} }
PlasmaComponents.ButtonColumn {
anchors {
right: parent.right
top: heading.top
}
PlasmaComponents.RadioButton {
id: fragmentRadio
text: "Fragment / Pixel Shader"
}
PlasmaComponents.RadioButton {
text: "Vertex Shader"
}
}
PlasmaComponents.TextArea { PlasmaComponents.TextArea {
id: editor id: editor
anchors { anchors {
@ -90,6 +109,11 @@ PlasmaComponents.Page {
bottomMargin: _s bottomMargin: _s
} }
text: { "void main(void) {\
gl_FragColor = vec4(1.0, 0.0, 0.0, 0.3);\
}"
}
// width: parent.width // width: parent.width
// parent.height-height: _h*2 // parent.height-height: _h*2
} }
@ -99,8 +123,13 @@ PlasmaComponents.Page {
text: "Upload Shader" text: "Upload Shader"
onClicked: { onClicked: {
shader = editor.text shader = editor.text
print("Uploading new vertex shader: \n" + shader); if (fragmentRadio.checked) {
mainShader.vertexShader = shader; print("Uploading new fragment shader: \n" + shader);
mainShader.fragmentShader = shader
} else {
print("Uploading new vertex shader: \n" + shader);
mainShader.vertexShader = shader;
}
} }
anchors { anchors {