Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amanda Ghassaei
OrigamiSimulator
Commits
74ebf5de
Commit
74ebf5de
authored
May 24, 2017
by
amandaghassaei
Browse files
small changes
parent
a66ff6eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
js/dynamic/dynamicSolver.js
View file @
74ebf5de
...
@@ -158,28 +158,28 @@ function initDynamicSolver(globals){
...
@@ -158,28 +158,28 @@ function initDynamicSolver(globals){
function
render
(){
function
render
(){
var
vectorLength
=
2
;
//
var vectorLength = 2;
globals
.
gpuMath
.
setProgram
(
"
packToBytes
"
);
//
globals.gpuMath.setProgram("packToBytes");
globals
.
gpuMath
.
setUniformForProgram
(
"
packToBytes
"
,
"
u_vectorLength
"
,
vectorLength
,
"
1f
"
);
//
globals.gpuMath.setUniformForProgram("packToBytes", "u_vectorLength", vectorLength, "1f");
globals
.
gpuMath
.
setUniformForProgram
(
"
packToBytes
"
,
"
u_floatTextureDim
"
,
[
textureDimCreases
,
textureDimCreases
],
"
2f
"
);
//
globals.gpuMath.setUniformForProgram("packToBytes", "u_floatTextureDim", [textureDimCreases, textureDimCreases], "2f");
globals
.
gpuMath
.
setSize
(
textureDimCreases
*
vectorLength
,
textureDimCreases
);
//
globals.gpuMath.setSize(textureDimCreases*vectorLength, textureDimCreases);
globals
.
gpuMath
.
step
(
"
packToBytes
"
,
[
"
u_lastTheta
"
],
"
outputBytes
"
);
//
globals.gpuMath.step("packToBytes", ["u_lastTheta"], "outputBytes");
//
if
(
globals
.
gpuMath
.
readyToRead
())
{
//
if (globals.gpuMath.readyToRead()) {
var
numPixels
=
nodes
.
length
*
vectorLength
;
//
var numPixels = nodes.length*vectorLength;
var
height
=
Math
.
ceil
(
numPixels
/
(
textureDimCreases
*
vectorLength
));
//
var height = Math.ceil(numPixels/(textureDimCreases*vectorLength));
var
pixels
=
new
Uint8Array
(
height
*
textureDimCreases
*
4
*
vectorLength
);
//
var pixels = new Uint8Array(height*textureDimCreases*4*vectorLength);
globals
.
gpuMath
.
readPixels
(
0
,
0
,
textureDimCreases
*
vectorLength
,
height
,
pixels
);
//
globals.gpuMath.readPixels(0, 0, textureDimCreases * vectorLength, height, pixels);
var
parsedPixels
=
new
Float32Array
(
pixels
.
buffer
);
//
var parsedPixels = new Float32Array(pixels.buffer);
for
(
var
i
=
0
;
i
<
parsedPixels
.
length
;
i
+=
2
){
//
for (var i=0;i<parsedPixels.length;i+=2){
if
(
Math
.
abs
(
parsedPixels
[
i
])
>
Math
.
PI
)
{
//
if (Math.abs(parsedPixels[i])>Math.PI) {
console
.
log
(
parsedPixels
[
i
+
1
]);
//theta
//
console.log(parsedPixels[i+1]);//theta
}
//
}
//
}
//
}
}
else
{
//
} else {
console
.
log
(
"
here
"
);
//
console.log("here");
}
//
}
var
vectorLength
=
4
;
var
vectorLength
=
4
;
globals
.
gpuMath
.
setProgram
(
"
packToBytes
"
);
globals
.
gpuMath
.
setProgram
(
"
packToBytes
"
);
...
...
Write
Preview
Supports
Markdown
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