Implementing a Texture: Difference between revisions
No edit summary |
|||
Line 10: | Line 10: | ||
Commit with example: adding the "Divide" texture: https://github.com/LuxCoreRender/LuxCore/commit/ce6e23c244b1bb426c1dcd13099a41982e565b88 | Commit with example: adding the "Divide" texture: https://github.com/LuxCoreRender/LuxCore/commit/ce6e23c244b1bb426c1dcd13099a41982e565b88 | ||
==== Creating the header file ==== | |||
==== Creating the source file ==== | |||
TODO: Description of the methods that need to be implemented: | |||
* GetFloatValue | |||
* GetSpectrumValue | |||
* Filter | |||
* Y | |||
* Bump | |||
etc. | |||
What do they do, what should they return? | |||
==== Modifying the base texture header ==== | ==== Modifying the base texture header ==== |
Revision as of 12:33, 19 June 2018
C++ Code
Files that need to be created:
- Header: include/slg/textures/yourtexturename.h
- Source: src/slg/textures/yourtexturename.cpp
Files that need to be edited:
- Base texture header: include/slg/textures/texture.h
- Sceneparse: src/slg/scene/parsetextures.cpp
- CMakeLists.txt: src/slg/CMakeLists.txt
Commit with example: adding the "Divide" texture: https://github.com/LuxCoreRender/LuxCore/commit/ce6e23c244b1bb426c1dcd13099a41982e565b88
Creating the header file
Creating the source file
TODO: Description of the methods that need to be implemented:
- GetFloatValue
- GetSpectrumValue
- Filter
- Y
- Bump
etc.
What do they do, what should they return?
Modifying the base texture header
Open the file include/slg/textures/texture.h
Add your new texture type to the TextureType
enum.
Modifying Sceneparse
Open src/slg/scene/parsetextures.cpp
Include the new header file you created for your texture (the list is alphabetic).
Next, go to the method Scene::CreateTexture
, scroll down until the end of the big if/else
statement and add a new else if
for your texture.
Modifying CMakeLists.txt
Open src/slg/CMakeLists.txt
Search for set(SLG_CORE_SRCS
and add your source filepath among the other textures (they are sorted alphabetically).
Compile and Test
To test your plugin, compile LuxCore: Compiling_LuxCore
After the compilation succeeds, you will need a scene to test your plugin. The easiest method is to edit one of the .scn files in the scenes/luxball directory.
TODO Example
Now, run luxcoreui from the root LuxCore directory with
./bin/luxcoreui ./scenes/luxball/luxball-sunset.cfg
TODO result example image
OpenCL Code
TODO