mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-07 21:08:33 -06:00
some cleanup
This commit is contained in:
@@ -102,7 +102,6 @@ void main(void)
|
||||
gl_FragDepth = depth;
|
||||
|
||||
vec4 color = bv2rgb(ge_brightness[0])/1.1;
|
||||
|
||||
|
||||
diffuse = texture2D(texture1, texCoord)*color;
|
||||
///diffuse = vec4(Color, 1.0);
|
||||
|
||||
@@ -9,6 +9,8 @@ layout(location = 2) in vec3 ge_brightness;
|
||||
|
||||
out vec4 diffuse;
|
||||
|
||||
in float scale;
|
||||
|
||||
const float k = 10.0;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -101,15 +103,16 @@ void main(void)
|
||||
|
||||
|
||||
//float a = ge_brightness[2]/500;
|
||||
float b = scale;
|
||||
vec4 color = bv2rgb(ge_brightness[0]*b)/250;
|
||||
//color*=b;
|
||||
|
||||
vec4 color = bv2rgb(ge_brightness[0]);/*250;
|
||||
|
||||
// GL_SMOOTH_POINTS decrepated in core profile.
|
||||
/*if(dot(gl_PointCoord-0.5,gl_PointCoord-0.5)>0.25)
|
||||
if(dot(gl_PointCoord-0.5,gl_PointCoord-0.5)>0.25)
|
||||
discard;
|
||||
else*/
|
||||
diffuse = vec4(color.xyz, 1);
|
||||
//diffuse = vec4(1);
|
||||
else
|
||||
//diffuse = vec4(color.xyz, 1);//*b;
|
||||
diffuse = vec4(1)*b;
|
||||
|
||||
//diffuse = vec4(Color, 1.0);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void main(){
|
||||
|
||||
/// --- distance modulus --- NOT OPTIMIZED YET.
|
||||
|
||||
//float M = vs_brightness[0][0]; // get ABSOLUTE magnitude (x param)
|
||||
// float M = vs_brightness[0][0]; // get ABSOLUTE magnitude (x param)
|
||||
float M = vs_brightness[0][2]; // if NOT running test-target.
|
||||
vec4 cam = vec4(-campos[0].xyz, campos[0].w); // get negative camera position
|
||||
vec4 pos = psc_position[0]; // get OK star position
|
||||
@@ -53,21 +53,20 @@ void main(){
|
||||
// I dont trust the legnth function at this point
|
||||
vec2 pc = vec2(sqrt(x*x +y*y + z*z), result[3]); // form vec2
|
||||
|
||||
pc[0] *= 0.324077929; // convert meters -> parsecs
|
||||
pc[1] += -18;
|
||||
pc[0] *= 0.324077929f; // convert meters -> parsecs
|
||||
pc[1] += -18f;
|
||||
|
||||
float pc_psc = pc[0] * pow(10, pc[1]); // psc scale out
|
||||
float apparent = -(M - 5.0f * (1.f - log10(pc_psc))); // get APPARENT magnitude.
|
||||
|
||||
vec4 P = gl_in[0].gl_Position;
|
||||
|
||||
float weight = 0.001; // otherwise this takes over.
|
||||
float weight = 0.00000005f; // otherwise this takes over.
|
||||
float depth = -P.z;
|
||||
depth *= apparent;
|
||||
//if(round(apparent) < -13)
|
||||
depth *= pow(apparent,6);
|
||||
//if(round(apparent) > 10)
|
||||
spriteSize += (depth*weight);
|
||||
|
||||
|
||||
// EMIT QUAD
|
||||
for(int i = 0; i < 4; i++){
|
||||
vec4 p1 = P;
|
||||
|
||||
@@ -7,6 +7,7 @@ layout(location = 2) out vec3 ge_brightness[];
|
||||
|
||||
float spriteSize = 0.1; // set here for now.
|
||||
out vec2 texCoord;
|
||||
out float scale;
|
||||
|
||||
in vec4 psc_position[];
|
||||
in vec4 campos[];
|
||||
@@ -29,21 +30,20 @@ void main(){
|
||||
|
||||
float distToPoint = 1;
|
||||
|
||||
float radius = 0.3f;
|
||||
float radius = 2f;
|
||||
// EMIT POINT
|
||||
gl_Position = gl_in[0].gl_Position;
|
||||
|
||||
// right now only threshing with absolute magnitude.
|
||||
float absMag = 2.0f;
|
||||
float absMag = 1.0f;
|
||||
if(vs_brightness[0].x < 0.0) absMag = 3;
|
||||
if(vs_brightness[0].x < -3.0) absMag = 6;
|
||||
if(vs_brightness[0].x < -6.0) absMag = 9;
|
||||
|
||||
/*
|
||||
float M = vs_brightness[0][0]; // get ABSOLUTE magnitude (x param)
|
||||
// float M = vs_brightness[0][0]; // get ABSOLUTE magnitude (x param)
|
||||
float M = vs_brightness[0][2]; // if NOT running test-target.
|
||||
vec4 cam = vec4(-campos[0].xyz, campos[0].w); // get negative camera position
|
||||
// does swizzle work?? FFS! do it manually:
|
||||
//vec4 cam = vec4(-campos[0][0], -campos[0][1], -campos[0][2], campos[0][3]);
|
||||
vec4 pos = psc_position[0]; // get OK star position
|
||||
|
||||
vec4 result = psc_addition(pos, cam); // compute vec from camera to position
|
||||
@@ -61,12 +61,15 @@ void main(){
|
||||
float pc_psc = pc[0] * pow(10, pc[1]); // psc scale out
|
||||
float apparent = (M - 5.0f * (1.f - log10(pc_psc))); // formula, get appMagnitude.
|
||||
|
||||
float weight = 0.001; // otherwise this takes over.
|
||||
float same = gl_in[0].gl_Position.z;
|
||||
same *=apparent;
|
||||
spriteSize += (same*weight);
|
||||
*/
|
||||
gl_PointSize = radius;
|
||||
vec4 P = gl_in[0].gl_Position;
|
||||
|
||||
float weight = 0.1f; // otherwise this takes over.
|
||||
float depth = -P.z;
|
||||
//depth *= pow(apparent,6);
|
||||
//if(round(apparent) > 10)
|
||||
scale = -apparent*weight;
|
||||
|
||||
gl_PointSize = -apparent*0.3;
|
||||
|
||||
EmitVertex();
|
||||
EndPrimitive();
|
||||
|
||||
@@ -264,7 +264,7 @@ void InteractionHandler::trackballRotate(int x, int y) {
|
||||
glm::vec2 mousePos = glm::vec2((float)x/width, (float)y/height);
|
||||
|
||||
mousePos = glm::clamp(mousePos, -0.5, 1.5); // Ugly fix #1: Camera position becomes NaN on mouse values outside [-0.5, 1.5]
|
||||
mousePos[1] = 0.5; // Ugly fix #2: Tempoarily only allow rotation around y
|
||||
//mousePos[1] = 0.5; // Ugly fix #2: Tempoarily only allow rotation around y
|
||||
|
||||
glm::vec3 curTrackballPos = mapToTrackball(mousePos);
|
||||
// LDEBUG(mousePos.x << ", " << mousePos.y << " = " << curTrackballPos.x << ", " << curTrackballPos.y << ", " << curTrackballPos.z);
|
||||
@@ -304,12 +304,12 @@ void InteractionHandler::keyboardCallback(int key, int action) {
|
||||
const double speed = 2.75;
|
||||
const double dt = getDt();
|
||||
if (key == 'S') {
|
||||
glm::vec3 euler(speed * dt, 0.0, 0.0);
|
||||
glm::vec3 euler(speed * dt* pow(10, 17), 0.0, 0.0);
|
||||
glm::quat rot = glm::quat(euler);
|
||||
orbit(rot);
|
||||
}
|
||||
if (key == 'W') {
|
||||
glm::vec3 euler(-speed * dt, 0.0, 0.0);
|
||||
glm::vec3 euler(-speed * dt* pow(10, 17), 0.0, 0.0);
|
||||
glm::quat rot = glm::quat(euler);
|
||||
orbit(rot);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ int printOglError(char *file, int line){
|
||||
|
||||
|
||||
#define GLSPRITES
|
||||
//#define GLPOINTS
|
||||
#define GLPOINTS
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "RenderableStars";
|
||||
|
||||
Reference in New Issue
Block a user