add libft : strlen
This commit is contained in:
parent
9022563247
commit
9b08ecfca7
|
@ -1,3 +1,6 @@
|
||||||
[submodule "webgl"]
|
[submodule "webgl"]
|
||||||
path = webgl
|
path = webgl
|
||||||
url = https://git.gaetanbrochard.dev/gbrochar/webgl
|
url = https://git.gaetanbrochard.dev/gbrochar/webgl
|
||||||
|
[submodule "libft"]
|
||||||
|
path = libft
|
||||||
|
url = https://git.gaetanbrochard.dev/gbrochar/libft.git
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -41,11 +41,11 @@ SRC = $(addprefix $(SRC_DIR), $(SRC_FILE))
|
||||||
OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILE))
|
OBJ = $(addprefix $(OBJ_DIR), $(OBJ_FILE))
|
||||||
INC = $(addprefix $(INC_DIR), $(INC_FILE))
|
INC = $(addprefix $(INC_DIR), $(INC_FILE))
|
||||||
|
|
||||||
LIB = -lm -lGL -lglfw glew-2.2.0/lib/libGLEW.a
|
LIB = -lm -lGL -lglfw glew-2.2.0/lib/libGLEW.a libft/libft.a
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
CFLAGS = -Wall -Werror -Wextra -g3
|
CFLAGS = -Wall -Werror -Wextra
|
||||||
|
|
||||||
RED = \033[31m
|
RED = \033[31m
|
||||||
GREEN = \033[32m
|
GREEN = \033[32m
|
||||||
|
@ -58,6 +58,7 @@ all: $(NAME)
|
||||||
|
|
||||||
$(NAME): $(OBJ) $(INC)
|
$(NAME): $(OBJ) $(INC)
|
||||||
@make -C glew-2.2.0
|
@make -C glew-2.2.0
|
||||||
|
@make -C libft
|
||||||
@$(CC) $(CFLAGS) -c $(SRC) -I $(INC_DIR) -I glew-2.2.0/include/
|
@$(CC) $(CFLAGS) -c $(SRC) -I $(INC_DIR) -I glew-2.2.0/include/
|
||||||
@mv $(OBJ_FILE) $(OBJ_DIR)
|
@mv $(OBJ_FILE) $(OBJ_DIR)
|
||||||
@$(CC) $(CFLAGS) $(OBJ) -o $(NAME) $(LIB)
|
@$(CC) $(CFLAGS) $(OBJ) -o $(NAME) $(LIB)
|
||||||
|
@ -71,11 +72,13 @@ $(OBJ_DIR)%.o: $(SRC_DIR)%.c inc/
|
||||||
@echo -e "$(CYAN)[CC]$(WHITE) $<"
|
@echo -e "$(CYAN)[CC]$(WHITE) $<"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@make -C libft clean
|
||||||
@rm -rf $(OBJ_DIR)
|
@rm -rf $(OBJ_DIR)
|
||||||
@echo -e "$(RED)[REMOVED]$(WHITE) obj files"
|
@echo -e "$(RED)[REMOVED]$(WHITE) obj files"
|
||||||
|
|
||||||
fclean: clean
|
fclean: clean
|
||||||
@make -C glew-2.2.0 clean
|
@make -C glew-2.2.0 clean
|
||||||
|
@make -C libft fclean
|
||||||
@rm -f $(NAME)
|
@rm -f $(NAME)
|
||||||
@echo -e "$(RED)[REMOVED]$(WHITE) $(NAME)"
|
@echo -e "$(RED)[REMOVED]$(WHITE) $(NAME)"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef SCOP_H
|
#ifndef SCOP_H
|
||||||
# define SCOP_H
|
# define SCOP_H
|
||||||
|
|
||||||
|
# include "../libft/libft.h"
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <ctype.h>
|
# include <ctype.h>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1ab0cdf1acf97db0cb8d90940c96a6f1ccb3a7af
|
|
@ -107,7 +107,7 @@ void parse_triangulate_dispatcher(t_env *e, int vertex_count) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void strtrim(char *line) {
|
void strtrim(char *line) {
|
||||||
size_t i = strlen(line) - 1;
|
size_t i = ft_strlen(line) - 1;
|
||||||
while (isspace(line[i])) {
|
while (isspace(line[i])) {
|
||||||
line[i] = '\0';
|
line[i] = '\0';
|
||||||
i--;
|
i--;
|
||||||
|
|
|
@ -44,15 +44,15 @@ int parse_append_data_index(t_env *e, char *phrase) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while ((token = strtok_r(phrase, "/", &phrase))) {
|
while ((token = strtok_r(phrase, "/", &phrase))) {
|
||||||
if (strlen(token) > 0 && token_count == 0) {
|
if (ft_strlen(token) > 0 && token_count == 0) {
|
||||||
e->object.properties |= VERTEX_FLAG;
|
e->object.properties |= VERTEX_FLAG;
|
||||||
ret = parse_append_data_ui(&(e->object.vertices_indices), token);
|
ret = parse_append_data_ui(&(e->object.vertices_indices), token);
|
||||||
}
|
}
|
||||||
else if (strlen(token) > 0 && token_count == 1) {
|
else if (ft_strlen(token) > 0 && token_count == 1) {
|
||||||
e->object.properties |= UV_FLAG;
|
e->object.properties |= UV_FLAG;
|
||||||
ret = parse_append_data_ui(&(e->object.uvs_indices), token);
|
ret = parse_append_data_ui(&(e->object.uvs_indices), token);
|
||||||
}
|
}
|
||||||
else if (strlen(token) > 0 && token_count == 2) {
|
else if (ft_strlen(token) > 0 && token_count == 2) {
|
||||||
e->object.properties |= NORMAL_FLAG;
|
e->object.properties |= NORMAL_FLAG;
|
||||||
ret = parse_append_data_ui(&(e->object.normals_indices), token);
|
ret = parse_append_data_ui(&(e->object.normals_indices), token);
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ static void AddShader(GLuint ShaderProgram, const char* pShaderText, GLenum Shad
|
||||||
const GLchar* p[1];
|
const GLchar* p[1];
|
||||||
p[0] = pShaderText;
|
p[0] = pShaderText;
|
||||||
GLint Lengths[1];
|
GLint Lengths[1];
|
||||||
Lengths[0] = strlen(pShaderText);
|
Lengths[0] = ft_strlen(pShaderText);
|
||||||
glShaderSource(*shader, 1, p, Lengths);
|
glShaderSource(*shader, 1, p, Lengths);
|
||||||
glCompileShader(*shader);
|
glCompileShader(*shader);
|
||||||
GLint success;
|
GLint success;
|
||||||
|
|
Loading…
Reference in New Issue