Added relativity
This commit is contained in:
parent
193b970837
commit
8cc0eb7d49
100012
Gal_data/Galaxy_a
Normal file
100012
Gal_data/Galaxy_a
Normal file
File diff suppressed because it is too large
Load Diff
0
Gal_data/Galaxy_b
Normal file
0
Gal_data/Galaxy_b
Normal file
@ -1,3 +1,3 @@
|
|||||||
0.5
|
0.1
|
||||||
75
|
150
|
||||||
0
|
0
|
||||||
|
298664
Gal_data/Universe
298664
Gal_data/Universe
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,9 @@ class Vector3;
|
|||||||
// Starts the clock
|
// Starts the clock
|
||||||
std::clock_t startTime = std::clock();
|
std::clock_t startTime = std::clock();
|
||||||
|
|
||||||
|
// Sets the constant
|
||||||
|
const float sol = 10.0; // Speed of light *should* be 1, but 10.0 make it compatible with old settings so I don't need to change the text in the creator
|
||||||
|
|
||||||
// Defines a pointer to the screen size (needs to be accessible everywhere, but the Vector3 class is still undefined!)
|
// Defines a pointer to the screen size (needs to be accessible everywhere, but the Vector3 class is still undefined!)
|
||||||
Vector3 *screenSize;
|
Vector3 *screenSize;
|
||||||
|
|
||||||
@ -233,11 +236,18 @@ struct Star
|
|||||||
Star() {}
|
Star() {}
|
||||||
|
|
||||||
// Called ever subframe
|
// Called ever subframe
|
||||||
void tick(float dt) {
|
void tick(float dt, bool relativistic) {
|
||||||
|
|
||||||
|
if (true){
|
||||||
|
acceleration = acceleration * (sol - sqrt(velocity.SqrMagnitude()))/sol;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Calc intégral lets gooo
|
// Calc intégral lets gooo
|
||||||
position = position + velocity * dt + acceleration * dt * dt * 0.5;
|
position = position + velocity * dt + acceleration * dt * dt * 0.5;
|
||||||
velocity = velocity + acceleration * dt;
|
velocity = velocity + acceleration * dt;
|
||||||
acceleration = Vector3 (0,0,0);
|
acceleration = Vector3 (0,0,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculates the field at a point in space
|
// Calculates the field at a point in space
|
||||||
@ -464,7 +474,7 @@ int main() {
|
|||||||
// Must update everything at the same time
|
// Must update everything at the same time
|
||||||
#pragma omp parallel for
|
#pragma omp parallel for
|
||||||
for (int i = 0 ; i < starCount ; i++) {
|
for (int i = 0 ; i < starCount ; i++) {
|
||||||
stars[i].tick(timestep);
|
stars[i].tick(timestep, i < sigStars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user