mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
Merge branch 'feature/iSWA' of github.com:OpenSpace/OpenSpace-Development into feature/iSWA
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -123,3 +123,4 @@ data/spice/jup260.bsp
|
||||
data/BATSRUS.cdf
|
||||
data/ENLIL.cdf
|
||||
data/scene/newhorizons/pluto/plutoprojection/images
|
||||
data/spice/nh_kernels/
|
||||
|
||||
11
CREDITS
11
CREDITS
@@ -1,6 +1,15 @@
|
||||
Alexander Bock
|
||||
Joakim Kilby
|
||||
Emil Axelsson
|
||||
Jonathas Costa
|
||||
Niclas Hultberg
|
||||
Michael Nilsson
|
||||
Sebastian Piwell
|
||||
Kalle Bladin
|
||||
Erik Broberg
|
||||
|
||||
Jonas Strandstedt
|
||||
Hans-Christian Helltegen
|
||||
Michal Marcinkowski
|
||||
Anton Arbring
|
||||
Anton Arbring
|
||||
Tomas Forsyth Rosin
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2014
|
||||
Copyright (c) 2014-2016
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
# Filenames
|
||||
# Don't change during runtime
|
||||
# (Transfer function values can be changed during runtime though)
|
||||
tsp_filename ${OPENSPACE_DATA}/enlil_64_32_8.tsp
|
||||
transferfunction_filename ${CONFIG}/transferfunctions/fire.txt
|
||||
|
||||
# Window dimensions
|
||||
# Don't change during runtime
|
||||
# NOT USED
|
||||
win_width 512
|
||||
win_height 512
|
||||
|
||||
# Save screenshots every frame (saved in flare/ folder) 0/1
|
||||
take_screenshot 0
|
||||
|
||||
|
||||
# 0 to not clear cache every frame, 1 to clear it
|
||||
# Used for benchmarking purposes
|
||||
clear_cache 0
|
||||
|
||||
# Local kernel work size
|
||||
# Can't be changed during runtime
|
||||
local_worksize_x 16
|
||||
local_worksize_y 16
|
||||
|
||||
# Scaling division to make textures smaller
|
||||
# Saves OpenCL threads
|
||||
# (A factor of 2 results in half the number of threads per dimension etc)
|
||||
texture_division_factor 1
|
||||
|
||||
# Error tolerances
|
||||
# Use -1 for no tolerance
|
||||
spatial_error_tolerance -1
|
||||
temporal_error_tolerance -1
|
||||
|
||||
# Calculate error or not (0 no, 1 yes)
|
||||
calculate_error 0
|
||||
|
||||
# Step size for TSP probing
|
||||
# Decrease this if holes appear in the rendering
|
||||
tsp_traversal_stepsize 0.02
|
||||
|
||||
# Ray caster constants
|
||||
raycaster_stepsize 0.005
|
||||
raycaster_intensity 1.0
|
||||
|
||||
# Animation speed
|
||||
animator_refresh_interval 0.5
|
||||
|
||||
# Various paths
|
||||
raycaster_kernel_filename ${KERNELS}/RaycasterTSP.cl
|
||||
tsp_traversal_kernel_filename ${KERNELS}/TSPTraversal.cl
|
||||
cube_shader_vert_filename ${SHADERS}/cubeVert.glsl
|
||||
cube_shader_frag_filename ${SHADERS}/cubeFrag.glsl
|
||||
quad_shader_vert_filename ${SHADERS}/quadVertFlare.glsl
|
||||
quad_shader_frag_filename ${SHADERS}/quadFrag.glsl
|
||||
|
||||
# Model
|
||||
start_pitch -20.0
|
||||
start_roll 30.0
|
||||
start_yaw 0.0
|
||||
|
||||
# Automatic pitch/roll/yaw
|
||||
pitch_speed 0.0
|
||||
roll_speed 0.0
|
||||
yaw_speed 0.0
|
||||
|
||||
# View
|
||||
|
||||
# Works well for standalone.xml
|
||||
translate_x -0.5
|
||||
translate_y -0.5
|
||||
translate_z -1.0
|
||||
|
||||
# Navigation
|
||||
# If mouse motion seems backwards, flip the sign of the roll and/or pitch factors
|
||||
mouse_pitch_factor -0.05
|
||||
mouse_roll_factor 0.05
|
||||
zoom_factor 0.35
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<Display swapInterval="1" />
|
||||
</Settings>
|
||||
<Node address="localhost" port="20401">
|
||||
<Window fullScreen="false" fxaa="false" numberOfSamples="8">
|
||||
<Window fullScreen="false" fxaa="false" numberOfSamples="8" name="OpenSpace">
|
||||
<Stereo type="none" />
|
||||
<!-- <Res x="4096" y="2304" /> -->
|
||||
<!-- <Res x="1920" y="1080" /> -->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" ?>
|
||||
<Cluster masterAddress="localhost">
|
||||
<Node address="localhost" port="20401">
|
||||
<Window fullScreen="false" numberOfSamples="8">
|
||||
<Window fullScreen="false" numberOfSamples="8" name="OpenSpace">
|
||||
<Stereo type="none" />
|
||||
<!-- 16:9 aspect ratio -->
|
||||
<Size x="1024" y="1024" />
|
||||
|
||||
@@ -5,8 +5,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_CALLISTO", -- should exist.
|
||||
Body = "CALLISTO",
|
||||
Frame = "IAU_CALLISTO", -- should exist.
|
||||
Body = "CALLISTO",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 2.631, 6},
|
||||
|
||||
@@ -4,10 +4,10 @@ return {
|
||||
Name = "Ceres",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
|
||||
Renderable = {
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_CERES",
|
||||
Body = "CERES",
|
||||
Frame = "IAU_CERES",
|
||||
Body = "CERES",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 6.390, 5 },
|
||||
@@ -17,18 +17,18 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/gray.png",
|
||||
},
|
||||
StartTime = "2010 JAN 01 00:00:00",
|
||||
EndTime = "2018 JAN 22 12:00:00"
|
||||
StartTime = "2010 JAN 01 00:00:00",
|
||||
EndTime = "2018 JAN 22 12:00:00"
|
||||
},
|
||||
Ephemeris = {
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "CERES",
|
||||
Reference = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/DawnKernels/pck/dawn_ceres_v01.tpc",
|
||||
"${OPENSPACE_DATA}/spice/DawnKernels/spk/sb_ceres_140724.bsp",
|
||||
"${OPENSPACE_DATA}/spice/DawnKernels/spk/sb_ceres_110211.bsp",
|
||||
"${OPENSPACE_DATA}/spice/DawnKernels/spk/sb_ceres_140724.bsp",
|
||||
"${OPENSPACE_DATA}/spice/DawnKernels/spk/sb_ceres_110211.bsp",
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
@@ -36,34 +36,34 @@ return {
|
||||
Frame = "IAU_CERES",
|
||||
Reference = "GALACTIC"
|
||||
},
|
||||
|
||||
|
||||
GuiName = "/Solar/Ceres"
|
||||
},
|
||||
--[[ Ceres Trail Module
|
||||
--[[ Ceres Trail Module
|
||||
{
|
||||
Name = "CeresTrail",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Renderable = {
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
Body = "CERES",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
|
||||
-- 3 Dummy values for compilation:
|
||||
TropicalOrbitPeriod = 500.0,
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
|
||||
-- 3 Dummy values for compilation:
|
||||
TropicalOrbitPeriod = 500.0,
|
||||
EarthOrbitRatio = 0.2,
|
||||
DayLength = 2,
|
||||
-- End of Dummy values
|
||||
|
||||
RGB = { 0.7, 0.5, 0.5 },
|
||||
Textures = {
|
||||
-- End of Dummy values
|
||||
|
||||
RGB = { 0.7, 0.5, 0.5 },
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/glare.png"
|
||||
},
|
||||
StartTime = "2010 JAN 01T00:00:00",
|
||||
EndTime = "2018 JAN 22 12:00:00"
|
||||
},
|
||||
Color = "textures/glare.png"
|
||||
},
|
||||
StartTime = "2010 JAN 01T00:00:00",
|
||||
EndTime = "2018 JAN 22 12:00:00"
|
||||
},
|
||||
GuiName = "/Solar/CeresTrail"
|
||||
}
|
||||
--]]
|
||||
--]]
|
||||
}
|
||||
@@ -5,8 +5,8 @@ return {
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_CHARON",
|
||||
Body = "CHARON",
|
||||
Frame = "IAU_CHARON",
|
||||
Body = "CHARON",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 6.035 , 5 },
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
return {
|
||||
-- Solar System module
|
||||
{
|
||||
Name = "SolarSystem",
|
||||
Parent = "Root",
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = { 0, 0, 0, 0}
|
||||
}
|
||||
},
|
||||
-- Solar System module
|
||||
{
|
||||
Name = "SolarSystem",
|
||||
Parent = "Root",
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = { 0, 0, 0, 0}
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -1,3 +1,35 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
openspace.time.setTime("2011 AUG 06 00:00:00")
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after all objects in the scene have been
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", true)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", true)
|
||||
--openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTrail.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTexture.renderable.enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
|
||||
@@ -1,3 +1,58 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
openspace.time.setTime(openspace.time.currentWallTime())
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after all objects in the scene have been
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
|
||||
--openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
-- openspace.setPropertyValue("PlutoTrail.renderable.enabled", false)
|
||||
-- openspace.setPropertyValue("PlutoTexture.renderable.enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
|
||||
openspace.iswa.addCygnet("-1,Data,1");
|
||||
openspace.iswa.addCygnet("-2,Data,1");
|
||||
openspace.iswa.addCygnet("-3,Data,1");
|
||||
|
||||
openspace.registerScreenSpaceRenderable(
|
||||
{
|
||||
Type = "ScreenSpaceCygnet",
|
||||
CygnetId = 7,
|
||||
Position = {-0.8, 0.3},
|
||||
FlatScreen = true,
|
||||
Scale = 0.25,
|
||||
});
|
||||
|
||||
openspace.registerScreenSpaceRenderable(
|
||||
{
|
||||
Type = "ScreenSpaceImage",
|
||||
TexturePath = "${OPENSPACE_DATA}/test2.jpg",
|
||||
Position = {0.8, -0.3},
|
||||
FlatScreen = true,
|
||||
Scale = 0.25,
|
||||
});
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
@@ -30,4 +85,3 @@ return {
|
||||
--"gridEquatorial",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,38 @@
|
||||
UseAccurateNewHorizonsKernels = false
|
||||
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
openspace.time.setTime("2015-07-14T10:00:00.00")
|
||||
openspace.time.setDeltaTime(0)
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after all objects in the scene have been
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", true)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", true)
|
||||
--openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTrail.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTexture.renderable.enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
|
||||
@@ -27,7 +27,7 @@ return {
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_EARTH",
|
||||
Body = "EARTH",
|
||||
Body = "EARTH",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 6.371, 6 },
|
||||
@@ -36,7 +36,7 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/earth_bluemarble.jpg",
|
||||
Night = "textures/earth_night.jpg",
|
||||
Night = "textures/earth_night.jpg",
|
||||
-- Depth = "textures/earth_depth.png"
|
||||
},
|
||||
Atmosphere = {
|
||||
@@ -82,7 +82,7 @@ return {
|
||||
Billboard = true,
|
||||
Texture = "textures/marker.png"
|
||||
},
|
||||
Ephemeris = {
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = {0, 0, 0, 5}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ return {
|
||||
Rotation = {2.1, 0, 0},
|
||||
Scaling = {1.1, 1.1, 1.1},
|
||||
ScalingExponent = 12,
|
||||
Source = "tsp/enlil_nh_128_128_16.tsp",
|
||||
Source = "tsp/enlil_nh_128_128_16.tsp",
|
||||
TransferFunction = "transferfunctions/fire.txt",
|
||||
BrickSelector = "tf",
|
||||
BrickSelector = "tf",
|
||||
},
|
||||
GuiName = "/Volumes/ENLIL New Horizons"
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ return {
|
||||
Parent = "Root",
|
||||
Renderable = {
|
||||
Type = "RenderableEphemeris",
|
||||
Textures = {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/glare_blue.png",
|
||||
-- need to add different texture
|
||||
},
|
||||
},
|
||||
Color = "textures/glare_blue.png",
|
||||
-- need to add different texture
|
||||
},
|
||||
},
|
||||
GuiName = "/Solar/Ephemeris"
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_EUROPA", -- should exist.
|
||||
Body = "EUROPA",
|
||||
Frame = "IAU_EUROPA", -- should exist.
|
||||
Body = "EUROPA",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.561, 6},
|
||||
|
||||
@@ -5,7 +5,7 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_GANYMEDE", -- should exist.
|
||||
Frame = "IAU_GANYMEDE", -- should exist.
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 2.631, 6},
|
||||
|
||||
@@ -3,23 +3,23 @@ return {
|
||||
{
|
||||
Name = "SphericalGrid",
|
||||
Parent = "Root",
|
||||
Static = true,
|
||||
Static = true,
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid",
|
||||
GridType = "ECLIPJ2000",
|
||||
GridColor = { 0.4, 0.0, 0.0, 1},
|
||||
GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0,
|
||||
-0.9938214 , -0.1109906, -0.0003515167, 0.0,
|
||||
-0.09647644, 0.8622859, 0.4971472 , 0.0,
|
||||
0.0 , 0.0 , 0.0 , 1.0 },
|
||||
GridSegments = 36,
|
||||
},
|
||||
Ephemeris = {
|
||||
GridType = "ECLIPJ2000",
|
||||
GridColor = { 0.4, 0.0, 0.0, 1},
|
||||
GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0,
|
||||
-0.9938214 , -0.1109906, -0.0003515167, 0.0,
|
||||
-0.09647644, 0.8622859, 0.4971472 , 0.0,
|
||||
0.0 , 0.0 , 0.0 , 1.0 },
|
||||
GridSegments = 36,
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static" -- for now, might change.
|
||||
},
|
||||
|
||||
--[[
|
||||
Ephemeris = {
|
||||
|
||||
--[[
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "EARTH",
|
||||
Reference = "ECLIPJ2000",
|
||||
@@ -27,8 +27,8 @@ return {
|
||||
Kernels = {
|
||||
"kernels/earth.bsp"
|
||||
}
|
||||
},
|
||||
--]]
|
||||
},
|
||||
--]]
|
||||
GuiName = "/Grid/Ecliptic"
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,18 @@ return {
|
||||
{
|
||||
Name = "SphericalGrid",
|
||||
Parent = "Root",
|
||||
Static = true,
|
||||
Static = true,
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid",
|
||||
GridType = "ICRF",
|
||||
GridColor = { 0.0, 0.0, 0.4, 1},
|
||||
GridMatrix = { -0.05487554, 0.4941095, -0.8676661, 0.0,
|
||||
-0.8734371 , -0.4448296, -0.1980764, 0.0,
|
||||
-0.483835 , 0.7469823, 0.4559838, 0.0,
|
||||
0.0 , 0.0 , 0.0 , 1.0 },
|
||||
GridSegments = 36,
|
||||
},
|
||||
Ephemeris = {
|
||||
GridType = "ICRF",
|
||||
GridColor = { 0.0, 0.0, 0.4, 1},
|
||||
GridMatrix = { -0.05487554, 0.4941095, -0.8676661, 0.0,
|
||||
-0.8734371 , -0.4448296, -0.1980764, 0.0,
|
||||
-0.483835 , 0.7469823, 0.4559838, 0.0,
|
||||
0.0 , 0.0 , 0.0 , 1.0 },
|
||||
GridSegments = 36,
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static" -- for now, might change.
|
||||
},
|
||||
|
||||
|
||||
@@ -3,23 +3,23 @@ return {
|
||||
{
|
||||
Name = "gridGalactic",
|
||||
Parent = "SolarSystem",
|
||||
Static = true,
|
||||
Static = true,
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid",
|
||||
GridType = "GALACTIC",
|
||||
GridColor = { 0.0, 0.4, 0.4, 1},
|
||||
GridMatrix = { 1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0 },
|
||||
GridSegments = 36,
|
||||
},
|
||||
Ephemeris = {
|
||||
GridType = "GALACTIC",
|
||||
GridColor = { 0.0, 0.4, 0.4, 1},
|
||||
GridMatrix = { 1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0 },
|
||||
GridSegments = 36,
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static" -- for now, might change.
|
||||
},
|
||||
|
||||
--[[
|
||||
Ephemeris = {
|
||||
|
||||
--[[
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "EARTH",
|
||||
Reference = "ECLIPJ2000",
|
||||
@@ -27,8 +27,8 @@ return {
|
||||
Kernels = {
|
||||
"kernels/earth.bsp"
|
||||
}
|
||||
},
|
||||
--]]
|
||||
},
|
||||
--]]
|
||||
GuiName = "/Grid/Galactic"
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
return {
|
||||
-- Latest image taken by LORRI
|
||||
{
|
||||
{
|
||||
Name = "ImagePlane",
|
||||
Parent = "NewHorizons",
|
||||
Renderable = {
|
||||
Type = "RenderablePlaneProjection",
|
||||
Frame = "IAU_JUPITER",
|
||||
DefaultTarget = "JUPITER",
|
||||
Spacecraft = "NEW HORIZONS",
|
||||
Instrument = "NH_LORRI",
|
||||
Moving = false,
|
||||
Frame = "IAU_JUPITER",
|
||||
DefaultTarget = "JUPITER",
|
||||
Spacecraft = "NEW HORIZONS",
|
||||
Instrument = "NH_LORRI",
|
||||
Moving = false,
|
||||
Texture = "textures/test.jpg",
|
||||
},
|
||||
Ephemeris = {
|
||||
@@ -17,17 +17,17 @@ return {
|
||||
Position = {0, 0, 0, 1}
|
||||
},
|
||||
},
|
||||
-- LORRI FoV square
|
||||
{
|
||||
-- LORRI FoV square
|
||||
{
|
||||
Name = "ImagePlane2",
|
||||
Parent = "NewHorizons",
|
||||
Renderable = {
|
||||
Type = "RenderablePlaneProjection",
|
||||
Frame = "IAU_JUPITER",
|
||||
DefaultTarget = "JUPITER",
|
||||
Spacecraft = "NEW HORIZONS",
|
||||
Instrument = "NH_LORRI",
|
||||
Moving = true,
|
||||
Frame = "IAU_JUPITER",
|
||||
DefaultTarget = "JUPITER",
|
||||
Spacecraft = "NEW HORIZONS",
|
||||
Instrument = "NH_LORRI",
|
||||
Moving = true,
|
||||
Texture = "textures/squarefov.png",
|
||||
},
|
||||
Ephemeris = {
|
||||
|
||||
@@ -5,8 +5,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_IO", -- should exist.
|
||||
Body = "IO",
|
||||
Frame = "IAU_IO", -- should exist.
|
||||
Body = "IO",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.8213, 6 },
|
||||
@@ -29,7 +29,7 @@ return {
|
||||
Observer = "JUPITER BARYCENTER",
|
||||
Kernels = {
|
||||
--"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
"${SPICE}/jup260.bsp",
|
||||
"${SPICE}/jup260.bsp",
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
|
||||
@@ -3,7 +3,7 @@ return {
|
||||
{
|
||||
Name = "JupiterBarycenter",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Ephemeris = {
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "JUPITER BARYCENTER",
|
||||
Reference = "ECLIPJ2000",
|
||||
@@ -11,7 +11,7 @@ return {
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
-- Jupiter module
|
||||
{
|
||||
@@ -19,8 +19,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_JUPITER",
|
||||
Body = "JUPITER BARYCENTER",
|
||||
Frame = "IAU_JUPITER",
|
||||
Body = "JUPITER BARYCENTER",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 0.71492, 8 },
|
||||
@@ -36,7 +36,7 @@ return {
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Ephemeris = {
|
||||
Type = "Static" -- jupiter is at its barycenter
|
||||
},
|
||||
Rotation = {
|
||||
|
||||
@@ -14,8 +14,8 @@ return {
|
||||
Parent = "MarsBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_MARS",
|
||||
Body = "MARS BARYCENTER",
|
||||
Frame = "IAU_MARS",
|
||||
Body = "MARS BARYCENTER",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 6.390, 6 },
|
||||
|
||||
@@ -14,8 +14,8 @@ return {
|
||||
Parent = "MercuryBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_MERCURY",
|
||||
Body = "MERCURY",
|
||||
Frame = "IAU_MERCURY",
|
||||
Body = "MERCURY",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 2.440, 6 },
|
||||
|
||||
@@ -14,8 +14,8 @@ return {
|
||||
Parent = "NeptuneBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_NEPTUNE",
|
||||
Body = "NEPTUNE BARYCENTER",
|
||||
Frame = "IAU_NEPTUNE",
|
||||
Body = "NEPTUNE BARYCENTER",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 2.4622 , 7 },
|
||||
|
||||
@@ -5,8 +5,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanetProjection",
|
||||
Frame = "IAU_CALLISTO",
|
||||
Body = "CALLISTO",
|
||||
Frame = "IAU_CALLISTO",
|
||||
Body = "CALLISTO",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.8213, 6 },
|
||||
@@ -15,28 +15,28 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/callisto.jpg",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "CALLISTO",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "CALLISTO",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
PotentialTargets = {
|
||||
"JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO"
|
||||
}
|
||||
@@ -67,7 +67,7 @@ return {
|
||||
Billboard = true,
|
||||
Texture = "textures/Callisto-Text.png"
|
||||
},
|
||||
Ephemeris = {
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = {0, -1, 0, 7}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ return {
|
||||
TropicalOrbitPeriod = 80 ,
|
||||
EarthOrbitRatio = 0.04,
|
||||
DayLength = 9.9259,
|
||||
LineFade = 2.0,
|
||||
LineFade = 2.0,
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "${COMMON_MODULE}/textures/glare_blue.png",
|
||||
|
||||
@@ -5,8 +5,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanetProjection",
|
||||
Frame = "IAU_EUROPA",
|
||||
Body = "EUROPA",
|
||||
Frame = "IAU_EUROPA",
|
||||
Body = "EUROPA",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.8213, 6 },
|
||||
@@ -15,28 +15,28 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/europa.jpg",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "EUROPA",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "EUROPA",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
PotentialTargets = {
|
||||
"JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO"
|
||||
}
|
||||
@@ -85,7 +85,7 @@ return {
|
||||
TropicalOrbitPeriod = 80 ,
|
||||
EarthOrbitRatio = 0.009,
|
||||
DayLength = 9.9259,
|
||||
LineFade = 2.0,
|
||||
LineFade = 2.0,
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "${COMMON_MODULE}/textures/glare_blue.png",
|
||||
|
||||
@@ -5,8 +5,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanetProjection",
|
||||
Frame = "IAU_GANYMEDE",
|
||||
Body = "GANYMEDE",
|
||||
Frame = "IAU_GANYMEDE",
|
||||
Body = "GANYMEDE",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.8213, 6 },
|
||||
@@ -15,28 +15,28 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/ganymede.jpg",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "GANYMEDE",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "GANYMEDE",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
PotentialTargets = {
|
||||
"JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO"
|
||||
}
|
||||
@@ -85,7 +85,7 @@ return {
|
||||
TropicalOrbitPeriod = 80 ,
|
||||
EarthOrbitRatio = 0.018,
|
||||
DayLength = 9.9259,
|
||||
LineFade = 2.0,
|
||||
LineFade = 2.0,
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "${COMMON_MODULE}/textures/glare_blue.png",
|
||||
|
||||
@@ -5,8 +5,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanetProjection",
|
||||
Frame = "IAU_IO",
|
||||
Body = "IO",
|
||||
Frame = "IAU_IO",
|
||||
Body = "IO",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.8213, 6 },
|
||||
@@ -15,28 +15,28 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/io.jpg",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "IO",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "IO",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
PotentialTargets = {
|
||||
"JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO"
|
||||
}
|
||||
@@ -85,7 +85,7 @@ return {
|
||||
TropicalOrbitPeriod = 100 ,
|
||||
EarthOrbitRatio = 0.0045,
|
||||
DayLength = 9.9259,
|
||||
LineFade = 2.0,
|
||||
LineFade = 2.0,
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "${COMMON_MODULE}/textures/glare_blue.png",
|
||||
|
||||
@@ -3,7 +3,7 @@ return {
|
||||
{
|
||||
Name = "JupiterBarycenter",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Ephemeris = {
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "JUPITER BARYCENTER",
|
||||
Reference = "ECLIPJ2000",
|
||||
@@ -11,7 +11,7 @@ return {
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp",
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
-- JupiterProjection module
|
||||
{
|
||||
@@ -19,8 +19,8 @@ return {
|
||||
Parent = "JupiterBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanetProjection",
|
||||
Frame = "IAU_JUPITER",
|
||||
Body = "JUPITER",
|
||||
Frame = "IAU_JUPITER",
|
||||
Body = "JUPITER",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 0.71492, 8 },
|
||||
@@ -29,71 +29,71 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/jupiterFlipped_low.jpg",
|
||||
Project = "textures/lorriTest1.jpg",
|
||||
Sequencing = "true",
|
||||
Project = "textures/lorriTest1.jpg",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
--Sequence = "F:/JupiterFullSequence",
|
||||
Sequence = "${OPENSPACE_DATA}/scene/newhorizons/jupiter/jupiterprojection/ProjectionsOfInterest",
|
||||
Projection = {
|
||||
--Sequence = "F:/JupiterFullSequence",
|
||||
Sequence = "${OPENSPACE_DATA}/scene/newhorizons/jupiter/jupiterprojection/ProjectionsOfInterest",
|
||||
SequenceType = "image-sequence",
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "JUPITER",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
DataInputTranslation = {
|
||||
Instrument = {
|
||||
LORRI = {
|
||||
DetectorType = "Camera",
|
||||
Spice = {"NH_LORRI"},
|
||||
},
|
||||
},
|
||||
Target ={
|
||||
Read = {
|
||||
"TARGET_NAME",
|
||||
"INSTRUMENT_HOST_NAME",
|
||||
"INSTRUMENT_ID",
|
||||
"START_TIME",
|
||||
"STOP_TIME",
|
||||
"DETECTOR_TYPE",
|
||||
--"SEQUENCE_ID",
|
||||
},
|
||||
Convert = {
|
||||
JRINGS = {"IMAGE-PLANE" },
|
||||
J1IO = {"IO" },
|
||||
J2EUROPA = {"EUROPA" },
|
||||
J6HIMALIA = {"IMAGE-PLANE" },
|
||||
J7ELARA = {"IMAGE-PLANE" },
|
||||
CALIBRATION = {"CALIBRATION" },
|
||||
JUPITER = {"JUPITER" },
|
||||
CALLISTO = {"CALLISTO" },
|
||||
GANYMEDE = {"GANYMEDE" },
|
||||
EARTH = {"EARTH" },
|
||||
NEWHORIZONS = {"NEW HORIZONS"},
|
||||
CCD = {"CAMERA" },
|
||||
FRAMECCD = {"SCANNER" },
|
||||
},
|
||||
},
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "JUPITER",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
DataInputTranslation = {
|
||||
Instrument = {
|
||||
LORRI = {
|
||||
DetectorType = "Camera",
|
||||
Spice = {"NH_LORRI"},
|
||||
},
|
||||
},
|
||||
Target ={
|
||||
Read = {
|
||||
"TARGET_NAME",
|
||||
"INSTRUMENT_HOST_NAME",
|
||||
"INSTRUMENT_ID",
|
||||
"START_TIME",
|
||||
"STOP_TIME",
|
||||
"DETECTOR_TYPE",
|
||||
--"SEQUENCE_ID",
|
||||
},
|
||||
Convert = {
|
||||
JRINGS = {"IMAGE-PLANE" },
|
||||
J1IO = {"IO" },
|
||||
J2EUROPA = {"EUROPA" },
|
||||
J6HIMALIA = {"IMAGE-PLANE" },
|
||||
J7ELARA = {"IMAGE-PLANE" },
|
||||
CALIBRATION = {"CALIBRATION" },
|
||||
JUPITER = {"JUPITER" },
|
||||
CALLISTO = {"CALLISTO" },
|
||||
GANYMEDE = {"GANYMEDE" },
|
||||
EARTH = {"EARTH" },
|
||||
NEWHORIZONS = {"NEW HORIZONS"},
|
||||
CCD = {"CAMERA" },
|
||||
FRAMECCD = {"SCANNER" },
|
||||
},
|
||||
},
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
PotentialTargets = {
|
||||
"JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO"
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static"
|
||||
Ephemeris = {
|
||||
Type = "Static"
|
||||
},
|
||||
|
||||
Rotation = {
|
||||
@@ -139,5 +139,5 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/JupiterTrail"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/NH_RALPH_MVIC_METHANE"
|
||||
},
|
||||
-- NewHorizonsFov module NH_RALPH_MVIC_NIR
|
||||
-- NewHorizonsFov module NH_RALPH_MVIC_NIR
|
||||
{
|
||||
Name = "NH_RALPH_MVIC_NIR",
|
||||
Parent = "NewHorizons",
|
||||
@@ -245,7 +245,7 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/NH_RALPH_MVIC_METHANE"
|
||||
},
|
||||
-- NewHorizonsFov module NH_ALICE_AIRGLOW
|
||||
-- NewHorizonsFov module NH_ALICE_AIRGLOW
|
||||
{
|
||||
Name = "NH_ALICE_AIRGLOW",
|
||||
Parent = "NewHorizons",
|
||||
@@ -272,7 +272,7 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/NH_ALICE_AIRGLOW"
|
||||
},
|
||||
-- NewHorizonsFov module NH_ALICE_SOC
|
||||
-- NewHorizonsFov module NH_ALICE_SOC
|
||||
{
|
||||
Name = "NH_ALICE_SOC",
|
||||
Parent = "NewHorizons",
|
||||
|
||||
@@ -8,13 +8,13 @@ return {
|
||||
Body = "NEW HORIZONS",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
RGB = { 0.8, 0.7, 0.7 },
|
||||
Textures = {
|
||||
RGB = { 0.8, 0.7, 0.7 },
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/glare_blue.png",
|
||||
-- need to add different texture
|
||||
},
|
||||
},
|
||||
Color = "textures/glare_blue.png",
|
||||
-- need to add different texture
|
||||
},
|
||||
},
|
||||
GuiName = "/Solar/NewHorizonsPath"
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,16 @@ return {
|
||||
Body = "NEW HORIZONS",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
RGB = { 0.1,0.01,0.30 },
|
||||
TropicalOrbitPeriod = 6330.595 ,
|
||||
EarthOrbitRatio = 0.857,
|
||||
DayLength = 9.9259,
|
||||
Textures = {
|
||||
RGB = { 0.1,0.01,0.30 },
|
||||
TropicalOrbitPeriod = 6330.595 ,
|
||||
EarthOrbitRatio = 0.857,
|
||||
DayLength = 9.9259,
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/glare_blue.png",
|
||||
-- need to add different texture
|
||||
},
|
||||
},
|
||||
Color = "textures/glare_blue.png",
|
||||
-- need to add different texture
|
||||
},
|
||||
},
|
||||
GuiName = "/Solar/NewHorizonsTrail"
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ return {
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanetProjection",
|
||||
Frame = "IAU_CHARON",
|
||||
Body = "CHARON",
|
||||
Frame = "IAU_CHARON",
|
||||
Body = "CHARON",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 6.035 , 5 },
|
||||
@@ -26,28 +26,28 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/charon_highres.jpg",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "CHARON",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "CHARON",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
PotentialTargets = {
|
||||
"PLUTO",
|
||||
"CHARON"
|
||||
@@ -82,18 +82,18 @@ return {
|
||||
Position = {0, -10, 0, 5}
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
Name = "CharonShadow",
|
||||
Parent = "Charon",
|
||||
Renderable = {
|
||||
Type = "RenderableShadowCylinder",
|
||||
TerminatorType = "PENUMBRAL",
|
||||
LightSource = "SUN",
|
||||
Observer = "NEW HORIZONS",
|
||||
Body = "CHARON",
|
||||
BodyFrame = "IAU_CHARON",
|
||||
MainFrame = "GALACTIC",
|
||||
Aberration = "NONE",
|
||||
TerminatorType = "PENUMBRAL",
|
||||
LightSource = "SUN",
|
||||
Observer = "NEW HORIZONS",
|
||||
Body = "CHARON",
|
||||
BodyFrame = "IAU_CHARON",
|
||||
MainFrame = "GALACTIC",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
|
||||
@@ -15,8 +15,8 @@ return {
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "HYDRA",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "HYDRA",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 0.53 , 5 },
|
||||
@@ -83,5 +83,5 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/HydraTrail"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ return {
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "KERBEROS",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "KERBEROS",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 0.1 , 5 },
|
||||
@@ -83,5 +83,5 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/KerberosTrail"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ return {
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "NIX",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "NIX",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 0.45 , 5 },
|
||||
@@ -83,5 +83,5 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/NixTrail"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ return {
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanetProjection",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "PLUTO",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "PLUTO",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.173 , 6 },
|
||||
@@ -41,116 +41,116 @@ return {
|
||||
Color = "textures/Shenk_180.jpg",
|
||||
-- Color = "textures/pluto_large.jpg",
|
||||
-- Color = "textures/white.png",
|
||||
Project = "textures/3.jpg",
|
||||
Sequencing = "true",
|
||||
Project = "textures/3.jpg",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Sequence = "${OPENSPACE_DATA}/scene/newhorizons/pluto/plutoprojection/images",
|
||||
EventFile = "${OPENSPACE_DATA}/scene/newhorizons/pluto/plutoprojection/assets/core_v9h_obs_getmets_v8_time_fix_nofrcd_mld.txt",
|
||||
Projection = {
|
||||
Sequence = "${OPENSPACE_DATA}/scene/newhorizons/pluto/plutoprojection/images",
|
||||
EventFile = "${OPENSPACE_DATA}/scene/newhorizons/pluto/plutoprojection/assets/core_v9h_obs_getmets_v8_time_fix_nofrcd_mld.txt",
|
||||
SequenceType = "hybrid",
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "PLUTO",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
DataInputTranslation = {
|
||||
Instrument = {
|
||||
LORRI = {
|
||||
DetectorType = "Camera",
|
||||
Spice = {"NH_LORRI"},
|
||||
},
|
||||
RALPH_MVIC_PAN_FRAME = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "RALPH_ABORT",
|
||||
Spice = {"NH_RALPH_MVIC_FT"},
|
||||
},
|
||||
RALPH_MVIC_COLOR = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "END_NOM",
|
||||
Spice = { "NH_RALPH_MVIC_NIR",
|
||||
"NH_RALPH_MVIC_METHANE",
|
||||
"NH_RALPH_MVIC_RED",
|
||||
"NH_RALPH_MVIC_BLUE" },
|
||||
},
|
||||
RALPH_LEISA = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "END_NOM",
|
||||
Spice = {"NH_RALPH_LEISA"},
|
||||
},
|
||||
RALPH_MVIC_PAN1 = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "END_NOM",
|
||||
Spice = {"NH_RALPH_MVIC_PAN1"},
|
||||
},
|
||||
RALPH_MVIC_PAN2 = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "END_NOM",
|
||||
Spice = {"NH_RALPH_MVIC_PAN2"},
|
||||
},
|
||||
ALICE_Use_AIRGLOW = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "ALICE_END_PIXELLIST",
|
||||
Spice = {"NH_ALICE_AIRGLOW"},
|
||||
},
|
||||
ALICE_Use_AIRGLOW = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "ALICE_END_HISTOGRAM",
|
||||
Spice = {"NH_ALICE_AIRGLOW"},
|
||||
},
|
||||
ALICE_Use_SOCC = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "ALICE_END_PIXELLIST",
|
||||
Spice = {"NH_ALICE_SOC"},
|
||||
},
|
||||
ALICE_Use_SOCC = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "ALICE_END_HISTOGRAM",
|
||||
Spice = {"NH_ALICE_SOC"},
|
||||
},
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "PLUTO",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
DataInputTranslation = {
|
||||
Instrument = {
|
||||
LORRI = {
|
||||
DetectorType = "Camera",
|
||||
Spice = {"NH_LORRI"},
|
||||
},
|
||||
RALPH_MVIC_PAN_FRAME = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "RALPH_ABORT",
|
||||
Spice = {"NH_RALPH_MVIC_FT"},
|
||||
},
|
||||
RALPH_MVIC_COLOR = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "END_NOM",
|
||||
Spice = { "NH_RALPH_MVIC_NIR",
|
||||
"NH_RALPH_MVIC_METHANE",
|
||||
"NH_RALPH_MVIC_RED",
|
||||
"NH_RALPH_MVIC_BLUE" },
|
||||
},
|
||||
RALPH_LEISA = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "END_NOM",
|
||||
Spice = {"NH_RALPH_LEISA"},
|
||||
},
|
||||
RALPH_MVIC_PAN1 = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "END_NOM",
|
||||
Spice = {"NH_RALPH_MVIC_PAN1"},
|
||||
},
|
||||
RALPH_MVIC_PAN2 = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "END_NOM",
|
||||
Spice = {"NH_RALPH_MVIC_PAN2"},
|
||||
},
|
||||
ALICE_Use_AIRGLOW = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "ALICE_END_PIXELLIST",
|
||||
Spice = {"NH_ALICE_AIRGLOW"},
|
||||
},
|
||||
ALICE_Use_AIRGLOW = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "ALICE_END_HISTOGRAM",
|
||||
Spice = {"NH_ALICE_AIRGLOW"},
|
||||
},
|
||||
ALICE_Use_SOCC = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "ALICE_END_PIXELLIST",
|
||||
Spice = {"NH_ALICE_SOC"},
|
||||
},
|
||||
ALICE_Use_SOCC = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "ALICE_END_HISTOGRAM",
|
||||
Spice = {"NH_ALICE_SOC"},
|
||||
},
|
||||
REX_START = {
|
||||
DetectorType = "Scanner",
|
||||
StopCommand = "REX_MODE_OFF",
|
||||
Spice = { "NH_REX" },
|
||||
}
|
||||
},
|
||||
Target ={
|
||||
Read = {
|
||||
"TARGET_NAME",
|
||||
"INSTRUMENT_HOST_NAME",
|
||||
"INSTRUMENT_ID",
|
||||
"START_TIME",
|
||||
"STOP_TIME",
|
||||
"DETECTOR_TYPE",
|
||||
--"SEQUENCE_ID",
|
||||
},
|
||||
Convert = {
|
||||
PLUTO = {"PLUTO" },
|
||||
NEWHORIZONS = {"NEW HORIZONS"},
|
||||
CCD = {"CAMERA" },
|
||||
FRAMECCD = {"SCANNER" },
|
||||
},
|
||||
},
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
},
|
||||
Target ={
|
||||
Read = {
|
||||
"TARGET_NAME",
|
||||
"INSTRUMENT_HOST_NAME",
|
||||
"INSTRUMENT_ID",
|
||||
"START_TIME",
|
||||
"STOP_TIME",
|
||||
"DETECTOR_TYPE",
|
||||
--"SEQUENCE_ID",
|
||||
},
|
||||
Convert = {
|
||||
PLUTO = {"PLUTO" },
|
||||
NEWHORIZONS = {"NEW HORIZONS"},
|
||||
CCD = {"CAMERA" },
|
||||
FRAMECCD = {"SCANNER" },
|
||||
},
|
||||
},
|
||||
},
|
||||
Instrument = {
|
||||
Name = "NH_LORRI",
|
||||
Method = "ELLIPSOID",
|
||||
Aberration = "NONE",
|
||||
Fovy = 0.2907,
|
||||
Aspect = 1,
|
||||
Near = 0.2,
|
||||
Far = 10000,
|
||||
},
|
||||
PotentialTargets = {
|
||||
"PLUTO",
|
||||
"CHARON",
|
||||
"NIX",
|
||||
"HYDRA",
|
||||
"P5",
|
||||
"P4",
|
||||
"PLUTO",
|
||||
"CHARON",
|
||||
"NIX",
|
||||
"HYDRA",
|
||||
"P5",
|
||||
"P4",
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
@@ -167,7 +167,7 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/Planets/Pluto"
|
||||
},
|
||||
{
|
||||
{
|
||||
Name = "PlutoBarycenterLabel",
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
@@ -201,7 +201,7 @@ return {
|
||||
Position = {0, -20, 0, 5}
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
Name = "PlutoTexture",
|
||||
Parent = "PlutoProjection",
|
||||
Renderable = {
|
||||
@@ -217,25 +217,25 @@ return {
|
||||
Position = {0, 0, 40, 5}
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
Name = "PlutoShadow",
|
||||
Parent = "PlutoProjection",
|
||||
Renderable = {
|
||||
Type = "RenderableShadowCylinder",
|
||||
TerminatorType = "PENUMBRAL",
|
||||
LightSource = "SUN",
|
||||
Observer = "NEW HORIZONS",
|
||||
Body = "PLUTO",
|
||||
BodyFrame = "IAU_PLUTO",
|
||||
MainFrame = "GALACTIC",
|
||||
Aberration = "NONE",
|
||||
TerminatorType = "PENUMBRAL",
|
||||
LightSource = "SUN",
|
||||
Observer = "NEW HORIZONS",
|
||||
Body = "PLUTO",
|
||||
BodyFrame = "IAU_PLUTO",
|
||||
MainFrame = "GALACTIC",
|
||||
Aberration = "NONE",
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = {0, 0, 0, 5}
|
||||
}
|
||||
},
|
||||
-- PlutoBarycentricTrail module
|
||||
-- PlutoBarycentricTrail module
|
||||
{
|
||||
Name = "PlutoBarycentricTrail",
|
||||
Parent = "PlutoBarycenter",
|
||||
@@ -276,5 +276,5 @@ return {
|
||||
},
|
||||
},
|
||||
GuiName = "/Solar/PlutoTrail"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ return {
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "STYX",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "STYX",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 0.75 , 4 },
|
||||
@@ -83,5 +83,5 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/CharonTrail"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,21 +3,21 @@ return {
|
||||
{
|
||||
Name = "PlanetCoordinates",
|
||||
Parent = "JupiterBarycenter",
|
||||
Static = true,
|
||||
Static = true,
|
||||
Renderable = {
|
||||
Type = "RenderableSphericalGrid",
|
||||
GridType = "GALACTIC",
|
||||
GridColor = { 0.2, 0.2, 0.2, 1},
|
||||
ParentsRotation = "IAU_JUPITER",
|
||||
GridSegments = 36,
|
||||
GridRadius = { 0.72, 8 },
|
||||
},
|
||||
Ephemeris = {
|
||||
GridType = "GALACTIC",
|
||||
GridColor = { 0.2, 0.2, 0.2, 1},
|
||||
ParentsRotation = "IAU_JUPITER",
|
||||
GridSegments = 36,
|
||||
GridRadius = { 0.72, 8 },
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static" -- for now, might change.
|
||||
},
|
||||
|
||||
--[[
|
||||
Ephemeris = {
|
||||
|
||||
--[[
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "EARTH",
|
||||
Reference = "ECLIPJ2000",
|
||||
@@ -25,8 +25,8 @@ return {
|
||||
Kernels = {
|
||||
"kernels/earth.bsp"
|
||||
}
|
||||
},
|
||||
--]]
|
||||
},
|
||||
--]]
|
||||
GuiName = "/Grid/Galactic"
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,8 @@ return {
|
||||
Parent = "PlutoBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "PLUTO",
|
||||
Frame = "IAU_PLUTO",
|
||||
Body = "PLUTO",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.173 , 6 },
|
||||
@@ -46,7 +46,7 @@ return {
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp",
|
||||
-- "${OPENSPACE_DATA}/spice/Pluto/EPHEMERIDES/nh_plu017.bsp"
|
||||
-- "C:/Users/michal/NewHorizons/SPICE/nh_plu017.bsp"
|
||||
-- "C:/Users/michal/NewHorizons/SPICE/nh_plu017.bsp"
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
@@ -56,7 +56,7 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/Planets/Pluto"
|
||||
},
|
||||
--[[
|
||||
--[[
|
||||
-- PlutoTrail module
|
||||
{
|
||||
Name = "PlutoTrail",
|
||||
|
||||
@@ -1,3 +1,35 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
openspace.time.setTime("2011 JUL 28 12:00:00")
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after all objects in the scene have been
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", true)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", true)
|
||||
--openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTrail.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTexture.renderable.enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
|
||||
@@ -14,8 +14,8 @@ return {
|
||||
Parent = "SaturnBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_SATURN",
|
||||
Body = "SATURN BARYCENTER",
|
||||
Frame = "IAU_SATURN",
|
||||
Body = "SATURN BARYCENTER",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 5.8232, 7 },
|
||||
|
||||
@@ -4,8 +4,8 @@ return {
|
||||
Name = "SolarSystemBarycenter",
|
||||
Parent = "SolarSystem",
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
},
|
||||
Type = "Static",
|
||||
},
|
||||
},
|
||||
|
||||
-- Sun module
|
||||
@@ -14,8 +14,8 @@ return {
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_SUN",
|
||||
Body = "SUN",
|
||||
Frame = "IAU_SUN",
|
||||
Body = "SUN",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 2.783200, 9 },
|
||||
@@ -72,7 +72,7 @@ return {
|
||||
Billboard = true,
|
||||
Texture = "textures/marker.png"
|
||||
},
|
||||
Ephemeris = {
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = {0, 0, 0, 5}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ return {
|
||||
Parent = "UranusBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_URANUS",
|
||||
Body = "URANUS BARYCENTER",
|
||||
Frame = "IAU_URANUS",
|
||||
Body = "URANUS BARYCENTER",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 2.5362 , 7 },
|
||||
|
||||
@@ -14,8 +14,8 @@ return {
|
||||
Parent = "VenusBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_VENUS",
|
||||
Body = "VENUS",
|
||||
Frame = "IAU_VENUS",
|
||||
Body = "VENUS",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 3.760, 6 },
|
||||
|
||||
Submodule ext/ghoul updated: 11bac4f34a...960bf261b1
@@ -104,7 +104,7 @@ public:
|
||||
void enableBarrier();
|
||||
void disableBarrier();
|
||||
|
||||
void runSettingsScripts();
|
||||
void runPostInitializationScripts(const std::string& sceneDescription);
|
||||
|
||||
private:
|
||||
OpenSpaceEngine(std::string programName, std::unique_ptr<WindowWrapper> windowWrapper);
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
bool loadSpiceKernels();
|
||||
void loadFonts();
|
||||
void runScripts(const ghoul::Dictionary& scripts);
|
||||
void runStartupScripts();
|
||||
void runPreInitializationScripts(const std::string& sceneDescription);
|
||||
void configureLogging();
|
||||
|
||||
// Components
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
// Needs to mirror struct on host
|
||||
struct KernelConstants {
|
||||
float stepSize;
|
||||
float intensity;
|
||||
int aDim;
|
||||
int bDim;
|
||||
int cDim;
|
||||
};
|
||||
|
||||
|
||||
// Turn normalized [0..1] coordinates into array index
|
||||
int CoordsToIndex(float3 _coordinates,
|
||||
int3 _dimensions) {
|
||||
// Put coords in [0 .. dim-1] range
|
||||
int x = (float)(_dimensions.x-1) * _coordinates.x;
|
||||
int y = (float)(_dimensions.y-1) * _coordinates.y;
|
||||
int z = (float)(_dimensions.z-1) * _coordinates.z;
|
||||
// Return index
|
||||
return x + y*_dimensions.x + z*_dimensions.x*_dimensions.y;
|
||||
}
|
||||
|
||||
|
||||
// Linearly interpolate between two values. Distance
|
||||
// is assumed to be normalized.
|
||||
float Lerp(float _v0, float _v1, float _d) {
|
||||
return _v0*(1.0 - _d) + _v1*_d;
|
||||
}
|
||||
|
||||
// Sample a volume given spherical integer coordinates
|
||||
float Sample(__global __read_only float *_data,
|
||||
int3 _coords,
|
||||
int3 _dims) {
|
||||
|
||||
int r = (_coords.x < _dims.x) ? _coords.x : _dims.x-1;
|
||||
int t = (_coords.y < _dims.y) ? _coords.y : _dims.y-1;
|
||||
int p = (_coords.z < _dims.z) ? _coords.z : _dims.z-1;
|
||||
int idx = r + t*_dims.x + p*_dims.x*_dims.y;
|
||||
return _data[idx];
|
||||
}
|
||||
|
||||
// Trilinear interpolation and sampling
|
||||
float Trilerp(__global __read_only float *_data,
|
||||
float3 _spherical,
|
||||
int3 _dims) {
|
||||
|
||||
// TODO fix wrap issue
|
||||
// Get coordinates in [0..dim-1] range
|
||||
float r = (float)(_dims.x-1) * _spherical.x;
|
||||
float t = (float)(_dims.y-1) * _spherical.y;
|
||||
float p = (float)(_dims.z-1) * _spherical.z;
|
||||
|
||||
// Lower values
|
||||
int r0 = (int)floor(r);
|
||||
int t0 = (int)floor(t);
|
||||
int p0 = (int)floor(p);
|
||||
|
||||
// Upper values
|
||||
int r1 = r0+1;
|
||||
int t1 = t0+1;
|
||||
int p1 = p0+1;
|
||||
|
||||
// Interpolation values
|
||||
float dr = r - floor(r);
|
||||
float dt = t - floor(t);
|
||||
float dp = p - floor(p);
|
||||
|
||||
// Sample corners
|
||||
float v000 = Sample(_data, (int3)(r0, t0, p0), _dims);
|
||||
float v100 = Sample(_data, (int3)(r1, t0, p0), _dims);
|
||||
float v010 = Sample(_data, (int3)(r0, t1, p0), _dims);
|
||||
float v110 = Sample(_data, (int3)(r1, t1, p0), _dims);
|
||||
float v001 = Sample(_data, (int3)(r0, t0, p1), _dims);
|
||||
float v101 = Sample(_data, (int3)(r1, t0, p1), _dims);
|
||||
float v011 = Sample(_data, (int3)(r0, t1, p1), _dims);
|
||||
float v111 = Sample(_data, (int3)(r1, t1, p1), _dims);
|
||||
|
||||
// Interpolate
|
||||
float v00 = Lerp(v000, v100, dr);
|
||||
float v10 = Lerp(v010, v110, dr);
|
||||
float v01 = Lerp(v001, v101, dr);
|
||||
float v11 = Lerp(v011, v111, dr);
|
||||
float v0 = Lerp(v00, v10, dt);
|
||||
float v1 = Lerp(v01, v11, dt);
|
||||
float v = Lerp(v0, v1, dp);
|
||||
|
||||
return min(v, 1.0);
|
||||
}
|
||||
|
||||
|
||||
// Turn normalized [0..1] cartesian coordinates
|
||||
// to normalized spherical [0..1] coordinates
|
||||
float3 CartesianToSpherical(float3 _cartesian) {
|
||||
// Put cartesian in [-1..1] range first
|
||||
_cartesian = (float3)(-1.0) + 2.0* _cartesian;
|
||||
float r = length(_cartesian);
|
||||
float theta, phi;
|
||||
if (r == 0.0) {
|
||||
theta = phi = 0.0;
|
||||
} else {
|
||||
theta = acos(_cartesian.z/r) / M_PI;
|
||||
phi = (M_PI + atan2(_cartesian.y, _cartesian.x)) / (2.0*M_PI);
|
||||
}
|
||||
r = r / sqrt(3.0);
|
||||
// Sampler ignores w component
|
||||
return (float3)(r, theta, phi);
|
||||
}
|
||||
|
||||
float4 TransferFunction(__global __read_only float *_tf, float _i) {
|
||||
// TODO remove 512 hard-coded value and change to 1D texture
|
||||
int i0 = (int)floor(511.0*_i);
|
||||
int i1 = (i0 < 511) ? i0+1 : i0;
|
||||
float di = _i - floor(_i);
|
||||
|
||||
float tfr0 = _tf[i0*4+0];
|
||||
float tfr1 = _tf[i1*4+0];
|
||||
float tfg0 = _tf[i0*4+1];
|
||||
float tfg1 = _tf[i1*4+1];
|
||||
float tfb0 = _tf[i0*4+2];
|
||||
float tfb1 = _tf[i1*4+2];
|
||||
float tfa0 = _tf[i0*4+3];
|
||||
float tfa1 = _tf[i1*4+3];
|
||||
|
||||
float tfr = Lerp(tfr0, tfr1, di);
|
||||
float tfg = Lerp(tfg0, tfg1, di);
|
||||
float tfb = Lerp(tfb0, tfb1, di);
|
||||
float tfa = Lerp(tfa0, tfa1, di);
|
||||
|
||||
return (float4)(tfr, tfg, tfb, tfa);
|
||||
}
|
||||
|
||||
__kernel void
|
||||
Raycaster(__global __read_only image2d_t _cubeFront,
|
||||
__global __read_only image2d_t _cubeBack,
|
||||
__global __write_only image2d_t _output,
|
||||
__global __read_only float * _voxelData,
|
||||
__constant struct KernelConstants *_constants,
|
||||
__global __read_only float *_tf) {
|
||||
|
||||
|
||||
int3 dimensions = (int3)(_constants->aDim,
|
||||
_constants->bDim,
|
||||
_constants->cDim);
|
||||
|
||||
// Kernel should be launched in 2D with one work item per pixel
|
||||
int idx = get_global_id(0);
|
||||
int idy = get_global_id(1);
|
||||
int2 intCoords = (int2)(idx, idy);
|
||||
|
||||
// Sampler for texture reading
|
||||
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
|
||||
const sampler_t volumeSampler = CLK_FILTER_LINEAR |
|
||||
CLK_NORMALIZED_COORDS_TRUE |
|
||||
CLK_ADDRESS_CLAMP_TO_EDGE;
|
||||
|
||||
// Read from textures
|
||||
float4 cubeFrontColor = read_imagef(_cubeFront, sampler, intCoords);
|
||||
float4 cubeBackColor = read_imagef(_cubeBack, sampler, intCoords);
|
||||
|
||||
// Figure out the direction
|
||||
float3 direction = (cubeBackColor-cubeFrontColor).xyz;
|
||||
float maxDistance = length(direction);
|
||||
direction = normalize(direction);
|
||||
|
||||
// Keep track of distance traversed
|
||||
float traversed = 0.0;
|
||||
|
||||
// Sum colors
|
||||
float stepSize = _constants->stepSize;
|
||||
float3 samplePoint = cubeFrontColor.xyz;
|
||||
float3 spherical;
|
||||
float4 associatedColor;
|
||||
float4 color = (float4)(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
while (traversed < maxDistance) {
|
||||
spherical = CartesianToSpherical(samplePoint);
|
||||
|
||||
//int index = timestepOffset + CoordsToIndex(spherical, dimensions);
|
||||
// Get intensity from data
|
||||
//float i = _voxelData[index];
|
||||
float i = Trilerp(_voxelData, spherical, dimensions);
|
||||
|
||||
// Texture stores intensity in R channel
|
||||
//float i = read_imagef(_voxelData, volumeSampler, spherical).x;
|
||||
|
||||
// Front-to-back compositing
|
||||
float4 tf = TransferFunction(_tf, i);
|
||||
color += (1.0 - color.w)*tf;
|
||||
|
||||
// color += (float4)(i, i, i, 1.0);
|
||||
samplePoint += direction * stepSize;
|
||||
traversed += stepSize;
|
||||
}
|
||||
|
||||
// Output
|
||||
float intensity = _constants->intensity;
|
||||
color *= intensity*stepSize;
|
||||
|
||||
// Write to image
|
||||
write_imagef(_output, intCoords, color);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,297 +0,0 @@
|
||||
// Needs to mirror struct on host
|
||||
struct KernelConstants {
|
||||
float stepSize;
|
||||
float intensity;
|
||||
int numBoxesPerAxis;
|
||||
};
|
||||
|
||||
// Linearly interpolate between two values. Distance
|
||||
// is assumed to be normalized.
|
||||
float Lerp(float _v0, float _v1, float _d) {
|
||||
return _v0*(1.0 - _d) + _v1*_d;
|
||||
}
|
||||
|
||||
|
||||
// Turn normalized [0..1] cartesian coordinates
|
||||
// to normalized spherical [0..1] coordinates
|
||||
float3 CartesianToSpherical(float3 _cartesian) {
|
||||
// Put cartesian in [-1..1] range first
|
||||
_cartesian = (float3)(-1.0) + 2.0* _cartesian;
|
||||
float r = length(_cartesian);
|
||||
float theta, phi;
|
||||
if (r == 0.0) {
|
||||
theta = phi = 0.0;
|
||||
} else {
|
||||
theta = acospi(_cartesian.z/r);
|
||||
phi = (M_PI + atan2(_cartesian.y, _cartesian.x)) / (2.0*M_PI);
|
||||
}
|
||||
r = r / native_sqrt(3.0);
|
||||
// Sampler ignores w component
|
||||
return (float3)(r, theta, phi);
|
||||
}
|
||||
|
||||
float4 TransferFunction(__global __read_only float *_tf, float _i) {
|
||||
// TODO remove hard-coded value and change to 1D texture
|
||||
int i0 = (int)floor(1023.0*_i);
|
||||
int i1 = (i0 < 1023) ? i0+1 : i0;
|
||||
float di = _i - floor(_i);
|
||||
|
||||
float tfr0 = _tf[i0*4+0];
|
||||
float tfr1 = _tf[i1*4+0];
|
||||
float tfg0 = _tf[i0*4+1];
|
||||
float tfg1 = _tf[i1*4+1];
|
||||
float tfb0 = _tf[i0*4+2];
|
||||
float tfb1 = _tf[i1*4+2];
|
||||
float tfa0 = _tf[i0*4+3];
|
||||
float tfa1 = _tf[i1*4+3];
|
||||
|
||||
float tfr = Lerp(tfr0, tfr1, di);
|
||||
float tfg = Lerp(tfg0, tfg1, di);
|
||||
float tfb = Lerp(tfb0, tfb1, di);
|
||||
float tfa = Lerp(tfa0, tfa1, di);
|
||||
|
||||
return (float4)(tfr, tfg, tfb, tfa);
|
||||
}
|
||||
|
||||
// Translates a global volume coordinate [0..1] to a box coordinate,
|
||||
// given a number of boxes that fit along each axis
|
||||
int3 BoxCoords(float3 _globalCoords, int _boxesPerAxis) {
|
||||
int3 boxCoords = convert_int3(floor(_globalCoords * (float)_boxesPerAxis));
|
||||
return clamp(boxCoords, (int3)(0, 0, 0), (int3)(_boxesPerAxis-1));
|
||||
}
|
||||
|
||||
// Calculate global volume coordinates for the corners of a box, given
|
||||
// the box's coordinates [0..NumBoxesPerAxis] and the number of boxes
|
||||
// that fit along each axis
|
||||
void BoxCorners(int3 _boxCoords, float3 *_minCorner, float3 *_maxCorner,
|
||||
int _boxesPerAxis) {
|
||||
// TODO figure out a better way to handle offsets
|
||||
*_minCorner = convert_float3(_boxCoords) / (float)_boxesPerAxis +
|
||||
(float3)(0.00001);
|
||||
*_maxCorner = convert_float3((_boxCoords+1)) / (float)_boxesPerAxis -
|
||||
(float3)(0.00001);
|
||||
}
|
||||
|
||||
|
||||
// Intersect a ray specifiec by origin and direction
|
||||
// with a box specified by opposing corners.
|
||||
// Returns intersect/no intersect along with t values
|
||||
// for intersections points.
|
||||
bool IntersectBox(float3 _boundsMin, float3 _boundsMax,
|
||||
float3 _rayO, float3 _rayD,
|
||||
float *_tMinOut, float *_tMaxOut) {
|
||||
|
||||
float _tMin, _tMax, tYMin, tYMax, tZMin, tZMax;
|
||||
float divx = 1.0/_rayD.x;
|
||||
if (divx >= 0.0) {
|
||||
_tMin = (_boundsMin.x - _rayO.x) * divx;
|
||||
_tMax = (_boundsMax.x - _rayO.x) * divx;
|
||||
} else {
|
||||
_tMin = (_boundsMax.x - _rayO.x) * divx;
|
||||
_tMax = (_boundsMin.x - _rayO.x) * divx;
|
||||
}
|
||||
float divy = 1.0/_rayD.y;
|
||||
if (divy >= 0.0) {
|
||||
tYMin = (_boundsMin.y - _rayO.y) * divy;
|
||||
tYMax = (_boundsMax.y - _rayO.y) * divy;
|
||||
} else {
|
||||
tYMin = (_boundsMax.y - _rayO.y) * divy;
|
||||
tYMax = (_boundsMin.y - _rayO.y) * divy;
|
||||
}
|
||||
if ( (_tMin > tYMax || tYMin > _tMax) ) return false;
|
||||
if (tYMin > _tMin) _tMin = tYMin;
|
||||
if (tYMax < _tMax) _tMax = tYMax;
|
||||
float divz = 1.0/_rayD.z;
|
||||
if (divz >= 0.0) {
|
||||
tZMin = (_boundsMin.z - _rayO.z) * divz;
|
||||
tZMax = (_boundsMax.z - _rayO.z) * divz;
|
||||
} else {
|
||||
tZMin = (_boundsMax.z - _rayO.z) * divz;
|
||||
tZMax = (_boundsMin.z - _rayO.z) * divz;
|
||||
}
|
||||
if ( (_tMin > tZMax || tZMin > _tMax) ) return false;
|
||||
if (tZMin > _tMin) _tMin = tZMin;
|
||||
if (tZMax < _tMax) _tMax = tZMax;
|
||||
*_tMinOut = _tMin;
|
||||
*_tMaxOut = _tMax;
|
||||
return ( (_tMin < 1e20 && _tMax > -1e20 ) );
|
||||
}
|
||||
|
||||
|
||||
int3 BrickAtlasCoords(int3 _boxCoords,
|
||||
__global int *_boxList,
|
||||
int _numBoxesPerAxis) {
|
||||
int boxIndex = _boxCoords.x +
|
||||
_boxCoords.y*_numBoxesPerAxis +
|
||||
_boxCoords.z*_numBoxesPerAxis*_numBoxesPerAxis;
|
||||
int x = _boxList[5*boxIndex+1];
|
||||
int y = _boxList[5*boxIndex+2];
|
||||
int z = _boxList[5*boxIndex+3];
|
||||
return (int3)(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
int BrickSize(int3 _boxCoords,
|
||||
__global int * _brickList,
|
||||
int _numBoxesPerAxis) {
|
||||
int boxIndex = _boxCoords.x +
|
||||
_boxCoords.y*_numBoxesPerAxis +
|
||||
_boxCoords.z*_numBoxesPerAxis*_numBoxesPerAxis;
|
||||
return _brickList[5*boxIndex+4];
|
||||
}
|
||||
|
||||
|
||||
// Traverse one brick, sampling individual voxels
|
||||
float4 TraverseBrick(__global __read_only image3d_t _textureAtlas,
|
||||
__global __read_only float *_tf,
|
||||
int3 _brickAtlasCoords, int _numBoxesPerAxis,
|
||||
int _brickSize, float _globalStepSize,
|
||||
float3 _brickEntry, float3 _brickExit) {
|
||||
|
||||
// Number of bricks of this size for each axix
|
||||
int numBricksPerAxis = _numBoxesPerAxis/_brickSize;
|
||||
// Find brick coordinates [0 .. NumBricksPerAxis]
|
||||
// Also taking brick size into account
|
||||
int3 brickCoords = BoxCoords(_brickEntry, numBricksPerAxis);
|
||||
|
||||
float numBoxesPerAxisf = (float)_numBoxesPerAxis;
|
||||
float numBricksPerAxisf = (float)numBricksPerAxis;
|
||||
|
||||
// Calculate local brick entry and exit coordinates [0..1]
|
||||
float3 localEntryCoords = numBricksPerAxisf *
|
||||
(_brickEntry - convert_float3(brickCoords)/numBricksPerAxisf);
|
||||
float3 localExitCoords = numBricksPerAxisf *
|
||||
(_brickExit - convert_float3(brickCoords)/numBricksPerAxisf);
|
||||
|
||||
// Calculate offset into texture atlas
|
||||
float3 offset = convert_float3(_brickAtlasCoords)/numBoxesPerAxisf;
|
||||
float3 atlasEntry = localEntryCoords/numBoxesPerAxisf + offset;
|
||||
float3 atlasExit = localExitCoords/numBoxesPerAxisf + offset;
|
||||
|
||||
float3 direction = atlasExit - atlasEntry;
|
||||
float maxDistance = length(atlasExit - atlasEntry);
|
||||
direction = normalize(direction);
|
||||
|
||||
float localStepSize = _globalStepSize * (float)_brickSize;
|
||||
float4 color = (float4)(0.0, 0.0, 0.0, 0.0);
|
||||
float traversed = 0.0;
|
||||
float3 samplePoint = atlasEntry;
|
||||
float4 spherical;
|
||||
const sampler_t atlasSampler = CLK_FILTER_LINEAR |
|
||||
CLK_NORMALIZED_COORDS_TRUE |
|
||||
CLK_ADDRESS_CLAMP_TO_EDGE;
|
||||
|
||||
while (traversed < maxDistance) {
|
||||
spherical.xyz = CartesianToSpherical(samplePoint);
|
||||
spherical.w = 1.0;
|
||||
|
||||
// Texture stores intensity in R channel
|
||||
float i = read_imagef(_textureAtlas, atlasSampler, spherical).x;
|
||||
|
||||
// Front-to-back compositing
|
||||
float4 tf = TransferFunction(_tf, i);
|
||||
color += (1.0 - color.w)*tf;
|
||||
|
||||
traversed += localStepSize;
|
||||
samplePoint += localStepSize * direction;
|
||||
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
__kernel void
|
||||
Raycaster(__global __read_only image2d_t _cubeFront,
|
||||
__global __read_only image2d_t _cubeBack,
|
||||
__global __write_only image2d_t _output,
|
||||
__global __read_only image3d_t _textureAtlas,
|
||||
__constant struct KernelConstants *_constants,
|
||||
__global __read_only float *_tf,
|
||||
__global int *_brickList) {
|
||||
|
||||
// Kernel should be launched in 2D with one work item per pixel
|
||||
int idx = get_global_id(0);
|
||||
int idy = get_global_id(1);
|
||||
int2 intCoords = (int2)(idx, idy);
|
||||
|
||||
// Sampler for texture reading
|
||||
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
|
||||
|
||||
// Read from textures
|
||||
float4 cubeFrontColor = read_imagef(_cubeFront, sampler, intCoords);
|
||||
float4 cubeBackColor = read_imagef(_cubeBack, sampler, intCoords);
|
||||
|
||||
// Figure out the direction
|
||||
float3 direction = (cubeBackColor-cubeFrontColor).xyz;
|
||||
float maxDistance = length(direction);
|
||||
direction = normalize(direction);
|
||||
float3 origin = cubeFrontColor.xyz - 0.001 * direction;
|
||||
|
||||
|
||||
// Keep track of distance traversed
|
||||
float traversed = 0.0;
|
||||
|
||||
// Sum colors
|
||||
float stepSize = _constants->stepSize;
|
||||
float3 samplePoint = cubeFrontColor.xyz;
|
||||
float4 color = (float4)(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
// TODO temp
|
||||
float a, b;
|
||||
if (IntersectBox((float3)(0.0), (float3)(1.0), origin, direction, &a, &b)) {
|
||||
color += (float4)(0.0, 0.0, 0.08, 1.0);
|
||||
}
|
||||
|
||||
while (traversed < maxDistance) {
|
||||
|
||||
int numBoxesPerAxis = _constants->numBoxesPerAxis;
|
||||
|
||||
// Convert the sample point to coords
|
||||
int3 boxCoords = BoxCoords(samplePoint, numBoxesPerAxis);
|
||||
// Lookup brick coords and size
|
||||
int3 brickAtlasCoords = BrickAtlasCoords(boxCoords,
|
||||
_brickList,
|
||||
numBoxesPerAxis);
|
||||
int brickSize = BrickSize(boxCoords, _brickList, numBoxesPerAxis);
|
||||
|
||||
// Calculate the box's corners
|
||||
float3 minCorner, maxCorner;
|
||||
BoxCorners(boxCoords, &minCorner, &maxCorner, numBoxesPerAxis);
|
||||
|
||||
// Intersect ray with box
|
||||
float tMin, tMax;
|
||||
IntersectBox(minCorner, maxCorner, origin, direction, &tMin, &tMax);
|
||||
|
||||
float3 brickEntry = origin + tMin*direction;
|
||||
// TODO calculate BRICK exit
|
||||
float3 brickExit = origin + tMax*direction;
|
||||
float brickDist = length(brickExit - brickEntry);
|
||||
|
||||
// Traverse brick
|
||||
float4 brickColor = TraverseBrick(_textureAtlas, _tf,
|
||||
brickAtlasCoords, numBoxesPerAxis,
|
||||
brickSize, stepSize,
|
||||
brickEntry, brickExit);
|
||||
|
||||
// Compositing
|
||||
color += (1.0 - brickColor.w)*brickColor;
|
||||
|
||||
// Advance ray
|
||||
samplePoint = brickExit;
|
||||
traversed += brickDist;
|
||||
|
||||
// color += (float4)(i, i, i, 1.0);
|
||||
samplePoint += direction * stepSize;
|
||||
traversed += stepSize;
|
||||
}
|
||||
|
||||
// Output
|
||||
float intensity = _constants->intensity;
|
||||
color *= intensity*stepSize;
|
||||
|
||||
// Write to image
|
||||
write_imagef(_output, intCoords, color);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,579 +0,0 @@
|
||||
struct KernelConstants {
|
||||
int gridType_;
|
||||
float stepsize_;
|
||||
float intensity_;
|
||||
int numTimesteps_;
|
||||
int numValuesPerNode_;
|
||||
int numOTNodes_;
|
||||
int numBoxesPerAxis_;
|
||||
float temporalTolerance_;
|
||||
float spatialTolerance_;
|
||||
int rootLevel_;
|
||||
int paddedBrickDim_;
|
||||
};
|
||||
|
||||
float3 CartesianToSpherical(float3 _cartesian);
|
||||
float Lerp(float _v0, float _v1, float _d);
|
||||
int LeftBST(int _bstNodeIndex, int _numValuesPerNode, int _numOTNodes,
|
||||
bool _bstRoot, __global __read_only int *_tsp);
|
||||
int RightBST(int _bstNodeIndex, int _numValuesPerNode, int _numOTNodes,
|
||||
bool _bstRoot, __global __read_only int *_tsp);
|
||||
int ChildNodeIndex(int _bstNodeIndex,
|
||||
int *_timespanStart,
|
||||
int *_timespanEnd,
|
||||
int _timestep,
|
||||
int _numValuesPerNode,
|
||||
int _numOTNodes,
|
||||
bool _bstRoot,
|
||||
__global __read_only int *_tsp);
|
||||
int BrickIndex(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp);
|
||||
bool IsBSTLeaf(int _bstNodeIndex, int _numValuesPerNode,
|
||||
bool _bstRoot, __global __read_only int *_tsp);
|
||||
bool IsOctreeLeaf(int _otNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp);
|
||||
int OTChildIndex(int _otNodeIndex, int _numValuesPerNode,
|
||||
int _child,
|
||||
__global __read_only int *_tsp) ;
|
||||
float TemporalError(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) ;
|
||||
float SpatialError(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp);
|
||||
int3 BoxCoords(float3 _globalCoords, int _boxesPerAxis) ;
|
||||
int3 AtlasBoxCoords(int _brickIndex,
|
||||
__global __read_only int *_brickList);
|
||||
float3 AtlasCoords(float3 _globalCoords, int _brickIndex, int _boxesPerAxis,
|
||||
int _paddedBrickDim, int _level,
|
||||
__global __read_only int *_brickList) ;
|
||||
void SampleAtlas(float4 *_color, float3 _coords, int _brickIndex,
|
||||
int _boxesPerAxis, int _paddedBrickDim, int _level,
|
||||
const sampler_t _atlasSampler,
|
||||
__read_only image3d_t _textureAtlas,
|
||||
__read_only image2d_t _transferFunction,
|
||||
const sampler_t _tfSampler,
|
||||
__global __read_only int *_brickList);
|
||||
bool TraverseBST(int _otNodeIndex, int *_brickIndex,
|
||||
__constant __read_only struct KernelConstants *_constants,
|
||||
__global __read_only int *_tsp, const int _timestep);
|
||||
int EnclosingChild(float3 _P, float _boxMid, float3 _offset) ;
|
||||
void UpdateOffset(float3 *_offset, float _boxDim, int _child) ;
|
||||
float4 TraverseOctree(float3 _rayO, float3 _rayD, float _maxDist,
|
||||
__read_only image3d_t _textureAtlas,
|
||||
__constant struct KernelConstants *_constants,
|
||||
__read_only image2d_t _transferFunction,
|
||||
__global __read_only int *_tsp,
|
||||
__global __read_only int *_brickList,
|
||||
const int _timestep);
|
||||
__kernel void RaycasterTSP(__read_only image2d_t _cubeFront,
|
||||
__read_only image2d_t _cubeBack,
|
||||
__write_only image2d_t _output,
|
||||
__read_only image3d_t _textureAtlas,
|
||||
__constant struct KernelConstants *_constants,
|
||||
__read_only image2d_t _transferFunction,
|
||||
//__global __read_only float *_transferFunction,
|
||||
__global __read_only int *_tsp,
|
||||
__global __read_only int *_brickList,
|
||||
const int _timestep);
|
||||
|
||||
|
||||
|
||||
// Turn normalized [0..1] cartesian coordinates
|
||||
// to normalized spherical [0..1] coordinates
|
||||
float3 CartesianToSpherical(float3 _cartesian) {
|
||||
// Put cartesian in [-1..1] range first
|
||||
_cartesian = (float3)(-1.0) + 2.0f* _cartesian;
|
||||
float r = length(_cartesian);
|
||||
float theta, phi;
|
||||
if (r == 0.0) {
|
||||
theta = phi = 0.0;
|
||||
} else {
|
||||
theta = acospi(_cartesian.z/r);
|
||||
phi = (M_PI + atan2(_cartesian.y, _cartesian.x)) / (2.0*M_PI);
|
||||
}
|
||||
r = r / native_sqrt(3.0f);
|
||||
// Sampler ignores w component
|
||||
return (float3)(r, theta, phi);
|
||||
}
|
||||
|
||||
// Linearly interpolate between two values. Distance
|
||||
// is assumed to be normalized.
|
||||
float Lerp(float _v0, float _v1, float _d) {
|
||||
return _v0*(1.0 - _d) + _v1*_d;
|
||||
}
|
||||
|
||||
/*
|
||||
float4 TransferFunction(__global __read_only image2d_t _tf,
|
||||
const sampler_t _tfSampler,
|
||||
float _i) {
|
||||
// TODO remove hard-coded value and change to 1D texture
|
||||
int i0 = (int)floor(1023.0*_i);
|
||||
int i1 = (i0 < 1023) ? i0+1 : i0;
|
||||
float di = _i - floor(_i);
|
||||
|
||||
float tfr0 = _tf[i0*4+0];
|
||||
float tfr1 = _tf[i1*4+0];
|
||||
float tfg0 = _tf[i0*4+1];
|
||||
float tfg1 = _tf[i1*4+1];
|
||||
float tfb0 = _tf[i0*4+2];
|
||||
float tfb1 = _tf[i1*4+2];
|
||||
float tfa0 = _tf[i0*4+3];
|
||||
float tfa1 = _tf[i1*4+3];
|
||||
|
||||
float tfr = Lerp(tfr0, tfr1, di);
|
||||
float tfg = Lerp(tfg0, tfg1, di);
|
||||
float tfb = Lerp(tfb0, tfb1, di);
|
||||
float tfa = Lerp(tfa0, tfa1, di);
|
||||
|
||||
return clamp((float4)(tfr, tfg, tfb, tfa), (float4)(0.0), (float4)(1.0));
|
||||
//return (float4)(tfr, tfg, tfb, tfa);
|
||||
float2 sampleCoords = (float2)(1.0, _i);
|
||||
return read_imagef(_tf, _tfSampler, sampleCoords);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Return index to the octree root (same index as BST root at that OT node)
|
||||
int OctreeRootNodeIndex() {
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
// Return index to left BST child (low timespan)
|
||||
int LeftBST(int _bstNodeIndex, int _numValuesPerNode, int _numOTNodes,
|
||||
bool _bstRoot, __global __read_only int *_tsp) {
|
||||
// If the BST node is a root, the child pointer is used for the OT.
|
||||
// The child index is next to the root.
|
||||
// If not root, look up in TSP structure.
|
||||
if (_bstRoot) {
|
||||
return _bstNodeIndex + _numOTNodes;
|
||||
} else {
|
||||
return _tsp[_bstNodeIndex*_numValuesPerNode + 1];
|
||||
}
|
||||
}
|
||||
|
||||
// Return index to right BST child (high timespan)
|
||||
int RightBST(int _bstNodeIndex, int _numValuesPerNode, int _numOTNodes,
|
||||
bool _bstRoot, __global __read_only int *_tsp) {
|
||||
if (_bstRoot) {
|
||||
return _bstNodeIndex + _numOTNodes*2;
|
||||
} else {
|
||||
return _tsp[_bstNodeIndex*_numValuesPerNode + 1] + _numOTNodes;
|
||||
}
|
||||
}
|
||||
|
||||
// Return child node index given a BST node, a time span and a timestep
|
||||
// Updates timespan
|
||||
int ChildNodeIndex(int _bstNodeIndex,
|
||||
int *_timespanStart,
|
||||
int *_timespanEnd,
|
||||
int _timestep,
|
||||
int _numValuesPerNode,
|
||||
int _numOTNodes,
|
||||
bool _bstRoot,
|
||||
__global __read_only int *_tsp) {
|
||||
// Choose left or right child
|
||||
int middle = *_timespanStart + (*_timespanEnd - *_timespanStart)/2;
|
||||
if (_timestep <= middle) {
|
||||
// Left subtree
|
||||
*_timespanEnd = middle;
|
||||
return LeftBST(_bstNodeIndex, _numValuesPerNode, _numOTNodes,
|
||||
_bstRoot, _tsp);
|
||||
} else {
|
||||
// Right subtree
|
||||
*_timespanStart = middle+1;
|
||||
return RightBST(_bstNodeIndex, _numValuesPerNode, _numOTNodes,
|
||||
_bstRoot, _tsp);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the brick index that a BST node represents
|
||||
int BrickIndex(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) {
|
||||
return _tsp[_bstNodeIndex*_numValuesPerNode + 0];
|
||||
}
|
||||
|
||||
// Checks if a BST node is a leaf ot not
|
||||
bool IsBSTLeaf(int _bstNodeIndex, int _numValuesPerNode,
|
||||
bool _bstRoot, __global __read_only int *_tsp) {
|
||||
if (_bstRoot) return false;
|
||||
return (_tsp[_bstNodeIndex*_numValuesPerNode + 1] == -1);
|
||||
}
|
||||
|
||||
// Checks if an OT node is a leaf or not
|
||||
bool IsOctreeLeaf(int _otNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) {
|
||||
// CHILD_INDEX is at offset 1, and -1 represents leaf
|
||||
return (_tsp[_otNodeIndex*_numValuesPerNode + 1] == -1);
|
||||
}
|
||||
|
||||
// Return OT child index given current node and child number (0-7)
|
||||
int OTChildIndex(int _otNodeIndex, int _numValuesPerNode,
|
||||
int _child,
|
||||
__global __read_only int *_tsp) {
|
||||
int firstChild = _tsp[_otNodeIndex*_numValuesPerNode + 1];
|
||||
return firstChild + _child;
|
||||
}
|
||||
|
||||
float TemporalError(int _bstNodeIndex, int _numValuesPerNode,
|
||||
|
||||
__global __read_only int *_tsp) {
|
||||
return as_float(_tsp[_bstNodeIndex*_numValuesPerNode + 3]);
|
||||
}
|
||||
|
||||
float SpatialError(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) {
|
||||
return as_float(_tsp[_bstNodeIndex*_numValuesPerNode + 2]);
|
||||
}
|
||||
|
||||
// Converts a global coordinate [0..1] to a box coordinate [0..boxesPerAxis]
|
||||
int3 BoxCoords(float3 _globalCoords, int _boxesPerAxis) {
|
||||
int3 boxCoords = convert_int3((_globalCoords * (float)_boxesPerAxis));
|
||||
return clamp(boxCoords, (int3)(0, 0, 0), (int3)(_boxesPerAxis-1));
|
||||
}
|
||||
|
||||
// Fetch atlas box coordinates from brick list
|
||||
int3 AtlasBoxCoords(int _brickIndex,
|
||||
__global __read_only int *_brickList) {
|
||||
int x = _brickList[3*_brickIndex+0];
|
||||
int y = _brickList[3*_brickIndex+1];
|
||||
int z = _brickList[3*_brickIndex+2];
|
||||
return (int3)(x, y, z);
|
||||
}
|
||||
|
||||
// Convert a global coordinate to a local in-box coordinate, given
|
||||
// the number of boxes (of this size) per axis and the box coordinates
|
||||
float3 InBoxCoords(float3 _globalCoords, int3 _boxCoords,
|
||||
int _boxesPerAxis, int _paddedBrickDim) {
|
||||
// Calculate [0.0 1.0] box coordinates
|
||||
float3 inbox = (_globalCoords - convert_float3(_boxCoords)/(float)_boxesPerAxis)
|
||||
* (float)_boxesPerAxis;
|
||||
// Map to padding range
|
||||
float low = 1.0/(float)_paddedBrickDim;
|
||||
float high = (float)(_paddedBrickDim-1)/(float)_paddedBrickDim;
|
||||
return (float3)(low) + inbox * ((float3)(high)-(float3)(low));
|
||||
}
|
||||
|
||||
float3 AtlasCoords(float3 _globalCoords, int _brickIndex, int _boxesPerAxis,
|
||||
int _paddedBrickDim, int _level,
|
||||
__global __read_only int *_brickList) {
|
||||
|
||||
// Use current octree level to calculate dividing factor for coordinates
|
||||
int divisor = (int)pow(2.0, _level);
|
||||
|
||||
// Calculate box coordinates, taking current subdivision level into account
|
||||
int3 boxCoords = BoxCoords(_globalCoords, _boxesPerAxis/divisor);
|
||||
|
||||
// Calculate local in-box coordinates for the point
|
||||
float3 inBoxCoords = InBoxCoords(_globalCoords, boxCoords,
|
||||
_boxesPerAxis/divisor,
|
||||
_paddedBrickDim*divisor);
|
||||
|
||||
// Fetch atlas box coordinates
|
||||
int3 atlasBoxCoords = AtlasBoxCoords(_brickIndex, _brickList);
|
||||
|
||||
// Transform coordinates to atlas coordinates
|
||||
return inBoxCoords/(float)_boxesPerAxis +
|
||||
convert_float3(atlasBoxCoords)/(float)_boxesPerAxis;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Sample atlas
|
||||
void SampleAtlas(float4 *_color, float3 _coords, int _brickIndex,
|
||||
int _boxesPerAxis, int _paddedBrickDim, int _level,
|
||||
const sampler_t _atlasSampler,
|
||||
__read_only image3d_t _textureAtlas,
|
||||
__read_only image2d_t _transferFunction,
|
||||
const sampler_t _tfSampler,
|
||||
__global __read_only int *_brickList) {
|
||||
|
||||
// Find the texture atlas coordinates for the point
|
||||
float3 atlasCoords = AtlasCoords(_coords, _brickIndex,
|
||||
_boxesPerAxis, _paddedBrickDim,
|
||||
_level, _brickList);
|
||||
|
||||
int3 boxCoords = BoxCoords(_coords, _boxesPerAxis);
|
||||
|
||||
float4 a4 = (float4)(atlasCoords.x, atlasCoords.y, atlasCoords.z, 1.0);
|
||||
// Sample the atlas
|
||||
float sample = read_imagef(_textureAtlas, _atlasSampler, a4).x;
|
||||
// Composition
|
||||
float4 tf = read_imagef(_transferFunction, _tfSampler, (float2)(sample, 0.0));
|
||||
*_color += (1.0f - _color->w)*tf;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool TraverseBST(int _otNodeIndex, int *_brickIndex,
|
||||
__constant __read_only struct KernelConstants *_constants,
|
||||
__global __read_only int *_tsp, const int _timestep) {
|
||||
// Start att the root of the current BST
|
||||
int bstNodeIndex = _otNodeIndex;
|
||||
bool bstRoot = true;
|
||||
int timespanStart = 0;
|
||||
int timespanEnd = _constants->numTimesteps_;
|
||||
|
||||
while (true) {
|
||||
*_brickIndex = BrickIndex(bstNodeIndex,
|
||||
_constants->numValuesPerNode_,
|
||||
_tsp);
|
||||
|
||||
// Check temporal error
|
||||
if (TemporalError(bstNodeIndex, _constants->numValuesPerNode_, _tsp) <=
|
||||
_constants->temporalTolerance_) {
|
||||
|
||||
// If the OT node is a leaf, we cannot do any better spatially
|
||||
if (IsOctreeLeaf(_otNodeIndex, _constants->numValuesPerNode_, _tsp)) {
|
||||
return true;
|
||||
|
||||
} else if (SpatialError(bstNodeIndex, _constants->numValuesPerNode_,
|
||||
_tsp) <= _constants->spatialTolerance_) {
|
||||
return true;
|
||||
|
||||
} else if (IsBSTLeaf(bstNodeIndex, _constants->numValuesPerNode_,
|
||||
bstRoot, _tsp)) {
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
// Keep traversing
|
||||
bstNodeIndex = ChildNodeIndex(bstNodeIndex, ×panStart,
|
||||
×panEnd,
|
||||
_timestep,
|
||||
_constants->numValuesPerNode_,
|
||||
_constants->numOTNodes_,
|
||||
bstRoot, _tsp);
|
||||
}
|
||||
|
||||
} else if (IsBSTLeaf(bstNodeIndex, _constants->numValuesPerNode_,
|
||||
bstRoot, _tsp)) {
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
// Keep traversing
|
||||
bstNodeIndex = ChildNodeIndex(bstNodeIndex, ×panStart,
|
||||
×panEnd,
|
||||
_timestep,
|
||||
_constants->numValuesPerNode_,
|
||||
_constants->numOTNodes_,
|
||||
bstRoot, _tsp);
|
||||
}
|
||||
|
||||
bstRoot = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Given a point, a box mid value and an offset, return enclosing child
|
||||
int EnclosingChild(float3 _P, float _boxMid, float3 _offset) {
|
||||
if (_P.x < _boxMid+_offset.x) {
|
||||
if (_P.y < _boxMid+_offset.y) {
|
||||
if (_P.z < _boxMid+_offset.z) {
|
||||
return 0;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
} else {
|
||||
if (_P.z < _boxMid+_offset.z) {
|
||||
return 2;
|
||||
} else {
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (_P.y < _boxMid+_offset.y) {
|
||||
if (_P.z < _boxMid+_offset.z) {
|
||||
return 1;
|
||||
} else {
|
||||
return 5;
|
||||
}
|
||||
} else {
|
||||
if (_P.z < _boxMid+_offset.z) {
|
||||
return 3;
|
||||
} else {
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateOffset(float3 *_offset, float _boxDim, int _child) {
|
||||
if (_child == 0) {
|
||||
// do nothing
|
||||
} else if (_child == 1) {
|
||||
_offset->x += _boxDim;
|
||||
} else if (_child == 2) {
|
||||
_offset->y += _boxDim;
|
||||
} else if (_child == 3) {
|
||||
_offset->x += _boxDim;
|
||||
_offset->y += _boxDim;
|
||||
} else if (_child == 4) {
|
||||
_offset->z += _boxDim;
|
||||
} else if (_child == 5) {
|
||||
_offset->x += _boxDim;
|
||||
_offset->z += _boxDim;
|
||||
} else if (_child == 6) {
|
||||
_offset->y += _boxDim;
|
||||
_offset->z += _boxDim;
|
||||
} else if (_child == 7) {
|
||||
*_offset += (float3)(_boxDim);
|
||||
}
|
||||
}
|
||||
|
||||
float4 TraverseOctree(float3 _rayO, float3 _rayD, float _maxDist,
|
||||
__read_only image3d_t _textureAtlas,
|
||||
__constant struct KernelConstants *_constants,
|
||||
__read_only image2d_t _transferFunction,
|
||||
__global __read_only int *_tsp,
|
||||
__global __read_only int *_brickList,
|
||||
const int _timestep) {
|
||||
|
||||
float stepsize = _constants->stepsize_;
|
||||
// Sample point
|
||||
float3 cartesianP = _rayO;
|
||||
// Keep track of distance traveled along ray
|
||||
float traversed = 0;
|
||||
// Cumulative color for ray to return
|
||||
float4 color = (float4)(0.0);
|
||||
|
||||
// Sampler for texture atlas
|
||||
const sampler_t atlasSampler = CLK_FILTER_LINEAR |
|
||||
CLK_NORMALIZED_COORDS_TRUE |
|
||||
CLK_ADDRESS_CLAMP_TO_EDGE;
|
||||
|
||||
|
||||
// Sampler for transfer function texture
|
||||
const sampler_t tfSampler = CLK_FILTER_LINEAR |
|
||||
CLK_NORMALIZED_COORDS_TRUE |
|
||||
CLK_ADDRESS_CLAMP_TO_EDGE;
|
||||
|
||||
// Traverse until sample point is outside of volume
|
||||
while (traversed < _maxDist) {
|
||||
|
||||
// Reset octree traversal variables
|
||||
float3 offset = (float3)(0.0);
|
||||
float boxDim = 1.0;
|
||||
bool foundBrick = false;
|
||||
int child;
|
||||
int level = _constants->rootLevel_;
|
||||
|
||||
int otNodeIndex = 0;
|
||||
|
||||
// Rely on finding a leaf for loop termination
|
||||
while (true) {
|
||||
|
||||
// Traverse BST to get a brick index, and see if the found brick
|
||||
// is good enough
|
||||
int brickIndex;
|
||||
bool bstSuccess = TraverseBST(otNodeIndex,
|
||||
&brickIndex,
|
||||
_constants,
|
||||
_tsp,
|
||||
_timestep);
|
||||
|
||||
// Convert to spherical if needed
|
||||
float3 sampleP;
|
||||
if (_constants->gridType_ == 0) { // cartesian
|
||||
sampleP = cartesianP;
|
||||
} else { // spherical ( == 1)
|
||||
sampleP = CartesianToSpherical(cartesianP);
|
||||
}
|
||||
|
||||
if (bstSuccess ||
|
||||
IsOctreeLeaf(otNodeIndex, _constants->numValuesPerNode_, _tsp)) {
|
||||
|
||||
//float s = 0.008*SpatialError(brickIndex, 4, _tsp);
|
||||
//color += (float4)(s);
|
||||
|
||||
|
||||
// Sample the brick
|
||||
SampleAtlas(&color, sampleP, brickIndex,
|
||||
_constants->numBoxesPerAxis_,
|
||||
_constants->paddedBrickDim_,
|
||||
level,
|
||||
atlasSampler, _textureAtlas,
|
||||
_transferFunction,
|
||||
tfSampler, _brickList);
|
||||
break;
|
||||
|
||||
} else {
|
||||
|
||||
// Keep traversing the octree
|
||||
|
||||
// Next box dimension
|
||||
boxDim /= 2.0f;
|
||||
|
||||
// Current mid point
|
||||
float boxMid = boxDim;
|
||||
|
||||
// Check which child encloses the sample point
|
||||
child = EnclosingChild(sampleP, boxMid, offset);
|
||||
|
||||
// Update offset for next level
|
||||
UpdateOffset(&offset, boxDim, child);
|
||||
|
||||
// Update index to new node
|
||||
otNodeIndex = OTChildIndex(otNodeIndex, _constants->numValuesPerNode_,
|
||||
child, _tsp);
|
||||
|
||||
level--;
|
||||
|
||||
}
|
||||
|
||||
} // while traversing
|
||||
|
||||
// Update sample point
|
||||
traversed += stepsize;
|
||||
cartesianP += stepsize * _rayD;
|
||||
|
||||
} // while (traversed < maxDist)
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
__kernel void RaycasterTSP(__read_only image2d_t _cubeFront,
|
||||
__read_only image2d_t _cubeBack,
|
||||
__write_only image2d_t _output,
|
||||
__read_only image3d_t _textureAtlas,
|
||||
__constant struct KernelConstants *_constants,
|
||||
__read_only image2d_t _transferFunction,
|
||||
//__global __read_only float *_transferFunction,
|
||||
__global __read_only int *_tsp,
|
||||
__global __read_only int *_brickList,
|
||||
const int _timestep) {
|
||||
|
||||
// Kernel should be launched in 2D with one work item per pixel
|
||||
int2 intCoords = (int2)(get_global_id(0), get_global_id(1));
|
||||
|
||||
// Sampler for color cube reading
|
||||
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
|
||||
|
||||
// Read from color cube textures
|
||||
float4 cubeFrontColor = read_imagef(_cubeFront, sampler, intCoords);
|
||||
float4 cubeBackColor = read_imagef(_cubeBack, sampler, intCoords);
|
||||
// Figure out ray direction and distance to traverse
|
||||
float3 direction = cubeBackColor.xyz - cubeFrontColor.xyz;
|
||||
|
||||
float maxDist = length(direction);
|
||||
|
||||
direction = normalize(direction);
|
||||
|
||||
float4 color = TraverseOctree(cubeFrontColor.xyz, // ray origin
|
||||
direction, // direction
|
||||
maxDist, // distance to traverse
|
||||
_textureAtlas, // voxel data atlas
|
||||
_constants, // kernel constants
|
||||
_transferFunction, // transfer function
|
||||
_tsp, // TSP tree struct
|
||||
_brickList,
|
||||
_timestep);
|
||||
|
||||
//color = 0.0001*color + cubeFrontColor;
|
||||
|
||||
write_imagef(_output, intCoords, _constants->intensity_*color);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
// Needs to mirror struct on host
|
||||
struct KernelConstants {
|
||||
float stepSize;
|
||||
float intensity;
|
||||
int aDim;
|
||||
int bDim;
|
||||
int cDim;
|
||||
};
|
||||
|
||||
// Linearly interpolate between two values. Distance
|
||||
// is assumed to be normalized.
|
||||
float Lerp(float _v0, float _v1, float _d) {
|
||||
return _v0*(1.0 - _d) + _v1*_d;
|
||||
}
|
||||
|
||||
|
||||
// Turn normalized [0..1] cartesian coordinates
|
||||
// to normalized spherical [0..1] coordinates
|
||||
float3 CartesianToSpherical(float3 _cartesian) {
|
||||
// Put cartesian in [-1..1] range first
|
||||
_cartesian = (float3)(-1.0) + 2.0* _cartesian;
|
||||
float r = length(_cartesian);
|
||||
float theta, phi;
|
||||
if (r == 0.0) {
|
||||
theta = phi = 0.0;
|
||||
} else {
|
||||
theta = acospi(_cartesian.z/r);
|
||||
phi = (M_PI + atan2(_cartesian.y, _cartesian.x)) / (2.0*M_PI);
|
||||
}
|
||||
r = r / native_sqrt(3.0);
|
||||
// Sampler ignores w component
|
||||
return (float3)(r, theta, phi);
|
||||
}
|
||||
|
||||
float4 TransferFunction(__global __read_only float *_tf, float _i) {
|
||||
// TODO remove hard-coded value and change to 1D texture
|
||||
int i0 = (int)floor(1023.0*_i);
|
||||
int i1 = (i0 < 1023) ? i0+1 : i0;
|
||||
float di = _i - floor(_i);
|
||||
|
||||
float tfr0 = _tf[i0*4+0];
|
||||
float tfr1 = _tf[i1*4+0];
|
||||
float tfg0 = _tf[i0*4+1];
|
||||
float tfg1 = _tf[i1*4+1];
|
||||
float tfb0 = _tf[i0*4+2];
|
||||
float tfb1 = _tf[i1*4+2];
|
||||
float tfa0 = _tf[i0*4+3];
|
||||
float tfa1 = _tf[i1*4+3];
|
||||
|
||||
float tfr = Lerp(tfr0, tfr1, di);
|
||||
float tfg = Lerp(tfg0, tfg1, di);
|
||||
float tfb = Lerp(tfb0, tfb1, di);
|
||||
float tfa = Lerp(tfa0, tfa1, di);
|
||||
|
||||
return (float4)(tfr, tfg, tfb, tfa);
|
||||
}
|
||||
|
||||
__kernel void
|
||||
Raycaster(__global __read_only image2d_t _cubeFront,
|
||||
__global __read_only image2d_t _cubeBack,
|
||||
__global __write_only image2d_t _output,
|
||||
__global __read_only image3d_t _voxelData,
|
||||
__constant struct KernelConstants *_constants,
|
||||
__global __read_only float *_tf) {
|
||||
|
||||
|
||||
int3 dimensions = (int3)(_constants->aDim,
|
||||
_constants->bDim,
|
||||
_constants->cDim);
|
||||
|
||||
// Kernel should be launched in 2D with one work item per pixel
|
||||
int idx = get_global_id(0);
|
||||
int idy = get_global_id(1);
|
||||
int2 intCoords = (int2)(idx, idy);
|
||||
|
||||
// Sampler for texture reading
|
||||
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
|
||||
const sampler_t volumeSampler = CLK_FILTER_LINEAR |
|
||||
CLK_NORMALIZED_COORDS_TRUE |
|
||||
CLK_ADDRESS_CLAMP_TO_EDGE;
|
||||
|
||||
// Read from textures
|
||||
float4 cubeFrontColor = read_imagef(_cubeFront, sampler, intCoords);
|
||||
float4 cubeBackColor = read_imagef(_cubeBack, sampler, intCoords);
|
||||
|
||||
// Figure out the direction
|
||||
float3 direction = (cubeBackColor-cubeFrontColor).xyz;
|
||||
float maxDistance = length(direction);
|
||||
direction = normalize(direction);
|
||||
|
||||
// Keep track of distance traversed
|
||||
float traversed = 0.0;
|
||||
|
||||
// Sum colors
|
||||
float stepSize = _constants->stepSize;
|
||||
float3 samplePoint = cubeFrontColor.xyz;
|
||||
float4 spherical;
|
||||
float4 color = (float4)(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
while (traversed < maxDistance) {
|
||||
spherical.xyz = CartesianToSpherical(samplePoint);
|
||||
spherical.w = 1.0;
|
||||
|
||||
// Texture stores intensity in R channel
|
||||
float i = read_imagef(_voxelData, volumeSampler, spherical).x;
|
||||
|
||||
// Front-to-back compositing
|
||||
float4 tf = TransferFunction(_tf, i);
|
||||
color += (1.0 - color.w)*tf;
|
||||
|
||||
// color += (float4)(i, i, i, 1.0);
|
||||
samplePoint += direction * stepSize;
|
||||
traversed += stepSize;
|
||||
}
|
||||
|
||||
// Output
|
||||
float intensity = _constants->intensity;
|
||||
color *= intensity*stepSize;
|
||||
|
||||
// Write to image
|
||||
write_imagef(_output, intCoords, color);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,445 +0,0 @@
|
||||
// Mirrors struct on host side
|
||||
struct TraversalConstants {
|
||||
int gridType_;
|
||||
float stepsize_;
|
||||
int numTimesteps_;
|
||||
int numValuesPerNode_;
|
||||
int numOTNodes_;
|
||||
float temporalTolerance_;
|
||||
float spatialTolerance_;
|
||||
};
|
||||
|
||||
float3 CartesianToSpherical(float3 _cartesian);
|
||||
int OctreeRootNodeIndex();
|
||||
int LeftBST(int _bstNodeIndex, int _numValuesPerNode, int _numOTNodes,
|
||||
bool _bstRoot, __global __read_only int *_tsp);
|
||||
int RightBST(int _bstNodeIndex, int _numValuesPerNode, int _numOTNodes,
|
||||
bool _bstRoot, __global __read_only int *_tsp);
|
||||
int ChildNodeIndex(int _bstNodeIndex,
|
||||
int *_timespanStart,
|
||||
int *_timespanEnd,
|
||||
int _timestep,
|
||||
int _numValuesPerNode,
|
||||
int _numOTNodes,
|
||||
bool _bstRoot,
|
||||
__global __read_only int *_tsp);
|
||||
int BrickIndex(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) ;
|
||||
bool IsBSTLeaf(int _bstNodeIndex, int _numValuesPerNode,
|
||||
bool _bstRoot, __global __read_only int *_tsp) ;
|
||||
bool IsOctreeLeaf(int _otNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) ;
|
||||
int OTChildIndex(int _otNodeIndex, int _numValuesPerNode,
|
||||
int _child,
|
||||
__global __read_only int *_tsp);
|
||||
void AddToList(int _brickIndex,
|
||||
__global volatile int *_reqList);
|
||||
float TemporalError(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) ;
|
||||
float SpatialError(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp);
|
||||
bool TraverseBST(int _otNodeIndex,
|
||||
int *_brickIndex,
|
||||
int _timestep,
|
||||
__constant struct TraversalConstants *_constants,
|
||||
__global volatile int *_reqList,
|
||||
__global __read_only int *_tsp);
|
||||
int EnclosingChild(float3 _P, float _boxMid, float3 _offset);
|
||||
void UpdateOffset(float3 *_offset, float _boxDim, int _child) ;
|
||||
void TraverseOctree(float3 _rayO,
|
||||
float3 _rayD,
|
||||
float _maxDist,
|
||||
__constant struct TraversalConstants *_constants,
|
||||
__global volatile int *_reqList,
|
||||
__global __read_only int *_tsp,
|
||||
const int _timestep);
|
||||
__kernel void TSPTraversal(__read_only image2d_t _cubeFront,
|
||||
__read_only image2d_t _cubeBack,
|
||||
__constant struct TraversalConstants *_constants,
|
||||
__global __read_only int *_tsp,
|
||||
__global int *_reqList,
|
||||
const int _timestep) ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Turn normalized [0..1] cartesian coordinates
|
||||
// to normalized spherical [0..1] coordinates
|
||||
float3 CartesianToSpherical(float3 _cartesian) {
|
||||
// Put cartesian in [-1..1] range first
|
||||
_cartesian = (float3)(-1.0) + 2.0f* _cartesian;
|
||||
float r = length(_cartesian);
|
||||
float theta, phi;
|
||||
if (r == 0.0) {
|
||||
theta = phi = 0.0;
|
||||
} else {
|
||||
theta = acospi(_cartesian.z/r);
|
||||
phi = (M_PI + atan2(_cartesian.y, _cartesian.x)) / (2.0*M_PI);
|
||||
}
|
||||
r = r / native_sqrt(3.0f);
|
||||
// Sampler ignores w component
|
||||
return (float3)(r, theta, phi);
|
||||
}
|
||||
|
||||
// Return index to the octree root (same index as BST root at that OT node)
|
||||
int OctreeRootNodeIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Return index to left BST child (low timespan)
|
||||
int LeftBST(int _bstNodeIndex, int _numValuesPerNode, int _numOTNodes,
|
||||
bool _bstRoot, __global __read_only int *_tsp) {
|
||||
// If the BST node is a root, the child pointer is used for the OT.
|
||||
// The child index is next to the root.
|
||||
// If not root, look up in TSP structure.
|
||||
if (_bstRoot) {
|
||||
return _bstNodeIndex + _numOTNodes;
|
||||
//return _bstNodeIndex + 1;
|
||||
} else {
|
||||
return _tsp[_bstNodeIndex*_numValuesPerNode + 1];
|
||||
}
|
||||
}
|
||||
|
||||
// Return index to right BST child (high timespan)
|
||||
int RightBST(int _bstNodeIndex, int _numValuesPerNode, int _numOTNodes,
|
||||
bool _bstRoot, __global __read_only int *_tsp) {
|
||||
if (_bstRoot) {
|
||||
return _bstNodeIndex + _numOTNodes*2;
|
||||
} else {
|
||||
return _tsp[_bstNodeIndex*_numValuesPerNode + 1] + _numOTNodes;
|
||||
}
|
||||
}
|
||||
|
||||
// Return child node index given a BST node, a time span and a timestep
|
||||
// Updates timespan
|
||||
int ChildNodeIndex(int _bstNodeIndex,
|
||||
int *_timespanStart,
|
||||
int *_timespanEnd,
|
||||
int _timestep,
|
||||
int _numValuesPerNode,
|
||||
int _numOTNodes,
|
||||
bool _bstRoot,
|
||||
__global __read_only int *_tsp) {
|
||||
// Choose left or right child
|
||||
int middle = *_timespanStart + (*_timespanEnd - *_timespanStart)/2;
|
||||
if (_timestep <= middle) {
|
||||
// Left subtree
|
||||
*_timespanEnd = middle;
|
||||
return LeftBST(_bstNodeIndex, _numValuesPerNode, _numOTNodes,
|
||||
_bstRoot, _tsp);
|
||||
} else {
|
||||
// Right subtree
|
||||
*_timespanStart = middle+1;
|
||||
return RightBST(_bstNodeIndex, _numValuesPerNode, _numOTNodes,
|
||||
_bstRoot, _tsp);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the brick index that a BST node represents
|
||||
int BrickIndex(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) {
|
||||
return _tsp[_bstNodeIndex*_numValuesPerNode + 0];
|
||||
}
|
||||
|
||||
// Checks if a BST node is a leaf ot not
|
||||
bool IsBSTLeaf(int _bstNodeIndex, int _numValuesPerNode,
|
||||
bool _bstRoot, __global __read_only int *_tsp) {
|
||||
if (_bstRoot) return false;
|
||||
return (_tsp[_bstNodeIndex*_numValuesPerNode + 1] == -1);
|
||||
}
|
||||
|
||||
// Checks if an OT node is a leaf or not
|
||||
bool IsOctreeLeaf(int _otNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) {
|
||||
// CHILD_INDEX is at offset 1, and -1 represents leaf
|
||||
return (_tsp[_otNodeIndex*_numValuesPerNode + 1] == -1);
|
||||
}
|
||||
|
||||
// Return OT child index given current node and child number (0-7)
|
||||
int OTChildIndex(int _otNodeIndex, int _numValuesPerNode,
|
||||
int _child,
|
||||
__global __read_only int *_tsp) {
|
||||
int firstChild = _tsp[_otNodeIndex*_numValuesPerNode+1];
|
||||
return firstChild + _child;
|
||||
}
|
||||
|
||||
// Increment the count for a brick in the request list
|
||||
void AddToList(int _brickIndex,
|
||||
__global volatile int *_reqList) {
|
||||
atomic_inc(&_reqList[_brickIndex]);
|
||||
}
|
||||
|
||||
float TemporalError(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) {
|
||||
return as_float(_tsp[_bstNodeIndex*_numValuesPerNode + 3]);
|
||||
}
|
||||
|
||||
float SpatialError(int _bstNodeIndex, int _numValuesPerNode,
|
||||
__global __read_only int *_tsp) {
|
||||
return as_float(_tsp[_bstNodeIndex*_numValuesPerNode + 2]);
|
||||
}
|
||||
|
||||
|
||||
// Given an octree node index, traverse the corresponding BST tree and look
|
||||
// for a useful brick.
|
||||
bool TraverseBST(int _otNodeIndex,
|
||||
int *_brickIndex,
|
||||
int _timestep,
|
||||
__constant struct TraversalConstants *_constants,
|
||||
__global volatile int *_reqList,
|
||||
__global __read_only int *_tsp) {
|
||||
|
||||
// Start at the root of the current BST
|
||||
int bstNodeIndex = _otNodeIndex;
|
||||
bool bstRoot = true;
|
||||
int timespanStart = 0;
|
||||
int timespanEnd = _constants->numTimesteps_;
|
||||
|
||||
// Rely on structure for termination
|
||||
while (true) {
|
||||
|
||||
// Update brick index (regardless if we use it or not)
|
||||
*_brickIndex = BrickIndex(bstNodeIndex,
|
||||
_constants->numValuesPerNode_,
|
||||
_tsp);
|
||||
|
||||
// If temporal error is ok
|
||||
// TODO float and <= errors
|
||||
if (TemporalError(bstNodeIndex, _constants->numValuesPerNode_,
|
||||
_tsp) <= _constants->temporalTolerance_) {
|
||||
|
||||
// If the ot node is a leaf, we can't do any better spatially so we
|
||||
// return the current brick
|
||||
if (IsOctreeLeaf(_otNodeIndex, _constants->numValuesPerNode_, _tsp)) {
|
||||
return true;
|
||||
|
||||
// All is well!
|
||||
} else if (SpatialError(bstNodeIndex, _constants->numValuesPerNode_,
|
||||
_tsp) <= _constants->spatialTolerance_) {
|
||||
return true;
|
||||
|
||||
// If spatial failed and the BST node is a leaf
|
||||
// The traversal will continue in the octree (we know that
|
||||
// the octree node is not a leaf)
|
||||
} else if (IsBSTLeaf(bstNodeIndex, _constants->numValuesPerNode_,
|
||||
bstRoot, _tsp)) {
|
||||
return false;
|
||||
|
||||
// Keep traversing BST
|
||||
} else {
|
||||
bstNodeIndex = ChildNodeIndex(bstNodeIndex,
|
||||
×panStart,
|
||||
×panEnd,
|
||||
_timestep,
|
||||
_constants->numValuesPerNode_,
|
||||
_constants->numOTNodes_,
|
||||
bstRoot,
|
||||
_tsp);
|
||||
}
|
||||
|
||||
// If temporal error is too big and the node is a leaf
|
||||
// Return false to traverse OT
|
||||
} else if (IsBSTLeaf(bstNodeIndex, _constants->numValuesPerNode_,
|
||||
bstRoot, _tsp)) {
|
||||
return false;
|
||||
|
||||
// If temporal error is too big and we can continue
|
||||
} else {
|
||||
bstNodeIndex = ChildNodeIndex(bstNodeIndex,
|
||||
×panStart,
|
||||
×panEnd,
|
||||
_timestep,
|
||||
_constants->numValuesPerNode_,
|
||||
_constants->numOTNodes_,
|
||||
bstRoot,
|
||||
_tsp);
|
||||
}
|
||||
|
||||
bstRoot = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Given a point, a box mid value and an offset, return enclosing child
|
||||
int EnclosingChild(float3 _P, float _boxMid, float3 _offset) {
|
||||
if (_P.x < _boxMid+_offset.x) {
|
||||
if (_P.y < _boxMid+_offset.y) {
|
||||
if (_P.z < _boxMid+_offset.z) {
|
||||
return 0;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
} else {
|
||||
if (_P.z < _boxMid+_offset.z) {
|
||||
return 2;
|
||||
} else {
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (_P.y < _boxMid+_offset.y) {
|
||||
if (_P.z < _boxMid+_offset.z) {
|
||||
return 1;
|
||||
} else {
|
||||
return 5;
|
||||
}
|
||||
} else {
|
||||
if (_P.z < _boxMid+_offset.z) {
|
||||
return 3;
|
||||
} else {
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateOffset(float3 *_offset, float _boxDim, int _child) {
|
||||
if (_child == 0) {
|
||||
// do nothing
|
||||
} else if (_child == 1) {
|
||||
_offset->x += _boxDim;
|
||||
} else if (_child == 2) {
|
||||
_offset->y += _boxDim;
|
||||
} else if (_child == 3) {
|
||||
_offset->x += _boxDim;
|
||||
_offset->y += _boxDim;
|
||||
} else if (_child == 4) {
|
||||
_offset->z += _boxDim;
|
||||
} else if (_child == 5) {
|
||||
_offset->x += _boxDim;
|
||||
_offset->z += _boxDim;
|
||||
} else if (_child == 6) {
|
||||
_offset->y += _boxDim;
|
||||
_offset->z += _boxDim;
|
||||
} else if (_child == 7) {
|
||||
*_offset += (float3)(_boxDim);
|
||||
}
|
||||
}
|
||||
|
||||
// Traverse one ray through the volume, build brick list
|
||||
void TraverseOctree(float3 _rayO,
|
||||
float3 _rayD,
|
||||
float _maxDist,
|
||||
__constant struct TraversalConstants *_constants,
|
||||
__global volatile int *_reqList,
|
||||
__global __read_only int *_tsp,
|
||||
const int _timestep) {
|
||||
|
||||
// Choose a stepsize that guarantees that we don't miss any bricks
|
||||
// TODO dynamic depending on brick dimensions
|
||||
float stepsize = _constants->stepsize_;
|
||||
float3 P = _rayO;
|
||||
// Keep traversing until the sample point goes outside the unit cube
|
||||
float traversed = 0.0f;
|
||||
|
||||
int max_iterations = 50;
|
||||
int iterations = 0;
|
||||
bool ok = stepsize > 0.0f && stepsize < fabs(_maxDist);
|
||||
//while (traversed < _maxDist && iterations < max_iterations) {
|
||||
while (traversed < _maxDist) {
|
||||
|
||||
// Reset traversal variables
|
||||
float3 offset = (float3)(0.0f);
|
||||
float boxDim = 1.0f;
|
||||
int child;
|
||||
|
||||
// Init the octree node index to the root
|
||||
int otNodeIndex = OctreeRootNodeIndex();
|
||||
|
||||
// Start traversing octree
|
||||
// Rely on finding a leaf for loop termination
|
||||
|
||||
while (true) {
|
||||
// See if the BST tree is good enough
|
||||
int brickIndex = 0;
|
||||
bool bstSuccess = TraverseBST(otNodeIndex,
|
||||
&brickIndex,
|
||||
_timestep,
|
||||
_constants,
|
||||
_reqList,
|
||||
_tsp);
|
||||
|
||||
|
||||
|
||||
if (bstSuccess) {
|
||||
|
||||
// Add the found brick to brick list
|
||||
AddToList(brickIndex, _reqList);
|
||||
// We are now done with this node, so go to next
|
||||
break;
|
||||
|
||||
// If the BST lookup failed but the octree node is a leaf,
|
||||
// add the brick anyway (it is the BST leaf)
|
||||
} else if (IsOctreeLeaf(otNodeIndex,
|
||||
_constants->numValuesPerNode_, _tsp)) {
|
||||
AddToList(brickIndex, _reqList);
|
||||
// We are now done with this node, so go to next
|
||||
break;
|
||||
|
||||
// If the BST lookup failed and we can traverse the octree,
|
||||
// visit the child that encloses the point
|
||||
} else {
|
||||
|
||||
// Next box dimension
|
||||
boxDim = boxDim/2.0f;
|
||||
|
||||
// Current mid point
|
||||
float boxMid = boxDim;
|
||||
|
||||
// Check which child encloses P
|
||||
|
||||
if (_constants->gridType_ == 0) { // Cartesian
|
||||
child = EnclosingChild(P, boxMid, offset);
|
||||
} else { // Spherical (==1)
|
||||
child = EnclosingChild(CartesianToSpherical(P), boxMid, offset);
|
||||
}
|
||||
|
||||
// Update offset
|
||||
UpdateOffset(&offset, boxDim, child);
|
||||
|
||||
// Update node index to new node
|
||||
//int oldIndex = otNodeIndex;
|
||||
otNodeIndex = OTChildIndex(otNodeIndex, _constants->numValuesPerNode_,
|
||||
child, _tsp);
|
||||
}
|
||||
} // while traversing
|
||||
|
||||
// Update
|
||||
traversed = traversed + stepsize;
|
||||
P = P + stepsize * _rayD;
|
||||
|
||||
} // while (traversed < maxDist)
|
||||
|
||||
|
||||
}
|
||||
|
||||
__kernel void TSPTraversal(__read_only image2d_t _cubeFront,
|
||||
__read_only image2d_t _cubeBack,
|
||||
__constant struct TraversalConstants *_constants,
|
||||
__global __read_only int *_tsp,
|
||||
__global int *_reqList,
|
||||
const int _timestep) {
|
||||
|
||||
// Kernel should be launched in 2D with one work item per pixel
|
||||
int2 intCoords = (int2)(get_global_id(0), get_global_id(1));
|
||||
|
||||
// Sampler for color cube reading
|
||||
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
|
||||
|
||||
// Read from color cube textures
|
||||
float4 cubeFrontColor = read_imagef(_cubeFront, sampler, intCoords);
|
||||
|
||||
if (length(cubeFrontColor.xyz) == 0.0) return;
|
||||
float4 cubeBackColor = read_imagef(_cubeBack, sampler, intCoords);
|
||||
|
||||
// Figure out ray direction
|
||||
float maxDist = length(cubeBackColor.xyz-cubeFrontColor.xyz);
|
||||
float3 direction = normalize(cubeBackColor.xyz-cubeFrontColor.xyz);
|
||||
|
||||
// Traverse octree and fill the brick request list
|
||||
TraverseOctree(cubeFrontColor.xyz, direction, maxDist,
|
||||
_constants, _reqList, _tsp, _timestep);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
|
||||
float3 CartesianToSpherical(float3 _cartesian);
|
||||
float intensityNormalizer(float intensity, float iMin, float iMax);
|
||||
|
||||
float3 CartesianToSpherical(float3 _cartesian) {
|
||||
// Put cartesian in [-1..1] range first
|
||||
_cartesian = (float3)(-1.0) + 2.0f* _cartesian;
|
||||
float r = length(_cartesian);
|
||||
float theta, phi;
|
||||
if (r == 0.0) {
|
||||
theta = phi = 0.0;
|
||||
} else {
|
||||
theta = acospi(_cartesian.z/r);
|
||||
phi = (M_PI + atan2(_cartesian.y, _cartesian.x)) / (2.0*M_PI);
|
||||
}
|
||||
r = r / native_sqrt(3.0f);
|
||||
// Sampler ignores w component
|
||||
return (float3)(r, theta, phi);
|
||||
}
|
||||
|
||||
float intensityNormalizer(float intensity, float iMin, float iMax) {
|
||||
float i = clamp(intensity, iMin, iMax);
|
||||
i = (i - iMin) / (iMax - iMin);
|
||||
return clamp(i, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
|
||||
#ifdef CL_VERSION_1_2
|
||||
#define RC_TF_TYPE image1d_t
|
||||
#define RC_TF_MAP(intensity) intensity
|
||||
#else
|
||||
#define RC_TF_TYPE image2d_t
|
||||
#define RC_TF_MAP(intensity) (float2)(intensity,0.0f)
|
||||
#endif
|
||||
|
||||
|
||||
#define EARLY_RAY_TERMINATION_OPACITY 0.95
|
||||
|
||||
void raySetup(float3 first, float3 last, float3 dimension, float3* rayDirection, float* tIncr, float* tEnd);
|
||||
bool earlyRayTermination(float4* color, float maxOpacity);
|
||||
|
||||
|
||||
#define RC_DEFINE_TEXTUE_COORDINATES(coords) \
|
||||
int2 coords = (int2)(get_global_id(0), get_global_id(1))
|
||||
|
||||
#define RC_DEFINE_VOLUME3D_DIMENSIONS(dimension, volume) \
|
||||
float3 dimension; \
|
||||
{ \
|
||||
int4 idim = get_image_dim(volume); \
|
||||
dimension = (float3)(idim.x,idim.y,idim.z); \
|
||||
}
|
||||
|
||||
|
||||
//#define RC_DEFINE_VARIABLES(dimension, intCoords)
|
||||
|
||||
/***
|
||||
* Calculates the direction of the ray and returns the number
|
||||
* of steps and the direction.
|
||||
***/
|
||||
void raySetup(float3 first, float3 last, float3 dimension, float3* rayDirection, float* tIncr, float* tEnd) {
|
||||
float samplingRate_ = 1.0f;
|
||||
*rayDirection = last - first;
|
||||
*tEnd = length(*rayDirection);
|
||||
*rayDirection = normalize(*rayDirection);
|
||||
*tIncr = 1.0/(samplingRate_*length((*rayDirection)*dimension));
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
* Applies early ray termination. The current opacity is compared to
|
||||
* the maximum opacity. In case it is greater, the opacity is set to
|
||||
* 1.0 and true is returned, otherwise false is returned.
|
||||
***/
|
||||
bool earlyRayTermination(float4* color, float maxOpacity) {
|
||||
if ((*color).w >= maxOpacity) {
|
||||
(*color).w = 1.0f;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#define RC_EARLY_RAY_TERMINATION(opacity, maxOpacity, finished) \
|
||||
finished = earlyRayTermination(&opacity, maxOpacity)
|
||||
|
||||
#define RC_BEGIN_LOOP_FOR \
|
||||
for (int loop=0; !finished && loop<RAYCASTING_LOOP_COUNT; ++loop) {
|
||||
#define RC_END_LOOP_BRACES }
|
||||
|
||||
/***
|
||||
* The beginning of a typical raycasting loop.
|
||||
*/
|
||||
#define RC_BEGIN_LOOP \
|
||||
bool finished = false; \
|
||||
float t = 0.0f; \
|
||||
int RAYCASTING_LOOP_COUNT = tEnd / tIncr; \
|
||||
RC_BEGIN_LOOP_FOR
|
||||
|
||||
|
||||
/***
|
||||
* The end of a typical raycasting loop. If adaptive sampling
|
||||
* is used for rendering bricked volumes, t is increased by a
|
||||
* multiple of tIncr, thereby skipping several samples.
|
||||
*/
|
||||
#ifdef ADAPTIVE_SAMPLING
|
||||
#define RC_END_LOOP(result) \
|
||||
RC_EARLY_RAY_TERMINATION(result, EARLY_RAY_TERMINATION_OPACITY, finished); \
|
||||
t += (tIncr * float(numberOfSkippedSamples)); \
|
||||
finished = finished || (t > tEnd); \
|
||||
RC_END_LOOP_BRACES
|
||||
#else
|
||||
#define RC_END_LOOP(result) \
|
||||
RC_EARLY_RAY_TERMINATION(result, EARLY_RAY_TERMINATION_OPACITY, finished); \
|
||||
t += tIncr; \
|
||||
finished = finished || (t > tEnd); \
|
||||
RC_END_LOOP_BRACES
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* In order to keep the shaders as free as possible from dealing
|
||||
* with bricking and adaptive sampling, these defines can be placed
|
||||
* before and after the compositing function calls to enable adaptive
|
||||
* sampling when bricking is used. For normal datasets these defines
|
||||
* will have no impact at all.
|
||||
*/
|
||||
#ifdef ADAPTIVE_SAMPLING
|
||||
#define RC_BEGIN_COMPOSITING \
|
||||
for (int i=0; i<numberOfSkippedSamples; i++) {
|
||||
#else
|
||||
#define RC_BEGIN_COMPOSITING
|
||||
#endif
|
||||
|
||||
#ifdef ADAPTIVE_SAMPLING
|
||||
#define RC_END_COMPOSITING \
|
||||
}
|
||||
#else
|
||||
#define RC_END_COMPOSITING
|
||||
#endif
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
#ifndef OFFSET
|
||||
#define OFFSET 0
|
||||
#endif
|
||||
|
||||
__kernel void hello(__global int * out)
|
||||
{
|
||||
size_t tid = get_global_id(0);
|
||||
out[tid] = tid + OFFSET;
|
||||
}
|
||||
@@ -40,7 +40,6 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimage.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ephemeris/dynamicephemeris.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ephemeris/spiceephemeris.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ephemeris/staticephemeris.h
|
||||
)
|
||||
@@ -62,7 +61,6 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ephemeris/dynamicephemeris.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ephemeris/spiceephemeris.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ephemeris/staticephemeris.cpp
|
||||
)
|
||||
@@ -77,11 +75,15 @@ set(SHADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/nighttexture_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/nighttexture_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_gs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/pscstandard_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/pscstandard_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/star_fs.glsl
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
#include <modules/base/rendering/screenspaceframebuffer.h>
|
||||
|
||||
#include <modules/base/ephemeris/staticephemeris.h>
|
||||
#include <modules/base/ephemeris/dynamicephemeris.h>
|
||||
#include <modules/base/ephemeris/spiceephemeris.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem>
|
||||
@@ -61,6 +60,7 @@ BaseModule::BaseModule()
|
||||
void BaseModule::internalInitialize() {
|
||||
FactoryManager::ref().addFactory(std::make_unique<ghoul::TemplateFactory<planetgeometry::PlanetGeometry>>());
|
||||
FactoryManager::ref().addFactory(std::make_unique<ghoul::TemplateFactory<modelgeometry::ModelGeometry>>());
|
||||
FactoryManager::ref().addFactory(std::make_unique<ghoul::TemplateFactory<ScreenSpaceRenderable>>());
|
||||
|
||||
auto fScreenSpaceRenderable = FactoryManager::ref().factory<ScreenSpaceRenderable>();
|
||||
ghoul_assert(fScreenSpaceRenderable, "ScreenSpaceRenderable factory was not created");
|
||||
@@ -84,7 +84,6 @@ void BaseModule::internalInitialize() {
|
||||
auto fEphemeris = FactoryManager::ref().factory<Ephemeris>();
|
||||
ghoul_assert(fEphemeris, "Ephemeris factory was not created");
|
||||
fEphemeris->registerClass<StaticEphemeris>("Static");
|
||||
fEphemeris->registerClass<StaticEphemeris>("Dynamic");
|
||||
fEphemeris->registerClass<SpiceEphemeris>("Spice");
|
||||
|
||||
auto fPlanetGeometry = FactoryManager::ref().factory<planetgeometry::PlanetGeometry>();
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/base/ephemeris/dynamicephemeris.h>
|
||||
|
||||
namespace {
|
||||
const std::string KeyPosition = "Position";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
DynamicEphemeris::DynamicEphemeris(const ghoul::Dictionary& dictionary)
|
||||
: _position(0.f, 0.f, 0.f, 0.f)
|
||||
{
|
||||
const bool hasPosition = dictionary.hasKeyAndValue<glm::vec4>(KeyPosition);
|
||||
if (hasPosition) {
|
||||
glm::vec4 tmp;
|
||||
dictionary.getValue(KeyPosition, tmp);
|
||||
_position = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
DynamicEphemeris::~DynamicEphemeris() {}
|
||||
|
||||
const psc& DynamicEphemeris::position() const {
|
||||
return _position;
|
||||
}
|
||||
|
||||
void DynamicEphemeris::setPosition(psc pos) {
|
||||
_position = pos;
|
||||
}
|
||||
|
||||
void DynamicEphemeris::update(const UpdateData&) {}
|
||||
|
||||
} // namespace openspace
|
||||
@@ -1,46 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __DYNAMICEPHEMERIS_H__
|
||||
#define __DYNAMICEPHEMERIS_H__
|
||||
|
||||
#include <openspace/scene/ephemeris.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class DynamicEphemeris: public Ephemeris {
|
||||
public:
|
||||
DynamicEphemeris(const ghoul::Dictionary& dictionary
|
||||
= ghoul::Dictionary());
|
||||
virtual ~DynamicEphemeris();
|
||||
virtual const psc& position() const;
|
||||
virtual void update(const UpdateData& data) override;
|
||||
void setPosition(psc pos);
|
||||
private:
|
||||
psc _position;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __DYNAMICEPHEMERIS_H__
|
||||
@@ -131,16 +131,17 @@ bool RenderablePlanet::initialize() {
|
||||
// Night texture program
|
||||
_programObject = renderEngine.buildRenderProgram(
|
||||
"nightTextureProgram",
|
||||
"${SHADERS}/nighttexture_vs.glsl",
|
||||
"${SHADERS}/nighttexture_fs.glsl");
|
||||
if (!_programObject) return false;
|
||||
"${MODULE_BASE}/shaders/nighttexture_vs.glsl",
|
||||
"${MODULE_BASE}/shaders/nighttexture_fs.glsl");
|
||||
if (!_programObject)
|
||||
return false;
|
||||
}
|
||||
else if (_programObject == nullptr) {
|
||||
// pscstandard
|
||||
_programObject = renderEngine.buildRenderProgram(
|
||||
"pscstandard",
|
||||
"${SHADERS}/pscstandard_vs.glsl",
|
||||
"${SHADERS}/pscstandard_fs.glsl");
|
||||
"${MODULE_BASE}/shaders/pscstandard_vs.glsl",
|
||||
"${MODULE_BASE}/shaders/pscstandard_fs.glsl");
|
||||
if (!_programObject) return false;
|
||||
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ bool RenderableSphere::initialize() {
|
||||
// pscstandard
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("Sphere",
|
||||
"${MODULES}/base/shaders/sphere_vs.glsl",
|
||||
"${MODULE_BASE}/shaders/sphere_vs.glsl",
|
||||
"${MODULES}/base/shaders/sphere_fs.glsl");
|
||||
if (!_shader)
|
||||
return false;
|
||||
|
||||
@@ -40,6 +40,7 @@ Fragment getFragment()
|
||||
vec4 diffuse;
|
||||
|
||||
vec2 texCoord = vs_st;
|
||||
// Why is this here? ---abock
|
||||
texCoord.s = 1 - texCoord.s;
|
||||
texCoord.t = 1 - texCoord.y;
|
||||
|
||||
|
||||
3
modules/iswa/include.cmake
Normal file
3
modules/iswa/include.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
set (OPENSPACE_DEPENDENCIES
|
||||
base
|
||||
)
|
||||
@@ -43,7 +43,6 @@ namespace openspace {
|
||||
{}
|
||||
|
||||
void ISWAModule::internalInitialize(){
|
||||
FactoryManager::ref().addFactory(std::make_unique<ghoul::TemplateFactory<ScreenSpaceRenderable>>());
|
||||
auto fRenderable = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "No renderable factory existed");
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ void DataPlane::setUniforms(){
|
||||
|
||||
int activeTransferfunctions = _transferFunctions.size();
|
||||
|
||||
ghoul::opengl::TextureUnit txUnits[activeTextures];
|
||||
ghoul::opengl::TextureUnit txUnits[10];
|
||||
int j = 0;
|
||||
for(int option : selectedOptions){
|
||||
if(_textures[option]){
|
||||
@@ -223,7 +223,7 @@ void DataPlane::setUniforms(){
|
||||
}
|
||||
}
|
||||
|
||||
ghoul::opengl::TextureUnit tfUnits[activeTransferfunctions];
|
||||
ghoul::opengl::TextureUnit tfUnits[10];
|
||||
j = 0;
|
||||
|
||||
if((activeTransferfunctions == 1) && (_textures.size() != _transferFunctions.size())){
|
||||
@@ -538,7 +538,7 @@ void DataPlane::setTransferFunctions(std::string tfPath){
|
||||
|
||||
if(tfFile.is_open()){
|
||||
while(getline(tfFile, line)){
|
||||
std::shared_ptr<TransferFunction> tf = std::make_shared<TransferFunction>(line);
|
||||
std::shared_ptr<TransferFunction> tf = std::make_shared<TransferFunction>(absPath(line));
|
||||
if(tf)
|
||||
tfs.push_back(tf);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ ScreenSpaceCygnet::ScreenSpaceCygnet(const ghoul::Dictionary& dictionary)
|
||||
: ScreenSpaceRenderable(dictionary)
|
||||
, _updateInterval("updateInterval", "Update Interval", 1.0, 0.0 , 10.0)
|
||||
{
|
||||
// hacky, have to first get as float and the cast to int.
|
||||
// hacky, have to first get as float and then cast to int.
|
||||
float cygnetid;
|
||||
dictionary.getValue("CygnetId", cygnetid);
|
||||
_cygnetId = (int)cygnetid;
|
||||
@@ -135,12 +135,17 @@ bool ScreenSpaceCygnet::isReady() const{
|
||||
}
|
||||
|
||||
void ScreenSpaceCygnet::updateTexture(){
|
||||
_memorybuffer = "";
|
||||
// If a download is in progress, dont send another request.
|
||||
//What if image failed to download?
|
||||
if(_futureTexture && !_futureTexture->isFinished)
|
||||
return;
|
||||
|
||||
_memorybuffer = "";
|
||||
std::shared_ptr<DownloadManager::FileFuture> future = ISWAManager::ref().downloadImageToMemory(_cygnetId, _memorybuffer);
|
||||
if(future){
|
||||
_futureTexture = future;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ScreenSpaceCygnet::loadTexture() {
|
||||
|
||||
@@ -103,10 +103,6 @@ void ISWAManager::addISWACygnet(std::string info){
|
||||
}
|
||||
|
||||
addISWACygnet(cygnetId);
|
||||
|
||||
/*if(data == "")
|
||||
else*/
|
||||
|
||||
}
|
||||
|
||||
void ISWAManager::addISWACygnet(int id, std::string info, int group){
|
||||
@@ -116,7 +112,6 @@ void ISWAManager::addISWACygnet(int id, std::string info, int group){
|
||||
std::shared_ptr<MetadataFuture> metaFuture = std::make_shared<MetadataFuture>();
|
||||
metaFuture->id = id;
|
||||
metaFuture->group = group;
|
||||
|
||||
if(info == _type[CygnetType::Texture]){
|
||||
metaFuture->type = CygnetType::Texture;
|
||||
metaFuture->geom = CygnetGeometry::Plane;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
~ISWAManager();
|
||||
|
||||
void addISWACygnet(std::string info);
|
||||
void addISWACygnet(int id, std::string info = "TEXTURE", int group = -1);
|
||||
void addISWACygnet(int id, std::string info = "Texture", int group = -1);
|
||||
void deleteISWACygnet(std::string);
|
||||
|
||||
// std::shared_ptr<DownloadManager::FileFuture> downloadImage(int, std::string);
|
||||
|
||||
@@ -64,6 +64,8 @@ source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
set(SHADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/crawlingline_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/crawlingline_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/fboPass_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/fboPass_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/fov_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/fov_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/projectiveTexture_fs.glsl
|
||||
|
||||
@@ -275,13 +275,20 @@ void RenderablePlaneProjection::updatePlane(const Image img, double currentTime)
|
||||
|
||||
const GLfloat vertex_data[] = { // square of two triangles drawn within fov in target coordinates
|
||||
// x y z w s t
|
||||
projection[1][0], projection[1][1], projection[1][2], projection[1][3], 0, 1, // Lower left 1
|
||||
projection[3][0], projection[3][1], projection[3][2], projection[3][3], 1, 0, // Upper right 2
|
||||
projection[2][0], projection[2][1], projection[2][2], projection[2][3], 0, 0, // Upper left 3
|
||||
projection[1][0], projection[1][1], projection[1][2], projection[1][3], 0, 1, // Lower left 4 = 1
|
||||
projection[0][0], projection[0][1], projection[0][2], projection[0][3], 1, 1, // Lower right 5
|
||||
projection[3][0], projection[3][1], projection[3][2], projection[3][3], 1, 0, // Upper left 6 = 2
|
||||
projection[1][0], projection[1][1], projection[1][2], projection[1][3], 0, 0, // Lower left 1
|
||||
projection[3][0], projection[3][1], projection[3][2], projection[3][3], 1, 1, // Upper right 2
|
||||
projection[2][0], projection[2][1], projection[2][2], projection[2][3], 0, 1, // Upper left 3
|
||||
projection[1][0], projection[1][1], projection[1][2], projection[1][3], 0, 0, // Lower left 4 = 1
|
||||
projection[0][0], projection[0][1], projection[0][2], projection[0][3], 1, 0, // Lower right 5
|
||||
projection[3][0], projection[3][1], projection[3][2], projection[3][3], 1, 1, // Upper left 6 = 2
|
||||
};
|
||||
//projection[1][0], projection[1][1], projection[1][2], projection[1][3], 0, 1, // Lower left 1
|
||||
// projection[3][0], projection[3][1], projection[3][2], projection[3][3], 1, 0, // Upper right 2
|
||||
// projection[2][0], projection[2][1], projection[2][2], projection[2][3], 0, 0, // Upper left 3
|
||||
// projection[1][0], projection[1][1], projection[1][2], projection[1][3], 0, 1, // Lower left 4 = 1
|
||||
// projection[0][0], projection[0][1], projection[0][2], projection[0][3], 1, 1, // Lower right 5
|
||||
// projection[3][0], projection[3][1], projection[3][2], projection[3][3], 1, 0, // Upper left 6 = 2
|
||||
|
||||
|
||||
glBindVertexArray(_quad); // bind array
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer); // bind buffer
|
||||
|
||||
@@ -255,8 +255,8 @@ bool RenderablePlanetProjection::initialize() {
|
||||
}
|
||||
|
||||
_fboProgramObject = ghoul::opengl::ProgramObject::Build("fboPassProgram",
|
||||
"${SHADERS}/fboPass_vs.glsl",
|
||||
"${SHADERS}/fboPass_fs.glsl");
|
||||
"${MODULES}/newhorizons/shaders/fboPass_vs.glsl",
|
||||
"${MODULES}/newhorizons/shaders/fboPass_fs.glsl");
|
||||
|
||||
loadTexture();
|
||||
loadProjectionTexture();
|
||||
|
||||
@@ -18,7 +18,6 @@ return {
|
||||
SGCT = "${BASE_PATH}/config/sgct",
|
||||
SCRIPTS = "${BASE_PATH}/scripts",
|
||||
SHADERS = "${BASE_PATH}/shaders",
|
||||
SHADERS_GENERATED = "${SHADERS}/generated",
|
||||
OPENSPACE_DATA = "${BASE_PATH}/data",
|
||||
SCENE = "${OPENSPACE_DATA}/scene",
|
||||
SPICE = "${OPENSPACE_DATA}/spice",
|
||||
@@ -36,13 +35,6 @@ return {
|
||||
Mono = "${FONTS}/Droid_Sans_Mono/DroidSansMono.ttf",
|
||||
Light = "${FONTS}/Roboto/Roboto-Regular.ttf"
|
||||
},
|
||||
StartupScripts = {
|
||||
"${SCRIPTS}/default_startup.lua",
|
||||
"${SCRIPTS}/iswa_startup.lua"
|
||||
},
|
||||
SettingsScripts = {
|
||||
"${SCRIPTS}/default_settings.lua"
|
||||
},
|
||||
Logging = {
|
||||
LogLevel = "Debug",
|
||||
ImmediateFlush = false,
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
--[[ OpenSpace settings script ]]--
|
||||
-- This Lua script get executed once at the start of the application and is used to
|
||||
-- set settings in the loaded scene graph
|
||||
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunGlare.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
|
||||
--openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
-- openspace.setPropertyValue("PlutoTrail.renderable.enabled", false)
|
||||
-- openspace.setPropertyValue("PlutoTexture.renderable.enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.75)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
@@ -1,50 +0,0 @@
|
||||
--[[ OpenSpace startup script ]]--
|
||||
-- This Lua script get executed once at the start of the application
|
||||
|
||||
--openspace.setInvertRotation(true) -- Uncomment this if you want to invert the rotation
|
||||
openspace.setInvertRoll(true);
|
||||
--openspace.setInteractionSensitivity(10) -- This is the default value for the sensitivity (the higher, the more sensitive)
|
||||
|
||||
-- openspace.time.setTime("2007 FEB 27 16:30:00") -- This is the start time for a Jupiter run of New Horizons
|
||||
|
||||
--openspace.time.setTime("2011 AUG 06 00:00:00") -- Dawn takes pictures of Vesta
|
||||
--openspace.time.setTime("2011 JUL 28 12:00:00") -- Rosetta starts dancing around 67p
|
||||
--openspace.time.setTime("2007 FEB 28 11:45:00") -- europa rise
|
||||
--TESTING ALICE
|
||||
--openspace.time.setTime("2015-07-13T00:00:00.00")
|
||||
|
||||
openspace.time.setTime("2015-07-14T10:00:00.00")
|
||||
|
||||
openspace.time.setDeltaTime(0) -- How many seconds pass per second of realtime, changeable in the GUI
|
||||
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua')) -- Load the default keybindings
|
||||
|
||||
-- openspace.time.setDeltaTime(50);
|
||||
|
||||
--openspace.time.setTime("2015-07-14T12:00:00.00") -- PLUTO
|
||||
-- NH takes series of images from visible to dark side (across terminator)
|
||||
-- Sequence lasts ~10 mins, (recommended dt = 10)
|
||||
|
||||
--openspace.time.setTime("2015-07-14T11:22:00.00") -- PLUTO
|
||||
--BEAUTIFUL SEQUENCE -- NH takes series of images (same as previous)
|
||||
-- Sequence ends at 2015 JUL 14T11:24:00:000, (recommended dt = 1)
|
||||
|
||||
--openspace.time.setTime("2015-07-14T11:36:40.00") -- PLUTO
|
||||
-- NH takes series of images (same as previous)
|
||||
-- Sequence ends at 2015 JUL 14T11:39:15:000, (recommended dt = 1)
|
||||
|
||||
--openspace.time.setTime("2015-07-14T11:48:43.00") -- CHARON
|
||||
--NH takes imagesequence across terminator
|
||||
-- Sequence ends at 2015 JUL 14T11:49:30:000, (recommended dt = 1)
|
||||
|
||||
--openspace.time.setTime("2015-07-14T12:04:35.00") -- PLUTO
|
||||
--NH takes imagesequence across Plutos north pole
|
||||
-- Sequence ends at 2015 JUL 14T12:05:48:000, (recommended dt = 1)
|
||||
|
||||
--openspace.time.setTime("2015-07-14T15:02:46.00") -- PLUTO DARKSIDE
|
||||
--From this point on NH takes a huge amount of images of the far side of
|
||||
-- CHARON and PLUTO - recommend run time from here and just let it run
|
||||
-- until audience tires (enough to fill 10-15 mins if run at dt = 100)
|
||||
|
||||
|
||||
-- print(openspace.time.currentTimeUTC())
|
||||
@@ -1,24 +0,0 @@
|
||||
--[[ OpenSpace startup script ]]--
|
||||
-- This Lua script get executed once at the start of the application
|
||||
|
||||
openspace.iswa.addCygnet("-1,Data,1");
|
||||
openspace.iswa.addCygnet("-2,Data,1");
|
||||
openspace.iswa.addCygnet("-3,Data,1");
|
||||
|
||||
openspace.registerScreenSpaceRenderable(
|
||||
{
|
||||
Type = "ScreenSpaceCygnet",
|
||||
CygnetId = 7,
|
||||
Position = {-0.8, 0.3},
|
||||
FlatScreen = true,
|
||||
Scale = 0.25,
|
||||
});
|
||||
|
||||
openspace.registerScreenSpaceRenderable(
|
||||
{
|
||||
Type = "ScreenSpaceImage",
|
||||
TexturePath = "${OPENSPACE_DATA}/test2.jpg",
|
||||
Position = {0.8, -0.3},
|
||||
FlatScreen = true,
|
||||
Scale = 0.25,
|
||||
});
|
||||
@@ -1,32 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
in vec4 color;
|
||||
out vec4 outputColor;
|
||||
|
||||
void main() {
|
||||
outputColor = color;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform mat4 projectionMatrix;
|
||||
uniform mat4 viewMatrix;
|
||||
uniform mat4 modelMatrix;
|
||||
|
||||
in vec4 position;
|
||||
out vec4 color;
|
||||
|
||||
void main() {
|
||||
gl_Position = projectionMatrix * viewMatrix * modelMatrix * position;
|
||||
color = position;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform int volumeType;
|
||||
|
||||
in vec3 vPosition;
|
||||
in vec4 worldPosition;
|
||||
in float s;
|
||||
|
||||
#include "ABuffer/abufferStruct.hglsl"
|
||||
#include "ABuffer/abufferAddToBuffer.hglsl"
|
||||
#include "PowerScaling/powerScaling_fs.hglsl"
|
||||
|
||||
void main() {
|
||||
vec4 fragColor = vec4(vPosition+0.5, 1.0);
|
||||
vec4 position = worldPosition;
|
||||
float depth = pscDepth(position);
|
||||
|
||||
gl_FragDepth = depth;
|
||||
|
||||
ABufferStruct_t frag;
|
||||
_col_(frag, fragColor);
|
||||
_z_(frag, depth);
|
||||
_type_(frag, volumeType);
|
||||
_pos_(frag, position);
|
||||
addToBuffer(frag);
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec4 vertPosition;
|
||||
|
||||
uniform mat4 modelViewProjection;
|
||||
uniform mat4 modelTransform;
|
||||
|
||||
out vec3 vPosition;
|
||||
out vec4 worldPosition;
|
||||
out float s;
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
void main() {
|
||||
|
||||
//vs_st = in_st;
|
||||
//vs_stp = in_position.xyz;
|
||||
|
||||
vPosition = vertPosition.xyz;
|
||||
worldPosition = vertPosition;
|
||||
|
||||
// this is wrong for the normal. The normal transform is the transposed inverse of the model transform
|
||||
//vs_normal = normalize(modelTransform * vec4(in_normal,0));
|
||||
|
||||
vec4 position = pscTransform(worldPosition, modelTransform);
|
||||
|
||||
// project the position to view space
|
||||
gl_Position = z_normalization(modelViewProjection * position);
|
||||
|
||||
// vPosition = vertPosition.xyz;
|
||||
// worldPosition = (modelTransform *vec4(vPosition, 1.0)).xyz;
|
||||
// gl_Position = modelViewProjection *vec4(worldPosition, 1.0);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
|
||||
in vec4 vs_color;
|
||||
out vec4 diffuse;
|
||||
|
||||
void main()
|
||||
{
|
||||
diffuse = vs_color;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform mat4 ViewProjection;
|
||||
uniform mat4 ModelTransform;
|
||||
|
||||
layout(location = 0) in vec3 in_position;
|
||||
layout(location = 1) in vec4 in_color;
|
||||
|
||||
out vec4 vs_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
// set variables
|
||||
vs_color = in_color;
|
||||
|
||||
gl_Position = ViewProjection*ModelTransform*vec4(in_position,1);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version 430
|
||||
|
||||
in vec2 UV;
|
||||
out vec4 Color;
|
||||
|
||||
uniform sampler2D Tex;
|
||||
uniform float Opacity;
|
||||
|
||||
void main()
|
||||
{
|
||||
Color = texture(Tex, UV) * Opacity;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version 430
|
||||
|
||||
layout (location = 0) in vec2 TexCoords;
|
||||
layout (location = 1) in vec3 Position;
|
||||
|
||||
out vec2 UV;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
UV = TexCoords;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform sampler2D quadTex;
|
||||
in vec2 texCoord;
|
||||
out vec4 color;
|
||||
|
||||
void main() {
|
||||
color = texture(quadTex, texCoord);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec2 texCoordinate;
|
||||
layout(location = 2) in vec3 vertPosition;
|
||||
|
||||
in vec4 position;
|
||||
out vec2 texCoord;
|
||||
|
||||
const vec2 screenScale = vec2(0.5, 0.5);
|
||||
|
||||
void main() {
|
||||
texCoord = vertPosition.xy*screenScale+screenScale; // scale vertex attribute to [0-1] range
|
||||
gl_Position = vec4(vertPosition.xy, 0.0, 1.0);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
in vec4 position;
|
||||
out vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = position;
|
||||
texCoord = position.xy/2.0 + 0.5;
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
// Based on http://prideout.net/blog/?p=64
|
||||
|
||||
uniform sampler3D texVolume;
|
||||
uniform mat4 modelView;
|
||||
uniform mat4 modelViewProjection;
|
||||
uniform float focalLength;
|
||||
uniform vec2 windowSize;
|
||||
uniform vec3 rayOrigin;
|
||||
uniform float stepSize;
|
||||
|
||||
const int maxNumSamples = 128;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
struct Ray {
|
||||
vec3 Origin;
|
||||
vec3 Dir;
|
||||
};
|
||||
|
||||
struct AABB {
|
||||
vec3 Min;
|
||||
vec3 Max;
|
||||
};
|
||||
|
||||
bool IntersectBox(Ray r, AABB box, out float t0, out float t1) {
|
||||
vec3 invR = 1.0 / r.Dir;
|
||||
vec3 tbot = invR * (box.Min-r.Origin);
|
||||
vec3 ttop = invR * (box.Max-r.Origin);
|
||||
vec3 tmin = min(ttop, tbot);
|
||||
vec3 tmax = max(ttop, tbot);
|
||||
vec2 t = max(tmin.xx, tmin.yz);
|
||||
t0 = max(t.x, t.y);
|
||||
t = min(tmax.xx, tmax.yz);
|
||||
t1 = min(t.x, t.y);
|
||||
return t0 <= t1;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec3 rayDirection;
|
||||
rayDirection.x = 2.0 * gl_FragCoord.x / windowSize.x - 1.0;
|
||||
rayDirection.y = 2.0 * gl_FragCoord.y / windowSize.y - 1.0;
|
||||
rayDirection.z = -focalLength;
|
||||
rayDirection = (vec4(rayDirection, 0) * modelView).xyz;
|
||||
|
||||
Ray eye = Ray( rayOrigin, normalize(rayDirection) );
|
||||
AABB box = AABB(vec3(-1.0), vec3(1.0));
|
||||
|
||||
float tnear, tfar;
|
||||
IntersectBox(eye, box, tnear, tfar);
|
||||
tnear = max(tnear, 0.0);
|
||||
|
||||
vec3 front = eye.Origin + eye.Dir* tnear;
|
||||
vec3 back = eye.Origin + eye.Dir* tfar;
|
||||
front = 0.5 * (front + 1.0);
|
||||
back = 0.5 * (back + 1.0);
|
||||
|
||||
vec3 direction = back-front;
|
||||
float directionLength = length(direction);
|
||||
direction = normalize(direction);
|
||||
vec3 position = front;
|
||||
vec4 tmp, color = vec4(0);
|
||||
int i = 0;
|
||||
|
||||
while (length(position-front) < directionLength && color.r != 1.0 && i < maxNumSamples) {
|
||||
++i;
|
||||
tmp = texture(texVolume, position);
|
||||
color = max(color, tmp); // MIP
|
||||
position = position + direction * stepSize;
|
||||
}
|
||||
|
||||
fragColor = vec4(color.rrr,1.0);
|
||||
|
||||
// // DEBUG DEBUG DEBUG
|
||||
// fragColor = vec4(front, 1.0);
|
||||
// if (front.x < 0.1)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.y < 0.1)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.x > 0.9)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.y > 0.9)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.x > 0.45 && front.x < 0.55)
|
||||
// fragColor = vec4(0.0);
|
||||
|
||||
// if (front.y > 0.45 && front.y < 0.55)
|
||||
// fragColor = vec4(0.0);
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
// Based on http://prideout.net/blog/?p=64
|
||||
|
||||
layout(points) in;
|
||||
layout(triangle_strip, max_vertices = 24) out;
|
||||
uniform mat4 modelViewProjection;
|
||||
in vec4 vPosition[1];
|
||||
|
||||
vec4 objCube[8]; // Object space coordinate of cube corner
|
||||
vec4 ndcCube[8]; // Normalized device coordinate of cube corner
|
||||
ivec4 faces[6]; // Vertex indices of the cube faces
|
||||
|
||||
void emit_vert(int vert) {
|
||||
gl_Position = ndcCube[vert];
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
void emit_face(int face) {
|
||||
emit_vert(faces[face][1]); emit_vert(faces[face][0]);
|
||||
emit_vert(faces[face][3]); emit_vert(faces[face][2]);
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
void main() {
|
||||
faces[0] = ivec4(0,1,3,2); faces[1] = ivec4(5,4,6,7);
|
||||
faces[2] = ivec4(4,5,0,1); faces[3] = ivec4(3,2,7,6);
|
||||
faces[4] = ivec4(0,3,4,7); faces[5] = ivec4(2,1,6,5);
|
||||
|
||||
float size = 0.5;
|
||||
vec4 P = vPosition[0];
|
||||
vec4 I = vec4(size, 0, 0, 0);
|
||||
vec4 J = vec4(0, size, 0, 0);
|
||||
vec4 K = vec4(0, 0, size, 0);
|
||||
|
||||
objCube[0] = P+K+I+J; objCube[1] = P+K+I-J;
|
||||
objCube[2] = P+K-I-J; objCube[3] = P+K-I+J;
|
||||
objCube[4] = P-K+I+J; objCube[5] = P-K+I-J;
|
||||
objCube[6] = P-K-I-J; objCube[7] = P-K-I+J;
|
||||
|
||||
// Transform the corners of the box:
|
||||
for (int vert = 0; vert < 8; vert++)
|
||||
ndcCube[vert] = modelViewProjection * objCube[vert];
|
||||
|
||||
// Emit the six faces:
|
||||
for (int face = 0; face < 6; face++)
|
||||
emit_face(face);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
// Based on http://prideout.net/blog/?p=64
|
||||
|
||||
layout(location = 0) in vec4 Position;
|
||||
out vec4 vPosition;
|
||||
uniform mat4 modelViewProjection;
|
||||
|
||||
void main() {
|
||||
gl_Position = modelViewProjection * Position;
|
||||
vPosition = Position;
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform sampler2D texBack, texFront;
|
||||
uniform sampler3D texVolume;
|
||||
uniform float stepSize;
|
||||
|
||||
in vec3 vPosition;
|
||||
in vec2 texCoords;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec3 front = texture(texFront, texCoords).xyz;
|
||||
vec3 back = texture(texBack, texCoords).xyz;
|
||||
vec3 direction = back-front;
|
||||
float directionLength = length(direction);
|
||||
direction = normalize(direction);
|
||||
vec3 position = front;
|
||||
vec4 tmp, color = vec4(0);
|
||||
|
||||
while (length(position-front) < directionLength && color.r != 1.0) {
|
||||
tmp = texture(texVolume, position);
|
||||
color = max(color, tmp); // MIP
|
||||
position = position + direction * stepSize;
|
||||
}
|
||||
|
||||
fragColor = vec4(color.rrr, 1.0);
|
||||
|
||||
// // DEBUG DEBUG DEBUG
|
||||
// fragColor = vec4(front, 1.0);
|
||||
// if (front.x < 0.1)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.y < 0.1)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.x > 0.9)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.y > 0.9)
|
||||
// fragColor = vec4(1.0);
|
||||
|
||||
// if (front.x > 0.45 && front.x < 0.55)
|
||||
// fragColor = vec4(0.0);
|
||||
|
||||
// if (front.y > 0.45 && front.y < 0.55)
|
||||
// fragColor = vec4(0.0);
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec2 texCoordinate;
|
||||
layout(location = 2) in vec3 vertPosition;
|
||||
|
||||
out vec3 vPosition;
|
||||
out vec2 texCoords;
|
||||
|
||||
// Source: http://stackoverflow.com/questions/2588875/whats-the-best-way-to-draw-a-fullscreen-quad-in-opengl-3-2
|
||||
const vec2 screenScale = vec2(0.5, 0.5);
|
||||
|
||||
void main() {
|
||||
texCoords = vertPosition.xy*screenScale+screenScale; // scale vertex attribute to [0-1] range
|
||||
gl_Position = vec4(vertPosition.xy, 0.0, 1.0);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user