Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
a1163dc2
Commit
a1163dc2
authored
Apr 03, 2014
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some nice variables to control mem alloc for 3D viz
parent
f3977e28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
10 deletions
+42
-10
actors.py
printrun/gl/libtatlin/actors.py
+42
-10
No files found.
printrun/gl/libtatlin/actors.py
View file @
a1163dc2
...
...
@@ -350,16 +350,45 @@ class GcodeModel(Model):
self
.
count_travel_indices
=
count_travel_indices
=
[
0
]
self
.
count_print_indices
=
count_print_indices
=
[
0
]
self
.
count_print_vertices
=
count_print_vertices
=
[
0
]
# Some trivial computations, but that's mostly for documentation :)
# Not like 10 multiplications are going to cost much time vs what's
# about to happen :)
# Max number of values which can be generated per gline
# to store coordinates/colors/normals.
# Nicely enough we have 3 per kind of thing for all kinds.
coordspervertex
=
3
verticesperline
=
4
coordsperline
=
coordspervertex
*
verticesperline
coords_count
=
lambda
nlines
:
nlines
*
coordsperline
travelverticesperline
=
2
travelcoordsperline
=
coordspervertex
*
travelverticesperline
travel_coords_count
=
lambda
nlines
:
nlines
*
travelcoordsperline
trianglesperface
=
2
facesperbox
=
4
trianglesperbox
=
trianglesperface
*
facesperbox
verticespertriangle
=
3
indicesperbox
=
verticespertriangle
*
trianglesperbox
boxperline
=
1
indicesperline
=
indicesperbox
*
boxperline
indices_count
=
lambda
nlines
:
nlines
*
indicesperline
nlines
=
len
(
model_data
)
travel_vertices
=
self
.
travels
=
numpy
.
zeros
(
nlines
*
6
,
dtype
=
GLfloat
)
ntravelcoords
=
travel_coords_count
(
nlines
)
ncoords
=
coords_count
(
nlines
)
nindices
=
indices_count
(
nlines
)
travel_vertices
=
self
.
travels
=
numpy
.
zeros
(
ntravelcoords
,
dtype
=
GLfloat
)
travel_vertex_k
=
0
vertices
=
self
.
vertices
=
numpy
.
zeros
(
n
lines
*
12
,
dtype
=
GLfloat
)
vertices
=
self
.
vertices
=
numpy
.
zeros
(
n
coords
,
dtype
=
GLfloat
)
vertex_k
=
0
colors
=
self
.
colors
=
numpy
.
zeros
(
n
lines
*
12
,
dtype
=
GLfloat
)
colors
=
self
.
colors
=
numpy
.
zeros
(
n
coords
,
dtype
=
GLfloat
)
color_k
=
0
normals
=
self
.
normals
=
numpy
.
zeros
(
n
lines
*
12
,
dtype
=
GLfloat
)
normals
=
self
.
normals
=
numpy
.
zeros
(
n
coords
,
dtype
=
GLfloat
)
normal_k
=
0
indices
=
self
.
indices
=
numpy
.
zeros
(
n
lines
*
24
,
dtype
=
GLuint
)
indices
=
self
.
indices
=
numpy
.
zeros
(
n
indices
,
dtype
=
GLuint
)
index_k
=
0
self
.
layer_idxs_map
=
{}
self
.
layer_stops
=
[
0
]
...
...
@@ -380,12 +409,15 @@ class GcodeModel(Model):
while
layer_idx
<
len
(
model_data
.
all_layers
):
with
self
.
lock
:
nlines
=
len
(
model_data
)
ntravelcoords
=
travel_coords_count
(
nlines
)
ncoords
=
coords_count
(
nlines
)
nindices
=
indices_count
(
nlines
)
if
nlines
*
12
!=
vertices
.
size
:
self
.
travels
.
resize
(
n
lines
*
6
,
refcheck
=
False
)
self
.
vertices
.
resize
(
n
lines
*
12
,
refcheck
=
False
)
self
.
colors
.
resize
(
n
lines
*
12
,
refcheck
=
False
)
self
.
normals
.
resize
(
n
lines
*
12
,
refcheck
=
False
)
self
.
indices
.
resize
(
n
lines
*
24
,
refcheck
=
False
)
self
.
travels
.
resize
(
n
travelcoords
,
refcheck
=
False
)
self
.
vertices
.
resize
(
n
coords
,
refcheck
=
False
)
self
.
colors
.
resize
(
n
coords
,
refcheck
=
False
)
self
.
normals
.
resize
(
n
coords
,
refcheck
=
False
)
self
.
indices
.
resize
(
n
indices
,
refcheck
=
False
)
layer
=
model_data
.
all_layers
[
layer_idx
]
has_movement
=
False
for
gline_idx
,
gline
in
enumerate
(
layer
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment