lots of little tweaks, the cl is still completely broken, need to revert the oct position calc
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include "Application.h"
|
||||
|
||||
const int Application::MAP_X = 32;
|
||||
const int Application::MAP_Y = 32;
|
||||
const int Application::MAP_Z = 32;
|
||||
const int Application::MAP_X = 16;
|
||||
const int Application::MAP_Y = 16;
|
||||
const int Application::MAP_Z = 16;
|
||||
|
||||
Application::Application() {
|
||||
|
||||
@@ -50,9 +50,10 @@ bool Application::init_clcaster() {
|
||||
raycaster->assign_octree(map);
|
||||
raycaster->assign_map(map);
|
||||
|
||||
|
||||
camera = std::make_shared<Camera>(
|
||||
sf::Vector3f(30.5f, 30.5f, 10.5f), // Starting position
|
||||
sf::Vector2f(1.50f, -2.0f), // Direction
|
||||
sf::Vector3f(3.8f, 3.4f, 2.6f), // Starting position
|
||||
sf::Vector2f(1.56f, .81f), // Direction
|
||||
window.get()
|
||||
);
|
||||
raycaster->assign_camera(camera);
|
||||
@@ -66,7 +67,7 @@ bool Application::init_clcaster() {
|
||||
|
||||
// Create a light prototype, send it to the controller, and get the handle back
|
||||
LightPrototype prototype(
|
||||
sf::Vector3f(30, 30.0f, 30.0f),
|
||||
sf::Vector3f(10, 10.0f, 10.0f),
|
||||
sf::Vector3f(-1.0f, -1.0f, -1.5f),
|
||||
sf::Vector4f(0.01f, 0.01f, 0.01f, 0.2f)
|
||||
);
|
||||
|
||||
@@ -239,9 +239,6 @@ bool CLCaster::create_viewport(int width, int height, float v_fov, float h_fov)
|
||||
|
||||
// And an array of vectors describing the way the "lens" of our
|
||||
// camera works
|
||||
|
||||
// This could be modified to make some odd looking camera lenses
|
||||
|
||||
viewport_matrix = new sf::Vector4f[width * height * 4];
|
||||
|
||||
for (int y = -view_res.y / 2; y < view_res.y / 2; y++) {
|
||||
@@ -258,9 +255,9 @@ bool CLCaster::create_viewport(int width, int height, float v_fov, float h_fov)
|
||||
static_cast<float>(ray.z * cos(1.57) - ray.x * sin(1.57))
|
||||
);
|
||||
|
||||
ray.y += (rand() % 1000) / 100000.0;
|
||||
ray.x += (rand() % 1000) / 100000.0;
|
||||
ray.z += (rand() % 1000) / 100000.0;
|
||||
// ray.y += (rand() % 1000) / 100000.0;
|
||||
// ray.x += (rand() % 1000) / 100000.0;
|
||||
// ray.z += (rand() % 1000) / 100000.0;
|
||||
|
||||
ray = Normalize(ray);
|
||||
int index = (x + view_res.x / 2) + view_res.x * (y + view_res.y / 2);
|
||||
|
||||
@@ -54,9 +54,9 @@ int Camera::add_relative_impulse(DIRECTION impulse_direction, float speed) {
|
||||
|
||||
}
|
||||
|
||||
float val = movement.z;
|
||||
//float val = movement.z;
|
||||
movement += SphereToCart(dir) * speed;
|
||||
movement.z = val;
|
||||
//movement.z = val;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -125,14 +125,14 @@ int Camera::update(double delta_time) {
|
||||
|
||||
movement.x *= static_cast<float>(friction_coefficient * delta_time * multiplier);
|
||||
movement.y *= static_cast<float>(friction_coefficient * delta_time * multiplier);
|
||||
|
||||
if (position.z < 3.0f){
|
||||
position.z = 3.0f;
|
||||
movement.z = -0.1;
|
||||
} else {
|
||||
// gravity
|
||||
movement.z -= 0.7f * delta_time;
|
||||
}
|
||||
movement.z *= static_cast<float>(friction_coefficient * delta_time * multiplier);
|
||||
// if (position.z < 3.0f){
|
||||
// position.z = 3.0f;
|
||||
// movement.z = -0.1;
|
||||
// } else {
|
||||
// // gravity
|
||||
// movement.z -= 0.7f * delta_time;
|
||||
// }
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,19 +16,19 @@ ArrayMap::ArrayMap(sf::Vector3i dimensions) {
|
||||
|
||||
for (int x = 0; x < dimensions.x; x++) {
|
||||
for (int y = 0; y < dimensions.y; y++) {
|
||||
for (int z = 0; z < 2; z++) {
|
||||
for (int z = 0; z < 1; z++) {
|
||||
setVoxel(sf::Vector3i(x, y, z), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < dimensions.x/2-1; x++) {
|
||||
for (int y = 0; y < dimensions.y/2-1; y++) {
|
||||
for (int z = 0; z < dimensions.z/2-1; z++) {
|
||||
setVoxel(sf::Vector3i(x, y, z), 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
// for (int x = 0; x < dimensions.x/2-1; x++) {
|
||||
// for (int y = 0; y < dimensions.y/2-1; y++) {
|
||||
// for (int z = 0; z < dimensions.z/2-1; z++) {
|
||||
// setVoxel(sf::Vector3i(x, y, z), 5);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user