mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 12:59:07 -06:00
Merge branch 'feature/osirisrex' of github.com:OpenSpace/OpenSpace into feature/osirisrex
This commit is contained in:
@@ -13,8 +13,8 @@ return {
|
||||
Body = BENNU_BODY,
|
||||
Geometry = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "models/BennuUntextured.obj",
|
||||
Magnification = 3.3,
|
||||
GeometryFile = "models/BennuResized.obj",
|
||||
Magnification = 0,
|
||||
},
|
||||
Shading = {
|
||||
PerformShading = true,
|
||||
|
||||
@@ -106,8 +106,15 @@ void ModelGeometry::changeRenderMode(const GLenum mode) {
|
||||
|
||||
bool ModelGeometry::initialize(Renderable* parent) {
|
||||
_parent = parent;
|
||||
PowerScaledScalar ps = PowerScaledScalar(1.0, 0.0); // will set proper bounding soon.
|
||||
_parent->setBoundingSphere(ps);
|
||||
float maximumDistanceSquared = 0;
|
||||
for (auto v: _vertices)
|
||||
{
|
||||
maximumDistanceSquared = glm::max(
|
||||
glm::pow(v.location[0], 2) +
|
||||
glm::pow(v.location[1], 2) +
|
||||
glm::pow(v.location[2], 2), maximumDistanceSquared);
|
||||
}
|
||||
_parent->setBoundingSphere(PowerScaledScalar(glm::sqrt(maximumDistanceSquared), 0.0));
|
||||
|
||||
if (_vertices.empty())
|
||||
return false;
|
||||
|
||||
@@ -105,7 +105,7 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
|
||||
openspace::SpiceManager::ref().addFrame(_target, _source);
|
||||
|
||||
setBoundingSphere(pss(1.f, 9.f));
|
||||
//setBoundingSphere(pss(1.f, 9.f));
|
||||
addProperty(_performShading);
|
||||
|
||||
if (dictionary.hasKeyAndValue<bool>(keyFading)) {
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace openspace {
|
||||
|
||||
RenderablePath::RenderablePath(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _lineFade("lineFade", "Line Fade", 0.75f, 0.f, 5.f)
|
||||
, _lineFade("lineFade", "Line Fade", 0.75f, 0.f, 1.f)
|
||||
, _lineWidth("lineWidth", "Line Width", 2.f, 1.f, 20.f)
|
||||
, _drawLine("drawline", "Draw Line", false)
|
||||
, _programObject(nullptr)
|
||||
@@ -161,6 +161,8 @@ void RenderablePath::render(const RenderData& data) {
|
||||
_programObject->setUniform("projectionTransform", data.camera.projectionMatrix());
|
||||
_programObject->setUniform("pointSteps", _pointSteps);
|
||||
_programObject->setUniform("color", _lineColor);
|
||||
_programObject->setUniform("lineFade", _lineFade);
|
||||
_programObject->setUniform("numVertices", nPointsToDraw);
|
||||
|
||||
if (_drawLine) {
|
||||
glLineWidth(_lineWidth);
|
||||
|
||||
@@ -67,7 +67,7 @@ Fragment getFragment() {
|
||||
float specularPower = 100;
|
||||
|
||||
vec3 ambientColor = ambientIntensity * lightColorAmbient * diffuseAlbedo;
|
||||
vec3 diffuseColor = specularIntensity * lightColor * diffuseAlbedo * max(diffuseCosineFactor, 0);
|
||||
vec3 diffuseColor = diffuseIntensity * lightColor * diffuseAlbedo * max(diffuseCosineFactor, 0);
|
||||
vec3 specularColor = specularIntensity * lightColor * specularAlbedo * pow(max(specularCosineFactor, 0), specularPower);
|
||||
|
||||
color = ambientColor + diffuseColor + specularColor;
|
||||
|
||||
@@ -30,6 +30,8 @@ uniform vec3 color;
|
||||
uniform mat4 modelViewTransform;
|
||||
uniform mat4 projectionTransform;
|
||||
uniform int pointSteps;
|
||||
uniform float lineFade;
|
||||
uniform int numVertices;
|
||||
|
||||
out vec4 vs_positionScreenSpace;
|
||||
out vec4 vs_pointColor;
|
||||
@@ -41,16 +43,20 @@ void main() {
|
||||
vs_positionScreenSpace = z_normalization(positionClipSpace);
|
||||
|
||||
gl_Position = vs_positionScreenSpace;
|
||||
|
||||
int id = gl_VertexID;
|
||||
|
||||
if(mod(id, pointSteps) == 0) {
|
||||
|
||||
if(mod(gl_VertexID, pointSteps) == 0) {
|
||||
vs_pointColor.rgb = color;
|
||||
vs_pointColor.a = 1.f;
|
||||
gl_PointSize = 10.0f;
|
||||
}
|
||||
else {
|
||||
vs_pointColor = vec4(0.6f, 0.6f, 0.6f, 0.8f);
|
||||
vs_pointColor.rgb = (color + vec3(0.6f, 0.6f, 0.6f)) / 2;
|
||||
gl_PointSize = 5.f;
|
||||
}
|
||||
if (lineFade == 0)
|
||||
vs_pointColor.a = 1.0;
|
||||
else
|
||||
{
|
||||
int threshHold = int(lineFade * numVertices);
|
||||
vs_pointColor.a = float(gl_VertexID - threshHold) / (numVertices - threshHold);
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ Fragment getFragment() {
|
||||
float specularPower = 100;
|
||||
|
||||
vec3 ambientColor = ambientIntensity * lightColorAmbient * diffuseAlbedo;
|
||||
vec3 diffuseColor = specularIntensity * lightColor * diffuseAlbedo * max(diffuseCosineFactor, 0);
|
||||
vec3 diffuseColor = diffuseIntensity * lightColor * diffuseAlbedo * max(diffuseCosineFactor, 0);
|
||||
vec3 specularColor = specularIntensity * lightColor * specularAlbedo * pow(max(specularCosineFactor, 0), specularPower);
|
||||
|
||||
color = ambientColor + diffuseColor + specularColor;
|
||||
|
||||
@@ -370,7 +370,7 @@ void OrbitalInteractionMode::updateCameraStateFromMouseStates(Camera& camera) {
|
||||
dvec3 camDirection = camera.viewDirectionWorldSpace();
|
||||
|
||||
// Declare other variables used in interaction calculations
|
||||
double minHeightAboveBoundingSphere = 10;
|
||||
double minHeightAboveBoundingSphere = 1;
|
||||
dvec3 centerToCamera = camPos - centerPos;
|
||||
dvec3 centerToBoundingSphere;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user