Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FluidSimulation
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
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amanda Ghassaei
FluidSimulation
Commits
3ea3a54b
Commit
3ea3a54b
authored
8 years ago
by
amandaghassaei
Browse files
Options
Downloads
Patches
Plain Diff
small changes
parent
b5342688
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.html
+2
-2
2 additions, 2 deletions
index.html
main.js
+15
-4
15 additions, 4 deletions
main.js
with
17 additions
and
6 deletions
index.html
+
2
−
2
View file @
3ea3a54b
...
@@ -64,8 +64,8 @@
...
@@ -64,8 +64,8 @@
vec2
ceiled
=
ceil
(
pos
);
vec2
ceiled
=
ceil
(
pos
);
vec2
floored
=
floor
(
pos
);
vec2
floored
=
floor
(
pos
);
float
n
=
texture2D
(
u_material
,
(
ceiled
+
pxCenter
)
/
u_textureSize
).
x
;
;
float
n
=
texture2D
(
u_material
,
(
ceiled
+
pxCenter
)
/
u_textureSize
).
x
;
//actually ne
float
s
=
texture2D
(
u_material
,
(
floored
+
pxCenter
)
/
u_textureSize
).
x
;
float
s
=
texture2D
(
u_material
,
(
floored
+
pxCenter
)
/
u_textureSize
).
x
;
//actually sw
if
(
ceiled
.
x
!=
floored
.
x
){
if
(
ceiled
.
x
!=
floored
.
x
){
float
se
=
texture2D
(
u_material
,
(
vec2
(
ceiled
.
x
,
floored
.
y
)
+
pxCenter
)
/
u_textureSize
).
x
;
float
se
=
texture2D
(
u_material
,
(
vec2
(
ceiled
.
x
,
floored
.
y
)
+
pxCenter
)
/
u_textureSize
).
x
;
float
nw
=
texture2D
(
u_material
,
(
vec2
(
floored
.
x
,
ceiled
.
y
)
+
pxCenter
)
/
u_textureSize
).
x
;
float
nw
=
texture2D
(
u_material
,
(
vec2
(
floored
.
x
,
ceiled
.
y
)
+
pxCenter
)
/
u_textureSize
).
x
;
...
...
This diff is collapsed.
Click to expand it.
main.js
+
15
−
4
View file @
3ea3a54b
...
@@ -62,10 +62,19 @@ function render(){
...
@@ -62,10 +62,19 @@ function render(){
// gl.uniform2f(mouseCoordLocation, mouseCoordinates[0], mouseCoordinates[1]);
// gl.uniform2f(mouseCoordLocation, mouseCoordinates[0], mouseCoordinates[1]);
// } else gl.uniform1f(mouseEnableLocation, 0);
// } else gl.uniform1f(mouseEnableLocation, 0);
GPU
.
step
(
"
advect
"
,
[
"
velocity
"
,
"
material
"
],
"
advectedMaterial
"
);
// Apply the first 3 operators in Equation 12.
// u = advect(u);
// u = diffuse(u);
// u = addForces(u);
// // Now apply the projection operator to the result.
// p = computePressure(u);
// u = subtractPressureGradient(u, p);
GPU
.
step
(
"
render
"
,
[
"
advectedMaterial
"
]);
GPU
.
step
(
"
advect
"
,
[
"
velocity
"
,
"
velocity
"
],
"
advectedVelocity
"
);
//advect velocity
GPU
.
swapTextures
(
"
velocity
"
,
"
advectedVelocity
"
);
GPU
.
step
(
"
advect
"
,
[
"
velocity
"
,
"
material
"
],
"
advectedMaterial
"
);
GPU
.
step
(
"
render
"
,
[
"
advectedMaterial
"
]);
GPU
.
swapTextures
(
"
advectedMaterial
"
,
"
material
"
);
GPU
.
swapTextures
(
"
advectedMaterial
"
,
"
material
"
);
}
else
resetWindow
();
}
else
resetWindow
();
...
@@ -96,11 +105,13 @@ function resetWindow(){
...
@@ -96,11 +105,13 @@ function resetWindow(){
for
(
var
i
=
0
;
i
<
height
;
i
++
){
for
(
var
i
=
0
;
i
<
height
;
i
++
){
for
(
var
j
=
0
;
j
<
width
;
j
++
){
for
(
var
j
=
0
;
j
<
width
;
j
++
){
var
index
=
4
*
(
i
*
width
+
j
);
var
index
=
4
*
(
i
*
width
+
j
);
velocity
[
index
]
=
i
/
100
;
velocity
[
index
]
=
i
/
100
0
;
velocity
[
index
+
1
]
=
j
/
100
;
velocity
[
index
+
1
]
=
j
/
100
0
;
}
}
}
}
GPU
.
initTextureFromData
(
"
velocity
"
,
width
,
height
,
"
FLOAT
"
,
velocity
,
true
);
GPU
.
initTextureFromData
(
"
velocity
"
,
width
,
height
,
"
FLOAT
"
,
velocity
,
true
);
GPU
.
initTextureFromData
(
"
advectedVelocity
"
,
width
,
height
,
"
FLOAT
"
,
new
Float32Array
(
width
*
height
*
4
),
true
);
GPU
.
initFrameBufferForTexture
(
"
advectedVelocity
"
);
var
material
=
new
Float32Array
(
width
*
height
*
4
);
var
material
=
new
Float32Array
(
width
*
height
*
4
);
for
(
var
i
=
0
;
i
<
height
;
i
++
){
for
(
var
i
=
0
;
i
<
height
;
i
++
){
for
(
var
j
=
0
;
j
<
width
;
j
++
){
for
(
var
j
=
0
;
j
<
width
;
j
++
){
...
...
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