Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Brave 2
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Börcsök Barnabás
Brave 2
Commits
3cd39b72
Commit
3cd39b72
authored
Dec 10, 2020
by
bobarna
Browse files
Options
Downloads
Patches
Plain Diff
ready for single demo
parent
af7105ad
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/geometries/PBDSimulation.cpp
+7
-7
7 additions, 7 deletions
src/geometries/PBDSimulation.cpp
src/rendering/Scene.cpp
+2
-2
2 additions, 2 deletions
src/rendering/Scene.cpp
with
9 additions
and
9 deletions
src/geometries/PBDSimulation.cpp
+
7
−
7
View file @
3cd39b72
...
...
@@ -15,9 +15,9 @@ PBDSimulation::PBDSimulation(HeadObject *_head, size_t _nr_sims, size_t _nr_segm
// placing hair on the head
propagateHead
();
collisionTriangles
.
emplace_back
(
0.15
,
-
1
,
1
);
collisionTriangles
.
emplace_back
(
0.15
,
1
,
0
);
collisionTriangles
.
emplace_back
(
0.15
,
-
1
,
-
1
);
/*
collisionTriangles.emplace_back(0.15, -1, 1);
*/
/*
collisionTriangles.emplace_back(0.15, 1, 0);
*/
/*
collisionTriangles.emplace_back(0.15, -1, -1);
*/
}
void
PBDSimulation
::
propagateHead
()
{
...
...
@@ -69,8 +69,8 @@ void PBDSimulation::update(float dt) {
if
(
i
<
strand
.
size
()
-
1
)
solve_bending_constraint
(
strand
[
i
-
1
],
strand
[
i
+
1
],
lSeg
*
0.9f
);
if
(
i
<
strand
.
size
()
-
2
&&
i
>
1
)
solve_bending_constraint
(
strand
[
i
-
2
],
strand
[
i
+
2
],
lSeg
*
1.9f
);
solve_collision_constraint
(
strand
[
i
],
collisionTriangles
[
0
],
collisionTriangles
[
1
],
collisionTriangles
[
2
]);
/*
solve_collision_constraint(strand[i],
*/
/*
collisionTriangles[0], collisionTriangles[1], collisionTriangles[2]);
*/
}
}
}
...
...
@@ -106,8 +106,8 @@ void PBDSimulation::solve_bending_constraint(Particle *p1, Particle *p2, float d
(
length
(
p1
->
tmp_pos
-
p2
->
tmp_pos
)
-
dist
)
*
(
p1
->
tmp_pos
-
p2
->
tmp_pos
)
/
length
(
p1
->
tmp_pos
-
p2
->
tmp_pos
);
p1
->
tmp_pos
+=
0.
6
*
d_p1
;
p2
->
tmp_pos
+=
0.
6
*
d_p2
;
p1
->
tmp_pos
+=
0.
4
*
d_p1
;
p2
->
tmp_pos
+=
0.
4
*
d_p2
;
}
void
PBDSimulation
::
solve_collision_constraint
(
Particle
*
p
,
vec3
&
q1
,
vec3
&
q2
,
vec3
&
q3
)
{
...
...
This diff is collapsed.
Click to expand it.
src/rendering/Scene.cpp
+
2
−
2
View file @
3cd39b72
...
...
@@ -13,7 +13,7 @@ Scene::Scene(int w, int h) : camera(vec3(0, -.15f, .5), // Camera position (wEye
void
Scene
::
Build
()
{
size_t
nrSims
=
200
;
size_t
nrSims
=
1
;
size_t
nrSegments
=
30
;
float
lSeg
=
0.025f
;
...
...
@@ -36,7 +36,7 @@ void Scene::Build() {
auto
headObject
=
new
HeadObject
(
phongShader
,
new
ObjGeometry
(
"../data/susanne.obj"
),
headMaterial
,
headTexture
);
headObject
->
Scale
(
vec3
(
.35
,
.35
,
.35
));
objects
.
push_back
(
headObject
);
/*
objects.push_back(headObject);
*/
auto
PBDSim
=
new
PBDSimulation
(
headObject
,
nrSims
,
nrSegments
,
lSeg
);
auto
simulationObject
=
new
HairSimObject
(
headObject
,
basicShader
,
PBDSim
);
...
...
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
sign in
to comment