mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-27 06:29:32 -06:00
Fix inverted texture problem
- Change texture indices of PowerScaledSphere - Change texture generation in FBOBass for projections - Updated NewHorizons to download unflipped texture - Use new Ghoul version
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "newhorizons_model", Destination = "models", Version = 1 },
|
||||
{ Identifier = "newhorizons_textures", Destination = "textures", Version = 1 }
|
||||
{ Identifier = "newhorizons_textures", Destination = "textures", Version = 2 }
|
||||
},
|
||||
TorrentFiles = {
|
||||
{ File = "NewHorizonsKernels.torrent", Destination = "${SPICE}" },
|
||||
|
||||
Submodule ext/ghoul updated: ba88e7fb74...989b2781f9
@@ -303,16 +303,17 @@ bool RenderablePlanetProjection::auxiliaryRendertarget(){
|
||||
size, size, 0.f, w, 1.f, 1.f,
|
||||
};
|
||||
|
||||
glGenVertexArrays(1, &_quad); // generate array
|
||||
glBindVertexArray(_quad); // bind array
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer); // bind buffer
|
||||
glGenVertexArrays(1, &_quad);
|
||||
glBindVertexArray(_quad);
|
||||
glGenBuffers(1, &_vertexPositionBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW);
|
||||
glEnableVertexAttribArray(3);
|
||||
glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(0));
|
||||
glEnableVertexAttribArray(4);
|
||||
glVertexAttribPointer(4, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(sizeof(GLfloat) * 4));
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(0));
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(sizeof(GLfloat) * 4));
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
||||
return completeSuccess;
|
||||
}
|
||||
@@ -376,7 +377,7 @@ void RenderablePlanetProjection::imageProjectGPU(){
|
||||
if (_geometry->hasProperty("radius")){
|
||||
ghoul::any r = _geometry->property("radius")->get();
|
||||
if (glm::vec4* radius = ghoul::any_cast<glm::vec4>(&r)){
|
||||
_fboProgramObject->setUniform("radius", radius);
|
||||
_fboProgramObject->setUniform("_radius", radius);
|
||||
}
|
||||
}else{
|
||||
LERROR("Geometry object needs to provide radius");
|
||||
@@ -384,7 +385,7 @@ void RenderablePlanetProjection::imageProjectGPU(){
|
||||
if (_geometry->hasProperty("segments")){
|
||||
ghoul::any s = _geometry->property("segments")->get();
|
||||
if (int* segments = ghoul::any_cast<int>(&s)){
|
||||
_fboProgramObject->setAttribute("segments", segments[0]);
|
||||
_fboProgramObject->setUniform("_segments", segments[0]);
|
||||
}
|
||||
}else{
|
||||
LERROR("Geometry object needs to provide segment count");
|
||||
|
||||
@@ -29,12 +29,13 @@ uniform sampler2D texture2;
|
||||
uniform mat4 ProjectorMatrix;
|
||||
uniform mat4 ModelTransform;
|
||||
uniform vec2 _scaling;
|
||||
uniform vec4 radius;
|
||||
flat in uint vs_segments;
|
||||
uniform vec4 _radius;
|
||||
uniform int _segments;
|
||||
|
||||
uniform float projectionFading;
|
||||
|
||||
in vec4 vs_position;
|
||||
|
||||
uniform vec3 boresight;
|
||||
|
||||
out vec4 color;
|
||||
@@ -43,16 +44,18 @@ out vec4 color;
|
||||
|
||||
vec4 uvToModel( float u, float v, vec4 radius, float segments){
|
||||
float fj = u * segments;
|
||||
float fi = v * segments;
|
||||
float fi = (1.0 - v) * segments;
|
||||
|
||||
float theta = fi * float(M_PI) / segments; // 0 -> PI
|
||||
float phi = fj * float(M_PI) * 2.0f / segments;
|
||||
|
||||
float x = radius[0] * sin(phi) * sin(theta); //
|
||||
float y = radius[1] * cos(theta); // up
|
||||
float y = radius[1] * cos(theta); // up
|
||||
float z = radius[2] * cos(phi) * sin(theta); //
|
||||
|
||||
return vec4(x, y, z, radius[3]);
|
||||
|
||||
return vec4(0.0);
|
||||
}
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
@@ -64,7 +67,7 @@ bool inRange(float x, float a, float b){
|
||||
void main() {
|
||||
vec2 uv = vec2(0.5,0.5)*vs_position.xy+vec2(0.5,0.5);
|
||||
|
||||
vec4 vertex = uvToModel(uv.x, uv.y, radius, vs_segments);
|
||||
vec4 vertex = uvToModel(uv.x, uv.y, _radius, _segments);
|
||||
|
||||
vec4 raw_pos = psc_to_meter(vertex, _scaling);
|
||||
vec4 projected = ProjectorMatrix * ModelTransform * raw_pos;
|
||||
|
||||
@@ -28,19 +28,17 @@ uniform mat4 ProjectorMatrix;
|
||||
uniform mat4 ModelTransform;
|
||||
uniform vec2 _scaling;
|
||||
|
||||
layout(location = 3) in vec4 in_position;
|
||||
layout(location = 0) in vec4 in_position;
|
||||
|
||||
uniform vec3 boresight;
|
||||
layout(location = 5) in int segments;
|
||||
uniform vec2 radius;
|
||||
|
||||
out vec4 vs_position;
|
||||
flat out uint vs_segments;
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
void main() {
|
||||
vs_position = in_position;
|
||||
vs_segments = segments;
|
||||
gl_Position = vec4(in_position.xy, 0.0, 1.0);
|
||||
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ PowerScaledSphere::PowerScaledSphere(const PowerScaledScalar& radius, int segmen
|
||||
|
||||
const float t1 = (fj / fsegments);
|
||||
const float t2 = 1.f - (fi / fsegments);
|
||||
//const float t2 = fi / fsegments;
|
||||
|
||||
//double tp = 1.0 / pow(10, static_cast<GLfloat>(radius[1]));
|
||||
|
||||
@@ -205,7 +204,6 @@ PowerScaledSphere::PowerScaledSphere(properties::Vec4Property &radius, int segme
|
||||
_varray[nr].normal[2] = normal[2];
|
||||
|
||||
const float t1 = fj / fsegments;
|
||||
//const float t2 = fi / fsegments;
|
||||
const float t2 = 1.f - (fi / fsegments);
|
||||
|
||||
_varray[nr].tex[0] = t1;
|
||||
|
||||
Reference in New Issue
Block a user