Added comments

This commit is contained in:
2026-02-10 15:31:37 +01:00
parent 399bbeb7c8
commit c2cda6db61
10 changed files with 125 additions and 72 deletions

View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/01 08:48:55 by aortigos #+# #+# */
/* Updated: 2026/01/11 16:05:14 by aortigos ### ########.fr */
/* Updated: 2026/02/10 12:40:04 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
@@ -31,12 +31,16 @@ t_texture_list *new_texture(char *line)
if ((!ft_strncmp(line, "NO", 2) || !ft_strncmp(line, "SO", 2))
|| !ft_strncmp(line, "WE", 2) || !ft_strncmp(line, "EA", 2))
{
// Extract first 2 chars as identifier
list->name = ft_substr(line, 0, 2);
// Extract everything after identifier
list->value = ft_substr(line, get_index(line, 2), ft_strlen(line));
}
else if ((!ft_strncmp(line, "F", 1) || !ft_strncmp(line, "C", 1)))
{
// Extract first char as identifier
list->name = ft_substr(line, 0, 1);
// Extract RGB values after identifier
list->value = ft_substr(line, get_index(line, 1), ft_strlen(line));
}
list->next = NULL;
@@ -47,6 +51,7 @@ void lst_back_ture(t_texture_list **l_ture, t_texture_list *new)
{
t_texture_list *tmp;
// If list is empty, new nodes becomes head
if (!*l_ture)
{
(*l_ture) = new;
@@ -64,11 +69,14 @@ int lst_ture(t_data *m, t_texture_list **l_ture)
t_texture_list *tmp;
i = 0;
// Process all 6 texture directives
while (m->texture2d[i])
{
// Create node for each texture line
tmp = new_texture(m->texture2d[i++]);
if (!tmp)
return (0);
// Add to end of list
lst_back_ture(l_ture, tmp);
}
return (1);