New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matcap #23
Merged
Matcap #23
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9b34726
fix rendering bug in doc example
b31a317
matcap
a76591b
matcap
ed0cbc8
matcap 2nd try
220b2bb
matcap cleanup
aa5051a
allow for transparent RGBA matcaps
e91c55a
adjust argument passing to new emscripten
4315e89
emscripten/WebGL does not like mipmap for SRGB textures
0b272f6
fix emscripten argument passing
990212a
load RGB or RGBA depending on target texture format
7af1a8a
use raw string literals for shader code
f245880
fix imgui transparency and Apple shader version
840fcde
better emscripten parameter parsing
629e1ca
travis: enable building all branches
dsieger ed77643
appveyor: build all branches
dsieger 58fe42c
improve documentation
83c9ef9
update pmp-data, which now contains some mat-cap textures
c4235a8
Merge branch 'develop' into matcap
1b58442
fix matcap loading in emscripten
c963272
slightly improved matcap shader
f06ea28
Fix minor issues.
dsieger a9dd246
adjusted copyright year(s)
1788e14
Mario tries hard to learn git
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
<!doctypehtml><html lang=en-us><head><meta charset=utf-8><meta content="text/html; charset=utf-8"http-equiv=Content-Type><style>body{margin:0;padding:0;overflow:hidden}.emscripten{padding-right:0;margin-left:auto;margin-right:auto;display:block}div.emscripten{text-align:center}canvas.emscripten{border:0 none;padding:0;background-color:#fff;width:100vw;height:100vh;max-height:100vh;display:block;overflow:hidden}</style></head><body><div class=emscripten id=status>Downloading...</div><div class=emscripten><progress hidden id=progress max=100 value=0></progress></div><canvas class=emscripten id=canvas oncontextmenu=event.preventDefault()></canvas><script>var statusElement=document.getElementById("status"),progressElement=document.getElementById("progress");function getUrlVars(){var o={};window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(e,t,n){o[t]=n});return o}var Module={preRun:[function(){var e=getUrlVars().model;if(e){var t=e.split("/").pop();console.log("reading "+e),Module.arguments=[t],FS.createPreloadedFile("./",t,e,!0,!1)}}],postRun:[],print:function(e){console.log(e)},printErr:function(e){console.error(e)},canvas:function(){var e=document.getElementById("canvas");return e.addEventListener("webglcontextlost",function(e){alert("WebGL context lost. You will need to reload the page."),e.preventDefault()},!1),e}(),setStatus:function(e){if(Module.setStatus.last||(Module.setStatus.last={time:Date.now(),text:""}),e!==Module.setStatus.text){var t=e.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/),n=Date.now();t&&n-Date.now()<30||(progressElement.hidden=t?(e=t[1],progressElement.value=100*parseInt(t[2]),progressElement.max=100*parseInt(t[4]),!1):(progressElement.value=null,!(progressElement.max=null)),statusElement.innerHTML=e)}},totalDependencies:0,monitorRunDependencies:function(e){this.totalDependencies=Math.max(this.totalDependencies,e),Module.setStatus(e?"Preparing... ("+(this.totalDependencies-e)+"/"+this.totalDependencies+")":"All downloads complete.")}};Module.setStatus("Downloading..."),window.onerror=function(){Module.setStatus("Exception thrown, see JavaScript console"),Module.setStatus=function(e){e&&Module.printErr("[post-exception status] "+e)}}</script><script async src=mpview.js></script></body></html> | ||
<!doctypehtml><html lang=en-us><head><meta charset=utf-8><meta content="text/html; charset=utf-8"http-equiv=Content-Type><style>body{margin:0;padding:0;overflow:hidden}.emscripten{padding-right:0;margin-left:auto;margin-right:auto;display:block}div.emscripten{text-align:center}canvas.emscripten{border:0 none;padding:0;background-color:#fff;width:100vw;height:100vh;max-height:100vh;display:block;overflow:hidden}</style></head><body><div class=emscripten id=status>Downloading...</div><div class=emscripten><progress hidden id=progress max=100 value=0></progress></div><canvas class=emscripten id=canvas oncontextmenu=event.preventDefault()></canvas><script>var statusElement=document.getElementById("status"),progressElement=document.getElementById("progress");function getUrlVars(){var o={};window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(e,t,n){o[t]=n});return o}var Module={preRun:[function(){window.frameElement&&window.frameElement.hasAttribute("controls")&&(console.log("show gui"),Module.arguments.push("-g"));var e=getUrlVars().model;if(!e&&window.frameElement&&window.frameElement.hasAttribute("model")&&(e=window.frameElement.getAttribute("model")),e){var t=e.split("/").pop();console.log("reading "+e),Module.arguments=[t],FS.createPreloadedFile("./",t,e,!0,!1)}}],postRun:[],print:function(e){console.log(e)},printErr:function(e){console.error(e)},canvas:function(){var e=document.getElementById("canvas");return e.addEventListener("webglcontextlost",function(e){alert("WebGL context lost. You will need to reload the page."),e.preventDefault()},!1),e}(),setStatus:function(e){if(Module.setStatus.last||(Module.setStatus.last={time:Date.now(),text:""}),e!==Module.setStatus.text){var t=e.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/),n=Date.now();t&&n-Date.now()<30||(progressElement.hidden=t?(e=t[1],progressElement.value=100*parseInt(t[2]),progressElement.max=100*parseInt(t[4]),!1):(progressElement.value=null,!(progressElement.max=null)),statusElement.innerHTML=e)}},totalDependencies:0,monitorRunDependencies:function(e){this.totalDependencies=Math.max(this.totalDependencies,e),Module.setStatus(e?"Preparing... ("+(this.totalDependencies-e)+"/"+this.totalDependencies+")":"All downloads complete.")}};Module.setStatus("Downloading..."),window.onerror=function(){Module.setStatus("Exception thrown, see JavaScript console"),Module.setStatus=function(e){e&&Module.printErr("[post-exception status] "+e)}}</script><script async src=mpview.js></script></body></html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Submodule pmp-data
updated
10 files
+ − | matcap/basic_1.jpg | |
+ − | matcap/basic_2.jpg | |
+ − | matcap/ceramic_dark.jpg | |
+ − | matcap/jade.jpg | |
+5 −0 | matcap/license.txt | |
+ − | matcap/metal_carpaint.jpg | |
+ − | matcap/metal_shiny.jpg | |
+ − | matcap/resin.jpg | |
+ − | matcap/skin.jpg | |
+ − | matcap/toon.jpg |
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
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,63 @@ | ||
//============================================================================= | ||
// Copyright (C) 2011-2018 The pmp-library developers | ||
// | ||
// This file is part of the Polygon Mesh Processing Library. | ||
// Distributed under a MIT-style license, see LICENSE.txt for details. | ||
// | ||
// SPDX-License-Identifier: MIT-with-employer-disclaimer | ||
//============================================================================= | ||
|
||
// clang-format off | ||
|
||
// mat-cap shader: assume view=(0,0,-1), then the tex-coord for | ||
// spherical environment mapping is just the normal's XY | ||
// scaled by 0.5 and shifted by 0.5. | ||
// scale by 0.49 to avoid artifacts at gracing angles | ||
static const char* matcap_vshader = | ||
#ifndef __EMSCRIPTEN__ | ||
"#version 330" | ||
#else | ||
"#version 300 es" | ||
#endif | ||
R"glsl( | ||
layout (location=0) in vec4 v_position; | ||
layout (location=1) in vec3 v_normal; | ||
out vec3 v2f_normal; | ||
uniform mat4 modelview_projection_matrix; | ||
uniform mat3 normal_matrix; | ||
|
||
void main() | ||
{ | ||
v2f_normal = normalize(normal_matrix * v_normal); | ||
gl_Position = modelview_projection_matrix * v_position; | ||
} | ||
)glsl"; | ||
|
||
|
||
static const char* matcap_fshader = | ||
#ifndef __EMSCRIPTEN__ | ||
"#version 330" | ||
#else | ||
"#version 300 es" | ||
#endif | ||
R"glsl( | ||
precision mediump float; | ||
|
||
in vec3 v2f_normal; | ||
uniform sampler2D matcap; | ||
uniform float alpha; | ||
out vec4 f_color; | ||
|
||
void main() | ||
{ | ||
vec2 uv = normalize(v2f_normal).xy * 0.49 + 0.5; | ||
vec4 rgba = texture(matcap, uv); | ||
rgba.a *= alpha; | ||
f_color = rgba; | ||
} | ||
)glsl"; | ||
|
||
|
||
//============================================================================= | ||
// clang-format on | ||
//============================================================================= |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright should be bumped to 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for new files or for changed files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be updated to current year on every change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated for all files that changed