Skip to content

C library crafted for applications using 42's MLX graphics library.

Notifications You must be signed in to change notification settings

lvoneduval/libgraphic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

project-logo

Libgraphic

Personal toolkit for C graphics programming using minilibx

last-commit repo-top-language repo-language-count

Developed with the software and tools below.

Vim 42 MLX VSCode OpenAI

Table of Contents

πŸ“ Overview

Libgraphic is a C library crafted to streamline the development of visually-rich applications using 42's MLX graphics library. It provides a robust abstraction layer for direct pixel drawing, color manipulation, and complex geometric transformations, making interactive graphics development both straightforward and powerful.


🧩 Features

Mlx tools

Libgraphic integrates dedicated utilities for the MLX library, enhancing its native graphical capabilities while simplifying the programming interface. Specific functions are designed to optimize and extend the library's features as detailed.
See mlx_tools.h for details

Advanced Color Management

Handling colors precisely is crucial for design, simulation, or gaming applications. Libgraphic offers utilities for managing RGB, RGBA, and HSL color spaces, including quick conversions between these formats and tools for adjusting brightness, saturation, and other color properties.
See color.h for details

Vertex and Vector Manipulation

Efficient vertex and vector management is key for 3D rendering or physical simulations. LibGraphic provides robust functions for handling 2D and 3D vertices in integer and float types, and 2D and 3D float vectors, simplifying everything from shape transformations to dynamics management.
See vertex.h or vector.h for details

Rotation Systems and Matrices

With advanced functions for handling rotations via quaternions, Euler angles, spheric rotations, and axe angles, Libgraphic allows for precise and flexible orientation and transformation management. Support for 4D matrices for 3D space transformations is also included, promising future enhancements.
See rotation.h or matrix.h for details

Camera Modeling and Graphics Mathematics

Libgraphic also simplifies the setup of cameras based on the pinhole model, enabling quick and easy adjustments for realistic renderings. The provided graphics math functions further extend the library’s capabilities in image and shape manipulation.
See camera.h for details

Debugging and Optimization

Poor debug functions, still needs a big improvement
See debug.h for details
Libgraphic is designed to be extensible, high-performing, and user-friendly, suitable for any graphic project you plan to undertake.


πŸ—‚οΈ Repository Structure

Show repository structure
└── README.md
└── camera/
    β”œβ”€β”€ includes/
    β”‚   └── camera.h
    └── sources/
        β”œβ”€β”€ ft_cam_new.c
        β”œβ”€β”€ ft_cam_init.c
        β”œβ”€β”€ ft_cam_lookat.c
        └── ft_view_mat4.c
└── color/
    β”œβ”€β”€ colorhsl/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── colorhsl.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_hsl_new.c
    β”‚       β”œβ”€β”€ ft_hsl_default.c
    β”‚       β”œβ”€β”€ ft_hsl_from_rgba.c
    β”‚       β”œβ”€β”€ ft_hsl_add.c
    β”‚       β”œβ”€β”€ ft_hsl_sub.c
    β”‚       └── ft_hsl_lerp.c
    β”œβ”€β”€ colorrgb/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── colorrgb.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_rgb_new.c
    β”‚       β”œβ”€β”€ ft_rgb_default.c
    β”‚       β”œβ”€β”€ ft_rgb_from_i.c
    β”‚       β”œβ”€β”€ ft_rgb_to_i.c
    β”‚       └── ft_rgb_lerp.c
    β”œβ”€β”€ colorrgba/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── colorrgba.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_rgba_new.c
    β”‚       β”œβ”€β”€ ft_rgba_default.c
    β”‚       β”œβ”€β”€ ft_rgba_from_i.c
    β”‚       β”œβ”€β”€ ft_rgba_from_hsl.c
    β”‚       β”œβ”€β”€ ft_rgba_add.c
    β”‚       β”œβ”€β”€ ft_rgba_sub.c
    β”‚       └── ft_icolor_lerp.c
    └── includes/
	β”œβ”€β”€ colorstruct.h
        └── color.h
└── debug/
    β”œβ”€β”€ includes/
    β”‚   └── debug.h
    └── sources/
        β”œβ”€β”€ print_camera.c
        β”œβ”€β”€ print_matrix.c
        └── print_vector.c
└── graphic_math/
    β”œβ”€β”€ includes/
    β”‚   └── g_math.h
    └── sources/
        β”œβ”€β”€ ft_orthoproj_mat4.c
        β”œβ”€β”€ ft_to_frange.c
        β”œβ”€β”€ ft_vieport_llc.c
        β”œβ”€β”€ ft_persproj_mat4.c
        β”œβ”€β”€ ft_vertex3f_proj.c
        └── ft_vieport_tlc.c
