Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add example of drawing an .obj with a material/texture. #176

Open
Triazic opened this issue Jul 1, 2023 · 5 comments
Open

Please add example of drawing an .obj with a material/texture. #176

Triazic opened this issue Jul 1, 2023 · 5 comments

Comments

@Triazic
Copy link

Triazic commented Jul 1, 2023

I can use 'LoadModel' to load my obj and I can render it using DrawModel with a tint.

But I can't figure out how to apply texture/material to it. Of the following functions in the cheatsheet:

image

Only SetModelMeshMaterial is exposed which I can't do, if I can't load it in the first place:
image

And the approach used in the raylib example here doesn't work due to type errors:
image

I don't doubt there is a way but I'd rather not dig into the cryptic bowels of the js/ts wrappings etc. Please provide an example using the API as it stands today.

@konsumer
Copy link
Collaborator

konsumer commented Jul 1, 2023

I would recommend looking at the original raylib examples, which all of our examples are based on. If you can't find an example of what you are trying to do, there are lots of helpful people on the raylib discord (including the 3 maintainers of this lib, like me, and the original author of raylib) that can probably help you put one together.

@twuky
Copy link
Collaborator

twuky commented Jul 2, 2023

right now the typescript definitions for this are correct - it is a number instead of an array - or rather its a pointer address to the array in c memory, and there isn't a way to work with it from JS at the moment. there are a lot of places like this that still are pretty lacking in node-raylib, and it largely affects the 3d workflow. in all likelyhood this may not be the best library to work in 3d with, at the moment

@twuky
Copy link
Collaborator

twuky commented Jul 2, 2023

this PR has some work in this regard - but materials still don't work in it #172

@Triazic
Copy link
Author

Triazic commented Jul 4, 2023

Noting the comment re. 3D not being great and the types being cooked, I have moved on from this library. The C# implementation Raylib-cs so far seems to have all the functions ported it's also not perfect (orbital camera doesn't work zz).

@twuky
Copy link
Collaborator

twuky commented Jul 4, 2023

C# will also give you a far easier time outputting builds as complete EXEs too. unless you are 100% married to TS/JS, or need your Express server to render some text/images, it just needs more work. theres a lot of hard-to-handle stuff going on with memory management with the C code, and representing that data in JS, and handing it back-and-forth efficiently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants