Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Commits
ce918e00
Verified
Commit
ce918e00
authored
3 years ago
by
Josch Morgenstern
Browse files
Options
Downloads
Patches
Plain Diff
[
#111
] change particle generation
parent
978581ca
No related branches found
No related tags found
1 merge request
!95
Resolve "Wassersimulation mit Interaktion"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/sph/src/main.cpp
+13
-6
13 additions, 6 deletions
projects/sph/src/main.cpp
with
13 additions
and
6 deletions
projects/sph/src/main.cpp
+
13
−
6
View file @
ce918e00
...
@@ -136,11 +136,18 @@ int main(int argc, const char **argv) {
...
@@ -136,11 +136,18 @@ int main(int argc, const char **argv) {
int
numberParticles
=
10000
;
int
numberParticles
=
10000
;
std
::
vector
<
Particle
>
particles
;
std
::
vector
<
Particle
>
particles
;
for
(
int
i
=
0
;
i
<
numberParticles
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numberParticles
;
i
++
)
{
float
randPos
=
(
float
)
std
::
rand
()
/
(
float
)
RAND_MAX
;
const
float
lo
=
0.4
;
glm
::
vec3
pos
=
glm
::
vec3
(
0.
f
);
const
float
hi
=
0.6
;
float
randVel
=
(
float
)
std
::
rand
()
/
(
float
)
RAND_MAX
;
const
float
vlo
=
0.4
;
glm
::
vec3
vel
=
glm
::
vec3
(
0.
f
);
const
float
vhi
=
0.6
;
float
x
=
lo
+
static_cast
<
float
>
(
rand
())
/
(
static_cast
<
float
>
(
RAND_MAX
/
(
hi
-
lo
)));
float
y
=
lo
+
static_cast
<
float
>
(
rand
())
/
(
static_cast
<
float
>
(
RAND_MAX
/
(
hi
-
lo
)));
float
z
=
lo
+
static_cast
<
float
>
(
rand
())
/
(
static_cast
<
float
>
(
RAND_MAX
/
(
hi
-
lo
)));
float
vx
=
vlo
+
static_cast
<
float
>
(
rand
())
/
(
static_cast
<
float
>
(
RAND_MAX
/
(
vhi
-
vlo
)));
float
vy
=
vlo
+
static_cast
<
float
>
(
rand
())
/
(
static_cast
<
float
>
(
RAND_MAX
/
(
vhi
-
vlo
)));
float
vz
=
vlo
+
static_cast
<
float
>
(
rand
())
/
(
static_cast
<
float
>
(
RAND_MAX
/
(
vhi
-
vlo
)));
glm
::
vec3
pos
=
glm
::
vec3
(
x
,
y
,
z
);
glm
::
vec3
vel
=
glm
::
vec3
(
vx
,
vy
,
vz
);
particles
.
push_back
(
Particle
(
pos
,
vel
));
particles
.
push_back
(
Particle
(
pos
,
vel
));
}
}
...
@@ -264,7 +271,7 @@ int main(int argc, const char **argv) {
...
@@ -264,7 +271,7 @@ int main(int argc, const char **argv) {
vkcv
::
PushConstants
pushConstantsCompute
(
sizeof
(
glm
::
vec2
));
vkcv
::
PushConstants
pushConstantsCompute
(
sizeof
(
glm
::
vec2
));
pushConstantsCompute
.
appendDrawcall
(
pushData
);
pushConstantsCompute
.
appendDrawcall
(
pushData
);
uint32_t
computeDispatchCount
[
3
]
=
{
static_cast
<
uint32_t
>
(
std
::
ceil
(
numberParticles
/
256.
f
)),
1
,
1
};
uint32_t
computeDispatchCount
[
3
]
=
{
static_cast
<
uint32_t
>
(
std
::
ceil
(
numberParticles
/
256.
f
)),
1
,
1
};
core
.
recordComputeDispatchToCmdStream
(
cmdStream
,
core
.
recordComputeDispatchToCmdStream
(
cmdStream
,
computePipeline1
,
computePipeline1
,
...
...
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