└── matrix/
    β”œβ”€β”€ includes/
    β”‚	β”œβ”€β”€ matrixstruct.h
    β”‚   └── matrix.h
    β”œβ”€β”€ matrix2/
    β”‚   β”œβ”€β”€ includes/
    β”‚   └── sources/
    β”œβ”€β”€ matrix3/
    β”‚   β”œβ”€β”€ includes/
    β”‚   └── sources/
    β”œβ”€β”€ matrix4/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── matrix4.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_mat4_null.c
    β”‚       β”œβ”€β”€ ft_mat4_identity.c
    β”‚       β”œβ”€β”€ ft_mat4_from_aarot.c
    β”‚       β”œβ”€β”€ ft_mat4_from_eulerrot.c
    β”‚       β”œβ”€β”€ ft_mat4_from_quat.c
    β”‚       β”œβ”€β”€ ft_mat4_from_sphrot.c
    β”‚       β”œβ”€β”€ ft_mat4_mul.c
    β”‚       β”œβ”€β”€ ft_mat4_premul_quat.c
    β”‚       β”œβ”€β”€ ft_mat4_premul_norm_quat.c
    β”‚       β”œβ”€β”€ ft_mat4_premul_vector3.c
    β”‚       β”œβ”€β”€ ft_mat4_postmul_quat.c
    β”‚       β”œβ”€β”€ ft_mat4_postmul_vector3.c
    β”‚       β”œβ”€β”€ ft_mat4_scale_from_vector3.c
    β”‚       └── ft_mat4_translate_from_vector3.c
    └── matrixX/
        β”œβ”€β”€ includes/
        └── sources/
└── mlx_tools/
    β”œβ”€β”€ includes/
    β”‚   └── mlx_tools.h
    └── sources/
        β”œβ”€β”€ fast_line.c
        β”œβ”€β”€ mlx_bresenham.c
        β”œβ”€β”€ mlx_end.c
        β”œβ”€β”€ mlx_init.c
        └── pixel_to_img.c
└── rotation/
    β”œβ”€β”€ axeAngleRot/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── aarot.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_aarot_new.c
    β”‚       β”œβ”€β”€ ft_aarot_from_eulerrot.c
    β”‚       β”œβ”€β”€ ft_aarot_from_quat.c
    β”‚       β”œβ”€β”€ ft_aarot_from_mat4.c
    β”‚       β”œβ”€β”€ ft_aarot_from_sphrot.c
    β”‚       └── ft_aarot_normalize.c
    β”œβ”€β”€ eulerRot/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── eulerrot.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_eulerrot_new.c
    β”‚       β”œβ”€β”€ ft_eulerrot_from_aarot.c
    β”‚       β”œβ”€β”€ ft_eulerrot_from_quat.c
    β”‚       β”œβ”€β”€ ft_eulerrot_from_mat4.c
    β”‚       β”œβ”€β”€ ft_eulerrot_from_sphrot.c
    β”‚       β”œβ”€β”€ ft_eulerrot_add.c
    β”‚       β”œβ”€β”€ ft_eulerrot_sub.c
    β”‚       β”œβ”€β”€ ft_eulerrot_equal.c
    β”‚       └── ft_eulerrot_lerp.c
    β”œβ”€β”€ quaternion/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── quaternion.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_quat_new.c
    β”‚       β”œβ”€β”€ ft_quat_from_aarot.c
    β”‚       β”œβ”€β”€ ft_quat_from_mat4.c
    β”‚       β”œβ”€β”€ ft_quat_from_vector3.c
    β”‚       β”œβ”€β”€ ft_quat_from_sphrot.c
    β”‚       β”œβ”€β”€ ft_quat_add.c
    β”‚       β”œβ”€β”€ ft_quat_sub.c
    β”‚       β”œβ”€β”€ ft_quat_add_n.c
    β”‚       β”œβ”€β”€ ft_quat_sub_n.c
    β”‚       β”œβ”€β”€ ft_quat_mul.c
    β”‚       β”œβ”€β”€ ft_quat_equal.c
    β”‚       β”œβ”€β”€ ft_quat_opp.c
    β”‚       β”œβ”€β”€ ft_quat_inv.c
    β”‚       β”œβ”€β”€ ft_quat_scale.c
    β”‚       β”œβ”€β”€ ft_quat_normalize.c
    β”‚       β”œβ”€β”€ ft_quat_magn.c
    β”‚       β”œβ”€β”€ ft_quat_crossprod.c
    β”‚       β”œβ”€β”€ ft_quat_dotnormalize.c
    β”‚       β”œβ”€β”€ ft_quat_dotprod.c
    β”‚       β”œβ”€β”€ ft_quat_lerp.c
    β”‚       β”œβ”€β”€ ft_quat_from_eulerrot.c
    β”‚       └── ft_quat_slerp.c
    β”œβ”€β”€ sphericRot/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── sphrot.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_sphrot_from_aarot.c
    β”‚       β”œβ”€β”€ ft_sphrot_from_eulerrot.c
    β”‚       β”œβ”€β”€ ft_sphrot_from_quat.c
    β”‚       └── ft_sphrot_from_mat4.c
    └─ includes/
       |── rotationstruct.h
       └── rotation.h
