Fixed the camera movement so it now take into account sub-voxel movement

Also fixed the distortion around the XY axes
This commit is contained in:
MitchellHansen
2016-09-23 14:08:01 -07:00
parent fe0fbc04e1
commit 1620f40d02
5 changed files with 29 additions and 22 deletions

View File

@@ -291,18 +291,16 @@ int CL_Wrapper::run_kernel(std::string kernel_name, const int work_size){
if (assert(error, "clEnqueueNDRangeKernel"))
return -1;
clFinish(getCommandQueue());
// What if errors out and gl objects are never released?
error = clEnqueueReleaseGLObjects(getCommandQueue(), 1, &buffer_map.at("image_buffer"), 0, NULL, NULL);
if (assert(error, "clEnqueueReleaseGLObjects"))
return -1;
return 1;
}
cl_device_id CL_Wrapper::getDeviceID(){ return device_id; };
cl_platform_id CL_Wrapper::getPlatformID(){ return platform_id; };
cl_context CL_Wrapper::getContext(){ return context; };
@@ -316,7 +314,6 @@ bool CL_Wrapper::assert(int error_code, std::string function_name){
switch (error_code) {
case CL_SUCCESS:
return false;

View File

@@ -68,7 +68,7 @@ int Camera::update(double delta_time) {
// so vector multiplication broke?
// have to do it component wise
double multiplier = 50;
double multiplier = 10;
position.x += movement.x * delta_time * multiplier;
position.y += movement.y * delta_time * multiplier;

View File

@@ -68,12 +68,8 @@ int main() {
//Map m(sf::Vector3i (50, 50, 50));
//return 1;
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");
// Setup CL, instantiate and pass in values to the kernel
CL_Wrapper c;
query_platform_devices();
@@ -81,9 +77,9 @@ int main() {
c.create_shared_context();
c.create_command_queue();
//c.compile_kernel("../kernels/kernel.cl", true, "hello");
if (c.compile_kernel("../kernels/minimal_kernel.cl", true, "min_kern") < 0) {
if (c.compile_kernel("../kernels/ray_caster_kernel.cl", true, "min_kern") < 0) {
std::cin.get();
return -1;
}
std::cout << "map...";
@@ -277,7 +273,7 @@ int main() {
camera.add_relative_impulse(Camera::DIRECTION::RIGHT);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::T)) {
camera.set_position(sf::Vector3f(20, 20, 20));
camera.set_position(sf::Vector3f(50, 50, 50));
}
camera.add_static_impulse(cam_vec);
@@ -313,8 +309,7 @@ int main() {
// Run the raycast
c.run_kernel("min_kern", WORK_SIZE);
clFinish(c.getCommandQueue());
// ==== RENDER ====
window.clear(sf::Color::Black);