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
af72c003
Commit
af72c003
authored
8 years ago
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement vertex shader
parent
9c5ff7de
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
subdivision-vertex.compute
QTProject/subdivision-vertex.compute
+17
-0
No files found.
QTProject/subdivision-vertex.compute
View file @
af72c003
#version 430 core
#define M_PI 3.14159265358979323846
layout (local_size_x = 1) in;
struct Vertex {
...
...
@@ -25,4 +27,19 @@ layout(std430, binding=3) writeonly buffer Output {
};
void main(){
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);
// FIXME: size or size - 1?
float t = 3.0f/8.0f + 2.0f/8.0f * cos(2.0f * M_PI / (float(size) - 1.0f));
float alpha = 5.0f/8.0f - t * t;
vec3 pos = vec3(0.0f, 0.0f, 0.0f);
for (unsigned int i = 1; i < size; i++) {
pos += vertices[indices[offsets[gl_GlobalInvocationID.x] + i]].pos;
}
new_vertices[gl_GlobalInvocationID.x].pos = (1.0f - alpha) * vertices[indices[offsets[gl_GlobalInvocationID.x]]].pos + alpha / (float(size) - 1) * pos;
}
This diff is collapsed.
Click to expand it.
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