Added color to lights, added a gui slider to control the single light color
This commit is contained in:
@@ -50,7 +50,7 @@ void LightHandle::add_movement(sf::Vector3f movement)
|
||||
|
||||
void LightHandle::set_position(sf::Vector3f position)
|
||||
{
|
||||
|
||||
data_reference->position = position;
|
||||
}
|
||||
|
||||
void LightHandle::set_direction(sf::Vector3f direction)
|
||||
@@ -60,7 +60,7 @@ void LightHandle::set_direction(sf::Vector3f direction)
|
||||
|
||||
void LightHandle::set_rgbi(sf::Vector4f rgbi)
|
||||
{
|
||||
|
||||
data_reference->rgbi = rgbi;
|
||||
}
|
||||
|
||||
void LightHandle::recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Event> event)
|
||||
|
||||
@@ -203,7 +203,7 @@ void Old_Map::generate_terrain() {
|
||||
|
||||
int z = static_cast<int>(height_map[x + y * dimensions.x]);
|
||||
|
||||
while (z > 0) {
|
||||
while (z > 0 && z < dimensions.z) {
|
||||
voxel_data[x + dimensions.x * (y + dimensions.z * z)] = 5;
|
||||
z--;
|
||||
}
|
||||
|
||||
15
src/main.cpp
15
src/main.cpp
@@ -143,7 +143,7 @@ int main() {
|
||||
LightPrototype prototype(
|
||||
sf::Vector3f(100.0f, 100.0f, 30.0f),
|
||||
sf::Vector3f(-1.0f, -1.0f, -1.5f),
|
||||
sf::Vector4f(1.0f, 1.0f, 1.0f, 1.0f)
|
||||
sf::Vector4f(0.2f, 0.9f, 0.0f, 1.0f)
|
||||
);
|
||||
|
||||
std::shared_ptr<LightHandle> handle(light_controller.create_light(prototype));
|
||||
@@ -178,6 +178,8 @@ int main() {
|
||||
sf::Clock sf_delta_clock;
|
||||
fps_counter fps;
|
||||
|
||||
float light_color[4] = { 0, 0, 0, 0 };
|
||||
|
||||
while (window.isOpen()) {
|
||||
|
||||
input_handler.consume_sf_events(&window);
|
||||
@@ -254,6 +256,17 @@ int main() {
|
||||
|
||||
ImGui::End();
|
||||
|
||||
ImGui::Begin("Lights");
|
||||
|
||||
if (ImGui::SliderFloat4("Color", light_color, 0, 1)) {
|
||||
sf::Vector4f light(light_color[0], light_color[1], light_color[2], light_color[3]);
|
||||
handle->set_rgbi(light);
|
||||
}
|
||||
|
||||
|
||||
ImGui::End();
|
||||
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ int Hardware_Caster::debug_quick_recompile()
|
||||
}
|
||||
validate();
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Hardware_Caster::test_edit_viewport(int width, int height, float v_fov, float h_fov)
|
||||
@@ -377,6 +377,11 @@ int Hardware_Caster::acquire_platform_and_device() {
|
||||
current_best_device = device;
|
||||
}
|
||||
|
||||
//if (device.type == CL_DEVICE_TYPE_CPU &&
|
||||
// current_best_device.type != CL_DEVICE_TYPE_CPU) {
|
||||
// current_best_device = device;
|
||||
//}
|
||||
|
||||
// Get the unit with the higher compute units
|
||||
if (device.comp_units > current_best_device.comp_units) {
|
||||
current_best_device = device;
|
||||
@@ -390,6 +395,7 @@ int Hardware_Caster::acquire_platform_and_device() {
|
||||
if (current_best_device.cl_gl_sharing == false && device.cl_gl_sharing == true) {
|
||||
current_best_device = device;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +406,8 @@ int Hardware_Caster::acquire_platform_and_device() {
|
||||
std::cout << "Selected Platform : " << platform_id << std::endl;
|
||||
std::cout << "Selected Device : " << device_id << std::endl;
|
||||
std::cout << "Selected Name : " << current_best_device.name << std::endl;
|
||||
|
||||
std::cout << "Selected Version : " << current_best_device.version << std::endl;
|
||||
|
||||
if (current_best_device.cl_gl_sharing == false) {
|
||||
std::cout << "This device does not support the cl_khr_gl_sharing extension" << std::endl;
|
||||
return RayCaster::SHARING_NOT_SUPPORTED;
|
||||
@@ -538,7 +545,7 @@ int Hardware_Caster::compile_kernel(std::string kernel_source, bool is_path, std
|
||||
kernel_map[kernel_name] = kernel;
|
||||
//kernel_map.emplace(std::make_pair(kernel_name, kernel));
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Hardware_Caster::set_kernel_arg(
|
||||
|
||||
Reference in New Issue
Block a user