Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
SWE
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
SWE
Commits
66509402
Commit
66509402
authored
Oct 07, 2013
by
Sebastian Rettenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option for endless loop
parent
085f8a30
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
3 deletions
+19
-3
controller.cpp
src/opengl/controller.cpp
+7
-3
simulation.cu
src/opengl/simulation.cu
+6
-0
simulation.h
src/opengl/simulation.h
+5
-0
visualization.cpp
src/opengl/visualization.cpp
+1
-0
No files found.
src/opengl/controller.cpp
View file @
66509402
...
...
@@ -157,6 +157,10 @@ bool Controller::handleKeyPress( SDL_keysym *keysym) {
allowStep
=
paused
;
simulation
->
restart
();
break
;
case
SDLK_l
:
// Change loop
simulation
->
toogleLoop
();
break
;
case
SDLK_w
:
// Switch rendering mode
visualization
->
toggleRenderingMode
();
...
...
@@ -264,7 +268,7 @@ bool Controller::handleKeyPress( SDL_keysym *keysym) {
scenarios
[
4
]
=
new
SWE_AsagiScenario
(
ASAGI_INPUT_DIR
"tohoku_gebco_ucsb3_500m_hawaii_bath.nc"
,
ASAGI_INPUT_DIR
"tohoku_gebco_ucsb3_500m_hawaii_displ.nc"
,
(
float
)
2
8800.
,
simulationArea
);
(
float
)
1
8800.
,
simulationArea
);
visInfos
[
4
]
=
new
SWE_AsagiJapanSmallVisInfo
();
}
...
...
@@ -288,7 +292,7 @@ bool Controller::handleKeyPress( SDL_keysym *keysym) {
scenarios
[
5
]
=
new
SWE_AsagiScenario
(
ASAGI_INPUT_DIR
"chile_gebco_usgs_2000m_bath.nc"
,
ASAGI_INPUT_DIR
"chile_gebco_usgs_500m_displ.nc"
,
(
float
)
288
00.
,
simulationArea
);
(
float
)
500
00.
,
simulationArea
);
}
simulation
->
loadNewScenario
(
scenarios
[
5
]);
...
...
@@ -310,7 +314,7 @@ bool Controller::handleKeyPress( SDL_keysym *keysym) {
scenarios
[
6
]
=
new
SWE_AsagiScenario
(
ASAGI_INPUT_DIR
"chile_gebco_usgs_2000m_bath.nc"
,
ASAGI_INPUT_DIR
"chile_gebco_usgs_500m_displ.nc"
,
(
float
)
2
88
00.
,
simulationArea
);
(
float
)
2
00
00.
,
simulationArea
);
}
simulation
->
loadNewScenario
(
scenarios
[
6
]);
...
...
src/opengl/simulation.cu
View file @
66509402
...
...
@@ -74,6 +74,12 @@ void Simulation::resize(float factor)
*/
void Simulation::runCuda(struct cudaGraphicsResource **vbo_resource, struct cudaGraphicsResource **vbo_normals)
{
if (loop) {
// Restart?
if (curTime >= scenario->endSimulation())
restart();
}
// map OpenGL buffer object for writing from CUDA
float3 *dptr, *dptr2;
std::size_t num_bytes, num_bytes2;
...
...
src/opengl/simulation.h
View file @
66509402
...
...
@@ -53,6 +53,8 @@ class Simulation {
void
getScalingApproximation
(
float
&
bScale
,
float
&
bOffset
,
float
&
wScale
);
void
toogleLoop
()
{
loop
=
!
loop
;
}
private
:
// Default scenario (used when no other scenario is specified)
SWE_SplashingPoolScenario
defaultScenario
;
...
...
@@ -72,6 +74,9 @@ class Simulation {
// Is this our first simulation step?
int
isFirstStep
;
// Do endless loop?
bool
loop
;
// Compute new water surface
void
calculateWaterSurface
(
float3
*
destBuffer
);
// Compute normals of the water surface for shading
...
...
src/opengl/visualization.cpp
View file @
66509402
...
...
@@ -60,6 +60,7 @@ Visualization::Visualization(int windowWidth, int windowHeight, const char* wind
text
->
addText
(
" Space: Pause/Resume"
);
text
->
addText
(
" ->: Next frame (when paused)"
);
text
->
addText
(
" r: Restart scenario"
);
text
->
addText
(
" l: Endless loop"
);
text
->
addText
(
" +/-: Scale wave height"
);
text
->
addText
(
"Mouse:"
);
text
->
addText
(
" Left button: rotate"
);
...
...
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