EAGL.ObjLoader (eagl v0.6.0)
View SourceSimple Wavefront OBJ file loader. Currently supports vertices, texture coordinates, normals, and faces.
Summary
Functions
Loads an OBJ file and returns vertex data ready for OpenGL. Returns {:ok, data} where data is a map containing
Functions
Loads an OBJ file and returns vertex data ready for OpenGL. Returns {:ok, data} where data is a map containing:
- :vertices - List of floats in x,y,z order
- :tex_coords - List of floats in u,v order
- :normals - List of floats in x,y,z order
- :indices - List of integers for indexed drawing
Options:
- :flip_normal_direction - boolean, set to true to flip normal direction for all models (default: false)
This works consistently for both models with existing normals and models that need generated normals. For models with existing normals: negates all normal components For models without normals: generates normals with flipped direction
- :smooth_normals - boolean, set to true to generate smooth normals by averaging across adjacent faces (default: false)
This gives a smoother appearance by eliminating the faceted look. When true, existing normals are ignored and smooth normals are generated.