mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
+ | Texture finally working entirely
This commit is contained in:
@ -7,7 +7,7 @@ Pos=1645,8
|
|||||||
Size=259,200
|
Size=259,200
|
||||||
|
|
||||||
[Window][Material]
|
[Window][Material]
|
||||||
Pos=1648,211
|
Pos=1648,210
|
||||||
Size=262,299
|
Size=262,299
|
||||||
|
|
||||||
[Window][Fog settings]
|
[Window][Fog settings]
|
||||||
|
@ -24,8 +24,8 @@ pl 0 -2 0 0 1 0 2 // floor
|
|||||||
|
|
||||||
qu -1 1.999 -1 2 0 0 0 0 2 6
|
qu -1 1.999 -1 2 0 0 0 0 2 6
|
||||||
|
|
||||||
OBJ scenes/obj/Dragon_800K.obj -0.5 0 0.55 5 0 90 0
|
OBJ obj/Dragon_800K.obj -0.5 0 0.55 5 0 90 0
|
||||||
OBJ scenes/obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0
|
OBJ obj/Dragon_800K.obj 0.5 0 -0.55 5 0 -90 0
|
||||||
|
|
||||||
|
|
||||||
# OBJ obj/Model.obj
|
# OBJ obj/Model.obj
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 555 KiB |
Binary file not shown.
Before Width: | Height: | Size: 92 KiB |
@ -239,6 +239,11 @@ void main()
|
|||||||
if (pixel_coords.x >= int(u_resolution.x) || pixel_coords.y >= int(u_resolution.y))
|
if (pixel_coords.x >= int(u_resolution.x) || pixel_coords.y >= int(u_resolution.y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// vec2 uv = ((vec2(pixel_coords)) / u_resolution);
|
||||||
|
// uv.x *= u_resolution.x / u_resolution.y;
|
||||||
|
// imageStore(output_image, pixel_coords, vec4(vec3(uv, 0.), 1.));
|
||||||
|
// return ;
|
||||||
|
|
||||||
if (u_pixelisation != 1 && (uint(pixel_coords.x) % u_pixelisation != 0 || uint(pixel_coords.y) % u_pixelisation != 0))
|
if (u_pixelisation != 1 && (uint(pixel_coords.x) % u_pixelisation != 0 || uint(pixel_coords.y) % u_pixelisation != 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ vec3 getTextureColor(int texture_index, hitInfo hit)
|
|||||||
{
|
{
|
||||||
GPUTriangle tri = triangles[hit.obj_index];
|
GPUTriangle tri = triangles[hit.obj_index];
|
||||||
uv = hit.u * tri.texture_vertex2 + hit.v * tri.texture_vertex3 + (1 - (hit.u + hit.v)) * tri.texture_vertex1;
|
uv = hit.u * tri.texture_vertex2 + hit.v * tri.texture_vertex3 + (1 - (hit.u + hit.v)) * tri.texture_vertex1;
|
||||||
|
uv = vec2(uv.x, 1-uv.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (texture(textures[texture_index], uv).rgb);
|
return (texture(textures[texture_index], uv).rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/01/16 15:00:33 by tomoron #+# #+# */
|
/* Created: 2025/01/16 15:00:33 by tomoron #+# #+# */
|
||||||
/* Updated: 2025/01/28 19:18:37 by ycontre ### ########.fr */
|
/* Updated: 2025/01/29 18:26:31 by ycontre ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -55,7 +55,6 @@ glm::vec2 ObjParser::getUV(std::stringstream &line)
|
|||||||
|
|
||||||
if(!(line >> res.x) || (!(line >> res.y) && !line.eof()))
|
if(!(line >> res.x) || (!(line >> res.y) && !line.eof()))
|
||||||
throw std::runtime_error("syntax error in obj file while parsing texture vertex");
|
throw std::runtime_error("syntax error in obj file while parsing texture vertex");
|
||||||
// res = res - glm::floor(res);
|
|
||||||
return(res);
|
return(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user