Skip to content

Commit

Permalink
Moved targetDistance into Experiment.h for now
Browse files Browse the repository at this point in the history
  • Loading branch information
bboudaoud-nv committed Jul 3, 2019
1 parent a5e073a commit 902c3ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion target/source/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ shared_ptr<JumpingEntity> App::spawnJumpingTarget(
const Vector2& distanceRange,
const Vector2& jumpSpeedRange,
const Vector2& gravityRange,
Point3 orbitCenter)
Point3 orbitCenter,
float targetDistance)
{
const int scaleIndex = clamp(iRound(log(scale) / log(1.0f + TARGET_MODEL_ARRAY_SCALING) + TARGET_MODEL_ARRAY_OFFSET), 0, m_targetModelArray.length() - 1);

Expand Down
5 changes: 2 additions & 3 deletions target/source/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ class App : public GApp {
shared_ptr<Experiment> ex; ///< Pointer to the experiment
shared_ptr<Logger> logger; ///< Pointer to the logger

const float targetDistance = 1.0f; ///< Actual distance to target

/** Call to change the reticle. */
void setReticle(int r);

Expand Down Expand Up @@ -182,7 +180,8 @@ class App : public GApp {
const Vector2& distanceRange,
const Vector2& jumpSpeedRange,
const Vector2& gravityRange,
Point3 orbitCenter
Point3 orbitCenter,
float targetDistance
);


Expand Down
9 changes: 5 additions & 4 deletions target/source/Experiment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void Experiment::initTargetAnimation() {

if (String(m_psych.getParam().str["jumpEnabled"].c_str()) == "true") {
m_app->spawnJumpingTarget(
f.pointToWorldSpace(Point3(0, 0, -m_app->targetDistance)),
f.pointToWorldSpace(Point3(0, 0, -m_targetDistance)),
visualSize,
m_targetColor,
{ m_psych.getParam().val["minSpeed"], m_psych.getParam().val["maxSpeed"] },
Expand All @@ -174,12 +174,13 @@ void Experiment::initTargetAnimation() {
{ m_psych.getParam().val["minDistance"], m_psych.getParam().val["maxDistance"] },
{ m_psych.getParam().val["minJumpSpeed"], m_psych.getParam().val["maxJumpSpeed"] },
{ m_psych.getParam().val["minGravity"], m_psych.getParam().val["maxGravity"] },
initialSpawnPos
initialSpawnPos,
m_targetDistance
);
}
else {
m_app->spawnFlyingTarget(
f.pointToWorldSpace(Point3(0, 0, -m_app->targetDistance)),
f.pointToWorldSpace(Point3(0, 0, -m_targetDistance)),
visualSize,
m_targetColor,
{ m_psych.getParam().val["minSpeed"], m_psych.getParam().val["maxSpeed"] },
Expand All @@ -192,7 +193,7 @@ void Experiment::initTargetAnimation() {
// Make sure we reset the target color here (avoid color bugs)
m_targetColor = Color3::red().pow(2.0f);
m_app->spawnFlyingTarget(
f.pointToWorldSpace(Point3(0, 0, -m_app->targetDistance)),
f.pointToWorldSpace(Point3(0, 0, -m_targetDistance)),
visualSize,
m_targetColor,
{ 0.0f, 0.0f },
Expand Down
1 change: 1 addition & 0 deletions target/source/Experiment.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class Experiment : public ReferenceCountedObject {
const float m_userSpawnDistance = 0.0f; ///< Where the user is spawned (in the axis of the target)

// Target parameters
const float m_targetDistance = 1.0f; ///< Actual distance to target
Color3 m_targetColor = Color3::red(); ///< Target color

// Reported data storage
Expand Down

0 comments on commit 902c3ac

Please sign in to comment.