-
Notifications
You must be signed in to change notification settings - Fork 2
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
Flowers OOP with raylib/examples/models/resources/skybox.png #6
Conversation
I got different results by calling reset. I'm not sure what's up. |
Also, does not compile to JS: $ nim js flowers_oop.nim I am not sure what's up, I'll try to upgrade naylib |
models/flowers_oop.nim
Outdated
# Zero out source to prevent double-free | ||
#source.cubemap.id = 0 | ||
#source.modelShader.id = 0 | ||
#source.model.meshCount = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these destructor hooks should be removed. The raylib library handles destructors for you. (If you need to attach a destructor to an object that has other managed resources you call them explicitly on the fields).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed explicit destructors except those on Flower instances (deferred)
Ready to review again. JS transpiling still doesn't work. I don't know how to solve it, I don't think claude.ai does eitther, at least not in my code. |
Naylib doesn't support the js platform since raylib is written in C. But you can compile it with emscripten. I have sent you a link on discord. |
|
||
var image = loadImage("resources/skybox.png") # TODO Replace with your texture path | ||
if image.data == nil: | ||
raise newException(IOError, "Failed to load skybox.png texture") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw these functions have error checking, so you don't need to do that explicitly. Apparently only loadShaderFromMemory is missing a isShaderValid call. Will investigate why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't put the checking in myself (I'm kind of bad that way), so I'm glad the library handles it!
Merging anyway. Thank you! |
What I did was use claude.ai to translate the code to Three.js. It got too aggressive with the normal in my shader though. See: https://coderextreme.net/assetmanager/ The translation worked well, and even helped fix the skybox issues. I just had to specify 6 images instead of 1. I don't know if naylib supports 6 images or not. |
Example with skybox and object oriented programming. Also intended to show reflection and prismatic effects (chromatic dispersion) with shaders, but I'm really unsure about if my skybox works right. The skybox in this pull request is pulled from raylib/examples/models/resources/skybox.png. I drew inspiration from the skybox example in raylib/examples, but it's not a complete port.
A good skybox image should show reflection, refraction and chromatic dispersion. Here's one with a skybox from Paul Debevec: