GteGenerateMeshUV.cpp
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #include <GTEnginePCH.h>
10 using namespace gte;
11 
13 "uniform Bounds\n"
14 "{\n"
15 " ivec2 bound;\n"
16 " int numBoundaryEdges;\n"
17 " int numInputs;\n"
18 "};\n"
19 "\n"
20 "struct VertexGraphData\n"
21 "{\n"
22 " int adjacent;\n"
23 " Real weight;\n"
24 "};\n"
25 "\n"
26 "buffer vertexGraph { ivec3 data[]; } vertexGraphSB;\n"
27 "buffer vertexGraphData { VertexGraphData data[]; } vertexGraphDataSB;\n"
28 "buffer orderedVertices { int data[]; } orderedVerticesSB;\n"
29 "buffer inTCoords { Real2 data[]; } inTCoordsSB;\n"
30 "buffer outTCoords { Real2 data[]; } outTCoordsSB;\n"
31 "\n"
32 "layout (local_size_x = NUM_X_THREADS, local_size_y = NUM_Y_THREADS, local_size_z = 1) in;\n"
33 "void main()\n"
34 "{\n"
35 " ivec2 t = ivec2(gl_GlobalInvocationID.xy);\n"
36 " int index = t.x + bound.x * t.y;\n"
37 " if (step(index, numInputs-1) == 1)\n"
38 " {\n"
39 " int v = orderedVerticesSB.data[numBoundaryEdges + index];\n"
40 " ivec2 range = vertexGraphSB.data[v].yz;\n"
41 " Real2 tcoord = Real2(0, 0);\n"
42 " Real weightSum = 0;\n"
43 " for (int j = 0; j < range.y; ++j)\n"
44 " {\n"
45 " VertexGraphData vgd = vertexGraphDataSB.data[range.x + j];\n"
46 " weightSum += vgd.weight;\n"
47 " tcoord += vgd.weight * inTCoordsSB.data[vgd.adjacent];\n"
48 " }\n"
49 " tcoord /= weightSum;\n"
50 " outTCoordsSB.data[v] = tcoord;\n"
51 " }\n"
52 "}\n";
53 
55 "cbuffer Bounds\n"
56 "{\n"
57 " int2 bound;\n"
58 " int numBoundaryEdges;\n"
59 " int numInputs;\n"
60 "};\n"
61 "\n"
62 "struct VertexGraphData\n"
63 "{\n"
64 " int adjacent;\n"
65 " Real weight;\n"
66 "};\n"
67 "\n"
68 "StructuredBuffer<int3> vertexGraph;\n"
69 "StructuredBuffer<VertexGraphData> vertexGraphData;\n"
70 "StructuredBuffer<int> orderedVertices;\n"
71 "StructuredBuffer<Real2> inTCoords;\n"
72 "RWStructuredBuffer<Real2> outTCoords;\n"
73 "\n"
74 "[numthreads(NUM_X_THREADS, NUM_Y_THREADS, 1)]\n"
75 "void CSMain(int2 t : SV_DispatchThreadID)\n"
76 "{\n"
77 " int index = t.x + bound.x * t.y;\n"
78 " if (step(index, numInputs-1))\n"
79 " {\n"
80 " int v = orderedVertices[numBoundaryEdges + index];\n"
81 " int2 range = vertexGraph[v].yz;\n"
82 " Real2 tcoord = Real2(0, 0);\n"
83 " Real weightSum = 0;\n"
84 " for (int j = 0; j < range.y; ++j)\n"
85 " {\n"
86 " VertexGraphData data = vertexGraphData[range.x + j];\n"
87 " weightSum += data.weight;\n"
88 " tcoord += data.weight * inTCoords[data.adjacent];\n"
89 " }\n"
90 " tcoord /= weightSum;\n"
91 " outTCoords[v] = tcoord;\n"
92 " }\n"
93 "}\n";
94 
96 {
97  &msGLSLSource,
98  &msHLSLSource
99 };
static std::string const msHLSLSource
static std::string const * msSource[]
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
static std::string const msGLSLSource


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59