forked from gazebosim/gz-sim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GUI for Global Illumination (VCT / CI VCT) (gazebosim#1597)
Signed-off-by: Matias N. Goldberg <[email protected]>
- Loading branch information
1 parent
31846cc
commit e7d8f5e
Showing
15 changed files
with
3,527 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
gz_add_gui_plugin(GlobalIlluminationCiVct | ||
SOURCES CiVctCascadePrivate.cc CiVctCascadePrivate.qml GlobalIlluminationCiVct.cc GlobalIlluminationCiVct.qml GlobalIlluminationCiVct.qrc | ||
QT_HEADERS CiVctCascadePrivate.hh GlobalIlluminationCiVct.hh | ||
PRIVATE_LINK_LIBS | ||
${GZ-RENDERING_LIBRARIES} | ||
) |
206 changes: 206 additions & 0 deletions
206
src/gui/plugins/global_illumination_civct/CiVctCascadePrivate.cc
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,206 @@ | ||
/* | ||
* Copyright (C) 2022 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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. | ||
* | ||
*/ | ||
|
||
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS | ||
|
||
#include "CiVctCascadePrivate.hh" | ||
|
||
#include "GlobalIlluminationCiVct.hh" | ||
|
||
#include "gz/rendering/GlobalIlluminationCiVct.hh" | ||
|
||
using namespace gz; | ||
using namespace sim; | ||
|
||
CiVctCascadePrivate::CiVctCascadePrivate(std::mutex &_serviceMutex, | ||
GlobalIlluminationCiVct &_creator, | ||
rendering::CiVctCascadePtr _cascade) : | ||
cascade(_cascade), | ||
creator(_creator), | ||
serviceMutex(_serviceMutex) | ||
{ | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
CiVctCascadePrivate::~CiVctCascadePrivate() | ||
{ | ||
} | ||
|
||
void CiVctCascadePrivate::UpdateResolution(int _axis, uint32_t _res) | ||
{ | ||
if (!this->creator.CascadesEditable()) | ||
return; | ||
|
||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
uint32_t resolution[3]; | ||
memcpy(resolution, this->cascade->Resolution(), sizeof(resolution)); | ||
resolution[_axis] = _res; | ||
this->cascade->SetResolution(resolution); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::UpdateOctantCount(int _axis, uint32_t _count) | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
uint32_t octantCount[3]; | ||
memcpy(octantCount, this->cascade->OctantCount(), sizeof(octantCount)); | ||
octantCount[_axis] = _count; | ||
this->cascade->SetOctantCount(octantCount); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::UpdateAreaHalfSize(int _axis, float _halfSize) | ||
{ | ||
if (!this->creator.CascadesEditable()) | ||
return; | ||
|
||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
math::Vector3d areaHalfSize = this->cascade->AreaHalfSize(); | ||
areaHalfSize[(size_t)_axis] = static_cast<double>(_halfSize); | ||
this->cascade->SetAreaHalfSize(areaHalfSize); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetAreaHalfSizeX(const float _v) | ||
{ | ||
this->UpdateAreaHalfSize(0, _v); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
float CiVctCascadePrivate::AreaHalfSizeX() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return static_cast<float>(this->cascade->AreaHalfSize().X()); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetAreaHalfSizeY(const float _v) | ||
{ | ||
this->UpdateAreaHalfSize(1, _v); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
float CiVctCascadePrivate::AreaHalfSizeY() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return static_cast<float>(this->cascade->AreaHalfSize().Y()); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetAreaHalfSizeZ(const float _v) | ||
{ | ||
this->UpdateAreaHalfSize(2, _v); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
float CiVctCascadePrivate::AreaHalfSizeZ() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return static_cast<float>(this->cascade->AreaHalfSize().Z()); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetResolutionX(const uint32_t _res) | ||
{ | ||
this->UpdateResolution(0, _res); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
uint32_t CiVctCascadePrivate::ResolutionX() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return this->cascade->Resolution()[0]; | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetResolutionY(const uint32_t _res) | ||
{ | ||
this->UpdateResolution(1, _res); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
uint32_t CiVctCascadePrivate::ResolutionY() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return this->cascade->Resolution()[1]; | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetResolutionZ(const uint32_t _res) | ||
{ | ||
this->UpdateResolution(2, _res); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
uint32_t CiVctCascadePrivate::ResolutionZ() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return this->cascade->Resolution()[2]; | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetOctantCountX(const uint32_t _octantCount) | ||
{ | ||
this->UpdateOctantCount(0, _octantCount); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
uint32_t CiVctCascadePrivate::OctantCountX() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return this->cascade->OctantCount()[0]; | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetOctantCountY(const uint32_t _octantCount) | ||
{ | ||
this->UpdateOctantCount(1, _octantCount); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
uint32_t CiVctCascadePrivate::OctantCountY() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return this->cascade->OctantCount()[1]; | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetOctantCountZ(const uint32_t _octantCount) | ||
{ | ||
this->UpdateOctantCount(2, _octantCount); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
uint32_t CiVctCascadePrivate::OctantCountZ() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return this->cascade->OctantCount()[2]; | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void CiVctCascadePrivate::SetThinWallCounter(const float _thinWallCounter) | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
this->cascade->SetThinWallCounter(_thinWallCounter); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
float CiVctCascadePrivate::ThinWallCounter() const | ||
{ | ||
std::lock_guard<std::mutex> lock(this->serviceMutex); | ||
return this->cascade->ThinWallCounter(); | ||
} |
Oops, something went wrong.