Move boundingsphere size in asset into the node from model projection

This commit is contained in:
Malin E
2023-03-03 14:55:06 +01:00
parent 98836e5393
commit 0d4c47f3be
4 changed files with 55 additions and 71 deletions

View File

@@ -48,10 +48,10 @@ local Vesta = {
DestinationFrame = "GALACTIC"
}
},
BoundingSphere = 262000,
Renderable = {
Type = "RenderableModelProjection",
GeometryFile = models .. "VestaComet_5000.obj",
BoundingSphereRadius = 262000,
Projection = {
Sequence = images,
SequenceType = "image-sequence",

View File

@@ -46,63 +46,62 @@ local Comet67P = {
Identifier = "67P",
Parent = Barycenter.Identifier,
Transform = {
Rotation = {
Type = "SpiceRotation",
SourceFrame = "67P/C-G_CK",
DestinationFrame = "GALACTIC"
}
Rotation = {
Type = "SpiceRotation",
SourceFrame = "67P/C-G_CK",
DestinationFrame = "GALACTIC"
}
},
BoundingSphere = 5000.0,
Renderable = {
Type = "RenderableModelProjection",
GeometryFile = models .. "67P_rotated_5_130.obj",
Projection = {
Sequence = { imagesDestination },
SequenceType = "image-sequence",
Observer = "ROSETTA",
Target = "CHURYUMOV-GERASIMENKO",
Aberration = "NONE",
TextureMap = true,
ShadowMap = true,
Type = "RenderableModelProjection",
GeometryFile = models .. "67P_rotated_5_130.obj",
Projection = {
Sequence = { imagesDestination },
SequenceType = "image-sequence",
Observer = "ROSETTA",
Target = "CHURYUMOV-GERASIMENKO",
Aberration = "NONE",
TextureMap = true,
ShadowMap = true,
DataInputTranslation = {
Instrument = {
NAVCAM = {
DetectorType = "Camera",
Spice = { "ROS_NAVCAM-A" }
}
},
Target = {
Read = {
"TARGET_NAME",
"INSTRUMENT_HOST_NAME",
"INSTRUMENT_ID",
"START_TIME",
"STOP_TIME"
},
Convert = {
CHURYUMOV = { "CHURYUMOV-GERASIMENKO" },
ROSETTA = { "ROSETTA" },
["ROSETTA-ORBITER"] = { "ROSETTA" },
CHURYUMOVGERASIMENKO11969R1 = { "CHURYUMOV-GERASIMENKO" },
CHURYUMOVGERASIMENKO = { "CHURYUMOV-GERASIMENKO" },
["CHURYUMOV-GERASIMENKO1(1969R1)"] = { "CHURYUMOV-GERASIMENKO" },
CALIBRATION = { "CALIBRATION" },
ALPHALYR = { "ALPHALYR" },
ZETACAS = { "ZETACAS" }
}
DataInputTranslation = {
Instrument = {
NAVCAM = {
DetectorType = "Camera",
Spice = { "ROS_NAVCAM-A" }
}
},
Instrument = {
Name = "ROS_NAVCAM-A",
Method = "ELLIPSOID",
Aberration = "NONE",
Fovy = 5.00,
Aspect = 1
Target = {
Read = {
"TARGET_NAME",
"INSTRUMENT_HOST_NAME",
"INSTRUMENT_ID",
"START_TIME",
"STOP_TIME"
},
Convert = {
CHURYUMOV = { "CHURYUMOV-GERASIMENKO" },
ROSETTA = { "ROSETTA" },
["ROSETTA-ORBITER"] = { "ROSETTA" },
CHURYUMOVGERASIMENKO11969R1 = { "CHURYUMOV-GERASIMENKO" },
CHURYUMOVGERASIMENKO = { "CHURYUMOV-GERASIMENKO" },
["CHURYUMOV-GERASIMENKO1(1969R1)"] = { "CHURYUMOV-GERASIMENKO" },
CALIBRATION = { "CALIBRATION" },
ALPHALYR = { "ALPHALYR" },
ZETACAS = { "ZETACAS" }
}
}
},
},
BoundingSphereRadius = 5000.0
Instrument = {
Name = "ROS_NAVCAM-A",
Method = "ELLIPSOID",
Aberration = "NONE",
Fovy = 5.00,
Aspect = 1
}
},
},
GUI = {
Name = "67P Churymov-Gerasimenko",

View File

@@ -108,12 +108,6 @@ namespace {
// [[codegen::verbatim(PerformShadingInfo.description)]]
std::optional<bool> performShading;
// The radius of the bounding sphere of this object. This has to be a
// radius that is larger than anything that is rendered by it. It has to
// be at least as big as the convex hull of the object. The default value
// is 10e9 meters.
std::optional<double> boundingSphereRadius;
};
#include "renderablemodelprojection_codegen.cpp"
} // namespace
@@ -171,12 +165,6 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
addPropertySubOwner(_projectionComponent);
_projectionComponent.initialize(identifier(), p.projection);
if (p.boundingSphereRadius.has_value()) {
_shouldOverrideBoundingSphere = true;
double boundingSphereRadius = p.boundingSphereRadius.value();
setBoundingSphere(boundingSphereRadius);
}
_performShading = p.performShading.value_or(_performShading);
addProperty(_performShading);
}
@@ -254,14 +242,12 @@ ghoul::opengl::Texture& RenderableModelProjection::baseTexture() const {
void RenderableModelProjection::render(const RenderData& data, RendererTasks&) {
// Update boundingsphere
if (!_shouldOverrideBoundingSphere) {
setBoundingSphere(_geometry->boundingRadius() * _modelScale *
glm::compMax(data.modelTransform.scale)
);
setBoundingSphere(_geometry->boundingRadius() * _modelScale *
glm::compMax(data.modelTransform.scale)
);
// Set Interaction sphere size to be 10% of the bounding sphere
setInteractionSphere(_boundingSphere * 0.1);
}
// Set Interaction sphere size to be 10% of the bounding sphere
setInteractionSphere(_boundingSphere * 0.1);
if (_projectionComponent.needsClearProjection()) {
_projectionComponent.clearAllProjections();

View File

@@ -85,7 +85,6 @@ private:
UniformCache(ProjectorMatrix, ModelTransform) _depthFboUniformCache;
std::unique_ptr<ghoul::modelgeometry::ModelGeometry> _geometry;
bool _shouldOverrideBoundingSphere = false;
double _modelScale = 1.0;
bool _invertModelScale = false;
bool _forceRenderInvisible = false;