Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
f28b13bf
Commit
f28b13bf
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
shader: fixed broken flat-shaded & flip-sided
parent
7ccf36a0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-gl/shader-code.ts
+0
-2
0 additions, 2 deletions
src/mol-gl/shader-code.ts
src/mol-gl/shader/chunks/assign-normal.glsl.ts
+0
-12
0 additions, 12 deletions
src/mol-gl/shader/chunks/assign-normal.glsl.ts
src/mol-gl/shader/mesh.frag.ts
+13
-2
13 additions, 2 deletions
src/mol-gl/shader/mesh.frag.ts
with
13 additions
and
16 deletions
src/mol-gl/shader-code.ts
+
0
−
2
View file @
f28b13bf
...
@@ -37,7 +37,6 @@ import assign_color_varying from './shader/chunks/assign-color-varying.glsl'
...
@@ -37,7 +37,6 @@ import assign_color_varying from './shader/chunks/assign-color-varying.glsl'
import
assign_group
from
'
./shader/chunks/assign-group.glsl
'
import
assign_group
from
'
./shader/chunks/assign-group.glsl
'
import
assign_marker_varying
from
'
./shader/chunks/assign-marker-varying.glsl
'
import
assign_marker_varying
from
'
./shader/chunks/assign-marker-varying.glsl
'
import
assign_material_color
from
'
./shader/chunks/assign-material-color.glsl
'
import
assign_material_color
from
'
./shader/chunks/assign-material-color.glsl
'
import
assign_normal
from
'
./shader/chunks/assign-normal.glsl
'
import
assign_position
from
'
./shader/chunks/assign-position.glsl
'
import
assign_position
from
'
./shader/chunks/assign-position.glsl
'
import
assign_size
from
'
./shader/chunks/assign-size.glsl
'
import
assign_size
from
'
./shader/chunks/assign-size.glsl
'
import
check_picking_alpha
from
'
./shader/chunks/check-picking-alpha.glsl
'
import
check_picking_alpha
from
'
./shader/chunks/check-picking-alpha.glsl
'
...
@@ -63,7 +62,6 @@ const ShaderChunks: { [k: string]: string } = {
...
@@ -63,7 +62,6 @@ const ShaderChunks: { [k: string]: string } = {
assign_group
,
assign_group
,
assign_marker_varying
,
assign_marker_varying
,
assign_material_color
,
assign_material_color
,
assign_normal
,
assign_position
,
assign_position
,
assign_size
,
assign_size
,
check_picking_alpha
,
check_picking_alpha
,
...
...
This diff is collapsed.
Click to expand it.
src/mol-gl/shader/chunks/assign-normal.glsl.ts
deleted
100644 → 0
+
0
−
12
View file @
7ccf36a0
export
default
`
#if defined(dFlatShaded) && defined(enabledStandardDerivatives)
vec3 fdx = dFdx(vViewPosition);
vec3 fdy = dFdy(vViewPosition);
vec3 normal = -normalize(cross(fdx, fdy));
#else
vec3 normal = -normalize(vNormal);
#ifdef dDoubleSided
normal = normal * (float(frontFacing) * 2.0 - 1.0);
#endif
#endif
`
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-gl/shader/mesh.frag.ts
+
13
−
2
View file @
f28b13bf
...
@@ -25,7 +25,11 @@ void main() {
...
@@ -25,7 +25,11 @@ void main() {
bool frontFacing = dot(vNormal, vViewPosition) < 0.0;
bool frontFacing = dot(vNormal, vViewPosition) < 0.0;
#endif
#endif
interior = !frontFacing; // TODO take dFlipSided into account
#if defined(dFlipSided)
interior = frontFacing;
#else
interior = !frontFacing;
#endif
#include assign_material_color
#include assign_material_color
...
@@ -38,7 +42,14 @@ void main() {
...
@@ -38,7 +42,14 @@ void main() {
#ifdef dIgnoreLight
#ifdef dIgnoreLight
gl_FragColor = material;
gl_FragColor = material;
#else
#else
#include assign_normal
#if defined(dFlatShaded) && defined(enabledStandardDerivatives)
vec3 normal = -faceNormal;
#else
vec3 normal = -normalize(vNormal);
#ifdef dDoubleSided
normal = normal * (float(frontFacing) * 2.0 - 1.0);
#endif
#endif
#include apply_light_color
#include apply_light_color
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment