Parses .off (Object File Format) files. This implementation follows this spec from the Princeton Shape Benchmark.

Overview

off-rs - A simple .off file parser

MIT License Continuous integration Crates.io

Parses .off (Object File Format) files. This implementation follows this spec from the Princeton Shape Benchmark.

Sample .off file:

# this file header has to be the first instruction
OFF
# cube.off
# A cube

# 8 vertices, 6 faces, 12 edges
8 6 12

# vetex coordinates: x, y, z
  1.632993   0.000000   1.154701
  0.000000   1.632993   1.154701
 -1.632993   0.000000   1.154701
  0.000000  -1.632993   1.154701
  1.632993   0.000000  -1.154701
  0.000000   1.632993  -1.154701
 -1.632993   0.000000  -1.154701
  0.000000  -1.632993  -1.154701

# face indicies & RGBA color data: n, v1, v2, v3, v4, r, g, b, a
  4  0 1 2 3  1.000 0.000 0.000 0.75
  4  7 4 0 3  0.300 0.400 0.000 0.75
  4  4 5 1 0  0.200 0.500 0.100 0.75
  4  5 6 2 1  0.100 0.600 0.200 0.75
  4  3 2 6 7  0.000 0.700 0.300 0.75
  4  6 5 4 7  0.000 1.000 0.000 0.75

This cube.off file is parsed using off-rs in this example.

Usage

let mesh = Mesh::parse(
    content,
    ..Default::default() // optional ParserOptions
);

println!("{:#?}", mesh);

Will return a structure like this:

Mesh {
    vertices: [
        Vertex {
            position: Position {
                x: 1.632993,
                y: 0.0,
                z: 1.154701,
            },
            color: None,
        },
        ...
    faces: [
        Face {
            vertices: [
                0,
                1,
                2,
                3,
            ],
            color: Some(
                Color {
                    r: 1.0,
                    g: 0.0,
                    b: 0.0,
                    a: 0.75,
                },
            ),
        },
        ...
You might also like...
A decoder and utility for the Flipnote Studios .ppm animation format
A decoder and utility for the Flipnote Studios .ppm animation format

A decoder and utility for the Flipnote Studios .ppm animation format

bevy_blender is a Bevy library that allows you to use assets created in Blender directly from the .blend file
bevy_blender is a Bevy library that allows you to use assets created in Blender directly from the .blend file

bevy_blender bevy_blender is a Bevy library that allows you to use assets created in Blender directly from the .blend file.

Generate a THIRDPARTY file with all licenses in a cargo project.

cargo-bundle-licenses Bundle all third-party licenses into a single file. NOTE This tools is not a lawyer and no guarantee of correctness can be made

single file, std only, async Rust executor

whorl - A single file, std only, async Rust executor whorl was created to teach you how async executors work in Rust. It is not the fastest executor n

Count zeroes on a disk or a file

Count zeroes on a disk or a file

Convert Hygea calendar to an iCal file to easily import it to Google Calendar (Rust version)

Hygea to iCal Goal Hygea provides a calendar via PDF and an application called Recycle. I just wanted to use an iCal file to import it in my calendar.

A cli utility written in Rust that allows fetching all the labels of a project, save those as a YAML file

A cli utility written in Rust that allows fetching all the labels of a project, save those as a YAML file that you can easily edit or save as backup and apply a saved preset to new repositories.

A tool that generates a Sublime Text project file that helps you get started using Scoggle.

README A tool that generates a Sublime Text project file that helps you get started using Scoggle. While Scoggle-Gen may not find every single source

Extracting react native app source code from apk file.

extract-myreact Extracting React Native app source code from apk file.

Comments
  • Simple parse benchmark

    Simple parse benchmark

    DRAFT: DONT MERGE YET

    Implemented a simple criterion benchmark which times the parsing of documents.

    The main use is/(can be) to catch regressions when new code is added.

    To run the benchmarks execute the following:

    cargo bench
    
    opened by Shemnei 3
  • Fuzzing

    Fuzzing

    Added simple fuzz case for parsing random inputs.

    I found some crashes/panics with it, but they will be fixed on another branch.

    To run the fuzz case:

    # Install cargo-fuzz
    # cargo install cargo-fuzz
    
    # Run fuzz case
    cargo fuzz run try_parse
    

    Further documentation: https://rust-fuzz.github.io/book/introduction.html

    opened by Shemnei 1
Owner
Michael Lohr
Because a Great Idea Is Never Enough
Michael Lohr
Convert an MCU register description from the EDC format to the SVD format

edc2svd Convert an MCU register description from the EDC format to the SVD format EDC files are used to describe the special function registers of PIC

Stephan 4 Oct 9, 2021
Basically a KrabsETW rip-off written in Rust

FerrisETW ?? Basically a KrabsETW rip-off written in Rust, hence the name Ferris ?? All credits go to the team at Microsoft who develop KrabsEtw, with

n4r1B 25 Dec 21, 2022
Ecstasy - a subjective experience of total involvement of the subject, with an object of their awareness.

Ecstasy (from Ancient Greek ἔκστασις ékstasis, meaning 'outside of oneself') is a subjective experience of total involvement of the subject, with an object of their awareness. In classical Greek literature it refers to removal of the mind or body "from its normal place of function."

null 2 Jun 11, 2022
File Tree Fuzzer allows you to create a pseudo-random directory hierarchy filled with some number of files.

FTZZ File Tree Fuzzer allows you to create a pseudo-random directory hierarchy filled with some number of files. Installation $ cargo +nightly install

Alex Saveau 22 Dec 28, 2022
Rust library to scan files and expand multi-file crates source code as a single tree

syn-file-expand This library allows you to load full source code of multi-file crates into a single syn::File. Features: Based on syn crate. Handling

Vitaly Shukela 11 Jul 27, 2022
transmute-free Rust library to work with the Arrow format

Arrow2: Transmute-free Arrow This repository contains a Rust library to work with the Arrow format. It is a re-write of the official Arrow crate using

Jorge Leitao 708 Dec 30, 2022
This crate allows writing a struct in Rust and have it derive a struct of arrays layed out in memory according to the arrow format.

Arrow2-derive - derive for Arrow2 This crate allows writing a struct in Rust and have it derive a struct of arrays layed out in memory according to th

Jorge Leitao 29 Dec 27, 2022
Serializer and deserializer for the VCR Cassette format

vcr-cassette Serializer and deserializer for the VCR Cassette format API Docs | Releases | Contributing Examples Given the following .json VCR Cassett

http-rs 12 Sep 15, 2021
IDX is a Rust crate for working with RuneScape .idx-format caches.

This image proudly made in GIMP License Licensed under GNU GPL, Version 3.0, (LICENSE-GPL3 or https://choosealicense.com/licenses/gpl-3.0/) Contributi

Ceikry 5 May 27, 2022
Small utility to display hour in a binary format on the Novation's Launchpad X.

lpx-binary-clock Small utility to display hour in a binary format on the Novation's Launchpad X. Hours, minutes and seconds are displayed one digit pe

Alexis LOUIS 1 Feb 13, 2022