Trying to get the position on the face where the rays intersect the voxel. Some promising first results.
This commit is contained in:
@@ -126,11 +126,11 @@ void Camera::recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Even
|
||||
}
|
||||
}
|
||||
|
||||
else if (event->type == vr::Event::KeyHeld) {
|
||||
else if (event->type == vr::Event::KeyPressed) {
|
||||
|
||||
vr::KeyPressed *key_event = static_cast<vr::KeyPressed*>(event.get());
|
||||
|
||||
if (key_event->code == sf::Keyboard::M) {
|
||||
if (key_event->code == sf::Keyboard::Y) {
|
||||
if (mouse_enabled)
|
||||
mouse_enabled = false;
|
||||
else
|
||||
|
||||
@@ -139,9 +139,9 @@ void Old_Map::generate_terrain() {
|
||||
}
|
||||
|
||||
|
||||
for (int x = dimensions.x / 2; x < dimensions.x / 2 + dimensions.x / 16; x++) {
|
||||
for (int y = dimensions.x / 2; y < dimensions.y / 2 + dimensions.x / 16; y++) {
|
||||
for (int z = 0; z < 20; z++) {
|
||||
for (int x = dimensions.x / 2; x < dimensions.x / 2 + dimensions.x / 64; x++) {
|
||||
for (int y = dimensions.x / 2; y < dimensions.y / 2 + dimensions.x / 64; y++) {
|
||||
for (int z = 0; z < 5; z++) {
|
||||
|
||||
voxel_data[x + dimensions.x * (y + dimensions.z * z)] = 6;
|
||||
}
|
||||
|
||||
@@ -162,6 +162,7 @@ int main() {
|
||||
Input input_handler;
|
||||
|
||||
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::KeyHeld);
|
||||
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::KeyPressed);
|
||||
camera->subscribe_to_publisher(&input_handler, vr::Event::EventType::MouseMoved);
|
||||
|
||||
WindowHandler win_hand(&window);
|
||||
@@ -181,14 +182,15 @@ int main() {
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Dash)) {
|
||||
raycaster->test_edit_viewport(WINDOW_X, WINDOW_Y, w -= 5, h -= 5);
|
||||
}
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::L)) {
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::LAlt)) {
|
||||
light_vec.at(0).position = camera->get_position();
|
||||
light_vec.at(0).direction_cartesian = SphereToCart(camera->get_direction());
|
||||
}
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::N)) {
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::O)) {
|
||||
light_vec.at(0).orbit_around_center(timer_accumulator += delta_time);
|
||||
}
|
||||
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::N)) {
|
||||
if (sf::Keyboard::isKeyPressed(sf::Keyboard::M)) {
|
||||
std::string path = "../assets/";
|
||||
std::string filename;
|
||||
std::getline(std::cin, filename);
|
||||
|
||||
Reference in New Issue
Block a user