Add renderable fov to OSIRIS-REx polycam and increse precision in rendering of view frustum (fov)

This commit is contained in:
Kalle Bladin
2016-08-15 20:20:36 -04:00
parent 9d04fd5593
commit fb7104fbed
5 changed files with 118 additions and 46 deletions
+1 -20
View File
@@ -60,26 +60,7 @@ return {
}, },
}, },
Target = { Target = {
Body = BENNU_BODY, Body = BENNU_BODY, -- Do we need this?
--[[
Read = {
"TARGET_NAME",
"INSTRUMENT_HOST_NAME",
"INSTRUMENT_ID",
"START_TIME",
"STOP_TIME",
},
Convert = {
CHURYUMOV = {"CHURYUMOV-GERASIMENKO"},
ROSETTA = {"ROSETTA" },
--NAVCAM = {"NAVCAM"},
["ROSETTA-ORBITER"] = {"ROSETTA" },
CHURYUMOVGERASIMENKO11969R1 = {"CHURYUMOV-GERASIMENKO"},
CHURYUMOVGERASIMENKO = {"CHURYUMOV-GERASIMENKO"},
["CHURYUMOV-GERASIMENKO1(1969R1)"] = {"CHURYUMOV-GERASIMENKO"},
--NAVIGATIONCAMERA = {"NAVCAM" },
},
]]
}, },
}, },
+77 -1
View File
@@ -69,7 +69,7 @@ return {
Destination = "ORX_SPACECRAFT" Destination = "ORX_SPACECRAFT"
}, },
Transform = { Transform = {
Translation = {0,0,0}, -- Translation relative to parent Translation = {1,0,0}, -- Translation relative to parent
--Rotation = {0,0,0}, -- Euler angles relative to parent (not implemented) --Rotation = {0,0,0}, -- Euler angles relative to parent (not implemented)
--Scale = {1,1,1}, -- Scale relative to parent (not implemented) --Scale = {1,1,1}, -- Scale relative to parent (not implemented)
}, },
@@ -77,6 +77,82 @@ return {
GuiName = "/Solar/ORX_OCAMS_POLYCAM" GuiName = "/Solar/ORX_OCAMS_POLYCAM"
}, },
--[[
{
Name = "ORX_OCAMS_POLYCAM FOV",
Parent = "ORX_OCAMS_POLYCAM",
Renderable = {
Type = "RenderableFov",
Body = "OSIRIS-REX",
Frame = "GALACTIC",
RGB = { 0.8, 0.7, 0.7 },
Textures = {
Type = "simple",
Color = "textures/glare_blue.png",
-- need to add different texture
},
Instrument = {
Name = "ORX_OCAMS_POLYCAM",
Method = "ELLIPSOID",
Aberration = "NONE",
},
PotentialTargets = {
"Bennu2",
}
},
GuiName = "/Solar/ORX_OCAMS_POLYCAM"
},
]]
{
Name = "POLYCAM",
Parent = "ORX_OCAMS_POLYCAM",
Renderable = {
Type = "RenderableFov",
Body = "OSIRIS-REX",
Frame = "ORX_OCAMS_POLYCAM",
RGB = { 0.8, 0.7, 0.7 },
Textures = {
Type = "simple",
Color = "textures/glare_blue.png",
-- need to add different texture
},
Instrument = {
Name = "ORX_OCAMS_POLYCAM",
Method = "ELLIPSOID",
Aberration = "NONE",
},
PotentialTargets = {
BENNU_BODY -- Bennu
}
},
GuiName = "/Solar/POLYCAM"
},
-- Latest image taken by POLYCAM
--[[
{
Name = "ImagePlaneOsirisRex",
Parent = "OsirisRex",
Renderable = {
Type = "RenderablePlaneProjection",
Frame = "IAU_BENNU",
DefaultTarget = BENNU_BODY,
Spacecraft = "OSIRIS-REX",
Instrument = "ORX_OCAMS_POLYCAM",
Moving = false,
Texture = "textures/defaultProj.png",
},
Ephemeris = {
Type = "Static",
Position = {0, 0, 0, 1}
},
},
]]
{ {
Name = "OsirisRexPathSolar", Name = "OsirisRexPathSolar",
Parent = "SolarSystemBarycenter", Parent = "SolarSystemBarycenter",
@@ -549,10 +549,21 @@ void RenderableFov::render(const RenderData& data) {
_drawFOV = false; _drawFOV = false;
// setup the data to the shader // setup the data to the shader
_programObject->setUniform("ViewProjection", data.camera.viewProjectionMatrix()); //_programObject->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
_programObject->setUniform("ModelTransform", glm::mat4(1)); //_programObject->setUniform("ModelTransform", glm::translate(glm::mat4(1), glm::vec3(data.positionVec3)) );
setPscUniforms(*_programObject.get(), data.camera, data.position); //setPscUniforms(*_programObject.get(), data.camera, data.position);
// Model transform and view transform needs to be in double precision
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.positionVec3) * // Translation
glm::dmat4(data.rotation);
glm::mat4 modelViewProjectionTransform =
data.camera.projectionMatrix() *
glm::mat4(data.camera.combinedViewMatrix() *
modelTransform);
_programObject->setUniform("modelViewProjectionTransform", modelViewProjectionTransform);
if (openspace::ImageSequencer::ref().isReady()) { if (openspace::ImageSequencer::ref().isReady()) {
_drawFOV = ImageSequencer::ref().instrumentActive(_instrumentID); _drawFOV = ImageSequencer::ref().instrumentActive(_instrumentID);
} }
+9 -13
View File
@@ -22,11 +22,17 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/ ****************************************************************************************/
/*
uniform mat4 ViewProjection; uniform mat4 ViewProjection;
uniform mat4 ModelTransform; uniform mat4 ModelTransform;
in vec4 vs_point_position; in vec4 vs_point_position;
in vec4 vs_point_velocity; in vec4 vs_point_velocity;
*/
//out vec4 vs_point_position;
in vec4 vs_point_velocity;
in vec4 vs_positionScreenSpace;
//out vec4 diffuse; //out vec4 diffuse;
@@ -35,19 +41,9 @@ in vec4 vs_point_velocity;
#include "fragment.glsl" #include "fragment.glsl"
Fragment getFragment() { Fragment getFragment() {
vec4 position = vs_point_position;
float depth = pscDepth(position);
// set the depth
//gl_FragDepth = depth;
//float l = length(vs_point_velocity);
vec4 diffuse = vs_point_velocity;
Fragment frag; Fragment frag;
frag.color = diffuse; frag.color = vs_point_velocity;
frag.depth = depth; frag.depth = vs_positionScreenSpace.w;
return frag; return frag;
} }
+17 -9
View File
@@ -24,30 +24,38 @@
#version __CONTEXT__ #version __CONTEXT__
uniform mat4 ViewProjection; //uniform mat4 ViewProjection;
uniform mat4 ModelTransform; //uniform mat4 ModelTransform;
//uniform vec4 etColor; //uniform vec4 etColor;
uniform vec4 objectVelocity; //uniform vec4 objectVelocity;
layout(location = 0) in vec4 in_point_position; layout(location = 0) in vec4 in_point_position;
layout(location = 1) in vec4 in_point_velocity; layout(location = 1) in vec4 in_point_velocity;
layout(location = 2) in vec2 in_point_timeindex; layout(location = 2) in vec2 in_point_timeindex;
out vec4 vs_point_position; //out vec4 vs_point_position;
out vec4 vs_point_velocity; out vec4 vs_point_velocity;
// Uniforms
uniform mat4 modelViewProjectionTransform;
// Outputs
out vec4 vs_positionScreenSpace;
#include "PowerScaling/powerScaling_vs.hglsl" #include "PowerScaling/powerScaling_vs.hglsl"
void main() void main()
{ {
vec4 position = vec4(in_point_position.xyz * pow(10, in_point_position.w), 1);
vec4 positionClipSpace = modelViewProjectionTransform * position;
// Write output
vs_positionScreenSpace = z_normalization(positionClipSpace);
gl_Position = vs_positionScreenSpace;
vs_point_velocity = in_point_velocity; vs_point_velocity = in_point_velocity;
vec4 tmp = in_point_position;
vec4 position = pscTransform(tmp, ModelTransform);
vs_point_position = tmp;
position = ViewProjection * position;
gl_Position = z_normalization(position);
/* /*
//vs_point_position = objpos; //vs_point_position = objpos;