The returned models can be rendered using indexedTriangles
from WebGL
.
WebGL.indexedTriangles mesh.vertices mesh.indices
All these methods take an URL as the first parameter.
Use the methods from here if you know whats in your file and if they only contain a single object with a single material. These are just provided for convenience.
loadMeshWithoutTexture : String -> (Result String (Types.MeshWith Types.Vertex) -> msg) -> Platform.Cmd.Cmd msg
Load a model that doesn't have texture coordinates.
loadMesh : String -> (Result String (Types.MeshWith Types.VertexWithTexture) -> msg) -> Platform.Cmd.Cmd msg
Load a model with texture coordinates.
loadMeshWithTangent : String -> (Result String (Types.MeshWith Types.VertexWithTextureAndTangent) -> msg) -> Platform.Cmd.Cmd msg
Load a model with texture coordinate and calculate vertex tangents. This is needed if you want to do tangent space normal mapping.
Use these methods if you don't know what kind of files you'll get or if your files contain multiple groups or materials.
loadObjFile : String -> (Result String Types.ObjFile -> msg) -> Platform.Cmd.Cmd msg
Load a .obj file from an URL
loadObjFile url ObjFileLoaded
loadObjFileWith : Settings -> String -> (Result String Types.ObjFile -> msg) -> Platform.Cmd.Cmd msg
{ withTangents : Basics.Bool }
withTangents : If true, vertex tangents will be calculated for meshes with texture coordinates. This is needed if you want to do tangent space normal mapping.
defaultSettings : Settings
parseObjStringWith : Settings -> String -> Result String Types.ObjFile
Same as loadObjFile
, but works on a string.