tutorials:advanced:create-module-lib
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorials:advanced:create-module-lib [2025/04/02 16:05] – gaetan | tutorials:advanced:create-module-lib [2025/04/02 16:26] (current) – gaetan | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| Let's create a very simple project from the '' | Let's create a very simple project from the '' | ||
| + | |||
| + | **Rename the Model.rgg file to An.rgg** (or any other name). It is not required but it gets confusing when all modules come from Model classes. | ||
| Let's include a custom shader from an image to the project (steps correspond to image bellow): | Let's include a custom shader from an image to the project (steps correspond to image bellow): | ||
| Line 66: | Line 68: | ||
| Then, restart GroIMP to load the library. | Then, restart GroIMP to load the library. | ||
| + | |||
| + | Now let's open a new project ('' | ||
| ==== Type ==== | ==== Type ==== | ||
| + | |||
| + | The types from the module library can be imported in the project like any other classes: | ||
| + | '' | ||
| + | |||
| + | The pattern is: '' | ||
| + | |||
| + | Notice that the name of the file is required in the import. GroIMP implicitly create classes with the name of the files to wrap all types defined in .rgg classes. | ||
| + | |||
| + | **Note:** in the '' | ||
| + | |||
| + | The Node An.A have the shader from their original project, i.e. the one with the image. | ||
| + | |||
| ==== Resources ==== | ==== Resources ==== | ||
| + | Resources from module lib can also be used without classes. You can use the shader '' | ||
| + | |||
| + | <code java> | ||
| + | module A(float len) extends Sphere(0.1) | ||
| + | { | ||
| + | {setShader(shader(" | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | The Shader reference use the path: '' | ||
tutorials/advanced/create-module-lib.1743602737.txt.gz · Last modified: 2025/04/02 16:05 by gaetan
