-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b123bc7
commit 8da0e63
Showing
21 changed files
with
344 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* Copyright (c) 2015-2024 EPFL/Blue Brain Project | ||
* All rights reserved. Do not distribute without permission. | ||
* Responsible Author: adrien.fleury@epfl.ch | ||
* | ||
* This file is part of Brayns <https://github.com/BlueBrain/Brayns> | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License version 3.0 as published | ||
* by the Free Software Foundation. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this library; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#include "CameraRegionEntrypoint.h" | ||
|
||
namespace brayns | ||
{ | ||
SetCameraRegionEntrypoint::SetCameraRegionEntrypoint(Engine &engine): | ||
_engine(engine) | ||
{ | ||
} | ||
|
||
std::string SetCameraRegionEntrypoint::getMethod() const | ||
{ | ||
return "set-camera-region"; | ||
} | ||
|
||
std::string SetCameraRegionEntrypoint::getDescription() const | ||
{ | ||
return "Update the camera image region"; | ||
} | ||
|
||
void SetCameraRegionEntrypoint::onRequest(const Request &request) | ||
{ | ||
auto params = request.getParams(); | ||
auto &camera = _engine.getCamera(); | ||
camera.setImageRegion({params.image_start, params.image_end}); | ||
request.reply(EmptyJson()); | ||
} | ||
|
||
GetCameraRegionEntrypoint::GetCameraRegionEntrypoint(Engine &engine): | ||
_engine(engine) | ||
{ | ||
} | ||
|
||
std::string GetCameraRegionEntrypoint::getMethod() const | ||
{ | ||
return "get-camera-region"; | ||
} | ||
|
||
std::string GetCameraRegionEntrypoint::getDescription() const | ||
{ | ||
return "Retreive the current camera image region"; | ||
} | ||
|
||
void GetCameraRegionEntrypoint::onRequest(const Request &request) | ||
{ | ||
auto &camera = _engine.getCamera(); | ||
auto region = camera.getImageRegion(); | ||
request.reply({region.lower, region.upper}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* Copyright (c) 2015-2024 EPFL/Blue Brain Project | ||
* All rights reserved. Do not distribute without permission. | ||
* Responsible Author: adrien.fleury@epfl.ch | ||
* | ||
* This file is part of Brayns <https://github.com/BlueBrain/Brayns> | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License version 3.0 as published | ||
* by the Free Software Foundation. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this library; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <brayns/engine/core/Engine.h> | ||
#include <brayns/network/entrypoint/Entrypoint.h> | ||
#include <brayns/network/messages/CameraRegionMessage.h> | ||
|
||
namespace brayns | ||
{ | ||
class SetCameraRegionEntrypoint final : public Entrypoint<CameraRegionMessage, EmptyJson> | ||
{ | ||
public: | ||
explicit SetCameraRegionEntrypoint(Engine &engine); | ||
|
||
std::string getMethod() const override; | ||
std::string getDescription() const override; | ||
void onRequest(const Request &request) override; | ||
|
||
private: | ||
Engine &_engine; | ||
}; | ||
|
||
class GetCameraRegionEntrypoint final : public Entrypoint<EmptyJson, CameraRegionMessage> | ||
{ | ||
public: | ||
explicit GetCameraRegionEntrypoint(Engine &engine); | ||
|
||
std::string getMethod() const override; | ||
std::string getDescription() const override; | ||
void onRequest(const Request &request) override; | ||
|
||
private: | ||
Engine &_engine; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* Copyright (c) 2015-2024 EPFL/Blue Brain Project | ||
* All rights reserved. Do not distribute without permission. | ||
* | ||
* Responsible Author: adrien.fleury@epfl.ch | ||
* | ||
* This file is part of Brayns <https://github.com/BlueBrain/Brayns> | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License version 3.0 as published | ||
* by the Free Software Foundation. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this library; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <brayns/json/Json.h> | ||
|
||
namespace brayns | ||
{ | ||
struct CameraRegionMessage | ||
{ | ||
Vector2f image_start = {1, 0}; | ||
Vector2f image_end = {0, 1}; | ||
}; | ||
|
||
template<> | ||
struct JsonAdapter<CameraRegionMessage> : ObjectAdapter<CameraRegionMessage> | ||
{ | ||
static JsonObjectInfo reflect() | ||
{ | ||
auto builder = Builder("CameraRegionMessage"); | ||
builder | ||
.getset( | ||
"image_start", | ||
[](auto &object) { return object.image_start; }, | ||
[](auto &object, auto value) { object.image_start = value; }) | ||
.description("Camera image region lower bound XY normalized"); | ||
builder | ||
.getset( | ||
"image_end", | ||
[](auto &object) { return object.image_end; }, | ||
[](auto &object, auto value) { object.image_end = value; }) | ||
.description("Camera image region upper bound XY normalized"); | ||
return builder.build(); | ||
} | ||
}; | ||
} // namespace brayns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.