Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
Unterteilungsalgorithmen
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
Unterteilungsalgorithmen
Commits
cce97fe9
Commit
cce97fe9
authored
Jul 01, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish vertex compute shader
parent
4f193052
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
subdivision-vertex.compute
QTProject/subdivision-vertex.compute
+4
-2
No files found.
QTProject/subdivision-vertex.compute
View file @
cce97fe9
...
@@ -29,7 +29,6 @@ layout(std430, binding=3) writeonly buffer Output {
...
@@ -29,7 +29,6 @@ layout(std430, binding=3) writeonly buffer Output {
void main(){
void main(){
unsigned int size = offsets[gl_GlobalInvocationID.x + 1] - offsets[gl_GlobalInvocationID.x];
unsigned int size = offsets[gl_GlobalInvocationID.x + 1] - offsets[gl_GlobalInvocationID.x];
new_vertices[gl_GlobalInvocationID.x].norm = vec3(0.0f, 0.0f, 0.0f);
new_vertices[gl_GlobalInvocationID.x].uv = vec2(0.0f, 0.0f);
new_vertices[gl_GlobalInvocationID.x].uv = vec2(0.0f, 0.0f);
// FIXME: size or size - 1?
// FIXME: size or size - 1?
...
@@ -37,9 +36,12 @@ void main(){
...
@@ -37,9 +36,12 @@ void main(){
float alpha = 5.0f/8.0f - t * t;
float alpha = 5.0f/8.0f - t * t;
vec3 pos = vec3(0.0f, 0.0f, 0.0f);
vec3 pos = vec3(0.0f, 0.0f, 0.0f);
vec3 norm = vec3(0.0f, 0.0f, 0.0f);
for (unsigned int i = 1; i < size; i++) {
for (unsigned int i = 1; i < size; i++) {
pos += vertices[indices[offsets[gl_GlobalInvocationID.x] + i]].pos;
pos += vertices[indices[offsets[gl_GlobalInvocationID.x] + i]].pos;
norm += vertices[indices[offsets[gl_GlobalInvocationID.x] + i]].norm;
}
}
new_vertices[gl_GlobalInvocationID.x].pos = (1.0f - alpha) * vertices[indices[offsets[gl_GlobalInvocationID.x]]].pos + alpha / (float(size) - 1) * pos;
new_vertices[gl_GlobalInvocationID.x].pos = (1.0f - alpha) * vertices[indices[offsets[gl_GlobalInvocationID.x]]].pos + alpha / (float(size) - 1.0f) * pos;
new_vertices[gl_GlobalInvocationID.x].norm = normalize((1.0f - alpha) * vertices[indices[offsets[gl_GlobalInvocationID.x]]].norm + alpha / (float(size) - 1.0f) * norm);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment