~ | Small modif

This commit is contained in:
RedShip
2025-01-15 19:53:00 +01:00
parent 7d81da012e
commit a892d5e7e6
9 changed files with 25390 additions and 25 deletions

View File

@ -0,0 +1,25 @@
newmtl 10517_Motorcycle_Helmet_v01
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka 10517_Motorcycle_Helmet_v01_difuse.jpg
map_Kd 10517_Motorcycle_Helmet_v01_difuse.jpg
newmtl 10517_Motorcycle_Helmet_v01_glass
Ns 10.0000
Ni 1.5000
d 0.3000
Tr 0.7000
Tf 0.3000 0.3000 0.3000
illum 2
Ka 0.2549 0.2549 0.2549
Kd 0.2549 0.2549 0.2549
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -22,4 +22,4 @@ sp -3.8 -0.1 0.60 0.5 5
cy 0 1 2 0.5 2 -1.5 0 0.75 1
OBJ obj/Lowpoly_tree_sample.obj
OBJ obj/10517_Motorcycle_Helmet_v01_L3.obj

View File

@ -71,23 +71,25 @@ vec3 sampleLights(vec3 position, inout uint rng_state)
{
vec3 light = vec3(0.0);
int emissive_count = 0;
for (int i = 0; i < u_objectsNum; i++)
{
GPUObject obj = objects[i];
if (materials[objects[i].mat_index].emission > 0.0)
emissive_count++;
int target_light = int(floor(randomValue(rng_state) * float(emissive_count)));
GPUObject obj = objects[target_light];
GPUMaterial mat = materials[obj.mat_index];
if (mat.emission > 0.0)
{
vec3 light_dir = normalize(obj.position - position);
float light_dist = length(obj.position - position);
Ray shadow_ray = Ray(position + light_dir * 0.01, light_dir);
hitInfo shadow_hit = traceRay(shadow_ray);
if (shadow_hit.obj_index == i)
if (shadow_hit.obj_index == target_light)
light += mat.emission * mat.color / (light_dist);
}
}
return (light);
}
@ -121,6 +123,6 @@ vec3 sampleLights(vec3 position, inout uint rng_state)
void calculateLightColor(GPUMaterial mat, hitInfo hit, inout vec3 color, inout vec3 light, inout uint rng_state)
{
color *= mat.color;
// light += mat.emission * mat.color;
light += sampleLights(hit.position, rng_state);
light += mat.emission * mat.color;
// light += sampleLights(hit.position, rng_state);
}

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/15 14:00:38 by TheRed #+# #+# */
/* Updated: 2024/12/23 17:42:20 by ycontre ### ########.fr */
/* Updated: 2025/01/15 19:32:41 by ycontre ### ########.fr */
/* */
/* ************************************************************************** */
@ -38,7 +38,7 @@ void Camera::updateCameraVectors()
void Camera::update(float delta_time)
{
delta_time = std::min(delta_time, 0.01f);
// delta_time = std::min(delta_time, 0.01f);
_velocity += _acceleration * delta_time;

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/23 18:29:41 by ycontre #+# #+# */
/* Updated: 2025/01/15 18:58:34 by ycontre ### ########.fr */
/* Updated: 2025/01/15 19:34:49 by ycontre ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,7 +17,7 @@ Scene::Scene()
_camera = new Camera(glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), -90.0f, 0.0f);
_gpu_volume.enabled = 0;
_gpu_volume.sigma_a = glm::vec3(0.0001f);
_gpu_volume.sigma_a = glm::vec3(0.0f);
_gpu_volume.sigma_s = glm::vec3(0.0800f);
_gpu_volume.sigma_t = _gpu_volume.sigma_a + _gpu_volume.sigma_s;
_gpu_volume.g = 0.9f;

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/26 21:43:51 by TheRed #+# #+# */
/* Updated: 2025/01/15 19:08:42 by tomoron ### ########.fr */
/* Updated: 2025/01/15 19:52:51 by ycontre ### ########.fr */
/* */
/* ************************************************************************** */
@ -141,7 +141,7 @@ void SceneParser::parseMtl(std::stringstream &input_line, std::map<std::string,
throw std::runtime_error("OBJ : could not open material file");
while(getline(file, line))
{
if(line[0] == '#' || !line[0])
if (line.empty() || line[0] == '#')
continue;
std::stringstream lineStream(line);
lineStream >> identifier;

View File

@ -6,7 +6,7 @@
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/13 16:16:24 by TheRed #+# #+# */
/* Updated: 2025/01/15 18:58:49 by ycontre ### ########.fr */
/* Updated: 2025/01/15 19:34:25 by ycontre ### ########.fr */
/* */
/* ************************************************************************** */
@ -242,7 +242,7 @@ void Window::imGuiRender()
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
if (has_changed)
_frameCount = (accumulate == 0) + 1;
_frameCount = (accumulate == 0) - 1;
}
GLFWwindow *Window::getWindow(void) const