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
0e18eda5
Commit
0e18eda5
authored
7 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
wip, color & lighting tweaks
parent
2d21bd7c
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-geo/representation/structure/spacefill.ts
+1
-1
1 addition, 1 deletion
src/mol-geo/representation/structure/spacefill.ts
src/mol-gl/renderable/mesh.ts
+5
-5
5 additions, 5 deletions
src/mol-gl/renderable/mesh.ts
src/mol-gl/shader/mesh.frag
+4
-3
4 additions, 3 deletions
src/mol-gl/shader/mesh.frag
with
10 additions
and
9 deletions
src/mol-geo/representation/structure/spacefill.ts
+
1
−
1
View file @
0e18eda5
...
@@ -70,7 +70,7 @@ export default function Spacefill(): UnitsRepresentation<SpacefillProps> {
...
@@ -70,7 +70,7 @@ export default function Spacefill(): UnitsRepresentation<SpacefillProps> {
const
spheres
=
createRenderObject
(
'
mesh
'
,
{
const
spheres
=
createRenderObject
(
'
mesh
'
,
{
position
:
mesh
.
vertexBuffer
,
position
:
mesh
.
vertexBuffer
,
normal
:
mesh
.
normalBuffer
,
normal
:
mesh
.
normalBuffer
,
color
:
{
'
@
type
'
:
'
attribute
'
,
value
:
(
mesh
as
any
).
colorBuffer
},
color
:
{
type
:
'
attribute
'
,
value
:
(
mesh
as
any
).
colorBuffer
},
transform
:
ValueCell
.
create
(
transformArray
),
transform
:
ValueCell
.
create
(
transformArray
),
elements
:
mesh
.
indexBuffer
,
elements
:
mesh
.
indexBuffer
,
...
...
This diff is collapsed.
Click to expand it.
src/mol-gl/renderable/mesh.ts
+
5
−
5
View file @
0e18eda5
...
@@ -17,9 +17,9 @@ type Mesh = 'mesh'
...
@@ -17,9 +17,9 @@ type Mesh = 'mesh'
type
Uniforms
=
{
[
k
:
string
]:
REGL
.
Uniform
|
REGL
.
Texture
}
type
Uniforms
=
{
[
k
:
string
]:
REGL
.
Uniform
|
REGL
.
Texture
}
type
AttributeColor
=
{
'
@
type
'
:
'
attribute
'
,
value
:
ValueCell
<
Float32Array
>
}
type
AttributeColor
=
{
type
:
'
attribute
'
,
value
:
ValueCell
<
Float32Array
>
}
type
InstanceColor
=
{
'
@
type
'
:
'
instance
'
,
value
:
ValueCell
<
ColorTexture
>
}
type
InstanceColor
=
{
type
:
'
instance
'
,
value
:
ValueCell
<
ColorTexture
>
}
type
ElementColor
=
{
'
@
type
'
:
'
element
'
,
value
:
ValueCell
<
ColorTexture
>
}
type
ElementColor
=
{
type
:
'
element
'
,
value
:
ValueCell
<
ColorTexture
>
}
type
Color
=
AttributeColor
|
InstanceColor
|
ElementColor
type
Color
=
AttributeColor
|
InstanceColor
|
ElementColor
namespace
Mesh
{
namespace
Mesh
{
...
@@ -42,7 +42,7 @@ namespace Mesh {
...
@@ -42,7 +42,7 @@ namespace Mesh {
instanceCount
:
data
.
instanceCount
,
instanceCount
:
data
.
instanceCount
,
...
_uniforms
...
_uniforms
}
}
if
(
data
.
color
[
'
@
type
'
]
===
'
instance
'
||
data
.
color
[
'
@
type
'
]
===
'
element
'
)
{
if
(
data
.
color
.
type
===
'
instance
'
||
data
.
color
.
type
===
'
element
'
)
{
Object
.
assign
(
uniforms
,
createColorUniforms
(
regl
,
data
.
color
.
value
as
ValueCell
<
ColorTexture
>
))
Object
.
assign
(
uniforms
,
createColorUniforms
(
regl
,
data
.
color
.
value
as
ValueCell
<
ColorTexture
>
))
}
}
const
attributes
=
getBuffers
({
const
attributes
=
getBuffers
({
...
@@ -51,7 +51,7 @@ namespace Mesh {
...
@@ -51,7 +51,7 @@ namespace Mesh {
normal
:
Attribute
.
create
(
regl
,
data
.
normal
,
data
.
positionCount
,
{
size
:
3
}),
normal
:
Attribute
.
create
(
regl
,
data
.
normal
,
data
.
positionCount
,
{
size
:
3
}),
...
createTransformAttributes
(
regl
,
data
.
transform
,
data
.
instanceCount
)
...
createTransformAttributes
(
regl
,
data
.
transform
,
data
.
instanceCount
)
})
})
if
(
data
.
color
[
'
@
type
'
]
===
'
attribute
'
)
{
if
(
data
.
color
.
type
===
'
attribute
'
)
{
attributes
.
color
=
Attribute
.
create
(
regl
,
data
.
color
.
value
as
ValueCell
<
Float32Array
>
,
data
.
positionCount
,
{
size
:
3
}).
buffer
attributes
.
color
=
Attribute
.
create
(
regl
,
data
.
color
.
value
as
ValueCell
<
Float32Array
>
,
data
.
positionCount
,
{
size
:
3
}).
buffer
}
}
const
command
=
regl
({
const
command
=
regl
({
...
...
This diff is collapsed.
Click to expand it.
src/mol-gl/shader/mesh.frag
+
4
−
3
View file @
0e18eda5
...
@@ -45,17 +45,18 @@ float orenNayarDiffuse(vec3 lightDirection, vec3 viewDirection, vec3 surfaceNorm
...
@@ -45,17 +45,18 @@ float orenNayarDiffuse(vec3 lightDirection, vec3 viewDirection, vec3 surfaceNorm
#pragma glslify: attenuation = require(./attenuation.glsl)
#pragma glslify: attenuation = require(./attenuation.glsl)
const
float
specularScale
=
0
.
65
;
const
float
specularScale
=
0
.
65
;
const
float
shininess
=
1
0
.
0
;
const
float
shininess
=
3
0
.
0
;
const
float
roughness
=
5
.
0
;
const
float
roughness
=
5
.
0
;
const
float
albedo
=
0
.
95
;
const
float
albedo
=
0
.
95
;
void
main
()
{
void
main
()
{
// determine surface to light direction
// determine surface to light direction
vec4
lightPosition
=
view
*
vec4
(
light
.
position
,
1
.
0
);
// vec4 lightPosition = view * vec4(light.position, 1.0);
vec4
lightPosition
=
vec4
(
vec3
(
0
.
0
,
0
.
0
,
-
10000
.
0
),
1
.
0
);
vec3
lightVector
=
lightPosition
.
xyz
-
vViewPosition
;
vec3
lightVector
=
lightPosition
.
xyz
-
vViewPosition
;
// calculate attenuation
// calculate attenuation
float
lightDistance
=
length
(
lightVector
);
//
float lightDistance = length(lightVector);
float
falloff
=
1
.
0
;
// attenuation(light.radius, light.falloff, lightDistance);
float
falloff
=
1
.
0
;
// attenuation(light.radius, light.falloff, lightDistance);
vec3
L
=
normalize
(
lightVector
);
// light direction
vec3
L
=
normalize
(
lightVector
);
// light direction
...
...
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