Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OrigamiSimulator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
7d54496e
Commit
7d54496e
authored
Sep 06, 2017
by
Amanda Ghassaei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memory fixes
parent
1b583022
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
14 deletions
+32
-14
.gitignore
.gitignore
+1
-0
js/dynamic/GPUMath.js
js/dynamic/GPUMath.js
+16
-8
js/dynamic/dynamicSolver.js
js/dynamic/dynamicSolver.js
+1
-1
js/model.js
js/model.js
+11
-4
js/threeView.js
js/threeView.js
+3
-1
No files found.
.gitignore
View file @
7d54496e
assets/attrib.txt
.idea/
todo.rtf
\ No newline at end of file
js/dynamic/GPUMath.js
View file @
7d54496e
...
...
@@ -39,9 +39,10 @@ function initGPUMath(){
GPUMath
.
prototype
.
createProgram
=
function
(
programName
,
vertexShader
,
fragmentShader
){
var
programs
=
this
.
programs
;
var
program
=
programs
[
n
ame
];
var
program
=
programs
[
programN
ame
];
if
(
program
)
{
console
.
warn
(
"
already a program with the name
"
+
programName
);
gl
.
useProgram
(
program
.
program
);
// console.warn("already a program with the name " + programName);
return
;
}
program
=
glBoilerplate
.
createProgramFromSource
(
gl
,
vertexShader
,
fragmentShader
);
...
...
@@ -55,9 +56,13 @@ function initGPUMath(){
GPUMath
.
prototype
.
initTextureFromData
=
function
(
name
,
width
,
height
,
typeName
,
data
,
shouldReplace
){
var
texture
=
this
.
textures
[
name
];
if
(
!
shouldReplace
&&
texture
)
{
console
.
warn
(
"
already a texture with the name
"
+
name
);
return
;
if
(
texture
){
if
(
!
shouldReplace
)
{
console
.
warn
(
"
already a texture with the name
"
+
name
);
return
;
}
gl
.
deleteTexture
(
texture
);
}
texture
=
glBoilerplate
.
makeTexture
(
gl
,
width
,
height
,
gl
[
typeName
],
data
);
this
.
textures
[
name
]
=
texture
;
...
...
@@ -67,9 +72,12 @@ function initGPUMath(){
GPUMath
.
prototype
.
initFrameBufferForTexture
=
function
(
textureName
,
shouldReplace
){
var
framebuffer
=
this
.
frameBuffers
[
textureName
];
if
(
framebuffer
&&
(
shouldReplace
===
undefined
||
!
shouldReplace
))
{
console
.
warn
(
"
framebuffer already exists for texture
"
+
textureName
);
return
;
if
(
framebuffer
){
if
(
!
shouldReplace
)
{
console
.
warn
(
"
framebuffer already exists for texture
"
+
textureName
);
return
;
}
gl
.
deleteFramebuffer
(
framebuffer
);
}
var
texture
=
this
.
textures
[
textureName
];
if
(
!
texture
){
...
...
js/dynamic/dynamicSolver.js
View file @
7d54496e
...
...
@@ -121,7 +121,7 @@ function initDynamicSolver(globals){
globals
.
shouldCenterGeo
=
false
;
}
if
(
_numSteps
==
undefined
)
_numSteps
=
globals
.
numSteps
;
if
(
_numSteps
==
=
undefined
)
_numSteps
=
globals
.
numSteps
;
for
(
var
j
=
0
;
j
<
_numSteps
;
j
++
){
solveStep
();
}
...
...
js/model.js
View file @
7d54496e
...
...
@@ -32,16 +32,23 @@ function initModel(globals){
setMeshMaterial
();
function
clearGeometries
(){
if
(
geometry
)
geometry
.
dispose
();
geometry
=
new
THREE
.
BufferGeometry
();
if
(
geometry
)
{
// geometry.dispose();
}
else
geometry
=
new
THREE
.
BufferGeometry
();
geometry
.
verticesNeedUpdate
=
true
;
geometry
.
dynamic
=
true
;
frontside
.
geometry
=
geometry
;
backside
.
geometry
=
geometry
;
_
.
each
(
lines
,
function
(
line
){
if
(
line
.
geometry
)
line
.
geometry
.
dispose
();
var
lineGeometry
=
new
THREE
.
BufferGeometry
();
var
lineGeometry
=
line
.
geometry
;
if
(
lineGeometry
)
{
// line.geometry.dispose();
}
else
lineGeometry
=
new
THREE
.
BufferGeometry
();
lineGeometry
.
verticesNeedUpdate
=
true
;
lineGeometry
.
dynamic
=
true
;
line
.
geometry
=
lineGeometry
;
});
...
...
js/threeView.js
View file @
7d54496e
...
...
@@ -141,7 +141,9 @@ function initThreeView(globals) {
}
function
sceneClearModel
(){
modelWrapper
.
children
=
[];
for
(
var
i
=
0
;
i
<
modelWrapper
.
children
.
length
;
i
++
){
modelWrapper
.
remove
(
modelWrapper
.
children
[
i
]);
}
}
function
onWindowResize
()
{
...
...
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