Commit f044552e authored by David Gilbert's avatar David Gilbert

Collision detection is now way more accurate - calls the noise function each frame tho.

parent 1e955d64
......@@ -19,8 +19,6 @@ uniform vec3 cameraPosition;
float getTessLevel(float d0, float d1){
float avg = (d0 + d1) / 2.0;
if(avg >= 100){
return 1;
......
......@@ -205,9 +205,11 @@ void main(){
tNormal = interpolate3D(tcNormal[0], tcNormal[1], tcNormal[2]);
tTexCoord = interpolate2D(tcTexCoord[0], tcTexCoord[1], tcTexCoord[2]);
tNormal = normalize(tNormal);
tPatchDistance = gl_TessCoord;
tPosition = interpolate3D(tcPosition[0], tcPosition[1], tcPosition[2]);
tPosition = normalize(tPosition);
//vec4 camWorld = uModelMatrix * vec4(tPosition, 1.0);
......
......@@ -19,7 +19,6 @@ uniform vec2 viewport;
float getTessLevel(float d0, float d1){
float avg = (d0 + d1) / 2.0;
float factor = 1.0/(recursionDepth*recursionDepth*recursionDepth);
......
......@@ -201,11 +201,12 @@ vec3 interpolate3D(vec3 v0, vec3 v1, vec3 v2){
void main(){
tNormal = interpolate3D(tcNormal[0], tcNormal[1], tcNormal[2]);
tNormal = normalize(tNormal);
tTexCoord = interpolate2D(tcTexCoord[0], tcTexCoord[1], tcTexCoord[2]);
//tPatchDistance = gl_TessCoord;
tPosition = interpolate3D(tcPosition[0], tcPosition[1], tcPosition[2]);
//tPosition = normalize(tPosition);
//vec4 camWorld = uModelMatrix * vec4(tPosition, 1.0);
//tPosition += tNormal * fBM( tPosition , 8, 32, 0.002 ) ;
......
......@@ -34,7 +34,7 @@ private:
bool m_keyState[SDL_NUM_SCANCODES];
float speed = 20;
float speed = 10;
void handleKeyboard(KeyboardEvent e);
void handleMouse(MouseEvent e);
......
......@@ -354,11 +354,10 @@ void PlayerSystem::update(float dt) {
// Calculate the noise at that point:
// TODO: Put the noise funtion somewhere where it makes more sense.
float noise = fBM(p, 8, 80.0, 0.003);
float noise = fBM(p, 8, 80, 0.003);
p = p * r;
p += noise * r;
float test = glm::length(p);
if (glm::length(cameraTransform->position) <= length(p)) {
if (glm::length(cameraTransform->position) <= glm::length(p) + 1) {
// We're inside a planet. Due to that not being good for our health, let's get out quick:
cameraTransform->position = cameraTransform->lastPosition;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment