Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
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
Service Desk
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
mlz
BornAgain
Commits
560513f4
Commit
560513f4
authored
6 years ago
by
anikhalder
Browse files
Options
Downloads
Patches
Plain Diff
Implement separate conditions for drawing 3D axes and objects
parent
c4b15039
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GUI/ba3d/ba3d/shaders/fragment_shader.frag
+30
-19
30 additions, 19 deletions
GUI/ba3d/ba3d/shaders/fragment_shader.frag
with
30 additions
and
19 deletions
GUI/ba3d/ba3d/shaders/fragment_shader.frag
+
30
−
19
View file @
560513f4
...
@@ -2,29 +2,40 @@ uniform highp vec3 lightPos1;
...
@@ -2,29 +2,40 @@ uniform highp vec3 lightPos1;
uniform
highp
vec4
color
;
uniform
highp
vec4
color
;
uniform
highp
float
ambient
;
uniform
highp
float
ambient
;
uniform
highp
vec3
eye
;
uniform
highp
vec3
eye
;
uniform
highp
bool
axis
;
varying
highp
vec3
vo
,
nm
;
varying
highp
vec3
vo
,
nm
,
ac
;
void
main
()
{
void
main
()
{
// ambient
if
(
axis
)
highp
vec3
amb_col
=
ambient
*
color
.
rgb
;
{
// for drawing colored 3D axes
gl_FragColor
=
vec4
(
ac
,
1
.
0
);
}
else
{
// for drawing 3D objects
// diffuse
// ambient
highp
vec3
L1
=
normalize
(
lightPos1
-
vo
);
highp
vec3
amb_col
=
ambient
*
color
.
rgb
;
highp
vec3
N
=
normalize
(
nm
);
highp
float
NL_sum
=
dot
(
N
,
L1
);
highp
float
NL
=
0
.
6
*
max
(
0
.
0
,
NL_sum
);
highp
vec3
diff_col
=
NL
*
color
.
rgb
;
// specular
// diffuse
float
spec
=
0
.
0
;
highp
vec3
L1
=
normalize
(
lightPos1
-
vo
);
highp
vec3
E
=
normalize
(
eye
-
vo
);
highp
vec3
N
=
normalize
(
nm
);
highp
float
ELN1
=
pow
(
max
(
0
.
0
,
dot
(
E
,
reflect
(
-
L1
,
N
))),
20
.
0
);
highp
float
NL_sum
=
dot
(
N
,
L1
);
if
(
NL
>
0
.
0
)
highp
float
NL
=
0
.
6
*
max
(
0
.
0
,
NL_sum
);
spec
=
ELN1
;
highp
vec3
diff_col
=
NL
*
color
.
rgb
;
vec3
spec_col
=
spec
*
vec3
(
1
.
0
,
1
.
0
,
1
.
0
);
highp
vec3
tot_col
=
amb_col
+
diff_col
+
spec_col
;
// specular
highp
vec4
C
=
vec4
(
tot_col
,
color
.
a
);
float
spec
=
0
.
0
;
gl_FragColor
=
clamp
(
C
,
0
.
0
,
1
.
0
);
highp
vec3
E
=
normalize
(
eye
-
vo
);
highp
float
ELN1
=
pow
(
max
(
0
.
0
,
dot
(
E
,
reflect
(
-
L1
,
N
))),
20
.
0
);
if
(
NL
>
0
.
0
)
spec
=
ELN1
;
vec3
spec_col
=
spec
*
vec3
(
1
.
0
,
1
.
0
,
1
.
0
);
highp
vec3
tot_col
=
amb_col
+
diff_col
+
spec_col
;
highp
vec4
C
=
vec4
(
tot_col
,
color
.
a
);
gl_FragColor
=
clamp
(
C
,
0
.
0
,
1
.
0
);
}
}
}
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