mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-21 20:39:08 -06:00
Fixes for emiitance and volume cut (still weird that it disappears).
This commit is contained in:
@@ -54,11 +54,11 @@ namespace {
|
||||
"${MODULES}/galaxy/shaders/raycasterbounds_fs.glsl";
|
||||
constexpr const char* _loggerCat = "Renderable Galaxy";
|
||||
|
||||
constexpr const std::array<const char*, 3> UniformNamesPoints = {
|
||||
"modelMatrix", "cameraViewProjectionMatrix", "emittanceFactor"
|
||||
constexpr const std::array<const char*, 2> UniformNamesPoints = {
|
||||
"modelMatrix", "cameraViewProjectionMatrix"
|
||||
};
|
||||
constexpr const std::array<const char*, 6> UniformNamesBillboards = {
|
||||
"modelMatrix", "cameraViewProjectionMatrix", "emittanceFactor",
|
||||
constexpr const std::array<const char*, 5> UniformNamesBillboards = {
|
||||
"modelMatrix", "cameraViewProjectionMatrix",
|
||||
"cameraUp", "eyePosition", "psfTexture"
|
||||
};
|
||||
|
||||
@@ -546,9 +546,6 @@ void RenderableGalaxy::renderPoints(const RenderData& data) {
|
||||
cameraViewProjectionMatrix
|
||||
);
|
||||
|
||||
float emittanceFactor = _opacityCoefficient * static_cast<glm::vec3>(_volumeSize).x;
|
||||
_pointsProgram->setUniform(_uniformCachePoints.emittanceFactor, emittanceFactor);
|
||||
|
||||
glBindVertexArray(_pointsVao);
|
||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(_nPoints * _enabledPointsRatio));
|
||||
|
||||
@@ -609,9 +606,6 @@ void RenderableGalaxy::renderBillboards(const RenderData& data) {
|
||||
cameraViewProjectionMatrix
|
||||
);
|
||||
|
||||
float emittanceFactor = _opacityCoefficient * static_cast<glm::vec3>(_volumeSize).x;
|
||||
_billboardsProgram->setUniform(_uniformCacheBillboards.emittanceFactor, emittanceFactor);
|
||||
|
||||
glm::dvec3 eyePosition = glm::dvec3(
|
||||
glm::inverse(data.camera.combinedViewMatrix()) * glm::dvec4(0.0, 0.0, 0.0, 1.0)
|
||||
);
|
||||
|
||||
@@ -90,10 +90,10 @@ private:
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _pointsProgram;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _billboardsProgram;
|
||||
UniformCache(
|
||||
modelMatrix, cameraViewProjectionMatrix, emittanceFactor
|
||||
modelMatrix, cameraViewProjectionMatrix
|
||||
) _uniformCachePoints;
|
||||
UniformCache(
|
||||
modelMatrix, cameraViewProjectionMatrix, emittanceFactor,
|
||||
modelMatrix, cameraViewProjectionMatrix,
|
||||
cameraUp, eyePosition, psfTexture
|
||||
) _uniformCacheBillboards;
|
||||
std::vector<float> _pointsData;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "floatoperations.glsl"
|
||||
|
||||
uniform sampler2D psfTexture;
|
||||
uniform float emittanceFactor;
|
||||
|
||||
in vec4 vs_position;
|
||||
in vec2 psfCoords;
|
||||
@@ -38,7 +37,6 @@ Fragment getFragment() {
|
||||
|
||||
vec4 textureColor = texture(psfTexture, 0.5*psfCoords + 0.5);
|
||||
vec4 fullColor = vec4(ge_color*textureColor.a, textureColor.a);
|
||||
fullColor.a *= emittanceFactor;
|
||||
if (fullColor.a == 0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include "fragment.glsl"
|
||||
#include "floatoperations.glsl"
|
||||
|
||||
uniform float emittanceFactor;
|
||||
|
||||
in vec4 vs_position;
|
||||
in vec3 vs_color;
|
||||
in float vs_screenSpaceDepth;
|
||||
@@ -34,7 +32,7 @@ in float vs_screenSpaceDepth;
|
||||
Fragment getFragment() {
|
||||
Fragment frag;
|
||||
|
||||
vec4 fullColor = vec4(vs_color, emittanceFactor);
|
||||
vec4 fullColor = vec4(vs_color, 1.0);
|
||||
frag.color = fullColor;
|
||||
|
||||
frag.depth = vs_screenSpaceDepth;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* 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;
|
||||
@@ -36,8 +36,8 @@ uniform mat4 modelViewTransform;
|
||||
void main() {
|
||||
modelPosition = vertPosition.xyz;
|
||||
viewPosition = modelViewTransform*vertPosition;
|
||||
|
||||
|
||||
// project the position to view space
|
||||
gl_Position = viewProjection * viewPosition;
|
||||
gl_Position.z = 1.0;
|
||||
gl_Position.z = 0.0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user