mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 11:39:49 -06:00
Make it possible to create multiple render copies at once and spread them out evenly on the azimuth coordinate
This commit is contained in:
@@ -61,7 +61,7 @@ public:
|
||||
void updateTextureResolution();
|
||||
|
||||
// Copies rendered
|
||||
void addRenderCopy();
|
||||
void addRenderCopy(const glm::vec3& raePosition, int nCopies);
|
||||
void removeRenderCopy();
|
||||
|
||||
private:
|
||||
|
||||
@@ -591,14 +591,17 @@ namespace {
|
||||
/**
|
||||
* Takes an identifier to a sky browser and adds a rendered copy to it.
|
||||
* \param id Identifier
|
||||
* \param raePosition Position in radius, azimuth, elevation coordinates
|
||||
* \param nCopies Number of copies
|
||||
*/
|
||||
[[codegen::luawrap]] void addRenderCopy(std::string id) {
|
||||
[[codegen::luawrap]] void addRenderCopy(std::string id,
|
||||
int nCopies = 1, glm::vec3 raePosition = glm::vec3(2.1f, 0.f, 0.f)) {
|
||||
// Get module
|
||||
SkyBrowserModule* module = global::moduleEngine->module<SkyBrowserModule>();
|
||||
|
||||
TargetBrowserPair* pair = module->getPair(id);
|
||||
if (pair) {
|
||||
pair->browser()->addRenderCopy();
|
||||
pair->browser()->addRenderCopy(raePosition, nCopies);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -178,18 +178,24 @@ void ScreenSpaceSkyBrowser::updateTextureResolution() {
|
||||
_objectSize = glm::ivec3(_texture->dimensions());
|
||||
}
|
||||
|
||||
void ScreenSpaceSkyBrowser::addRenderCopy() {
|
||||
openspace::properties::Property::PropertyInfo info = RenderCopyInfo;
|
||||
info.identifier += _renderCopies.size();
|
||||
_renderCopies.push_back(
|
||||
std::make_unique<properties::Vec3Property>(
|
||||
info,
|
||||
glm::vec3(2.1f, 0.f, 0.f),
|
||||
glm::vec3(0.f, -glm::pi<float>(), -glm::half_pi<float>()),
|
||||
glm::vec3(10.f, glm::pi<float>(), glm::half_pi<float>())
|
||||
)
|
||||
);
|
||||
addProperty(_renderCopies.back().get());
|
||||
void ScreenSpaceSkyBrowser::addRenderCopy(const glm::vec3& raePosition, int nCopies) {
|
||||
int start = _renderCopies.size();
|
||||
for (int i = 0; i < nCopies; i++) {
|
||||
openspace::properties::Property::PropertyInfo info = RenderCopyInfo;
|
||||
float azimuth = i * glm::two_pi<float>() / nCopies;
|
||||
glm::vec3 position = raePosition + glm::vec3(0.f, azimuth, 0.f);
|
||||
std::string id = "Rendercopy" + std::to_string(start + i);
|
||||
info.identifier = id.c_str();
|
||||
_renderCopies.push_back(
|
||||
std::make_unique<properties::Vec3Property>(
|
||||
info,
|
||||
position,
|
||||
glm::vec3(0.f, -glm::pi<float>(), -glm::half_pi<float>()),
|
||||
glm::vec3(10.f, glm::pi<float>(), glm::half_pi<float>())
|
||||
)
|
||||
);
|
||||
addProperty(_renderCopies.back().get());
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSpaceSkyBrowser::removeRenderCopy() {
|
||||
|
||||
Reference in New Issue
Block a user