Select Git revision
brunel_example.py
controller_overlay.hpp 2.55 KiB
//------------------------------------------------------------------------------
// Project Phoenix
//
// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
// Virtual Reality & Immersive Visualization Group.
//------------------------------------------------------------------------------
// License
//
// Licensed under the 3-Clause BSD License (the "License");
// you may not use this file except in compliance with the License.
// See the file LICENSE for the full text.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//------------------------------------------------------------------------------
#ifndef OPTICAL_BENCH_CONTROLLER_OVERLAY_HPP_
#define OPTICAL_BENCH_CONTROLLER_OVERLAY_HPP_
#include <functional>
#include <string>
#include <vector>
#include "phx/core/component.hpp"
#include "phx/core/entity.hpp"
#include "phx/core/scene.hpp"
#include "phx/resources/resource_pointer.hpp"
#include "phx/resources/types/image.hpp"
#include "phx/suppress_warnings.hpp"
namespace phx {
class ControllerOverlay : public Component {
public:
enum GripMode {
EMPTY = 0,
ROTATION = 1,
TRANSLATION = 2,
RESET = 3,
SELECT = 4
};
enum TriggerMode { NORMAL = 0, GRAB = 1, GRABBED = 2 };
explicit ControllerOverlay(phx::Entity* entity, phx::Scene* scene);
virtual ~ControllerOverlay() = default;
std::string ToString() const override;
void SetGripMode(GripMode m);
void SetTrackpadRotate(bool activate);
void SetTrackpadAngle(float angle);
void SetTriggerMode(TriggerMode m);
private:
phx::Entity* grip_left_;
phx::Entity* grip_right_;
phx::Entity* grip_trigger_;
phx::Entity* grip_trackpad_;
GripMode current_grip_mode_ = GripMode::RESET;
TriggerMode current_trigger_mode_ = TriggerMode::NORMAL;
bool current_grip_select_ = false;
bool current_trackpad_rotate_ = false;
float current_angle_ = 0.0f;
std::vector<phx::ResourcePointer<phx::Image>> grip_images_;
std::vector<phx::ResourcePointer<phx::Image>> trigger_images_;
std::vector<phx::ResourcePointer<phx::Image>> trackpad_images_;
void setEntityImage(phx::Entity* e, phx::ResourcePointer<phx::Image> i);
};
} // namespace phx
#endif // OPTICAL_BENCH_CONTROLLER_OVERLAY_HPP_