Git Product home page Git Product logo

genmesh's Introduction

Matrix room gfx-hal on crates.io Build Status
Getting Started | Documentation | Blog | Funding

gfx-rs

gfx-rs is a low-level, cross-platform graphics and compute abstraction library in Rust. It consists of the following components:

gfx-hal deprecation

As of the v0.9 release, gfx-hal is now in maintenance mode. gfx-hal development was mainly driven by wgpu, which has now switched to its own GPU abstraction called wgpu-hal. For this reason, gfx-hal development has switched to maintenance only, until the developers figure out the story for gfx-portability. Read more about the transition in #3768.

hal

  • gfx-hal which is gfx's hardware abstraction layer: a Vulkan-ic mostly unsafe API which translates to native graphics backends.
  • gfx-backend-* which contains graphics backends for various platforms:
  • gfx-warden which is a data-driven reference test framework, used to verify consistency across all graphics backends.

gfx-rs is hard to use, it's recommended for performance-sensitive libraries and engines. If that's not your domain, take a look at wgpu-rs for a safe and simple alternative.

Hardware Abstraction Layer

The Hardware Abstraction Layer (HAL), is a thin, low-level graphics and compute layer which translates API calls to various backends, which allows for cross-platform support. The API of this layer is based on the Vulkan API, adapted to be more Rust-friendly.

Hardware Abstraction Layer (HAL)

Currently HAL has backends for Vulkan, DirectX 12/11, Metal, and OpenGL/OpenGL ES/WebGL.

The HAL layer is consumed directly by user applications or libraries. HAL is also used in efforts such as gfx-portability.

See the Big Picture blog post for connections.

The old gfx crate (pre-ll)

This repository was originally home to the gfx crate, which is now deprecated. You can find the latest versions of the code for that crate in the pre-ll branch of this repository.

The master branch of this repository is now focused on developing gfx-hal and its associated backend and helper libraries, as described above. gfx-hal is a complete rewrite of gfx, but it is not necessarily the direct successor to gfx. Instead, it serves a different purpose than the original gfx crate, by being "lower level" than the original. Hence, the name of gfx-hal was originally ll, which stands for "lower level", and the original gfx is now referred to as pre-ll.

The spiritual successor to the original gfx is actually wgpu, which stands on a similar level of abstraction to the old gfx crate, but with a modernized API that is more fit for being used over Vulkan/DX12/Metal. If you want something similar to the old gfx crate that is being actively developed, wgpu is probably what you're looking for, rather than gfx-hal.

Contributing

We are actively looking for new contributors and aim to be welcoming and helpful to anyone that is interested! We know the code base can be a bit intimidating in size and depth at first, and to this end we have a label on the issue tracker which marks issues that are new contributor friendly and have some basic direction for completion in the issue comments. If you have any questions about any of these issues (or any other issues) you may want to work on, please comment on GitHub and/or drop a message in our Matrix chat!

License

This repository is licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

genmesh's People

Contributors

alteous avatar angrylawyer avatar bors[bot] avatar brendanzab avatar burtonageo avatar bvssvni avatar csherratt avatar fu5ha avatar ivanukhov avatar jake-shadle avatar kvark avatar maikklein avatar petrochenkov avatar rhuagh avatar serpis avatar timnn avatar veykril avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

genmesh's Issues

Generate unit cubes.

Cube generates a cube centered at the origin with sides of length two. Just as Sphere generates a unit sphere, maybe Cube should generate a unit cube with sides of length one?

Update crates.io version

Could you please update the crates.io version of this crate? Looks like it hasn't been updated in 3 years.

Add scaling options

The primitives right now just produce a primitive that is close to a unit vector. The original idea was that people would scale the primitives using the .vertex() trait. There are a few cases where I don't think this is satisfactory. The cone primitive for example has different normals based on these values, so for the sake of our uses we should add them.

Common vertex format

Considering #25 and #26 to generate more vertex data, we may end up with too much (partially redundant) code if we want the generators to support various combinations like vertex + normal, vertex, vertex + tex-coords.

We might want to consider a single vertex format to be used by all generators, potentially also covering #27. The user should still be able to map the vertex to its own format and drop some of the generated data.

The main problem I see here is the complexity of shared vertex generation. For example, a cube would no longer be able to share any vertices, since each face has a different normal (unless we smooth normals over the cube, which doesn't make much sense).

Automated testing

The library needs some sort of testing. For example, we could compare the output of Iterator implementation for each generator versus SharedVertex + IndexedPolygon data.

Move to fixed sized arrays.

We have used tuples because of the history problems with fixed sized arrays in rust. These days fixed sized arrays are much easier to work with, so we should look at migrating some of the types to use arrays.

See Quad and Triangle.

updated rust nightly does not like old/explicit closure syntax

issue with obsolete syntax

$ cargo build
   Compiling genmesh v0.0.12
/home/chris/.cargo/registry/src/github.com-1ecc6299db9ec823/genmesh-0.0.12/src/sphere.rs:108:18: 108:22 error: obsolete syntax: `:`, `&mut:`, or `&:`
/home/chris/.cargo/registry/src/github.com-1ecc6299db9ec823/genmesh-0.0.12/src/sphere.rs:108         let f = |&: u: usize, v: usize| {
                                                                                                              ^~~~
note: rely on inference instead
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
Could not compile `genmesh`.

Generate normals

Categories:

  • As part of the mesh generators (sphere, plane, cube)
  • Computed based on the vertices supplied (flat shading)
  • Averaged based on the faces shared supplied

Use `nalgebra` instead of `cgmath`

Heya, since most other gamedev related libraries are on nalgebra, I'd like to update this library to use that as well.

Another reason is that the current version on crates.io (0.6.2) depends on cgmath 0.16.1, which depends on rand v0.4.6. By swapping to nalgebra, at least for the amethyst game engine, we get to remove at least both the cgmath and rand crate compilations (there may be others, but I haven't done a thorough check).

I'm thinking in the future, if ultraviolet becomes the standard, we could put the relevant math library choice behind feature flags, though that's something in the future future.

Vertices does not implement `ExactSizeIterator`

Most if not all of the generators in genmesh emit a set number of vertices on .vertices. Yet, this iterator does not implement ExactSizeIterator.

This can be unergonomic when working with crates that expect an iterator of a fixed length. For example, when you create a buffer in Vulkano and you want to fill it with values, it expects an ExactSizeIterator.

How to fix this

Vertices internally uses EmitVertices. The issue with this is that EmitVertices is not an Iterator, and thus the amount of vertices it will emit is not set.

The best way to fix this is likely to implement Vertices directly on every generator, and leave EmitVertices around for backwards compatibility.

[META] Common Meshes

List of Meshes genmesh should be able to generate:

  • Plane
  • Cube
  • SphereUV
  • Sphere Icosahedron
  • Torus #23
  • Cone #48
  • Cylinder #40
  • Rust Logo

Add docs

The library is almost without docs.

Implement Torus

It's a nice object that can occlude itself and looks beautiful when rotating.

Hard normals option

I need the smoothing to be configurable by a flag. Currently, normals of cylinder and sphere are smoothed.

Generate tangents

As part of applying normal maps to generated meshes, it would be useful to have genmesh generate tangent vectors in addition to normal vectors for each vertex.

Consider moving under Gfx?

The recent rust breakage showed how genmesh could be a weak link of the ecosystem. gfx-rs breaks on it, glium does as well. We'd have to temporarily avoid using genmesh for the time of your absence. Perhaps, share some push access, or even move the repo under Gfx or PistonDevelopers?
Personally, I'd like to see gfx-rs/mesh_gen ;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.