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
c3bbcaba
Commit
c3bbcaba
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
moved ply to shape converter to mol-model-formats
parent
67b3aac2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-model-formats/shape/ply.ts
+12
-16
12 additions, 16 deletions
src/mol-model-formats/shape/ply.ts
src/mol-plugin/state/transforms/model.ts
+1
-1
1 addition, 1 deletion
src/mol-plugin/state/transforms/model.ts
with
13 additions
and
17 deletions
src/mol-model
/shape/
forma
r
ts/
ply/plyData_to_
shape.ts
→
src/mol-model
-
formats/shape
/ply
.ts
+
12
−
16
View file @
c3bbcaba
...
@@ -5,16 +5,16 @@
...
@@ -5,16 +5,16 @@
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
*/
import
{
ply_form
,
PlyFile
}
from
'
../../../../mol-io/reader/ply/parse_data/data-model
'
;
import
{
RuntimeContext
,
Task
}
from
'
mol-task
'
;
import
{
RuntimeContext
,
Task
}
from
'
mol-task
'
;
import
{
Mesh
}
from
'
../../../../mol-geo/geometry/mesh/mesh
'
;
import
{
MeshBuilder
}
from
'
../../../../mol-geo/geometry/mesh/mesh-builder
'
;
import
{
addTriangle
}
from
'
mol-geo/geometry/mesh/builder/triangle
'
;
import
{
addTriangle
}
from
'
mol-geo/geometry/mesh/builder/triangle
'
;
import
{
Shape
}
from
'
../../shape
'
;
import
{
Color
}
from
'
../../../../mol-util/color
'
;
import
{
ShapeProvider
}
from
'
mol-model/shape/provider
'
;
import
{
ShapeProvider
}
from
'
mol-model/shape/provider
'
;
import
{
Color
}
from
'
mol-util/color
'
;
import
{
ply_form
,
PlyFile
}
from
'
mol-io/reader/ply/parse_data/data-model
'
;
import
{
MeshBuilder
}
from
'
mol-geo/geometry/mesh/mesh-builder
'
;
import
{
Mesh
}
from
'
mol-geo/geometry/mesh/mesh
'
;
import
{
Shape
}
from
'
mol-model/shape
'
;
export
interface
My
Data
{
interface
PlyShape
Data
{
centers
:
number
[],
centers
:
number
[],
normals
:
number
[],
normals
:
number
[],
faces
:
number
[],
faces
:
number
[],
...
@@ -22,11 +22,11 @@ export interface MyData {
...
@@ -22,11 +22,11 @@ export interface MyData {
labels
:
string
[],
labels
:
string
[],
}
}
function
collectData_for_Shape
(
parsedData
:
ply_form
):
My
Data
{
function
collectData_for_Shape
(
parsedData
:
ply_form
):
PlyShape
Data
{
// parsedData.data.PLY_File. to access So.format.Ply
// parsedData.data.PLY_File. to access So.format.Ply
console
.
log
(
'
parsedData
'
,
parsedData
)
console
.
log
(
'
parsedData
'
,
parsedData
)
const
{
vertices
,
colors
,
faces
,
normals
}
=
parsedData
const
{
vertices
,
colors
,
faces
,
normals
}
=
parsedData
const
data
:
My
Data
=
{
const
data
:
PlyShape
Data
=
{
centers
:
vertices
,
centers
:
vertices
,
normals
:
normals
,
normals
:
normals
,
faces
:
faces
,
faces
:
faces
,
...
@@ -44,7 +44,7 @@ function collectData_for_Shape(parsedData: ply_form): MyData {
...
@@ -44,7 +44,7 @@ function collectData_for_Shape(parsedData: ply_form): MyData {
return
data
;
return
data
;
}
}
async
function
get
Sphere
Mesh
(
ctx
:
RuntimeContext
,
centers
:
number
[],
normals
:
number
[],
faces
:
number
[],
mesh
?:
Mesh
)
{
async
function
get
Ply
Mesh
(
ctx
:
RuntimeContext
,
centers
:
number
[],
normals
:
number
[],
faces
:
number
[],
mesh
?:
Mesh
)
{
const
builderState
=
MeshBuilder
.
createState
(
faces
.
length
,
faces
.
length
,
mesh
)
const
builderState
=
MeshBuilder
.
createState
(
faces
.
length
,
faces
.
length
,
mesh
)
builderState
.
currentGroup
=
0
builderState
.
currentGroup
=
0
for
(
let
i
=
0
,
il
=
faces
.
length
/
4
;
i
<
il
;
++
i
)
{
for
(
let
i
=
0
,
il
=
faces
.
length
/
4
;
i
<
il
;
++
i
)
{
...
@@ -65,19 +65,15 @@ async function getSphereMesh(ctx: RuntimeContext, centers: number[], normals: nu
...
@@ -65,19 +65,15 @@ async function getSphereMesh(ctx: RuntimeContext, centers: number[], normals: nu
addTriangle
(
builderState
,
triangle_vertices
,
triangle_normals
,
triangle_indices
)
addTriangle
(
builderState
,
triangle_vertices
,
triangle_normals
,
triangle_indices
)
}
}
let
a
=
MeshBuilder
.
getMesh
(
builderState
);
let
a
=
MeshBuilder
.
getMesh
(
builderState
);
// a.normalsComputed = false
// Mesh.computeNormalsImmediate(a)
console
.
log
(
a
);
console
.
log
(
a
);
return
a
return
a
}
}
async
function
getShape
(
ctx
:
RuntimeContext
,
parsedData
:
ply_form
,
props
:
{},
shape
?:
Shape
<
Mesh
>
)
{
export
async
function
getShape
(
ctx
:
RuntimeContext
,
parsedData
:
ply_form
,
props
:
{},
shape
?:
Shape
<
Mesh
>
)
{
const
data
=
collectData_for_Shape
(
parsedData
)
const
data
=
collectData_for_Shape
(
parsedData
)
await
ctx
.
update
(
'
async creation of shape from myData
'
)
await
ctx
.
update
(
'
async creation of shape from myData
'
)
const
{
centers
,
normals
,
faces
,
colors
,
labels
}
=
data
const
{
centers
,
normals
,
faces
,
colors
,
labels
}
=
data
const
mesh
=
await
get
Sphere
Mesh
(
ctx
,
centers
,
normals
,
faces
,
shape
&&
shape
.
geometry
)
const
mesh
=
await
get
Ply
Mesh
(
ctx
,
centers
,
normals
,
faces
,
shape
&&
shape
.
geometry
)
const
groupCount
=
centers
.
length
/
3
const
groupCount
=
centers
.
length
/
3
return
shape
||
Shape
.
create
(
return
shape
||
Shape
.
create
(
'
test
'
,
mesh
,
'
test
'
,
mesh
,
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin/state/transforms/model.ts
+
1
−
1
View file @
c3bbcaba
...
@@ -19,12 +19,12 @@ import { StateObject, StateTransformer } from 'mol-state';
...
@@ -19,12 +19,12 @@ import { StateObject, StateTransformer } from 'mol-state';
import
{
RuntimeContext
,
Task
}
from
'
mol-task
'
;
import
{
RuntimeContext
,
Task
}
from
'
mol-task
'
;
import
{
ParamDefinition
as
PD
}
from
'
mol-util/param-definition
'
;
import
{
ParamDefinition
as
PD
}
from
'
mol-util/param-definition
'
;
import
{
stringToWords
}
from
'
mol-util/string
'
;
import
{
stringToWords
}
from
'
mol-util/string
'
;
import
{
shapeFromPly
}
from
'
mol-model/shape/formarts/ply/plyData_to_shape
'
;
import
{
PluginStateObject
as
SO
,
PluginStateTransform
}
from
'
../objects
'
;
import
{
PluginStateObject
as
SO
,
PluginStateTransform
}
from
'
../objects
'
;
import
{
trajectoryFromGRO
}
from
'
mol-model-formats/structure/gro
'
;
import
{
trajectoryFromGRO
}
from
'
mol-model-formats/structure/gro
'
;
import
{
parseGRO
}
from
'
mol-io/reader/gro/parser
'
;
import
{
parseGRO
}
from
'
mol-io/reader/gro/parser
'
;
import
{
parseMolScript
}
from
'
mol-script/language/parser
'
;
import
{
parseMolScript
}
from
'
mol-script/language/parser
'
;
import
{
transpileMolScript
}
from
'
mol-script/script/mol-script/symbols
'
;
import
{
transpileMolScript
}
from
'
mol-script/script/mol-script/symbols
'
;
import
{
shapeFromPly
}
from
'
mol-model-formats/shape/ply
'
;
export
{
TrajectoryFromBlob
};
export
{
TrajectoryFromBlob
};
export
{
TrajectoryFromMmCif
};
export
{
TrajectoryFromMmCif
};
...
...
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