Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define INTERPOLATE(name) \
- o.name = \
- patch[0].name * barycentric.x + \
- patch[1].name * barycentric.y + \
- patch[2].name * barycentric.z;
- int subdivisions = 1;
- struct v2h
- {
- float2 uv : TEXCOORD0;
- float3 normal : NORMAL;
- float4 vertex : SV_POSITION;
- };
- struct chull
- {
- float edges[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- };
- [UNITY_domain("tri")]
- [UNITY_partitioning("integer")]
- [UNITY_outputcontrolpoints(3)]
- [UNITY_outputtopology("triangle_cw")]
- [UNITY_patchconstantfunc("hull_const")]
- v2h hull(InputPatch<v2h, 3> patch,
- uint id : SV_OutputControlPointID) {
- v2h o = patch[id];
- return o;
- }
- chull hull_const(InputPatch<v2h, 3> patch) {
- chull o;
- o.edges[0] = subdivisions;
- o.edges[1] = subdivisions;
- o.edges[2] = subdivisions;
- o.inside = subdivisions;
- return o;
- }
- [UNITY_domain("tri")]
- v2h domain(
- chull factors,
- OutputPatch<v2h, 3> patch,
- float3 barycentric : SV_DomainLocation
- ) {
- v2h o;
- INTERPOLATE(uv);
- INTERPOLATE(normal);
- INTERPOLATE(vertex);
- return o;
- }
Add Comment
Please, Sign In to add comment