Merge branch 'master' of http://git.j3d1.de/KKK/KlassischeKeplerKriege
This commit is contained in:
commit
756e98fe9f
55 changed files with 123227 additions and 437 deletions
BIN
data/img/planet_mars.png
Normal file
BIN
data/img/planet_mars.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
BIN
data/img/test.png
Normal file
BIN
data/img/test.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7 KiB |
114662
data/mesh/planet_128.stl
Normal file
114662
data/mesh/planet_128.stl
Normal file
File diff suppressed because it is too large
Load diff
18
data/mesh/rocket.scad
Normal file
18
data/mesh/rocket.scad
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
$fn = 16;
|
||||
|
||||
translate([0, 0, -0.2]) {
|
||||
cylinder(r=0.05, h=0.4);
|
||||
translate([0, 0, 0.25]) cylinder(r=0.065, h=0.1);
|
||||
translate([0, 0, 0.35]) sphere(r=0.07);
|
||||
translate([0, 0, 0.35]) cylinder(r=0.01, h=0.2);
|
||||
|
||||
for (h=[0.07, 0.2]) {
|
||||
translate([0, 0, h]) {
|
||||
for (i=[0,1,2,3]) {
|
||||
rotate([0, 0, 90*i]) {
|
||||
cube([0.2, 0.01, 0.07], center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
5126
data/mesh/rocket.stl
Normal file
5126
data/mesh/rocket.stl
Normal file
File diff suppressed because it is too large
Load diff
13
data/shader/background.frag
Normal file
13
data/shader/background.frag
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#version 120
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
varying vec3 vertex;
|
||||
varying vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = texture2D(texture, uv).rgb;
|
||||
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
||||
12
data/shader/background.vert
Normal file
12
data/shader/background.vert
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#version 120
|
||||
uniform vec2 uvScale;
|
||||
|
||||
varying vec3 vertex;
|
||||
varying vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = gl_Vertex;
|
||||
vertex = gl_Position.xyz;
|
||||
uv = uvScale * (0.5 + vertex.xy / 2.0);
|
||||
}
|
||||
|
|
@ -10,6 +10,10 @@ uniform vec3 materialColor;
|
|||
uniform int materialKind;
|
||||
uniform int materialSeed;
|
||||
|
||||
uniform int explLightsNum;
|
||||
uniform vec3 explLightsPos[10];
|
||||
uniform float explLightsIntensities[10];
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 Eye = normalize(-vertex);
|
||||
|
|
@ -27,7 +31,31 @@ void main()
|
|||
vec3 color = materialColor;
|
||||
color = max(vec3(0.0), min(vec3(1.0), color));
|
||||
|
||||
vec3 IDiffuse = vec3(color) * lightColor * max(dot(normal, lightDirection), 0.0);
|
||||
vec3 light = lightColor * max(dot(normal, lightDirection), 0.0);
|
||||
//vec3 light = vec3(0.0);
|
||||
|
||||
int i;
|
||||
for (i=0; i<explLightsNum; i++) {
|
||||
vec3 explLightColor = vec3(1.0, 0.5, 0.2);
|
||||
vec3 diff = vertex - explLightsPos[i];
|
||||
float l = 10.0*length(diff);
|
||||
float dir = max(0.0, -dot(normal, diff));
|
||||
float dp = max(0.0, 1.0-l);
|
||||
|
||||
float intensity = 10.0;
|
||||
if (dp == 0.0) {
|
||||
intensity *= dir;
|
||||
} else {
|
||||
intensity *= dp;
|
||||
}
|
||||
intensity /= 1.0 + 0.5*l*l;
|
||||
|
||||
light += intensity * pow(explLightsIntensities[i], 2.0) * explLightColor;
|
||||
}
|
||||
|
||||
light = max(vec3(0.0), light);
|
||||
|
||||
vec3 IDiffuse = vec3(color) * light;
|
||||
|
||||
// TODO make instensity/exponent as parameter
|
||||
//vec3 ISpecular = lightColor * 5.0 * pow(max(dot(Reflected, Eye), 0.0), 2.0);
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ varying vec3 lightDirection;
|
|||
|
||||
uniform mat4 model;
|
||||
uniform vec3 lightPosition;
|
||||
uniform float aspectRatio;
|
||||
|
||||
void main()
|
||||
{
|
||||
// TODO: this becomes invalid when projection matrices are used
|
||||
vec3 p = (model*vec4(in_vertex, 1.0)).xyz;
|
||||
vec3 p = (model*vec4(in_vertex/vec3(aspectRatio, 1.0, 1.0), 1.0)).xyz;
|
||||
lightDirection = normalize(lightPosition - p);
|
||||
|
||||
vertex = p.xyz;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ varying vec3 velocity;
|
|||
varying float decay;
|
||||
|
||||
varying float explCenterDist;
|
||||
uniform vec3 explCenter;
|
||||
|
||||
float pi = 3.14159;
|
||||
|
||||
vec3 hsv2rgb(vec3 c)
|
||||
{
|
||||
|
|
@ -13,15 +14,28 @@ vec3 hsv2rgb(vec3 c)
|
|||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
float hash(float n)
|
||||
{
|
||||
return fract(sin(n)*43758.5453);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float r = length(vertex);
|
||||
if (r > 1.0) {
|
||||
// normalize radius from 0..1
|
||||
vec2 vn = 2.0*vertex;
|
||||
float rn = length(vn);
|
||||
float angle = atan(vn.y, vn.x);
|
||||
float hs = 20.0;
|
||||
float removeCorners = 0.5 * (hash(fract(hs*vertex.x)) + hash(fract(hs*vertex.y)));
|
||||
if (rn+removeCorners > 1.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
//float rf = 0.5-0.5*rn;
|
||||
float rf = 1.0;
|
||||
|
||||
float d = decay/(1.0+max(0.0, 1.0-2.0*explCenterDist));
|
||||
float h = (1.0-d)/6.0;
|
||||
float h = max(0.0, (1.0-d)/6.0) * rf;
|
||||
float v = max(0.0, (1.0-log(d)));
|
||||
float s = max(0.0, min(30.0 * sqrt(decay) * explCenterDist, 1.0));
|
||||
|
||||
|
|
@ -31,4 +45,5 @@ void main()
|
|||
gl_FragColor = vec4(hsv2rgb(vec3(h, s, v)), 1.0);
|
||||
|
||||
//gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
|
||||
//gl_FragColor.rgb = vec3(0.5+0.5*(a/pi));
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
#version 120
|
||||
attribute vec2 in_vertex;
|
||||
attribute vec3 in_position;
|
||||
attribute vec3 in_velocity;
|
||||
attribute vec2 in_geometry;
|
||||
attribute vec3 in_position;
|
||||
attribute vec3 in_velocity;
|
||||
attribute float in_maxDist;
|
||||
|
||||
uniform float age;
|
||||
uniform float size;
|
||||
|
|
@ -14,6 +15,8 @@ varying vec3 velocity;
|
|||
varying vec2 vertex;
|
||||
varying float explCenterDist;
|
||||
|
||||
uniform float aspectRatio;
|
||||
|
||||
// TODO: rotate to face the user!
|
||||
void main()
|
||||
{
|
||||
|
|
@ -26,11 +29,17 @@ void main()
|
|||
decay = ageMod / halfAge;
|
||||
|
||||
// faster particles are smaller
|
||||
// TODO: scale by time too! scale down fast after 3 halfAges
|
||||
float scaleBySpeed = (1.0 - 0.95*length(in_velocity)/maxVelocity);
|
||||
float finalSize = size * scaleBySpeed;
|
||||
vec2 base = in_vertex;
|
||||
vec3 p = finalSize*vec3(base, 0.0);
|
||||
vec3 offset = (0.2*age + log(1.0+age*5.0)) * in_velocity + in_position;
|
||||
float finalSize = size * scaleBySpeed * (1.0-max(0.0, decay-3.0*halfAge)/2.0);
|
||||
vec2 base = in_geometry;
|
||||
vec3 p = vec3(finalSize*base, 0.0);
|
||||
vec3 move = (0.2*age + log(1.0+age*5.0)) * in_velocity;
|
||||
float md = length(move);
|
||||
if (md > in_maxDist) {
|
||||
move *= in_maxDist / md;
|
||||
}
|
||||
vec3 offset = move + in_position;
|
||||
p += offset;
|
||||
|
||||
gl_Position = vec4(p, 1.0);
|
||||
|
|
@ -38,5 +47,5 @@ void main()
|
|||
vertex = base.xy;
|
||||
velocity = in_velocity;
|
||||
|
||||
explCenterDist = length(explCenter-offset);
|
||||
explCenterDist = length(explCenter - offset);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue