Accretion disk texture

Co-Authored-By: Emil Wallberg <49481622+EmilWallberg@users.noreply.github.com>
This commit is contained in:
Wilhelm Björkström
2025-05-09 16:07:22 +02:00
parent cd1a60374b
commit 76cdf4adf3
4 changed files with 18 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

View File

@@ -190,6 +190,13 @@ namespace openspace {
LWARNING("UniformCache is missing 'colorBVMap'");
}
#ifdef M_Kerr
ghoul::opengl::TextureUnit accretionDiskUnit;
if (!bindTexture(_uniformCache.accretionDisk, accretionDiskUnit, _accretionDiskTexture)) {
LWARNING("UniformCache is missing 'accretionDisk'");
}
#endif // M_Kerr
SendSchwarzschildTableToShader();
SendStarKDTreeToShader();
@@ -343,7 +350,13 @@ namespace openspace {
else {
LWARNING(std::format("Failed to load environment texture from path '{}'", absPath(_colorBVMapTexturePath).string()));
}
#if M_Kerr
_accretionDiskTexture = ghoul::io::TextureReader::ref().loadTexture(absPath("${MODULE_BLACKHOLE}/rendering/accretion_disk.png"), 1);
if (_accretionDiskTexture) {
_accretionDiskTexture->uploadTexture();
}
#endif
}
void RenderableBlackHole::bindFramebuffer() {

View File

@@ -79,11 +79,12 @@ namespace openspace {
GLuint _ssboStarKDTree = 0;
GLuint _ssboStarKDTreeIndices = 0;
UniformCache(environmentTexture, viewGrid, worldRotationMatrix, cameraRotationMatrix, colorBVMap, r_0) _uniformCache;
UniformCache(environmentTexture, viewGrid, worldRotationMatrix, cameraRotationMatrix, colorBVMap, r_0, accretionDisk) _uniformCache;
std::unique_ptr<ghoul::opengl::Texture> _warpTableTex;
std::unique_ptr<ghoul::opengl::Texture> _environmentTexture;
std::unique_ptr<ghoul::opengl::Texture> _colorBVMapTexture;
std::unique_ptr<ghoul::opengl::Texture> _accretionDiskTexture;
};
} // openspace namespace

View File

@@ -10,6 +10,7 @@ in vec2 TexCoord;
uniform sampler2D environmentTexture;
uniform sampler2D viewGrid;
uniform sampler1D accretionDisk;
uniform mat4 cameraRotationMatrix;
uniform mat4 worldRotationMatrix;
@@ -184,7 +185,7 @@ Fragment getFragment() {
frag.color = vec4(0.0f);
return frag;
} else if(sphericalCoords.x == DISK){
frag.color = vec4(clamp(sphericalCoords.y, 0.0, 1.0), 0.3*clamp(sphericalCoords.y, 0.0, 1.0), 0.15*clamp(sphericalCoords.y, 0.0, 1.0), 1.0f);
frag.color = vec4(texture(accretionDisk, sphericalCoords.y).rgb, 1.0f);
return frag;
}
vec4 starColor = searchNearestStar(vec3(0.0f, sphericalCoords.x, sphericalCoords.y), l);