Implementing a Texture: Difference between revisions
Line 24: | Line 24: | ||
==== Modifying CMakeLists.txt ==== | ==== Modifying CMakeLists.txt ==== | ||
Open src/slg/CMakeLists.txt<br> | |||
Search for <code>set(SLG_CORE_SRCS</code> and add your source filepath among the other textures (they are sorted alphabetically). | |||
==== Compile and Test ==== | ==== Compile and Test ==== |
Revision as of 16:15, 18 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
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