diff options
author | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2018-10-22 14:18:24 +0300 |
---|---|---|
committer | Jere Tuliniemi <jere.tuliniemi@qt.io> | 2019-01-15 12:14:07 +0000 |
commit | 0cf63f1de93635c85fc3120cdfce3410a59edc9b (patch) | |
tree | 30ea4185da967d19e2c33298698fb6deadfec1d4 /tests/scenes/customvertex/materials/simple-pos.material | |
parent | 7c203cb04362c246c709285d583052ec1358e7de (diff) |
Enable vertex shaders in custom materials
If <VertexShader> tags in custom material contain a main function, use
the shaders provided as is. The shader generator adds } to the end of
the fully custom fragment shaders so I left that also to the vertex
shader generation.
Custom attributes can be provided with a user-generated .mesh file. The
test scene has a sphere with the normal attr_pos and a sphere with an
attr_pos2 instead. "simple-pos.material" expects an attr_pos vertex
attribute and "simple-pos2.material" an attr_pos2.
Task-number: QT3DS-2026
Change-Id: I2c0cd1c079f9c741900f119aefd2e3515d42f36d
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'tests/scenes/customvertex/materials/simple-pos.material')
-rw-r--r-- | tests/scenes/customvertex/materials/simple-pos.material | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/scenes/customvertex/materials/simple-pos.material b/tests/scenes/customvertex/materials/simple-pos.material new file mode 100644 index 0000000..6a76694 --- /dev/null +++ b/tests/scenes/customvertex/materials/simple-pos.material @@ -0,0 +1,25 @@ +<Material name="simple" version="1.0"> + <MetaData> + <Property formalName="Test Vertex" name="test_vertex" type="Float" default="1.000000" stage="vertex" category="Material" /> + <Property formalName="Test Fragment" name="test_fragment" type="Float" default="1.000000" stage="fragment" category="Material" /> + </MetaData> + <Shaders type="GLSL" version="330"> + <Shader> + <VertexShader> + attribute vec3 attr_pos; + uniform mat4 modelViewProjection; + + void main() { + gl_Position = modelViewProjection * vec4(attr_pos, test_vertex); + </VertexShader> + <FragmentShader> + void main() { + fragOutput = vec4(1.0, test_fragment, 0.0, 1.0); + </FragmentShader> + </Shader> + </Shaders> +<Passes> + <Pass> + </Pass> +</Passes> +</Material> |