GaryHuan9 / Echo

An awesome ray traced 3D renderer build in C# from scratch!
MIT License
17 stars 3 forks source link

[Feature Request] Mesh reader integration #43

Closed GaryHuan9 closed 1 year ago

GaryHuan9 commented 2 years ago

Is your feature request related to a problem? Please describe. We need a universal way of feeding the streamed data from the various mesh format readers into Echo.Scenic, specifically, to the MeshEntity object. Additionally, this should also be an interface that allow us to efficiently feed mesh data into Echo from the outside (other code using Echo).

Describe the solution you'd like A new interface that requires a ReadTriangle method which will allow the consumer to read the stream of triangles one by one. MeshEntity will use this interface to handle the request from Echo.Scenic during preparation. Since this interface will be implemented by many file loaders, it should also implement IDisposable, to give the loaders a way to dispose of their resources.

Additional context Note that for the time being, we will not allow different triangles from the same mesh to have different Materials. Each triangle will simply contain 3 vertices, 3 normals, and 3 texture coordinates, with the latter two being optional.