-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
484 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
*.bsc | ||
*.pdb | ||
*.ilk | ||
*.ipch | ||
|
||
# Precompiled Headers | ||
*.gch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ | |
import sys | ||
import math | ||
|
||
gDEVELOPMENT = True | ||
gDEVELOPMENT = False | ||
|
||
CLEANUP_MANAGER_VERSION = 0.62 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
|
||
///////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Licensed under the "New" BSD License. | ||
// License page - https://github.com/Neill3d/MoBu/blob/master/LICENSE | ||
// | ||
// GitHub repository - https://github.com/Neill3d/MoBu | ||
// | ||
// Author Sergey Solokhin (Neill3d) 2014-2017 | ||
// e-mail to: s@neill3d.com | ||
// www.neill3d.com | ||
///////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
// recomputer normals in real-time (for a good quality deformations) | ||
|
||
#version 430 | ||
#extension GL_NV_shader_atomic_float : enable | ||
|
||
layout (local_size_x = 1024, local_size_y = 1) in; | ||
|
||
uniform int numberOfTriangles; | ||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// TYPES AND DATA BUFFERS | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
// INPUT from mobu mesh data | ||
layout (std430, binding = 0) readonly buffer PositionBuffer | ||
{ | ||
vec4 positions[]; | ||
} positionBuffer; | ||
|
||
layout (std430, binding = 1) readonly buffer IndicesBuffer | ||
{ | ||
int indices[]; | ||
} indicesBuffer; | ||
|
||
// output | ||
layout (std140, binding = 2) coherent buffer OutputNormals | ||
{ | ||
vec4 normals[]; | ||
} outputNormals; | ||
|
||
|
||
//////////////////////////////////////////////////////// | ||
// | ||
|
||
uint get_invocation() | ||
{ | ||
uint work_group = gl_GlobalInvocationID.y * (gl_NumWorkGroups.x * gl_WorkGroupSize.x) + gl_GlobalInvocationID.x; | ||
return work_group; | ||
} | ||
|
||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// MAIN | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
void main() | ||
{ | ||
// id in the array | ||
uint flattened_id = get_invocation(); | ||
|
||
// ?! skip unused part of the array | ||
if (flattened_id >= numberOfTriangles) | ||
return; | ||
|
||
int id1 = indicesBuffer.indices[flattened_id * 3]; | ||
int id2 = indicesBuffer.indices[flattened_id * 3 + 1]; | ||
int id3 = indicesBuffer.indices[flattened_id * 3 + 2]; | ||
|
||
vec4 pos1 = positionBuffer.positions[id1]; | ||
vec4 pos2 = positionBuffer.positions[id2]; | ||
vec4 pos3 = positionBuffer.positions[id3]; | ||
|
||
vec4 pos21 = pos2-pos1; | ||
vec4 pos31 = pos3-pos1; | ||
|
||
vec3 n = cross(pos21.xyz, pos31.xyz); | ||
n = normalize(n); | ||
|
||
barrier(); | ||
|
||
// accumulate vertex normal by connected face normal | ||
atomicAdd(outputNormals.normals[id1].x, n.x); | ||
atomicAdd(outputNormals.normals[id1].y, n.y); | ||
atomicAdd(outputNormals.normals[id1].z, n.z); | ||
|
||
atomicAdd(outputNormals.normals[id2].x, n.x); | ||
atomicAdd(outputNormals.normals[id2].y, n.y); | ||
atomicAdd(outputNormals.normals[id2].z, n.z); | ||
|
||
atomicAdd(outputNormals.normals[id3].x, n.x); | ||
atomicAdd(outputNormals.normals[id3].y, n.y); | ||
atomicAdd(outputNormals.normals[id3].z, n.z); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
///////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Licensed under the "New" BSD License. | ||
// License page - https://github.com/Neill3d/MoBu/blob/master/LICENSE | ||
// | ||
// GitHub repository - https://github.com/Neill3d/MoBu | ||
// | ||
// Author Sergey Solokhin (Neill3d) 2014-2017 | ||
// e-mail to: s@neill3d.com | ||
// www.neill3d.com | ||
///////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
// recomputer normals in real-time (for a good quality deformations) | ||
// 3 - normalize accumulated normals and don't forget about duplicates | ||
|
||
#version 430 | ||
|
||
layout (local_size_x = 1024, local_size_y = 1) in; | ||
|
||
uniform int numberOfNormals; | ||
uniform int duplicateStart; | ||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// TYPES AND DATA BUFFERS | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
// inout | ||
layout (std140, binding = 2) buffer OutputNormals | ||
{ | ||
vec4 normals[]; | ||
} outputNormals; | ||
|
||
layout (std430, binding = 3) buffer Duplicates | ||
{ | ||
int indices[]; | ||
} duplicates; | ||
|
||
//////////////////////////////////////////////////////// | ||
// | ||
|
||
uint get_invocation() | ||
{ | ||
uint work_group = gl_GlobalInvocationID.y * (gl_NumWorkGroups.x * gl_WorkGroupSize.x) + gl_GlobalInvocationID.x; | ||
return work_group; | ||
} | ||
|
||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// MAIN | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
void main() | ||
{ | ||
// id in the array | ||
uint flattened_id = get_invocation(); | ||
|
||
// ?! skip unused part of the array | ||
if (flattened_id >= numberOfNormals) | ||
return; | ||
|
||
vec4 nor; | ||
if (flattened_id < duplicateStart) | ||
{ | ||
nor = outputNormals.normals[flattened_id]; | ||
nor = normalize(nor); | ||
} | ||
else | ||
{ | ||
int id = duplicates.indices[flattened_id - duplicateStart]; | ||
nor = outputNormals.normals[ id ]; | ||
} | ||
|
||
outputNormals.normals[flattened_id] = nor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
///////////////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Licensed under the "New" BSD License. | ||
// License page - https://github.com/Neill3d/MoBu/blob/master/LICENSE | ||
// | ||
// GitHub repository - https://github.com/Neill3d/MoBu | ||
// | ||
// Author Sergey Solokhin (Neill3d) 2014-2017 | ||
// e-mail to: s@neill3d.com | ||
// www.neill3d.com | ||
///////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
// recomputer normals in real-time (for a good quality deformations) | ||
// 1 - zero vertex normals before we proceed with vertex-face accumulation | ||
|
||
#version 430 | ||
|
||
layout (local_size_x = 1024, local_size_y = 1) in; | ||
|
||
uniform int numberOfNormals; | ||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// TYPES AND DATA BUFFERS | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
// output buffer | ||
layout (std140, binding = 2) buffer OutputNormals | ||
{ | ||
vec4 normals[]; | ||
} outputNormals; | ||
|
||
|
||
//////////////////////////////////////////////////////// | ||
// | ||
|
||
uint get_invocation() | ||
{ | ||
uint work_group = gl_GlobalInvocationID.y * (gl_NumWorkGroups.x * gl_WorkGroupSize.x) + gl_GlobalInvocationID.x; | ||
return work_group; | ||
} | ||
|
||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// MAIN | ||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
void main() | ||
{ | ||
// id in the array | ||
uint flattened_id = get_invocation(); | ||
|
||
// ?! skip unused part of the array | ||
if (flattened_id >= numberOfNormals) | ||
return; | ||
|
||
outputNormals.normals[flattened_id] = vec4(0.0, 0.0, 0.0, 0.0); | ||
} |
Oops, something went wrong.