└── vector/
    β”œβ”€β”€ includes/
    β”‚	β”œβ”€β”€ vectorstruct.h
    β”‚   └── vector.h
    β”œβ”€β”€ vector2/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── vector2.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_vector2_new.c
    β”‚       β”œβ”€β”€ ft_vector2_add.c
    β”‚       β”œβ”€β”€ ft_vector2_sub.c
    β”‚       β”œβ”€β”€ ft_vector2_equal.c
    β”‚       β”œβ”€β”€ ft_vector2_opp.c
    β”‚       β”œβ”€β”€ ft_vector2_scale.c
    β”‚       β”œβ”€β”€ ft_vector2_magn.c
    β”‚       β”œβ”€β”€ ft_vector2_normalize.c
    β”‚       β”œβ”€β”€ ft_vector2_det.c
    β”‚       └── ft_vector2_dotprod.c
    └── vector3/
        β”œβ”€β”€ includes/
        β”‚   └── vector3.h
        └── sourceGs/
            β”œβ”€β”€ ft_vector3_new.c
            β”œβ”€β”€ ft_vector3_null.c
            β”œβ”€β”€ ft_vector3_from_quat.c
            β”œβ”€β”€ ft_vector3_add.c
            β”œβ”€β”€ ft_vector3_sub.c
            β”œβ”€β”€ ft_vector3_opp.c
            β”œβ”€β”€ ft_vector3_scale.c
            β”œβ”€β”€ ft_vector3_equal.c
            β”œβ”€β”€ ft_vector3_magn.c
            β”œβ”€β”€ ft_vector3_crossprod.c
            β”œβ”€β”€ ft_vector3_dotprod.c
            └── ft_vector3_normalize.c
└── vertex/
    β”œβ”€β”€ includes/
    β”‚	β”œβ”€β”€ vertexstruct.h
    β”‚   └── vertex.h
    β”œβ”€β”€ vertex2f/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── vertex2f.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_vertex2f_new.c
    β”‚       β”œβ”€β”€ ft_vertex2f_null.c
    β”‚       β”œβ”€β”€ ft_vertex2f_add.c
    β”‚       β”œβ”€β”€ ft_vertex2f_sub.c
    β”‚       β”œβ”€β”€ ft_vertex2f_mul.c
    β”‚       β”œβ”€β”€ ft_vertex2f_div.c
    β”‚       └── ft_vertex2f_opp.c
    β”œβ”€β”€ vertex2i/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── vertex2i.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_vertex2i_new.c
    β”‚       β”œβ”€β”€ ft_vertex2i_null.c
    β”‚       β”œβ”€β”€ ft_vertex2i_add.c
    β”‚       β”œβ”€β”€ ft_vertex2i_sub.c
    β”‚       β”œβ”€β”€ ft_vertex2i_mul.c
    β”‚       β”œβ”€β”€ ft_vertex2i_div.c
    β”‚       └── ft_vertex2i_opp.c
    β”œβ”€β”€ vertex3f/
    β”‚   β”œβ”€β”€ includes/
    β”‚   β”‚   └── vertex3f.h
    β”‚   └── sources/
    β”‚       β”œβ”€β”€ ft_vertex3f_new.c
    β”‚       β”œβ”€β”€ ft_vertex3f_null.c
    β”‚       β”œβ”€β”€ ft_vertex3f_add.c
    β”‚       β”œβ”€β”€ ft_vertex3f_sub.c
    β”‚       β”œβ”€β”€ ft_vertex3f_mul.c
    β”‚       β”œβ”€β”€ ft_vertex3f_div.c
    β”‚       β”œβ”€β”€ ft_vertex3f_opp.c
    β”‚       └── ft_vertex3f_from_vertex3i.c
    └── vertex3i/
        β”œβ”€β”€ includes/
        β”‚   └── vertex3i.h
        └── sources/
            β”œβ”€β”€ ft_vertex3i_new.c
            β”œβ”€β”€ ft_vertex3i_null.c
            β”œβ”€β”€ ft_vertex3i_add.c
            β”œβ”€β”€ ft_vertex3i_sub.c
            β”œβ”€β”€ ft_vertex3i_mul.c
            β”œβ”€β”€ ft_vertex3i_div.c
            └── ft_vertex3i_opp.c

πŸš€ Getting Started

System Requirements:

βš™οΈ Installation

From source

  1. Clone the libgraphic repository:
$ git clone https://github.com/lvoneduval/libgraphic
  1. Pull the submodules:
$ git clone https://github.com/lvoneduval/libgraphic
  1. Add the header into your files:
#include "<path to libgraphic>/libraphic.h"

Quick Start

Kickstart your journey by following our straightforward Quick Start Guide. This guide is designed to help you set up and start using the Libgraphic with practical examples and essential setup instructions.


Complete Documentation Overview

Explore the comprehensive documentation to familiarize yourself with all aspects of our platform. This documentation serves as a central hub to guide you through the features and functionalities of our system.


πŸ›  Project Roadmap

  • β–Ί MAKEFILE
  • β–Ί DEPENDENCIES:
  • β–Ί DOCUMENTATION:
  • β–Ί Quick Start
  • β–Ί ADD MATRIX
  • β–Ί UPDATE DEBUG

πŸ“„ License

This project is currently not protected under any License.

πŸ‘ Acknowledgments

Return

About

C library crafted for applications using 42's MLX graphics library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published